17
9/9/2015 System Copy (Cloning) Oracle DBA for SAP Basis http://oracledbaforsapbasis.webs.com/systemcopycloning.htm 1/17 ORACLE DBA FOR SAP BASIS SYSTEM REFRESH SYSTEM REFRESH using Export – Import Required DVDs, Master DVD: 51033208_11 The remaining DVDs you will get in the slides Executing Sapinst in the source system NW2

System Copy (Cloning) - Oracle DBA for SAP Basis

Embed Size (px)

DESCRIPTION

.

Citation preview

9/9/2015 System Copy (Cloning) ­ Oracle DBA for SAP Basis

http://oracledbaforsapbasis.webs.com/systemcopycloning.htm 1/17

ORACLE DBA FOR SAP BASIS

SYSTEM REFRESHSYSTEM REFRESH using Export – ImportRequired DVDs,Master DVD: 51033208_11The remaining DVDs you will get in the slides

Executing Sapinst in the source system NW2

9/9/2015 System Copy (Cloning) ­ Oracle DBA for SAP Basis

http://oracledbaforsapbasis.webs.com/systemcopycloning.htm 2/17

TRNG999 is the source system Host Name

Giving the location where the export file will be stored

9/9/2015 System Copy (Cloning) ­ Oracle DBA for SAP Basis

http://oracledbaforsapbasis.webs.com/systemcopycloning.htm 3/17

9/9/2015 System Copy (Cloning) ­ Oracle DBA for SAP Basis

http://oracledbaforsapbasis.webs.com/systemcopycloning.htm 4/17

IMPORTING THE EXPORTED FILE­

9/9/2015 System Copy (Cloning) ­ Oracle DBA for SAP Basis

http://oracledbaforsapbasis.webs.com/systemcopycloning.htm 5/17

NW3 is the target system name

9/9/2015 System Copy (Cloning) ­ Oracle DBA for SAP Basis

http://oracledbaforsapbasis.webs.com/systemcopycloning.htm 6/17

9/9/2015 System Copy (Cloning) ­ Oracle DBA for SAP Basis

http://oracledbaforsapbasis.webs.com/systemcopycloning.htm 7/17

9/9/2015 System Copy (Cloning) ­ Oracle DBA for SAP Basis

http://oracledbaforsapbasis.webs.com/systemcopycloning.htm 8/17

9/9/2015 System Copy (Cloning) ­ Oracle DBA for SAP Basis

http://oracledbaforsapbasis.webs.com/systemcopycloning.htm 9/17

I have done the system refresh in the same Host TRNG999

9/9/2015 System Copy (Cloning) ­ Oracle DBA for SAP Basis

http://oracledbaforsapbasis.webs.com/systemcopycloning.htm 10/17

9/9/2015 System Copy (Cloning) ­ Oracle DBA for SAP Basis

http://oracledbaforsapbasis.webs.com/systemcopycloning.htm 11/17

Browse the exported file directory

9/9/2015 System Copy (Cloning) ­ Oracle DBA for SAP Basis

http://oracledbaforsapbasis.webs.com/systemcopycloning.htm 12/17

System Copy Successfully Completed…. Now enjoy the new system.

­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­

Homogeneous System Copy using Online/Offline Database Backup

This guide is prepared for a Homogeneous System Copy using Online/Offline Database Backup. Steps for aHomogeneous system copy are briefly as below:

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

Prerequisites

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

9/9/2015 System Copy (Cloning) ­ Oracle DBA for SAP Basis

http://oracledbaforsapbasis.webs.com/systemcopycloning.htm 13/17

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 ­ <targetsid>adm# stopsap all# exit# su – ora<targetsid># lsnrctl stop# exit# cd /oracle/<SID>/# 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/*

On Windows systems, SAP and Oracle services can be stopped via the following commandline program afterlogging as <sid>adm:ntscmgr stop SAP<SID>_<SYSNO> ntscmgr stop SAPOSCOLntscmgr stop OracleService<SID>

2. You have to resize the following file systems before restore process. Take into account sizes of source system.

/oracle/<SID>/sapdata1/oracle/<SID>/sapdata2/oracle/<SID>/sapdata3/oracle/<SID>/sapdata4/oracle/<SID>/sapdata5/oracle/<SID>/sapdata6/oracle/<SID>/saparch

3. After cleaning necessary file systems/directories, you have to restore most current database backup to targetsystem. For this, find the detail backup log (e.g. bdkxxsrh.anf) for that backup on source system. You can determinethis from back<SID>.log summary backup log file or using DB12.

On Windows systems, while restoring source database on target system, you have to keepsame mount points for Oracle Data Directories.For example if all of your source data directories resides on "d:>" disk(d:\oracle\<SSID>\sapdatax), then you have to create data dirs. at target system on "d:>" disk.After restore process, you can change the directories. For example you can distribute sapdataxdirectories on many disks. This will be mentioned in CONTROLFILE creation step later.

9/9/2015 System Copy (Cloning) ­ Oracle DBA for SAP Basis

http://oracledbaforsapbasis.webs.com/systemcopycloning.htm 14/17

3.a. Mount the necessary backup volume on target system.3.b. Use the following command to begin restore:# su ­ ora<tsid># cd sapbackup# brrestore ­m full ­b <det_log_file> ­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 therestore command executed) and in backup. Also, Oracle_Home parameters in backup and in current system will bedifferent and recognized by brrestore. But the restore command will restore the datafiles to match current systemsfile system. Here is a sample log of a restore.

All the datafiles and online redolog files (only for Offline DB Backup) must be successfullyrestored. At this step, there are 3 probability that must be take into account for the followingsteps. You are using an online database backup of source system to create target system. Youhave to find and put all archive files created during online backup into target systems archivedirectory to be able to recover database. You can also apply all the archives created from theonline backup start time to latest available. You are using an offline database backup of sourcesystem which is running in ARCHIVELOG mode to create target system. You may find thearchive files created after offline backup on source system to make database current on targetsystem via applying during recovery. You are using an offline database backup of sourcesystem which is running in NOARCHIVELOG mode to create target system. You don't haveany 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 tocreate CONTROLFILE of target system. For this you have 2 option.4.a. You can use R3COPY program which is under "/kernel/UNIX/COMMON" directory ofKernel CD. This program can be used only on UNIX systems. For Windows systems, "4.b"option must be used.Run this program by ora<sid> user on source system. After some confirmations, executestep "(a) Source system: Generating the script CONTROL.SQL".This will create a script named CONTROL.SQL under /oracle/<SSID>/sapreorg directory.Copy this script into target system (any directory). This file is ready for execution and doesn'trequire any modification.

4.b. SVRMGRL or SQLPLUS can create a scrpit to create controlfile using current CONTROLFILE content. Login tosource system as ora<sid> user and execute the following SVRMGRL/SQLPLUS commands. To be able to executefollowing commands, database must be at least in MOUNT mode..

# svrmgrlSVRMGR> connect internalSVRMGR> alter database backup controlfile to trace;SVRMGR> exitAs a result of this command, a trace file (e.g. ora_54764_hvd.trc ) will be created under/oracle/<SSID>/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.Rename file name as CONTROL.SQL. Open file to edit using VI (UNIX) or NOTEPAD (WIN).Remove all lines before "STARTUP MOUNT" line. Delete all commented "#" lines. Also remove all lines after

9/9/2015 System Copy (Cloning) ­ Oracle DBA for SAP Basis

http://oracledbaforsapbasis.webs.com/systemcopycloning.htm 15/17

CHARACTER SET WE8DEC;" line. Change all Source SID's to Target SID via following commands.UNIX (VI): :%s/<SSID>/<TSID>/gWIN (NOTEPAD): CTRL+HChange the line CREATE CONTROLFILE REUSE DATABASE ‘SSID’ NORESETLOGS ARCHIVELOG;as followCREATE 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 editCONTROL.SQL file for new destinations.

5. After CONTROL.SQL script preparation, following commands must be run to createCONTROLFILE of target system:# su – ora<targetsid>

# svrmgrlSVRMGR> connect internalSVRMGR> @/<path_to_file>/control.sqlYou have to guarantee the successful completion of this command as follow:SVRMGR> @control.sqlStatement processed.SVRMGR>6. Database will be in inconsistent status after creation of CONTROLFILE. This can be viewed by trying to open thedatabase.SVRMGR> alter database open;alter database open*ORA­01589: must use RESETLOGS or NORESETLOGS option for database openSVRMGR> alter database open resetlogs;alter database open resetlogs*ORA­01195: online backup of file 1 needs more recovery to be consistentORA­01110: data file 1: '/oracle/<hedefSID>/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 therecovery 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 recoverdatabase.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 databasechanges commands, you will use source system archive file on new systems database recovery. Copy all archive filescreated since online backup on source system to archive directory of target system. Archive file names are different fromasked during recovery session. You can change archive file names for target system via thefollowing script.cd /oracle/<TSID>/saparchfor i in `ls|grep <SSID>`;do

9/9/2015 System Copy (Cloning) ­ Oracle DBA for SAP Basis

http://oracledbaforsapbasis.webs.com/systemcopycloning.htm 16/17

file_name=`echo $i |cut ­dD ­f2`;mv $i <TSID>$file_name;doneAlternatively 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 1ORA­00289: suggestion : /oracle/HVS/saparch/HVSarch1_22746.dbf

ORA­00280: change 44138924 for thread 1 is in sequence #22746Specify log: <RET>=suggested | filename | AUTO | CANCEL/oracle/HVS/saparch/HVDarch1_22746.dbfLog 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 CANCELcommand.ORA­00279: change 44164157 generated at 03/26/2003 01:58:29 needed for thread 1ORA­00289: suggestion : /oracle/HVS/saparch/HVSarch1_22754.dbfORA­00280: change 44164157 for thread 1 is in sequence #22754Specify log: <RET>=suggested | filename | AUTO | CANCELCANCELMedia recovery cancelled.SVRMGR>But recovery session must be started with the following command and cancelled again to be 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 1ORA­00289: suggestion : /oracle/HVS/saparch/HVSarch1_22754.dbfORA­00280: change 44164157 for thread 1 is in sequence #22754Specify log: <RET>=suggested | filename | AUTO | CANCELCANCELMedia 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 recoveryORA­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 youcan recover database to the most current status using archive files. The archive application and statup of database is sameas an online backed up database copy in "7.b".8. after opening database, LISTENER process must be started.# su – ora<targetsid># lsnrctl start

9/9/2015 System Copy (Cloning) ­ Oracle DBA for SAP Basis

http://oracledbaforsapbasis.webs.com/systemcopycloning.htm 17/17

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

# su ­ <targetsid>adm# startsap

10. As your Hardware Key is not changed, you don't have to get additional License Key fromSAPNET. You can use previous systems (on target system, if SID is not changed) License in newsystem created on target system.11. Logon to the SAP R/3 System and goto TCODE SE06. Select "Database Copy or Migration" andexecute "Post Installation Processing".

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

Copyright ©2014

Create a Free Website