System Copy (Cloning) - Oracle DBA For SAP Basis
System Copy (Cloning) - Oracle DBA For SAP Basis
SystemCopy(Cloning)OracleDBAforSAPBasis
ORACLEDBAFORSAPBASIS
SYSTEMREFRESH
SYSTEMREFRESHusingExportImport
RequiredDVDs,
MasterDVD:51033208_11
TheremainingDVDsyouwillgetintheslides
ExecutingSapinstinthesourcesystemNW2
http://oracledbaforsapbasis.webs.com/systemcopycloning.htm
1/17
9/9/2015
SystemCopy(Cloning)OracleDBAforSAPBasis
TRNG999isthesourcesystemHostName
Givingthelocationwheretheexportfilewillbestored
http://oracledbaforsapbasis.webs.com/systemcopycloning.htm
2/17
9/9/2015
SystemCopy(Cloning)OracleDBAforSAPBasis
http://oracledbaforsapbasis.webs.com/systemcopycloning.htm
3/17
9/9/2015
SystemCopy(Cloning)OracleDBAforSAPBasis
IMPORTINGTHEEXPORTEDFILE
http://oracledbaforsapbasis.webs.com/systemcopycloning.htm
4/17
9/9/2015
SystemCopy(Cloning)OracleDBAforSAPBasis
NW3isthetargetsystemname
http://oracledbaforsapbasis.webs.com/systemcopycloning.htm
5/17
9/9/2015
SystemCopy(Cloning)OracleDBAforSAPBasis
http://oracledbaforsapbasis.webs.com/systemcopycloning.htm
6/17
9/9/2015
SystemCopy(Cloning)OracleDBAforSAPBasis
http://oracledbaforsapbasis.webs.com/systemcopycloning.htm
7/17
9/9/2015
SystemCopy(Cloning)OracleDBAforSAPBasis
http://oracledbaforsapbasis.webs.com/systemcopycloning.htm
8/17
9/9/2015
SystemCopy(Cloning)OracleDBAforSAPBasis
IhavedonethesystemrefreshinthesameHostTRNG999
http://oracledbaforsapbasis.webs.com/systemcopycloning.htm
9/17
9/9/2015
SystemCopy(Cloning)OracleDBAforSAPBasis
http://oracledbaforsapbasis.webs.com/systemcopycloning.htm
10/17
9/9/2015
SystemCopy(Cloning)OracleDBAforSAPBasis
Browsetheexportedfiledirectory
http://oracledbaforsapbasis.webs.com/systemcopycloning.htm
11/17
9/9/2015
SystemCopy(Cloning)OracleDBAforSAPBasis
SystemCopySuccessfullyCompleted.Nowenjoythenewsystem.
HomogeneousSystemCopyusingOnline/OfflineDatabaseBackup
ThisguideispreparedforaHomogeneousSystemCopyusingOnline/OfflineDatabaseBackup.Stepsfora
Homogeneoussystemcopyarebrieflyasbelow:
PreparationsonTargetSystem.
RestoreOnline/OfflineBackupofSourceSystemontoTargetSystem.
CreateCONTROLFILEcreationscriptonSourceSystem.
ModificationofCONTROLFILEscriptandcreationofCONTROLFILEsofTargetSystem.
RecoveryofOracleDatabaseonTargetSystem.
CompletionofSystemCopy
Prerequisites
Followingconditionsmustbeprovidedtocopyasystem:
BothSourceandTargetSystemsmusthaveSameOperatingSystemandDatabaseSystem.AlsoPatchlevels
mustbesame.
Youhavesufficientfreespaceforsapdatadirectoriesontargetsystem.ForWindowssystems,youhavetocreate
alldriveswheredatafilesresidesonsourcesystem.
Usemostcurrentdatabasebackupinordertoshortendatabasecreationtime.
http://oracledbaforsapbasis.webs.com/systemcopycloning.htm
12/17
9/9/2015
SystemCopy(Cloning)OracleDBAforSAPBasis
Procedure
1.DataandLogdirectoriesontargetsystemmustbecleanedbeforerestoringsourcedatabase.
Herebelowarethecommandstocleandirectories.Beforethis,youhavetostopallSAPandOracleprocesses.
#su<targetsid>adm
#stopsapall
#exit
#suora<targetsid>
#lsnrctlstop
#exit
#cd/oracle/<SID>/
#rmrfsapdata?/*
#rmrforiglog?/*
#rmrfmirrlog?
#rmrfsapreorg/*
#rmrfsaparch/*
#rmrfsaptrace/usertrace/*
#rmrfsaptrace/background/*
#rmrfsapbackup/*
#rmrfsapcheck/*
OnWindowssystems,SAPandOracleservicescanbestoppedviathefollowingcommandlineprogramafter
loggingas<sid>adm:
ntscmgrstopSAP<SID>_<SYSNO>ntscmgrstopSAPOSCOL
ntscmgrstopOracleService<SID>
2.Youhavetoresizethefollowingfilesystemsbeforerestoreprocess.Takeintoaccountsizesofsourcesystem.
/oracle/<SID>/sapdata1
/oracle/<SID>/sapdata2
/oracle/<SID>/sapdata3
/oracle/<SID>/sapdata4
/oracle/<SID>/sapdata5
/oracle/<SID>/sapdata6
/oracle/<SID>/saparch
3.Aftercleaningnecessaryfilesystems/directories,youhavetorestoremostcurrentdatabasebackuptotarget
system.Forthis,findthedetailbackuplog(e.g.bdkxxsrh.anf)forthatbackuponsourcesystem.Youcandetermine
thisfromback<SID>.logsummarybackuplogfileorusingDB12.
OnWindowssystems,whilerestoringsourcedatabaseontargetsystem,youhavetokeep
samemountpointsforOracleDataDirectories.
Forexampleifallofyoursourcedatadirectoriesresideson"d:>"disk
(d:\oracle\<SSID>\sapdatax),thenyouhavetocreatedatadirs.attargetsystemon"d:>"disk.
Afterrestoreprocess,youcanchangethedirectories.Forexampleyoucandistributesapdatax
directoriesonmanydisks.ThiswillbementionedinCONTROLFILEcreationsteplater.
http://oracledbaforsapbasis.webs.com/systemcopycloning.htm
13/17
9/9/2015
SystemCopy(Cloning)OracleDBAforSAPBasis
3.a.Mountthenecessarybackupvolumeontargetsystem.
3.b.Usethefollowingcommandtobeginrestore:
#suora<tsid>
#cdsapbackup
#brrestoremfullb<det_log_file>c(det_log_file=forexamplebdkxxsrh.anf)
Atthefirststepofrestore,systemwillrecognizethattheOracleSIDisdifferentontargetmachine(wherethe
restorecommandexecuted)andinbackup.Also,Oracle_Homeparametersinbackupandincurrentsystemwillbe
differentandrecognizedbybrrestore.Buttherestorecommandwillrestorethedatafilestomatchcurrentsystems
filesystem.Hereisasamplelogofarestore.
Allthedatafilesandonlineredologfiles(onlyforOfflineDBBackup)mustbesuccessfully
restored.Atthisstep,thereare3probabilitythatmustbetakeintoaccountforthefollowing
steps.Youareusinganonlinedatabasebackupofsourcesystemtocreatetargetsystem.You
havetofindandputallarchivefilescreatedduringonlinebackupintotargetsystemsarchive
directorytobeabletorecoverdatabase.Youcanalsoapplyallthearchivescreatedfromthe
onlinebackupstarttimetolatestavailable.Youareusinganofflinedatabasebackupofsource
systemwhichisrunninginARCHIVELOGmodetocreatetargetsystem.Youmayfindthe
archivefilescreatedafterofflinebackuponsourcesystemtomakedatabasecurrentontarget
systemviaapplyingduringrecovery.Youareusinganofflinedatabasebackupofsource
systemwhichisrunninginNOARCHIVELOGmodetocreatetargetsystem.Youdon'thave
anyarchivefilescreatedonsourcesystemsoyoudon'tneedanything.
Thosedifferenceswillbedetailedinrecoverystep.
4.Afterrestoringdatafilesandredologfiles,ascriptsmustbepreparedonsourcesystemto
createCONTROLFILEoftargetsystem.Forthisyouhave2option.
4.a.YoucanuseR3COPYprogramwhichisunder"/kernel/UNIX/COMMON"directoryof
KernelCD.ThisprogramcanbeusedonlyonUNIXsystems.ForWindowssystems,"4.b"
optionmustbeused.
Runthisprogrambyora<sid>useronsourcesystem.Aftersomeconfirmations,execute
step"(a)Sourcesystem:GeneratingthescriptCONTROL.SQL".
ThiswillcreateascriptnamedCONTROL.SQLunder/oracle/<SSID>/sapreorgdirectory.
Copythisscriptintotargetsystem(anydirectory).Thisfileisreadyforexecutionanddoesn't
requireanymodification.
4.b.SVRMGRLorSQLPLUScancreateascrpittocreatecontrolfileusingcurrentCONTROLFILEcontent.Loginto
sourcesystemasora<sid>userandexecutethefollowingSVRMGRL/SQLPLUScommands.Tobeabletoexecute
followingcommands,databasemustbeatleastinMOUNTmode..
#svrmgrl
SVRMGR>connectinternal
SVRMGR>alterdatabasebackupcontrolfiletotrace
SVRMGR>exit
Asaresultofthiscommand,atracefile(e.g.ora_54764_hvd.trc)willbecreatedunder
/oracle/<SSID>/saptace/usertracedirectory.Filecanbedeterminedbysortingaccordingtomodification/creationdates
(UNIX:#lsltr).Mostcurrentfilemustbecheched.
YouhavetoeditthisfiletobeabletouseforCONTROLFILEcreationontargetsystem.
RenamefilenameasCONTROL.SQL.OpenfiletoeditusingVI(UNIX)orNOTEPAD(WIN).
Removealllinesbefore"STARTUPMOUNT"line.Deleteallcommented"#"lines.Alsoremovealllinesafter
http://oracledbaforsapbasis.webs.com/systemcopycloning.htm
14/17
9/9/2015
SystemCopy(Cloning)OracleDBAforSAPBasis
CHARACTERSETWE8DEC"line.ChangeallSourceSID'stoTargetSIDviafollowingcommands.
UNIX(VI)::%s/<SSID>/<TSID>/g
WIN(NOTEPAD):CTRL+H
ChangethelineCREATECONTROLFILEREUSEDATABASESSIDNORESETLOGSARCHIVELOG
asfollow
CREATECONTROLFILEREUSESETDATABASETSIDRESETLOGSARCHIVELOG
Ifyouwanttochangedatafileorredologfiledestinations,firstmovethefilesontargetdestinationatOSlevel,thenedit
CONTROL.SQLfilefornewdestinations.
5.AfterCONTROL.SQLscriptpreparation,followingcommandsmustberuntocreate
CONTROLFILEoftargetsystem:
#suora<targetsid>
#svrmgrl
SVRMGR>connectinternal
SVRMGR>@/<path_to_file>/control.sql
Youhavetoguaranteethesuccessfulcompletionofthiscommandasfollow:
SVRMGR>@control.sql
Statementprocessed.
SVRMGR>
6.DatabasewillbeininconsistentstatusaftercreationofCONTROLFILE.Thiscanbeviewedbytryingtoopenthe
database.
SVRMGR>alterdatabaseopen
alterdatabaseopen
*
ORA01589:mustuseRESETLOGSorNORESETLOGSoptionfordatabaseopen
SVRMGR>alterdatabaseopenresetlogs
alterdatabaseopenresetlogs
*
ORA01195:onlinebackupoffile1needsmorerecoverytobeconsistent
ORA01110:datafile1:'/oracle/<hedefSID>/sapdata1/system_1/system.data1'
Atthisstep,arecoverymustbemadeinordertobeabletousethedatabase.
7.3typeofrecoverycanbemade,accordingtoyourstatusmentionedattheendofSTEP3.allthe
recoverytypesmustbeusedby"USINGBACKUPCONTROLFILE"asCONTROLFILEiscreatedmanually.
7.a.IfyoursourcesystemisrunniginNOARCHIVELOGmode,thenyouhavetousethefollowingcommandtorecover
database.
SVRMGR>recoverdatabaseusingbackupcontrolfileuntilcancel
7.b.Ifyourestoredanonlinebackupontargetsystemandputallthearchivefilescreatedsinceonlinebackupstarttime,
usethefollowingcommands.
SVRMGR>recoverdatabaseusingbackupcontrolfile
Afterexecutionofthiscommand,Oraclewillaskforarchivefilestobeconsistent.Asarchivefilescontainsonlydatabase
changescommands,youwillusesourcesystemarchivefileonnewsystemsdatabaserecovery.Copyallarchivefiles
createdsinceonlinebackuponsourcesystemtoarchivedirectoryoftargetsystem.Archivefilenamesaredifferentfrom
askedduringrecoverysession.Youcanchangearchivefilenamesfortargetsystemviathe
followingscript.
cd/oracle/<TSID>/saparch
foriin`ls|grep<SSID>`
do
http://oracledbaforsapbasis.webs.com/systemcopycloning.htm
15/17
9/9/2015
SystemCopy(Cloning)OracleDBAforSAPBasis
file_name=`echo$i|cutdDf2`
mv$i<TSID>${file_name}
done
Alternativelyyoucanenterfilenamesmanuallyasrequiredbyrecoverysessionasfollow:
SVRMGR>recoverdatabaseusingbackupcontrolfile
ORA00279:change44138924generatedat03/26/200300:00:24neededforthread1
ORA00289:suggestion:/oracle/HVS/saparch/HVSarch1_22746.dbf
ORA00280:change44138924forthread1isinsequence#22746
Specifylog:{<RET>=suggested|filename|AUTO|CANCEL}
/oracle/HVS/saparch/HVDarch1_22746.dbf
Logapplied.
Afterapplicationofallnecessaryarchives(atleastallthearchivescreatedduringonlinebackupmustbeapplied.
Archivesfromthispointcanbeappliedtomakedatabasecurrent),nextrequestforarchiveiscancelledviaCANCEL
command.
ORA00279:change44164157generatedat03/26/200301:58:29neededforthread1
ORA00289:suggestion:/oracle/HVS/saparch/HVSarch1_22754.dbf
ORA00280:change44164157forthread1isinsequence#22754
Specifylog:{<RET>=suggested|filename|AUTO|CANCEL}
CANCEL
Mediarecoverycancelled.
SVRMGR>
Butrecoverysessionmustbestartedwiththefollowingcommandandcancelledagaintobeabletostartdatabase.
SVRMGR>recoverdatabaseusingbackupcontrolfileuntilcancel
ORA00279:change44164157generatedat03/26/200301:58:29neededforthread1
ORA00289:suggestion:/oracle/HVS/saparch/HVSarch1_22754.dbf
ORA00280:change44164157forthread1isinsequence#22754
Specifylog:{<RET>=suggested|filename|AUTO|CANCEL}
CANCEL
Mediarecoverycancelled.
SVRMGR>
Otherwisefollowingerrorwillariseduringdatabaseopening.
SVRMGR>alterdatabaseopenresetlogs
alterdatabaseopenresetlogs
*
ORA01113:file1needsmediarecovery
ORA01110:datafile1:'/oracle/HVS/sapdata1/system_1/system.data1'
Toopendatabase,usethefollowingcommand:
SVRMGR>alterdatabaseopenresetlogs
Statementprocessed.
SVRMGR>
7.c.Ifyourestoredanofflinebackupontargetsystem,youcanrecoverdatabasetothetimeofbackupcompletedoryou
canrecoverdatabasetothemostcurrentstatususingarchivefiles.Thearchiveapplicationandstatupofdatabaseissame
asanonlinebackedupdatabasecopyin"7.b".
8.afteropeningdatabase,LISTENERprocessmustbestarted.
#suora<targetsid>
#lsnrctlstart
http://oracledbaforsapbasis.webs.com/systemcopycloning.htm
16/17
9/9/2015
SystemCopy(Cloning)OracleDBAforSAPBasis
9.ToopenSAPsystem,usethefollowingcommands.
#su<targetsid>adm
#startsap
10.AsyourHardwareKeyisnotchanged,youdon'thavetogetadditionalLicenseKeyfrom
SAPNET.Youcanuseprevioussystems(ontargetsystem,ifSIDisnotchanged)Licenseinnew
systemcreatedontargetsystem.
11.LogontotheSAPR/3SystemandgotoTCODESE06.Select"DatabaseCopyorMigration"and
execute"PostInstallationProcessing".
ChangealloftheSourceSystemObjectstoTargetSystemObjectsasasked.
12.DeleteoldTMSconfigurationandmakenewconfigurationforTMSviaSTMSTCODE.
13.Afterallofabovesteps,youhavecompletedaSystemCopyusingOnline/OfflineDatabase
Backup.
Copyright2014
CreateaFreeWebsite
http://oracledbaforsapbasis.webs.com/systemcopycloning.htm
17/17