Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
1)
Modified: 22May2015
Type: HOWTO
ToBottom
InthisDocument
Goal
Solution
DuplicatedatabasefromserverAtoserverB(NonASM)
1.Backupoftheprimarydatabase.
2.Determinehowmuchdiskspacewillberequired.
3.Ensuringyouhaveenoughspaceonyourtargetserver.
4.Makingthebackupavailablefortheduplicateprocess.
5.Creatingtheinit.ora&administrationdirectoriesfortheduplicatedatabase.
6.EnsuringSQL*NETconnectionstoprimarydatabaseandRMANcatalogareworking.
7.PrepareRMANduplicatescript.
8.ExecutetheRMANscript.
References
APPLIESTO:
OracleDatabaseEnterpriseEditionVersion9.0.1.4to11.2.0.0[Release9.0.1to11.2]
Informationinthisdocumentappliestoanyplatform.
***Checkedforrelevanceon06Aug2009***
***Checkedforrelevanceon01Feb2011***
***Checkedforrelevanceon21May2015***
GOAL
Thefollowingnotewillguideauserincreatingaduplicatedatabaseonanewhost(nonASM).Thescenariorefersto
arecoverycataloghoweveracatalogisnotmandatory.Thefollowingexamplehasbeencompletedonalinux
operatingsystem.
Thenoteisapplicablefor9i,10gand11g.However11ghasnewfeaturesoftheduplicatecommand,seefurther
detailsinthefollowingarticles:
Note452868.1RMAN'DuplicateFromActiveDatabase'Featurein11G
Note1375864.1PerformBackupBasedRMANDuplicateWithoutConnectingtoaTargetDatabaseforBothDisk&
TapeBackups(availablein11.2andbeyond)
SOLUTION
DuplicatedatabasefromserverAtoserverB(NonASM)
Assumeddatabasenames:
PrimaryDatabaseSID:PROD
DuplicateDatabaseSID:AUX
RMANCatalogSID:RMAN
================================================================================
Steps
1.Backuptheprimarydatabase.
2.Determinehowmuchdiskspacewillberequired.
3.Ensuringyouhaveenoughspaceonyourtargetserver.
4.Makingthebackupavailablefortheduplicateprocess.
5.Creatingtheinit.ora&administrationdirectoriesfortheduplicatedatabase.
6.EnsuringSQL*NETconnectionstoprimarydatabaseandRMANcatalogareworking.
7.PrepareRMANduplicatescript.
8.ExecutetheRMANscript.
================================================================================
1.Backupoftheprimarydatabase.
HostA(Target)
Priortocreatingaduplicatedatabaseyoumusthaveabackupofthetargetdatabase.Inthisexampleweassumethe
backupmediaisdisk.FindappropriatediskspaceonhostAandtakeafullbackupincludingarchivelogsandcurrent
controlfile(Figure1a).Ifyouareplanningtoduplicateasubsetofthedatabasereferto(Figure1b)thisillustratesthe
RMANcommandtobackingupcertaintablespaces.
[oracle@linux]exportORACLE_SID=PROD
[oracle@linux]rmantarget=/catalog=rman/rman@RMAN
RMAN>run{
allocatechanneld1typedisk
backupformat'/backups/PROD/df_t%t_s%s_p%p'database
sql'altersystemarchivelogcurrent'
backupformat'/backups/PROD/al_t%t_s%s_p%p'archivelogall
releasechanneld1
}
Figure1aThiscommandwillperformafulldatabasebackupincludingarchivelogsandthecurrentcontrolfile.
[oracle@linux]exportORACLE_SID=PROD
[oracle@linux]rmantarget=/catalog=rman/rman@RMAN
RMAN>run{
allocatechanneld1typedisk
backupformat'/backups/PROD/df_t%t_s%s_p%p'
tablespaceSYSTEM,SYSAUX,UNDO,USERS
sql'altersystemarchivelogcurrent'
backupformat'/backups/PROD/al_t%t_s%s_p%p'archivelogall
releasechanneld1
}
Figure1bThiscommandwillperformatablespacebackup(SYSTEM,SYSAUX,UNDO&USERS)includingarchive
logsandthecurrentcontrolfile.Thiswouldbeusedifrmanisduplicatingasubsetofthedatabase.
2.Determinehowmuchdiskspacewillberequired.
2.Determinehowmuchdiskspacewillberequired.
HostA(Target)
Afterdecidingwhatyouwillbeduplicating,calculatetheentirespacethiswillrequireonthenewhost.Thefull
databasecalculation(Figure2a)willcalculatetheentirespacerequiredwhereas(figure2b)allowsyoutoenterthe
tablespacenamesinordertocalculatethespacerequired.Figure2cprovidesasampleoutput.
Note:sqlvalidforversion10gonly.
SQL>selectDF.TOTAL/1048576"DataFileSizeMb",
LOG.TOTAL/1048576"RedoLogSizeMb",
CONTROL.TOTAL/1048576"ControlFileSizeMb",
(DF.TOTAL+LOG.TOTAL+CONTROL.TOTAL)/1048576"TotalSizeMb"
fromdual,
(selectsum(a.bytes)TOTALfromdba_data_filesa)DF,
(selectsum(b.bytes)TOTALfromv$logb)LOG,
(selectsum((cffsz+1)*cfbsz)TOTALfromx$kcccfc)CONTROL
Figure2aCalculatetotalspaceforalldatafileswithindatabase.
SQL>selectDF.TOTAL/1048576"DataFileSizeMb",
LOG.TOTAL/1048576"RedoLogSizeMb",
CONTROL.TOTAL/1048576"ControlFileSizeMb",
(DF.TOTAL+LOG.TOTAL+CONTROL.TOTAL)/1048576"TotalSizeMb"fromdual,
(selectsum(a.bytes)TOTALfromdba_data_filesa
wheretablespace_namein('SYSTEM','UNDOTBS1','SYSAUX','USERS'))DF,
(selectsum(b.bytes)TOTALfromv$logb)LOG,
(selectsum((cffsz+1)*cfbsz)TOTALfromx$kcccfc)CONTROL
Figure2bIfduplicatingasubsetofthedatabase,calculatespaceforlistoftablespaceswithinprimarydatabase.
DataFileSizeMbRedoLogSizeMbControlFileSizeMbTotalSizeMb
90015020.343751070.34375
Figure2cSampleoutputofspacecalculation.
3.Ensuringyouhaveenoughspaceonyourtargetserver.
HostB(Aux)
Priortostartingtheduplicateprocessyoumustensureyouhaveenoughdiskspacewithinfilesystemtoholdthe
database.
[oracle@linux]dfkh
FilesystemSizeUsedAvailUse%Mountedon
/dev/vg01/root9.9G2.8G6.6G30%/
/dev/sda1145M16M122M12%/boot
none999M0999M0%/dev/shm
/dev/vg01/tmp2.0G383M1.5G20%/tmp
/dev/vg01/u0120G12G7.0G62%/u01
/dev/vg01/u024.9G1010M3.6G22%/u02
/dev/vg01/backups5.9G1.2G4.4G22%/backups
/dev/vg01/oradata15G13G2.0G87%/oradata
Figure3aSampleoutputshowingthespaceavailableonyourfilesystem.
Comparetheresultsreceivedfromthisquerywiththeoutputfrom2aor2bandensureyouhaveenoughdiskspace
foryourduplicatedatabase.
4.Makingthebackupavailablefortheduplicateprocess.
IfyourbackupresidesondiskyouwillneedtocopythisbackupfromhostAtohostB.Ensureyouplaceitinthesame
directoryaswhereitwascreated.Intheexamplebelow(figure4a)thebackuppieceresidesin
/backups/PROD
thesefilesneedtobecopiedintothesamedirectoryonhostB.
Furthermorealsoensurethanallarchivelogbackupshavealsobeenmovedandanyarchivelogsinthearchivelog
directorythatmayberequirefortherecovery.Thearchivelogsrequiredwilldependonthepointintimeofthe
recovery.
RMAN>listbackup
BSKeyTypeLVSizeDeviceTypeElapsedTimeCompletionTime
22Full529MDISK00:00:512006/05/1611:12:54
BPKey:22Status:AVAILABLECompressed:NOTag:TAG20060516T111203
PieceName:/backups/PROD/df_t590584323_s23_p1
ListofDatafilesinbackupset22
FileLVTypeCkpSCNCkpTimeName
1Full13938452006/05/1611:12:03/oradata/PROD/system01.dbf
2Full13938452006/05/1611:12:03/oradata/PROD/undotbs01.dbf
3Full13938452006/05/1611:12:03/oradata/PROD/sysaux01.dbf
4Full13938452006/05/1611:12:03/oradata/PROD/users01.dbf
BSKeySizeDeviceTypeElapsedTimeCompletionTime
2448MDISK00:00:062006/05/1611:13:07
BPKey:24Status:AVAILABLECompressed:NOTag:TAG20060516T111301
PieceName:/backups/PROD/al_t590584381_s25_p1
ListofArchivedLogsinbackupset24
ThrdSeqLowSCNLowTimeNextSCNNextTime
17813447502006/05/1504:55:3413532082006/05/1510:00:19
17913532082006/05/1510:00:1913532132006/05/1510:00:20
18013532132006/05/1510:00:2013715642006/05/1522:00:11
18113715642006/05/1522:00:1113732912006/05/1522:00:59
18213732912006/05/1522:00:5913810662006/05/1603:00:05
18313810662006/05/1603:00:0513906852006/05/1609:03:00
18413906852006/05/1609:03:0013938702006/05/1611:13:00
18513938702006/05/1611:13:0013939292006/05/1611:13:00
Figure4aAlistbackupshowingthebackuppiecesthatneedtobecopiedacrossHostB
5.Creatingtheinit.ora&administrationdirectoriesfortheduplicatedatabase.
HostB(AUX)
Createthepfile[initAUX.ora]parameterfileinthe$ORACLE_HOME/dbsdirectoryfortheauxiliarydatabase.An
exampleisshownbelow(figure5a)withbareminimumsettings.Noteyoumayrequiretosetparameterswhichare
thesameasyourproductiondatabase(refertoyouprimaryinit.ora)
ARACTARGETdatabasecanbeduplicatedaswellusingthesameprocedureasoutlined.RMANwillonlycreate
theauxiliarydatabaseasasingleinstance.TheauxiliarydatabasecanthenbeconvertedtoRACafterafterthe
duplicatehassucceeded.
NOTE:IfthetargetdatabaseisRACandasubsetofthedatabasewillbeduplicated,ALLundotablespacesofthe
targetmustbeincludedintheauxiliary.
#++
#|FILE:initAUX.ora|
#|DATABASENAME:AUX|
#++
#SetthebelowtolocationofthecloneDuplicatedatabase/nameof
#clonedatabase.
audit_file_dest=/oradata/AUX/adump
background_dump_dest=/oradata/AUX/bdump
core_dump_dest=/oradata/AUX/cdump
user_dump_dest=/oradata/AUX/udump
db_name="AUX"
instance_name=AUX
cluster_database=false(incasetheproductionisaracenvironment)
#Setthebelowtothelocationoftheduplicateclonecontrolfile.
control_files=
('/oradata/AUX/control01.ctl','/oradata/AUX/control02.ctl','/oradata/AUX/control03.ctl')
#Setthebelowforthefromandtolocationforalldatafiles/redo
#logstobecloned.
db_file_name_convert=("/oradata/PROD/","/oradata/AUX/")
log_file_name_convert=("/oradata/PROD/","/oradata/AUX/")
#Setthebelowtothesameastheproductiontarget
undo_management=AUTO
undo_retention=10800
undo_tablespace=UNDOTBS1
db_block_size=8192
compatible=10.2.0.1.0
Figure5aSampleinitAUX.orawithminimalsettings
FollowingthecreationoftheinitAUX.orastartupnomounttheauxiliaryinstance.
[oracle@linux]exportORACLE_SID=AUX
[oracle@linux]sqlplus'/assysdba'
SQLPLUS>startupnomount
Figure5bstartupnomounttheAUXinstance.
6.EnsuringSQL*NETconnectionstoprimarydatabaseandRMANcatalogareworking.
HostB(AUX)
Ensuretheproductiontargetdatabaseisopenoratleastmounted.Ifusingacatalogdatabasethismustalsobeopen.
TestyourSQL*NETconnections:FromHostByoumustbeabletoconnecttotheprimaryDBassysdbaandmakean
rmanconnectiontoRMAN.Performabasictestusingsqlplus.Whenyouhavesuccessfullyconnectedexitsqlplusand
moveontothenextstep.
[oracle@linux]%sqlplus'sys/oracle@PRODassysdba'
[oracle@linux]%sqlplusrman/rman@RMAN(notmandatory)
Figure6aSQL*NETconnections
7.PrepareRMANduplicatescript.
InaworkingdirectoryonHostBcreateanRMANscriptfileduplicate.rcv.
Theexamplesbelow
(Figure7a)showsthecommandforacompleteduplicate
(Figure7b)skipsthetablespaceswhicharenotrequiredintheduplicateand
(Figure7c)providethesyntaxrequiredforapointintimeduplicate.
run{
allocateauxiliarychannelC1devicetypedisk
duplicatetargetdatabasetoAUX
}
Figure7aSampleduplicatecommand.
run{
allocateauxiliarychannelC1devicetypedisk
duplicatetargetdatabasetoAUXskiptablespaceABC,XYZ
}
Figure7bSampleduplicatescriptomittingoptionaltablespaces
run{
setuntiltime"to_date('Jan01200012:00:00','MonDDYYYYHH24:MI:SS')"
allocateauxiliarychannelC1devicetypedisk
duplicatetargetdatabasetoAUX
}
Figure7cSampleduplicatescripttoapointintime.
8.ExecutetheRMANscript.
StartRMAN,connecttotheproductiontarget,thecataloginstanceandalsotheauxiliaryclone.RuntheRMAN
duplicatescriptasshownbelow.BeforedoingthisensurethattheOracleSIDenvironmentvariableissettothe
duplicateclonedatabase.
[oracle@linux]exportORACLE_SID=AUX
[oracle@linux]rmantargetsys/sys@PRODcatalogrman/rman@rmanauxiliary/
RMAN>@duplicate.rcv
Figure8aExecutetheRMANduplicatescript.
REFERENCES
NOTE:452868.1RMAN'DuplicateFromActiveDatabase'Featurein11G
NOTE:1375864.1PerformBackupBasedRMANDUPLICATEWithoutConnectingToTargetDatabaseForBothDisk&
TapeBackups
Didn'tfindwhatyouarelookingfor?
AskinCommunity...
Related
Products
OracleDatabaseProducts>OracleDatabaseSuite>OracleDatabase>OracleDatabaseEnterpriseEdition>Recovery
Manager>Duplicatingexistingdatabases
Keywords
AUXILIARY DUPLICATEDATABASE
BacktoTop