Pages

Thursday, July 29, 2021

SAP Profile Parameter

 

In SAP system  there are two types of parameter profiles are defined at /sapmnt/<SID>/profile they are named as Default profile and Instance profile .Further there are two Instance profile in the system PAS profile and ASCS profile.


Name Convention of the files :

1. Default Profile -- DEFAULT.PFL

2. PAS \ Application Server Profile -- <SID>_<Instance_Name>_<Hostname>

3. ASCS \ SCS Profile -- <SID>_<ASCSXX>_<Hostname> or <SID>_<SCSXX>_<Hostname>

Parameters defined in these profiles has been used to define the functionality of an sap system like number of work processes, buffer size, lock table size, Enable SAP* etc. All the profiles can be managed from either from RZ10 or OS level directly. 

RZ10 keeps the changes of profile in form of  version management of profile which helps us to easily revert the changes to the latest working version of the profile whenever required.

Parameter that need to be changed at application level then we change in specific Instance profile of the system and changes required at system level then we do the changes in Default Profile.

There are two type of parameter that are defined in SAP system

1. Static Parameter

2. Dynamic Parameter

Static Parameter needs restart of the system to reflect the changes, Whereas dynamic parameters can updated at the runtime as per requirement and by resting the system it will be reverted to original.

From RZ11 we can easily find out parameter is static or dynamic.



Wednesday, July 28, 2021

Create Self Signed Certificate for SAP System

Problem :

HTTPS Protocol need to be enable for non-production landscape, to avoid SSL certificate error on browser.

Solution:

We can create and apply self signed certificate for non-production SAP System. We will be using OPENSSL command line tool that has been used to generate Private key , CSRs , root certificate and self-signed certificate.

To download the OPEN SSL tool https://www.openssl.org/ 

1. Generate the key pair of rsa algorithm with key length 2048 .

    cmd > openssl genrsa -out key-pair.key 2048


2. Create certificate signing request and fill the required details like Country, State, Common Name.

    cmd >  openssl req -new -key key-pair.key -out certificate.csr




















3. Now create Root CA certificate for self-signed certificate

cmd > openssl req -x509 -new -nodes -key key-pair.key -sha256 -days 350 -out myCA.pem


4. Now create a self signed certificate 

cmd> openssl x509 -req -days 3650 -in certificate.csr -CA myCA.pem -CAkey key-pair.key -CAcreateserial -out server-cert.crt




5. Now converted the created certificate in PKCS12# format and provide your password.

cmd> openssl pkcs12 -export -out server-cert.pfx -inkey key-pair.key -in server-cert.crt



Now import server-cert.pfx into the system through STRUST (ABAP) or into Certificate and Key Storage (JAVA)

Also this server-cert.pfx can be converted into *.pse and it can also be imported directly  into system.


If you are still getting the certificate error after calling the URL on HTTPS



Then import Root certificate in Trusted root Certification Authority and PKCS12 certificate in Personal of Certification Manager.


Optional :

If required, we can extract the public key from the generated key-pair.key

cmd> openssl rsa -in key-pair.key -pubout -out key-pair-public.key




Friday, July 23, 2021

ORA-19909: datafile 1 belongs to an orphan incarnation

 Problem :

RMAN> RECOVER DATABASE FROM TAG STANDBY_24062021; 
Starting recover at 26-JUN-21 allocated channel: 
ORA_DISK_1 channel ORA_DISK_1: SID=701 device type=DISK starting media recovery media recovery failed 
RMAN-00571: =========================================================== 
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS =============== RMAN-00571: =========================================================== RMAN-03002: failure of recover command at 06/26/2021 00:03:23 
ORA-00283: recovery session canceled due to errors 
RMAN-11003: failure during parse/execution of SQL statement: alter database recover if needed standby start 
ORA-00283: recovery session canceled due to errors 
ORA-19909: datafile 1 belongs to an orphan incarnation
ORA-01110: data file 1: '/oracle/EHS/sapdata1/system_1/system.data1'

Solution :

Find out incarnation details from both DC and DR databases. 

At Primary Database

        RMAN> list incarnation of database; 

List of Database Incarnations 

DB Key Inc Key DB Name DB ID STATUS Reset SCN Reset Time 
------- ------- -------- ---------------- --- ---------- ---------- 
1 1 PEP 2473586590 CURRENT 1 29-APR-14 
2 2 PEP 2473586590 ORPHAN 8252951530 25-JUN-17 

At Standby Database

    RMAN> list incarnation of database; 

List of Database Incarnations 

DB Key Inc Key DB Name DB ID STATUS Reset SCN Reset Time 
------- ------- -------- ---------------- --- ---------- ---------- 
1 1 EHS 2473586590 PARENT 1 29-APR-14 
2 2 EHS 2473586590 ORPHAN 8252951530 25-JUN-17 
3 3 EHS 2473586590 CURRENT 22946868559 09-AUG-20

You can see from above data that Primary and Standby database are on different incarnation (Statue: CURRENT). You have to change standby database incarnation to match DC incarnation. 

 In our case below command will work: 

At Standby database

        RMAN> reset database to incarnation 1; 

database reset to incarnation 1 

        RMAN> list incarnation of database; 

List of Database Incarnations 

DB Key Inc Key DB Name DB ID STATUS Reset SCN Reset Time 
------- ------- -------- ---------------- --- ---------- ---------- 
1 1 EHS 2473586590 CURRENT 1 29-APR-14 
2 2 EHS 2473586590 ORPHAN 8252951530 25-JUN-17 
3 3 EHS 2473586590 ORPHAN 22946868559 09-AUG-2

Oracle Standby database incremental recovery using RMAN

 Problem :

When oraarch from Primary Database (DC) got deleted or corrupted before apply to Standby Database (DR), because of this log apply has stopped and both the system are not in sync.

Solution :

1. Verify log sequence at both DC and DR Run below command at both DC and DR. 

Find out last log number generated and last log applied at DR. Verify if there is a gap. 

        select max(sequence#) from v$archived_log where applied='YES';

2.  Stop oraarch shipping from DC to DR.

Set log_archive_dest_state_2 parameter to ‘DEFER’ at DC database in order to stop log shipping. 

At Primary Database: 

    Verify Parameter value: 

        show parameter log_archive_dest_state_2; 
                log_archive_dest_state_2 string     ENABLE 

    Change Parameter value: 

        alter system set log_archive_dest_state_2='DEFER' scope=both

    Verify Parameter value: 

        show parameter log_archive_dest_state_2; 
                    log_archive_dest_state_2 string     DEFER

3. Find out current SCN number of DR Database 

At Standby Database: 

    Run below command to find out SCN number: 

        SELECT to_char(CURRENT_SCN) FROM V$DATABASE;

            TO_CHAR(CURRENT_SCN) 
            264020244345

4. Take incremental backup (through RMAN utility) of DC Database from SCN number captured in last step .

At Primary Database: 

            run 
            { 
             allocate channel ch1 type disk; 
             allocate channel ch2 type disk; 
             allocate channel ch3 type disk; 
             backup incremental from scn 264020244345 database tag='STANDBY_24092021' format '/media/database_%d_%u_%s'; 
            release channel ch1; 
            release channel ch2; 
            release channel ch3; 
            }


5. Create a standby control file to restore it in the standby database.

At Primary Database: 

Run below command to create standby control file. 

        alter database create standby controlfile as '/media/cntrlEHS.dbf'; 

6. Move the incremental backup files and control files from DC to DR through SCP/rsync

7. Stop the recovery process (MRP) in DR.

At Standby Database: 

    Run below command to stop MRP process at DR. 

        alter database recover managed standby database cancel;

8. Shutdown the database and replace control files 

At Standby Database: 

    Run below command to shut down the database

        SQL> shutdown immediate;    

    Take backup of current control files and then replace all control files

9. Add incremental backup files to RMAN catalog and start the recovery. 

At Standby Database: 

    Add backup files to catalog with below command. 

        RMAN> catalog backuppiece ‘/media/database_EHS_o902a1as_5897’;

Start RMAN recovery with below command. 

        RMAN> RECOVER DATABASE FROM TAG STANDBY_24092021;

10. After completion of restore start the log shipping from DC to DR At Primary Database: 

    Run below command to start log shipping. 

        alter system set log_archive_dest_state_2='ENABLE' scope=both;

11. Start the log shipping from DC to DR At Primary Database.

    Run below command to start log shipping. 

        alter system set log_archive_dest_state_2='ENABLE' scope=both;

12. Verify that logs are being shipped from DC to DR and getting applied at DR. Once all logs have been applied, check last log applied at both DC and DR.

Troubleshoot or Analyse Long running Transport Import

 Problem:

This is very common problem do we face sometime while importing the transport request in SAP ABAP system.

To trouble shoot this long running transport we need to check import log, file system, transport job, work process, system log and etc.



Troubleshooting / Solution :

1. Check you File system (/usr/sap/trans , /sapmt, /sapmt/<SID>, /oracle/<SID>/oraarch, /usr/sap/<SID>) of the application server.

2. Check the availability of space in Tablespace . If its 100 % full extended the size of tablespace by adding datafile to it.

3. Check RDD* Job that has been schedule with DDIC, is running or not. If its failing check the job log or the SM21 logs. 

4. Check the status of Update from SM13.

5. Check for dialog or background work process is sufficient available in system to preform the import of Transport.

6. Check the transport directory have necessary permission to read the cofile and datafile.

7. Delete entry from TRBAT and TRJOB tables and also delete any *.LOC file which has been created  at /usr/sap/trans/temp

To cancel the long running transport below steps can be helpful.

1. Cancel the specified work process "Cancel without core" option from SM50.

2. Kill the tp processes running at OS 

        sidadm> ps -ef | grep tp
        sidadm> kill -9 <tp-process-id>

3.  Delete the necessary transport from Import monitor by doing Right Click -> Delete Entry.

4. Delete the released  RDDIMPDP job in client 000 and reschedule it  with report RDDNEWPP in 000 client of the system.

Thursday, July 22, 2021

Configure DB13 to work with a standalone Oracle database in Distributed/ HA Environment

 Problem :

Oracle database runs on the host where no SAP Instance are installed / running . in DB13 database jobs will fail and in SM59 SAPXPG_DBDEST_<SAPDBHOST> RFC will fail

Solution :

Windows :

1. Check the parameter SAPDBHOST in DEFAULT.PFL and the host names of SAP instances in SM51.

2. Install the standalone gateway on Database server

2. Check for destination SM59 -> TCO/IP -> SAPXPG_DBDEST_<SAPDBHOST> in SM59 exists and Update the installed gateway host and gateway service of  standalone gateway server.

Linux :

1. Check the parameter SAPDBHOST in DEFAULT.PFL

2. Install the OS sofware package "rsh" on application and database host

3. Set the profile variable gw/netstat_once = 0 & gw/remsh = rsh

4. Enable password ssh connection between application and database host with <sid>adm user.

5. Perform the connection test from OS level

           rsh <database host> -l <sid>adm sapxpg

6. RFC destination SAPXPG_DBDEST_<SAPDBHOST> will be created automatically and no gateway options set for that destination.

7. Restart the SAP Instance to reflect the parameter