You are on page 1of 17

System Copy Guides

SAP recommends that you make a system copy in order to build a test, demo, training or standby system (Oracle and
Informix: standby systems cannot be created with a system copy). You should perform upgrades in a test system first.
This way you can identify customer pecific problems which might result from modifications. Thus, we can sort the
general needs for a system copy as follow:
a. To create a new training system for end-user or project team education
b. To create a DEMO system
c.

To create a Test system for upgrade or other purposes.

d. To recover a system on another machine with the same platform after a crash.
e. To copy large clients. If a client very large to export/import, it is better to do a system copy rather than client
transport.
If a system copy takes place between systems with same platform ( operating system and database system ) , we
call this HOMOGENEOUS SYSTEM COPY.
If The system copy takes place between systems with different platforms ( at least one of the component must be
different, OS or RDBMS ), we call this HETEROGENEOUS SYSTEM COPY.
There 3 ways of a Homogeneous System Copy in R/3 Systems.
1. Homogeneous System Copy using Online / Offline Database Backup.
2. Homogeneous System Copy using R3LOAD Procedure.
3. Homogeneous System Copy using R3COPY Procedure.
This guide is prepared for a Homogeneous System Copy using Online/Offline Database Backup.
The procedure described tested on AIX 4.3.3/Oracle 8.1.7, AIX 5.1/Oracle 8.1.7, AIX 5.1/Oracle 9.2.0 and
Win2K/Oracle 8.1.7 platforms.
The command reference given in this guide is taken from a homogeneous system copy done on AIX 4.3.3/Oracle
8.1.7 platform. Differences of other platforms such as Windows will be shown in the same sections.

Homogeneous System Copy using Online/Offline Database Backup


This guide is prepared for a Homogeneous System Copy using Online/Offline Database Backup. Steps for a
Homogeneous system copy are briefly as below:
a. Preparations on Target System.
b. Restore Online/Offline Backup of Source System onto Target System.
c.

Create CONTROLFILE creation script on Source System.

d. Modification of CONTROLFILE script and creation of CONTROLFILEs of Target System.


e. Recovery of Oracle Database on Target System.
f.

Completion of System Copy

Prerequisites
Following conditions must be provided to copy a system:
a. Both Source and Target Systems must have Same Operating System and Database System. Also Patch
levels must be same.
b. You have sufficient free space for sapdata directories on target system.
c. For Windows systems, you have to create all drives where datafiles resides on source system.
d. Use most current database backup in order to shorten database creation time.

Procedure
1. 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.
# su -adm # stopsap all # exit # su ora # lsnrctl stop # exit # cd /oracle// # rm rf sapdata?/* # rm rf origlog?/* # rm
rf mirrlog? # rm rf sapreorg/* # rm rf saparch/* # rm rf saptrace/usertrace/* # rm rf saptrace/background/* # rm
rf sapbackup/* # rm rf sapcheck/*

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
2. 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.

DB12 -Backup Logs

back.log File
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. You can also restore datafiles and online redolog files (if you
are using offline backup) using backup tools such as BACKFM tool of IBM TSM.

3.a. Mount the necessary backup volume on target system.


3.b. Use the following command to begin restore:
# su -ora # cd sapbackup # brrestore -m full -b -c (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.
Here is a sample log of a restore.

All the datafiles and online redolog files (only for Offline DB Backup) must be successfully restored.
At this step, there are 3 probability that must be take into account for the following steps.
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.
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.
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.
Those differences will be detailed in recovery step.
4. After restoring datafiles and redolog files, a scripts must be prepared on source system to create CONTROLFILE
of target system. For this you have 2 option.
4.a. You can use R3COPY program which is under "/kernel/UNIX/COMMON" directory of Kernel CD. This program
can be used only on UNIX systems. For Windows systems, "4.b" option must be used. Run this program by ora user
on source system. After some confirmations, execute step "(a) Source system: Generating the script
CONTROL.SQL". This will create a script named CONTROL.SQL under /oracle//sapreorg directory. Copy this script
into target system (any directory). This file is ready for execution and doesn't require any modification.

4.b. SVRMGRL or SQLPLUS can create a scrpit to create controlfile using current CONTROLFILE content. Login to
source system as ora user and execute the following SVRMGRL/SQLPLUS commands. To be able to execute
following commands, database must be at least in MOUNT mode..
# svrmgrl SVRMGR> connect internal SVRMGR> alter database backup controlfile to trace; SVRMGR> exit
As a result of this command, a trace file (e.g. ora_54764_hvd.trc ) will be created under /oracle//saptace/usertrace
directory. File can be determined by sorting according to modification/creation dates (UNIX: # ls ltr). Most current file
must be cheched.
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 VI (UNIX) or NOTEPAD (WIN).
c.

Remove all lines before "STARTUP MOUNT" line. Delete all commented "#" lines. Also remove all lines
after CHARACTER SET WE8DEC;" line.

d. Change all Source SID's to Target SID via following commands.


UNIX (VI): :%s///g WIN (NOTEPAD): CTRL+H
Change the line
CREATE CONTROLFILE REUSE DATABASE SSID NORESETLOGS ARCHIVELOG;
as follow
CREATE CONTROLFILE REUSE SET DATABASE TSID 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.

5. After CONTROL.SQL script preparation, following commands must be run to create CONTROLFILE of target
system:
# su ora
# svrmgrl SVRMGR> connect internal SVRMGR> @/ /control.sql
You have to guarantee the successful completion of this command as follow:

SVRMGR> @control.sql Statement processed. SVRMGR>


6. Database will be in inconsistent status after creation of CONTROLFILE. This can be viewed by trying to open the
database.
SVRMGR> alter database open; alter database open * ORA-01589: must use RESETLOGS or NORESETLOGS
option for database open SVRMGR> alter database open resetlogs; alter database open resetlogs * ORA-01195:
online backup of file 1 needs more recovery to be consistent ORA-01110: data file 1:
'/oracle//sapdata1/system_1/system.data1'
At this step, a recovery must be made in order to be able to use the database.
7. 3 type of recovery can be made, according to your status mentioned at the end of STEP-3. all the recovery types
must be used by "USING BACKUP CONTROLFILE" as CONTROLFILE is created manually.
7.a. If your source system is runnig in NOARCHIVELOG mode, then you have to use the following command to
recover database.
SVRMGR> recover database using backup controlfile until cancel;
7.b. 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.
SVRMGR> 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 target system via the
following script.
cd /oracle//saparch for i in `ls|grep `; do
file_name=`echo $i |cut -dD -f2`; mv $i ${file_name}; done
Alternatively you can enter file names manually as required by recovery session as follow:
SVRMGR> recover database using backup controlfile; ORA-00279: change 44138924 generated at 03/26/2003
00:00:24 needed for thread 1 ORA-00289: suggestion : /oracle/HVS/saparch/HVSarch1_22746.dbf
ORA-00280: change 44138924 for thread 1 is in sequence #22746 Specify log: {=suggested | filename | AUTO |
CANCEL} /oracle/HVS/saparch/HVDarch1_22746.dbf Log applied.

After application of all necessary archives (at least all the archives created during online backup must be applied.
Archives from this point can be applied to make database current), next request for archive is cancelled via CANCEL
command.
ORA-00279: change 44164157 generated at 03/26/2003 01:58:29 needed for thread 1 ORA-00289: suggestion :
/oracle/HVS/saparch/HVSarch1_22754.dbf ORA-00280: change 44164157 for thread 1 is in sequence #22754
Specify log: {=suggested | filename | AUTO | CANCEL} CANCEL Media recovery cancelled. SVRMGR>
But recovery session must be started with the following command and cancelled again to ba able to start database.
SVRMGR> recover database using backup controlfile until cancel; ORA-00279: change 44164157 generated at
03/26/2003 01:58:29 needed for thread 1 ORA-00289: suggestion : /oracle/HVS/saparch/HVSarch1_22754.dbf ORA00280: change 44164157 for thread 1 is in sequence #22754 Specify log: {=suggested | filename | AUTO | CANCEL}
CANCEL Media recovery cancelled. SVRMGR>
Otherwise following error will arise during database opening.
SVRMGR> alter database open resetlogs; alter database open resetlogs * ORA-01113: file 1 needs media recovery
ORA-01110: data file 1: '/oracle/HVS/sapdata1/system_1/system.data1'
To open database, use the following command:
SVRMGR> alter database open resetlogs; Statement processed. SVRMGR>
7.c. If you restored an offline backup on target system, you can recover database to the time of backup completed or
you can recover database to the most current status using archive files. The archive application and statup of
database is same as an online backed up database copy in "7.b".
8. after opening database, LISTENER process must be started.
# su ora # lsnrctl start

9. To open SAP system, use the following commands.


# su -adm # startsap

1. 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.
2. Logon to the SAP R/3 System and goto TCODE SE06. Select "Database Copy or Migration" and execute
"Post Installation Processing".

SE06
Change all of the Source System Objects to Target System Objects as asked.
1. Delete old TMS configuration and make new configuration for TMS via STMS TCODE.
2. After all of above steps, you have completed a System Copy using Online/Offline Database Backup.

*************************************************************************************

Here is a good method I use, depending on your landscape, you may have a few more steps with
setting permissions for the DB users. There may also be some steps you will not have to perform. READ THE
WHOLE DOCUMENT VERY CAREFULLY and make the necessary adjustments to it prior to attempting to use.

PART 1

System Refresh
Preparing the Target System
Save DB13 configuration
1.

Log on to the existing target SAP system

2.

Run transaction DB13

3.

From the Calendar menu, select print

4.

Select a printer and press <Shift>+<F1>

Exporting the current users


SCC8
1.

In the Selected Profile field, press <F4> and select SAP_USERS.

2.

Press the Choose button

3.

In the Target System, enter the <SID> of the existing target system.

4.

Press the Start Immediately button.

5.

Press the Continue button

6.

Make note of the transport number for the client-specific data

7.

Press <Enter> to continue.

SE01
1.

Enter the transport number noted in step 6 above and enter it in the Request/Task box.

2.

Press the Logs buttons.

3.

If the export is still executing, press <F5> to refresh.

4.

Repeat press <F5> on occasion to refresh. DO NOT CONTINUE UNTIL THE EXPORT IS COMPLETE

Export the current printer definitions


SPAD
1.

Press <SHIFT>+<F8> to go in to change mode

2.

Create a transport of the printer definitions by clicking on the Output devices button

3.

From the Edit menu, select Transport and then Transport all

4.

Press <Enter> when warned about processing target system.

5.

When prompted for a new transport, press <F8> to create a new transport.

6.

Make note of the transport number.

7.

Enter a appropriate description (i.e Printers for import after refresh) and press <Enter> to save.

8.

Press <Enter> to accept the newly created transport

SE01
1.

Enter the transport number noted in step 6 above and enter it in the Request/Task box.

2.

Press the Display button

3.

Click on the task underneath the transport and press <F9> to release the task

4.

Click on transport press <F9> to release the transport.

Preparing the Source System


Gather Information
DB12
1.

Press the Overview of database backups button.

2.

Locate the backup that your are going to use for the restore, and note the log name in the last column (i.e

bdqjnsfk.anf)
3.

Double click on backup entry to view the details.

4.

Press the Detail Log button

5.

Scroll down to the very bottom and note the date and time that the BRARCHIVE command was started.

6.

Press <F3> 3 time to go back to the main DB13 screen

7.

Press the Overview of redo log backups button.

8.

Locate the backup that was started around the time noted in step and note the name of the log file associated

with that backup (i.e. adqjomaf.cds).


9.
10.

Double click on backup entry to view the details.


Scroll down to the bottom and make note of the first and last Redo Log number included in that backup.

Copy Files
1.

Locate the following files and copy them from the appropriate directory on source system to the corresponding

directory on the target system.


File Name

Typical Location

CATALOG.<SID>

C:\BACKINTLOG or H:\ORACLE\<SID>\SABACKUP

BACKUP<SID>.LOG

H:\ORACLE\<SID>\SAPBACKUP

<BACKUP>.ANF (noted in step 2 above)


ARCH<SID>.LOG

2.

H:\ORACLE\<SID>\SAPBACKUP

H:\ORACLE\<SID>\SAPARCH

Rename or delete the existing CATALOG.<SID>, BACKUP<SID>.LOG and ARCH<SID>LOG files on the target

system
3.

Rename the CATALOG.<SID>, BACKUP<SID>.LOG and ARCH<SID>LOG files that were copied from the

source system to reflect the System ID of the target system (i.e CATALOG.PFC will become CATALOG.QFC etc.)

Export Oracle Control file information


1.

Logon on to the source system as <sid>adm

2.

Start a command prompt,

3.

Enter the command: sqlplus /nolog

4.

Enter the following commands

connect / as sysdba

show parameter user_dump_dest


alter database backup controlfile to trace;
quit

5.

Open Windows Explorer and navigate to directory noted the in the results of the show parameter

user_dump_dest above
6.

Locate the most recently created file and copy it to a directory on the target system.

7.

Rename the file on the target system to NEWCNTRL.SQL

8.

Start Notepad

9.

From the File menu, select Open.

10.

Select All Files from the Files of Type box and navigate to the NEWCNTRL.SQL and press the Open button.

11.

Remove the entire first section of the file up to, but NOT including the STARTUP NOMOUNT line in the

second section entitled Set #2. RESETLOGS case.


12.

Replace the word REUSE with SET in the CREATE CONTROLFILE line.

13.

From the Edit menu, select Replace

14.

In the Find What: box enter the <SID> of the source system. In the Replace With box, enter the <SID> of the

target system. Press the Replace All button.


15.
1.

Remove all the lines at the end of the file after the semi-colon, beginning with the
Recovery is line.

16.

If the file paths on the source system are the same as on the target system, then no further editing of the file is

required. Otherwise you need to adapt the file paths to reflect the directory structure on the target system.
17.

From the File menu, select Save.

18.

From the File menu, select Exit

Restore and Recover the Oracle Database


Restore the Oracle Database
1.

Logon on to the source system as <sid>adm

2.

Using the SAP System Manager, stop SAP as normal

3.

Run the command SQLPLUS /NOLOG

4.

Enter the following command into SQLPLUS

connect / as sysdba
shutdown immediate
quit
5.

To restore the database run the following command

brrestore -m full -b <backup>.anf -d util_file -p init<newSID>.sap

<backup>.anf in the ANF file noted above in the Copy Files section
6.

From the Start button, select Search, the For Files or Folders.

7.

In the Search for files or folders box, enter CNTRL<SID>.DBF. Make sure the the Look in box is set to Local

Harddrives. Press the OK button.


8.

Once the search is complete, rename all of the existing CNTRL<SID>.DBF files to back them up.

9.

To restore the redo logs required to fully recover the database, enter the following command.

brrestore -p init<newSID>.sap -a <1st redo>-<last redo> -d util_file -r init<newSID>.utl -k no -l E

<1st redo> and <last redo> are the numbers of the first and last redo logs associated with the backup that was used
to do the restore. This was noted in the Gather Information section above.
10.

Enter the command: sqlplus /nolog

11.

Enter the following commands

connect / as sysdba
@<drive letter>:\<directory path>\newcntrl.sql (This is file that was edited previously)
shutdown immediate
startup mount
recover database using backup controlfile until cancel;
AUTO
If prompted for a redo log that wasnt included in the backup, enter the command CANCEL
Alter database open resetlogs;
Shutdown immediate
Startup
Quit
12.

At this point the Oracle database should be started with out any errors. If problems do exist, you must resolve

them before continuing.

Reset Oracle system users


1.

The Oracle user OPS$<hostname or domain>\<SID>ADM and OPS$<hostname or

domain>\SAPSERVICE<SID> must exist for every SAP database. These are the Oracle users that connect to Oracle
from Windows to run SAP integrated backups, CBO stats, etc. without having to supply an Oracle password.
2.

Run the command SQLPLUS /NOLOG

3.

Enter the following command into SQLPLUS

Connect / as sysdba
4.

Check the users with the following: select USERNAME from DBA_USERS;

5.

Use the SQL script attached to note 50088 --- @<drive letter>:\<directory path>\oradbusr.sql

@oradbusr.sql <schemaowner> NT <hostname or domain> <SID>

oradbusr.sql is a txt file attached to note

50088
schemaowner is sapr3 for 46d systems it is sap<sid> for 6.x systems

6.

Run the command SQLPLUS /NOLOG

Post Restore Procedures


Re-Install SAP License
1.

Get the current license information for this system from Service Market Place by going to

http://service.sap.com/system-data
2.

From a command prompt, run the command saplicense install

3.

Follow the prompts using the information available on the Service Market Place.

Delete Old Licenses


1.

From a command prompt, run the command saplicense -show

2.

If there are other licenses list other than the one that was just installed, then enter the command saplicense

delete
3.

Enter the <SID> associated with the old license.

4.

Enter the Hardware Key associated with the old license

5.

Enter R3_ORA as the Product ID.

Configure SAP for Zero Batch Processes


1.

Create a copy of the instance profile usr\sap\<SID>\sys\profile\<SID>_DVEBMGS<SYSNR>_<HOSTNAME>

2.

Open the instance profile \usr\sap\<SID>\sys\profile\<SID>_DVEBMGS<SYSNR>_<HOSTNAME> using

SAPPAD or other text editor.


3.

Make note of the number of batches processes configured by looking at the value on the rdisp/wp_no_btc line

4.

Change the line containing rdisp/wp_no_btc to read

rdisp/wp_no_btc = 0
5.

Save the new version of the instance profile

Start SAP
1.

Using the SAP System Manager, start SAP as normal

Stop Batch Jobs


1.

Log on to the newly refreshed target system

SM37
1.

Set the fields as follows

Job name: *
User name: *
Job Status: Released and Ready checked off, all others unchecked
Fr: 01/01/0001
To: 12/31/9999
Or after event: *
2.

Press <F8> to execute the query

3.

From the list of released jobs, place a checkmark beside any jobs that begin with DBA:

4.

From the Job menu, select Delete

5.

Press the Yes button to delete the jobs

6.

Press <F5> to select all the jobs

7.

Remove the check marks from beside the following jobs

Any jobs starting with RDDIMPDP


Any job starting with SAP
AUTO_SESSION_MANAGER
8.

From the jobs menu, select Release -> Scheduled

9.

Press <F3> to go back

10.

Repeat step 1 through 9 until it is confirmed that all jobs except those listed in step 7 are not listed.

Stop SAP
1.

Using the SAP System Manager, stop SAP as normal

Restore the Number of Batch Processes.


1.

Open the instance profile \usr\sap\<SID>\sys\profile\<SID>_DVEBMGS<SYSNR>_<HOSTNAME> using

SAPPAD or other text editor.


2.

Change the line containing rdisp/wp_no_btc back to the value it was at before changing it to zero.

3.

Save the new version of the instance profile