Skip to Content

What is Homogeneous system copy?

If a system copy takes place between systems with same platform (operating system and database system), then it’s called HOMOGENEOUS SYSTEM COPY.

Reasons for Copying a SAP System

  1. To create a new training system for end-user or project team education
  2. To create a DEMO system
  3. To create a Test system for upgrade or other purposes.
  4. To recover a system on another machine with the same platform after a crash.
  5. To copy large clients. If a client very large to export/import, it is better to do a system copy rather than client transport.

  Methods for homogeneous system copy  

·         Backup and restore method(DOES NOT REQUIRE PRD DOWNTIME)

·         By using SAPinst import/export method(REQUIRES SIGNIFICANT AMOUNT OF DOWNTIME)

Note:- In our case I am going to follow backup and restore method since no downtime required, henceforth this guide is prepared for a Homogeneous System Copy using Online/Offline Database Backup

Homogeneous System Copy using Online/Offline Database Backup

. Steps for a Homogeneous system copy are briefly as below:

  1. Preparations on Target System.
  2. Restore Online/Offline Backup of Source System onto Target System.
  3. Create CONTROLFILE creation script on Source System.
  4. Modification of CONTROLFILE script and creation of CONTROLFILEs of Target System.
  5. Recovery of Oracle Database on Target System.
  6. Completion of System Copy.

  Prerequisites  

Following conditions must be provided to copy a system:

  1. Both Source and Target Systems must have Same Operating System and Database System. Also Patch levels must be same.
  2. You have sufficient free space for sapdata directories on target system.
  3. For Windows systems, you have to create all drives where datafiles resides on source system.
  4. Use most current database backup in order to shorten database creation time.

Procedure

Data and Log directories on target system must be cleaned before restoring source database. Here below are the commands to clean directories. Before this, you have to stop all SAP and Oracle processes in service.msc.

    1. You have to resize the following file systems before restore process. Take into account sizes of source system.
    2. /oracle//sapdata1 /oracle//sapdata2 /oracle//sapdata3 /oracle//sapdata4 /oracle//sapdata5 /oracle//sapdata6 /oracle//saparch

After cleaning necessary file systems/directories, you have to restore most current database backup to target system. For this, find the detail backup log (e.g. bdkxxsrh.anf) for that backup on source system. You can determine this from back.log summary backup log file or using DB12. Copy this detailed backup log file into /oracle//sapbackup directory on target system. Use BRRESTORE command below to restore the source database on target system

Use the following command to begin restore:

cd sapbackup

brrestore -m full -b  (det_log_file= for example bdkxxsrh.anf)

At the first step of restore, system will recognize that the Oracle SID is different on target machine (where the restore command executed) and in backup. Also, Oracle_Home parameters in backup and in current system will be different and recognized by brrestore. But the restore command will restore the datafiles to match current systems file system.

All the datafiles and online redolog files (only for Offline DB Backup) must be successfully restored.

At this step, there are 3 probabilities that must be taken into account for the following steps.

i.            You are using an online database backup of source system to create target system.

You have to find and put all archive files created during online backup into target systems archive directory to be able to recover database. You can also apply all the archives created from the online backup start time to latest available.

ii.            You are using an offline database backup of source system which is running in ARCHIVELOG mode to create target system.

You may find the archive files created after offline backup on source system to make database current on target system via applying during recovery.

iii.            You are using an offline database backup of source system which is running in NOARCHIVELOG mode to create target system.

You don’t have any archive files created on source system so you don’t need anything.

After restoring datafiles and redolog files, a script must be prepared on source system to create CONTROLFILE of target system.

Use SQLPLUS to create a script to create controlfile using current CONTROLFILE content. Login to source system as QSGadm user and execute the following SQLPLUS commands. To be able to execute following commands, database must be at least in MOUNT mode.

SQL>alter database backup controlfile to trace;

As a result of this command, a trace file (e.g. qsg_ora_6944) will be created under /oracle//saptace/usertrace directory.

You have to edit this file to be able to use for CONTROLFILE creation on target system.

a.       Rename file name as CONTROL.SQL

b.      Open file to edit using NOTEPAD.

c.       Remove all lines before “STARTUP MOUNT” line. Delete all commented “#” lines. Also remove all lines after CHARACTER SET UTF8;” line.

d.      Change all Source PSG SID to QSG SID (use ctrl+H)

Change the line

CREATE CONTROLFILE REUSE DATABASE ‘PSG’ NORESETLOGS ARCHIVELOG;

As follow

CREATE CONTROLFILE REUSE SET DATABASE ‘QSG’ RESETLOGS ARCHIVELOG;

If you want to change datafile or redolog file destinations, first move the files on target destination at OS level, then edit CONTROL.SQL file for new destinations.

After CONTROL.SQL script preparation, following commands must be run to create CONTROLFILE of target system:

Database will be in inconsistent status after creation of CONTROLFILE. This can be viewed by trying to open the database.

SQL> alter database open;

alter database open * ORA-01589: must use RESETLOGS or NORESETLOGS option for database open

At this step, a recovery must be made in order to be able to use the database.

If your source system is running in NOARCHIVELOG mode, then you have to use the following command to recover database.

SQL> recover database using backup controlfile until cancel;

If you restored an online backup on target system and put all the archive files created since online backup start time, use the following commands.

SQL> recover database using backup controlfile;

After execution of this command, Oracle will ask for archive files to be consistent. As archive files contains only database changes commands, you will use source system archive file on new systems database recovery. Copy all archive files created since online backup on source system to archive directory of target system. Archive file names are different from asked during recovery session. You can change archive file names for targetsystem manually.

But recovery session must be started with the following command and cancelled again to be able to start database.

Otherwise following error will arise during database opening.

SQL> alter database open resetlogs;

alter database open resetlogs * ORA-01113: file 1 needs media recovery ORA-01110: data file 1: ‘/oracle/QSG/sapdata1/system_1/system.data1’

To open database, use the following command:

SQL> alter database open resetlogs;

After opening database, LISTENER process must be started.

Before opening SAP perform the following activities:-

·         Change dbs_ors_schema to SAPPSG both in CI and DI that is both in 10.99.32.45 and 10.99.32.46

·         Check the users and lock status by entering following command

Make sure all the users are in open state.

·         Run oradbusr.sql as per the Note 50088 – Creating OPS$ users on Windows NT/Oracle to create ops$ users

SQL>@F:\oradbusr.sql  SAPTSID  NT DOMAIN SID

If you still find any errors refer NOTE 400241 (https://websmp230.sap-ag.de/sap%28bD1lbiZjPTAwMQ==%29/bc/bsp/spn/sapnotes/index2.htm?numm=400241)

·         Now change the password of SAPPSG by using brconnect so that it will get updated in SAPUSER table, enter the following command in cmd

brconnect -u system/basis$1234 -f chpass -o SAPPSG -p basis$1234

Note: – If you use below command in SQL for changing password the result will not be updated in the SAPUSER table, but if you change thru brconnect an encrypted password will be created, so please always use brconnect to change the password.

SQL> insert into “OPS$ CHESVLQSAP1 \QSGADM”.sapuser values(‘SAPPSG’,’basis@1234′);

·         So now when you parse the below commands and expect the same output, also check r3trans –d in command prompt and ensure return code is 0000

SQL>conn /@SID

SQL>connected .                                                                                     

·         Now start the SAP services

Logon to the SAP R/3 System and go to TCODE SE06. Select “Database Copy or Migration” and execute “Post Installation Processing”.

Change all of the Source System Objects to Target System Objects as asked.

Delete old TMS configuration and make new configuration for TMS via STMS TCODE.

Now Login to 000 client with SAP*, as your Hardware Key is not changed, you don’t have to get additional License Key from SAPNET. You can use previous systems (on target system, if SID is not changed) License in new system created on target system.

To report this post you need to login first.

2 Comments

You must be Logged on to comment or reply to a post.

Leave a Reply