Pages

Wednesday, January 29, 2020

Activating SAP* user in SAP ABAP System


Procedure :

      1. Set the value of parameter login/no_automatic_user_sapstar = 0 in instance profile.
      2. Switch the OS user to oracle or ora<sid>.
      3. Run the below command

           a.  select bname, mandt from "SAPSR3"."USR02 where bname='SAP*';
           b.  delete from USR02 where bname='SAP*' and mandt=800;
           c.   commit;


Suggestion:
By default password of SAP* is Pass or pass.
Default user of SAP* in SAP IDES system in client 800 is 19920706.
Always disable the parameter after the use.

Extend tablespace or add datafile size in Oracle for SAP using brtools



Procedure :

BR*Tools main menu

 1 = Instance management
 2 - Space management
 3 - Segment management
 4 - Backup and database copy
 5 - Restore and recovery
 6 - Check and verification
 7 - Database statistics
 8 - Additional functions
 9 - Exit program

Standard keys: c - cont, b - back, s - stop, r - refr
-------------------------------------------------------------------------------
BR0662I Enter your choice:
2
BR0280I BRTOOLS time stamp: 2020-01-29 14:09:42
BR0663I Your choice: '2'
-------------------------------------------------------------------------------
Database space management

 1 = Extend tablespace
 2 - Create tablespace
 3 - Drop tablespace
 4 - Alter tablespace
 5 - Alter data file
 6 - Move data file
 7 - Additional space functions
 8 - Reset program status

Standard keys: c - cont, b - back, s - stop, r - refr
-------------------------------------------------------------------------------
BR0662I Enter your choice:
1
BR0280I BRTOOLS time stamp: 2020-01-29 14:09:49
BR0663I Your choice: '1'
-------------------------------------------------------------------------------
BRSPACE options for tablespace extension

 1 - BRSPACE profile (profile) ...... [init<SID>.sap]
 2 - Database user/password (user) .. [/]
 3 ~ Tablespace name (tablespace) ... []
 4 - Confirmation mode (confirm) .... [yes]
 5 - Scrolling line count (scroll) .. [20]
 6 - Message language (language) .... [E]
 7 - BRSPACE command line (command) . [-p init<SID>.sap -s 20 -l E -f tsextend]

Standard keys: c - cont, b - back, s - stop, r - refr
-------------------------------------------------------------------------------
BR0662I Enter your choice:
3
BR0280I BRTOOLS time stamp: 2020-01-29 14:09:51
BR0663I Your choice: '3'
BR0681I Enter string value for "tablespace" []:
PSAPSR3
-------------------------------------------------------------------------------
BRSPACE options for tablespace extension

 1 - BRSPACE profile (profile) ...... [init<SID>.sap]
 2 - Database user/password (user) .. [/]
 3 ~ Tablespace name (tablespace) ... [PSAPSR3]
 4 - Confirmation mode (confirm) .... [yes]
 5 - Scrolling line count (scroll) .. [20]
 6 - Message language (language) .... [E]
 7 - BRSPACE command line (command) . [-p init<SID>.sap -s 20 -l E -f tsextend -t PSAPSR3]

Standard keys: c - cont, b - back, s - stop, r - refr
-------------------------------------------------------------------------------
BR0662I Enter your choice:
c
BR0280I BRTOOLS time stamp: 2020-01-29 14:09:57
BR0663I Your choice: 'c'

-------------------------------------------------------------------------------
Options for extension of tablespace PSAPSR3 (1. file)

 1 * Last added file name (lastfile) ....... [/oracle/<SID>/sapdata3/sr3_223/sr3.data223]
 2 * Last added file size in MB (lastsize) . [10000]
 3 - New file to be added (file) ........... [/oracle/<SID>/sapdata3/sr3_224/sr3.data224]
 4 # Raw disk / link target (rawlink) ...... []
 5 - Size of the new file in MB (size) ..... [10000]
 6 - File autoextend mode (autoextend) ..... [no]
 7 # Maximum file size in MB (maxsize) ..... []
 8 # File increment size in MB (incrsize) .. []
 9 - SQL command (command) ................. [alter tablespace PSAPSR3 add datafile '/oracle/<SID>/sapdata3/sr3_224/sr3.data224' size 10000M autoextend off]

Standard keys: c - cont, b - back, s - stop, r - refr
-------------------------------------------------------------------------------
BR0662I Enter your choice:
3
BR0280I BRSPACE time stamp: 2020-01-29 14:10:11
BR0663I Your choice: '3'
-------------------------------------------------------------------------------
Options for extension of tablespace PSAPSR3 (1. file)

 1 * Last added file name (lastfile) ....... [/oracle/<SID>/sapdata3/sr3_223/sr3.data223]
 2 * Last added file size in MB (lastsize) . [10000]
 3 - New file to be added (file) ........... [/oracle/<SID>/sapdata2/sr3_224/sr3.data224]
 4 # Raw disk / link target (rawlink) ...... []
 5 - Size of the new file in MB (size) ..... [10000]
 6 - File autoextend mode (autoextend) ..... [no]
 7 # Maximum file size in MB (maxsize) ..... []
 8 # File increment size in MB (incrsize) .. []
 9 - SQL command (command) ................. [alter tablespace PSAPSR3 add datafile '/oracle/<SID>/sapdata2/sr3_224/sr3.data224' size 10000M autoextend off]

Standard keys: c - cont, b - back, s - stop, r - refr
-------------------------------------------------------------------------------
BR0662I Enter your choice:
c
BR0280I BRSPACE time stamp: 2020-01-29 14:10:41
BR0663I Your choice: 'c'
BR0259I Program execution will be continued...
BR0370I Directory /oracle/<SID>/sapreorg/sfdadqyw created

BR0370I Directory /oracle/<SID>/sapdata2/sr3_224 created

BR1016I SQL statement 'alter tablespace PSAPSR3 add datafile '/oracle/<SID>/sapdata2/sr3_224/sr3.data224' size 10000M autoextend off' executed successfully

BR1051I Tablespace PSAPSR3 extended successfully with file(s): /oracle/<SID>/sapdata2/sr3_224/sr3.data224 10000M


Extend tablespace or add datafile size in Oracle for SAP using sqlplus


Pre-requisite:
Make sure that there is enough free space available in File System


Procedure :

     1. Login into the system with oracle or ora<sid>
     2. Open the sqlplus prompt using below command
           sqlplus / as sysdba
     3. At the SQL prompt use the below command alter the Tablespace size
          alter tablespace <TABLESPACENAME> add datafile '/oracle/<SID>/sapdata<no>/<DATAFILE folder ex- sr3_223>/<DATAFILE name ex- sr3.data223> size 10000M autoextend off
       

    4. commit;


Suggestion :
Create <DATAFILE folder> under the required sapdata folder.




ORA-01017: invalid username/password; logon denied after SAP system refresh



Pre-requisite:
Below procedure is valid for Oracle 11g because it supports OPS$ mechanism

Procedure :

     1. Select username from dba_users where username like 'OPS%';
     2. Drop user OPS$SAPSERVICEP<OLD_SID> cascade;
     3. Drop user OPS$<OLD_SID>ADM cascade;
     4. Drop user OPS$ORA<OLD_SID> cascade;
     5. Create user OPS$SAPSERVICE<NEW_SID> identified externally;
     6. Create user OPS$ORA<NEW_SID> identified externally;
     7. Create user OPS$<NEW_SID>ADM identified externally;
     8. Grant connect,resource, sapdba to OPS$<NEW_SID>ADM;
     9. Grant connect,resource, sapdba to OPS$ORA<NEW_SID>;
     10. Create table OPS$<NEW_SID>ADM.SAPUSER(USERID VARCHAR(256),PASSWD VARCHAR(256));
     11. Insert into OPS$<SID>ADM.SAPUSER values('SAPSR3','<Password>');


Suggestion:
After reset the SAPSR3 password using above method, use brtools to rest it again, So that
the password will be saved in encrypted form in the table.

System Refresh using Backup/Restore Method


Pre-requisite:

Both the source and target File system should be same.
Size of file system should be same.
Take the trace control file from source to target.
Ensure the the source working database backup.


Procedure :

       1.  Login to target system.
       2.  Shutdown the application server and database server.
       3.  Stop the listener
       4.  Delete all the files available under mirrlogA, mirrlogB, origlogA, origlogB
            sapdata1, sapdata2,sapdata3 .
       5. Copy the last successful backup file from source /oracle/<SOURCE_SID>/sapbackup/
           <filename>.aff (offline backup) or <filename>.anf (online backup) to target
           /oracle/<TGT_SID>/sapbackup
       6. Create backup control on source system
            alter database backup controlfile to trace as '/home/oracle/controlfile_backup.txt .
       7. Copy the below content of trace and create control_sid.sql and move it to
           target server under /oracle and update the SID of the system .
          
          STARTUP NOMOUNT
          CREATE CONTROLFILE SET DATABASE "<TGT_SID>" RESETLOGS ARCHIVELOG
         MAXLOGFILES 255
         MAXLOGMEMBERS 3
         MAXDATAFILES 254
         MAXINSTANCES 50
         MAXLOGHISTORY 21034
        LOGFILE
               GROUP 1 (
               '/oracle/<TGT_SID>/origlogA/log_g11m1.dbf',
              '/oracle/<TGT_SID>/mirrlogA/log_g11m2.dbf'
               ) SIZE 50M BLOCKSIZE 512,
               GROUP 2 (
              '/oracle/<TGT_SID>/origlogB/log_g12m1.dbf',
             '/oracle/<TGT_SID>/mirrlogB/log_g12m2.dbf'
              ) SIZE 50M BLOCKSIZE 512,
             GROUP 3 (
              '/oracle/<TGT_SID>/origlogA/log_g13m1.dbf',
              '/oracle/<TGT_SID>/mirrlogA/log_g13m2.dbf'
              ) SIZE 50M BLOCKSIZE 512,
             GROUP 4 (
             '/oracle/<TGT_SID>/origlogB/log_g14m1.dbf',
             '/oracle/<TGT_SID>/mirrlogB/log_g14m2.dbf'
              ) SIZE 50M BLOCKSIZE 512
   DATAFILE
             '/oracle/<TGT_SID>/sapdata1/system_1/system.data1',
             '/oracle/<TGT_SID>/sapdata1/sysaux_1/sysaux.data1',
             '/oracle/<TGT_SID>/sapdata1/undo_1/undo.data1',
             '/oracle/<TGT_SID>/sapdata2/sr3_1/sr3.data1',
             '/oracle/<TGT_SID>/sapdata2/sr3_2/sr3.data2',
             '/oracle/<TGT_SID>/sapdata2/sr3_3/sr3.data3',
             '/oracle/<TGT_SID>/sapdata2/sr3_4/sr3.data4',
             '/oracle/<TGT_SID>/sapdata2/sr3_5/sr3.data5',
             '/oracle/<TGT_SID>/sapdata2/sr3_6/sr3.data6',
              '/oracle/<TGT_SID>/sapdata2/sr3_7/sr3.data7',
  CHARACTER SET UTF8
  ;

      7. Command to restore the backup from tape to system in background mode
           nohup  brrestore -c force -b <file_name>.anf -p init<SID>.sap -r backup_utility.utl -m full -u /  &
      8. Restore can be monitored from the subsequent log file in /oracle/<SID>/sapbackup latest <file_name>.rsb
      9. Go to the path where control_<SID>.sql has been placed and create the control file with below command.
          


          
      






                         
    10. Now recover the database using the below sqlplus command, system will ask for archive log for the further recovery, if required.
          recover database using backup controlfile until time '2020-01-27:22:53:00';























   
     11.  Now open the database with resetlogs.






   
    12. Now the check the database mode.








   
   13.  Start the listener.
   14.  Switch the user to <sid>adm and check the output of R3trans -d.









Note :
If R3trans fails with  error ORA-01017: invalid username/password; Check link

   15. Now start the sap system.


Suggestion :
Recovery time taken in Point 10 should be same as source backup file we copied in point 5 or less than that time.
; is mandatory in control file and it should be in individual line.

        

Table Re-organization Using BRTOOLS


Procedure:

Take the count of the table 








Start the brtools using ora<sid> or oracle user












Choose the option 3 (Segment Management)













Choose option 1 (Reorganize Tables)




Now choose option 6 (Table names) to provide the name of the table and press c to Continue




Now it will show the directory path and log location for table
















Depend upon the size of table reorganization will run.


Suggestion:
Depend upon the size and data table reorganization will run.
If any error will come re-run the table again.

Thursday, January 23, 2020

SAP R/3 Architecture



The SAP System has a three-tier client/server architecture.In SAP Application server all the data is stored in a database and the data is always processed by the application layer. The connection between the different layers are connected with network.Depending on the requirement Application layer and Database layer can be hosted on single single or disturbed system.


R/3 three tier architecture stands for Real time data processing in three tier architecture.


Presentation Layer
It layer creates an interface between the Application Server and End User. SAP systems can be connected in two ways:
- SAP GUI
- Browser

Application Layer
It consist of Primary Application Server(PAS) and ABAP Central Services (ASCS) or SCS in case of JAVA.  PAS consists of Dispatcher, Watchdog and Gateways Service where as ASCS or SCS consists
Message Server, Enqeue Service.

Database Layer
It consist the RDBMS which stores the data of SAP system.SAP is compatible with several databases i.e Oracle, Sybase, MaxDB, SQL Server, HANA.

Components of SAP 3-tier Architecture




https://help.sap.com/doc/saphelp_nw70/7.0.31/en-US/84/54953fc405330ee10000000a114084/content.htm?no_cache=true




  • The Internet Communication Manager (ICM) sets up the connection to the Internet. It can process both server and client Web requests.It supports the protocols HTTP, HTTPS, and SMTP. The SAP Web AS may be a Web server or a client. 
  • The dispatcher distributes the requests to the work processes. If all the processes are occupied the requests are stored in the dispatcher queue.
  • The Work Processes execute ABAP or Java programs.
  • The SAP Gateway makes the RFC interface between the SAP instances available (within an SAP System and beyond system boundaries).
  • The Message Server exchanges messages and balances the load in the SAP system.










The C++ runtime installed on this machine is too old to run SAPinst



       Error :
       

    Reason:

       SAP Kernel 748 or higher, the system uses a new compiler version on Linux platforms. This compiler version requires a runtime environment that is not delivered as standard with RHEL 6, SLES 11, or OL 6.


     Solution :

               SLES

                       Install libstdc++ package


              RHEL
         
                   1.   Install compat-sap-c++ package
                   2.   mkdir /usr/sap/lib
                   3.   ln -s /opt/rh/SAP/lib64/compat-sap-c++.so /usr/sap/lib/libstdc++.so.6
                   4.   Changing the file/directory ownership of /usr/sap/lib to sapadm:sapsys or <sid>adm:sapsys user:group is possible

            Oracle Linux

                   1.   Install compat-sap-c++ package
                   2.   mkdir /usr/sap/lib
                   3.   ln -s /opt/rh/SAP/lib64/compat-sap-c++.so /usr/sap/lib/libstdc++.so.6
                   4.   Changing the file/directory ownership of /usr/sap/lib to sapadm:sapsys or  <sid>adm:sapsys user:group is possible

ORA-28000: the account is locked in SAP


Error :
 
      Output of R3trans -d shows ORA-28000: the account is locked


Resaon :

      Schema User expired or password has been locked out.


Solution :

   
SQL> select username,ACCOUNT_STATUS from dba_users where username='SAPSR3';

                USERNAME                                         ACCOUNT_STATUS
                --------------------------                          --------------------------------
                 SAPSR3                                                 LOCKED(TIMED)

SQL> alter user SAPSR3 account unlock;

User altered.

SQL> select username,ACCOUNT_STATUS from dba_users where username='SAPSR3';

                USERNAME                                         ACCOUNT_STATUS
                --------------------------                          --------------------------------
                 SAPSR3                                                 OPEN

Now run the command so that the password of the user never expires again


SQL> alter profile DEFAULT limit PASSWORD_REUSE_TIME unlimited;

            Profile altered.

SQL> alter profile DEFAULT limit PASSWORD_LIFE_TIME  unlimited;



             Profile altered.