Oracle RAC, Data Guard, and Pluggable Databases: When MAA Meets Multitenant (#OOW14 Version)
Cloning Pluggable Databases
-
Upload
dev-fitriady -
Category
Documents
-
view
217 -
download
0
description
Transcript of Cloning Pluggable Databases
-
25/9/2015 CloningPluggableDatabases
http://www.oracle.com/webfolder/technetwork/tutorials/obe/db/12c/r1/pdb/pdb_clone/pdb_clone.html 1/3
Purpose
Thistutorialcoversthestepsrequiredtocloneapluggabledatabase(PDB)fromacontainerdatabase(CDB)intothesameCDB.
TimetoComplete
Approximately15minutes
Introduction
YoucancopyasourcePDBfromaCDBandplugthecopyintothesameCDBorintoanotherCDB.Thiscapabilityissuitableforthefollowingsituations:
YouwanttotesttheapplicationpatchofyourproductionPDB.YoufirstcloneyourproductionapplicationinaclonedPDB,patchtheclonedPDB,andtestit.Youwanttodiagnoseperformanceissuesorperformperformanceregressiontestsonyourapplication.Becauseyoucannotperformthisoperationinparallelwiththeproductioninthesamedatabase,youclonethePDBintoanotherCDB.
Scenario
Inthistutorial,youwilluseSQL*PlustoperformaPDBcloningoperationwithinthesameCDB.Note:IfyouwanttocloneaPDBfromaCDBintoanotherCDB,youidentifythesourceCDBbycreatingadatabaselinktoitfromtheCDBinwhichyouwanttocreatetheclone.
Prerequisites
Beforestartingthistutorial,youshould:
EnsurethatyouhaveenoughdiskspacetoholdacompletecloneofthePDB.InstallOracleDatabase12c.CreateoneCDBwithonePDBinit.
Theenvironmentusedinthedevelopmentofthistutorialisasfollows:
ORACLE_HOME:/u01/app/oracle/product/12.1.0TNSListenerport:1521Containerdatabases:
SID:cdb1SID:cdb2
Pluggabledatabases(incdb1):pdb1pdb2
Inthissection,youpreparethesourcePDBtobeclonedandthetargetnewPDBtobecreated.
SettingtheSourcePDBtoREADONLYMode
1. UseSQL*PlustoclosethePDBthatyouwanttoclone.
.oraenv
[entercdb1attheprompt]
sqlplus/assysdba
alterpluggabledatabasepdb1closeimmediate
2.OpenthePDBthatyouwanttocloneinREADONLYmode.
alterpluggabledatabasepdb1openreadonly
exit
CreatingaDirectoryfortheNewClonePDB
Overview
PreparingtheSourcePDBtoClone
CloningPluggableDatabases
-
25/9/2015 CloningPluggableDatabases
http://www.oracle.com/webfolder/technetwork/tutorials/obe/db/12c/r1/pdb/pdb_clone/pdb_clone.html 2/3
1. Navigateto/stageorwhereveryoucanfindenoughavailablespacetostorethedatafilesforpdb1_clone.
cd/stage
2. Createasubdirectorycalledpdb1_cloneunder/stage.Note:Youmayneedtologinasroottocreatethesubdirectory,andthenchangetheownertooracleandthegrouptooinstall.
mkdirpdb1_clone
ConfiguringOMFtotheDirectoryoftheClonePDB
1. UseSQL*Plustoconnectassysdbaandsetthefollowingparameter:
sqlplus/assysdbaaltersystemsetdb_create_file_dest='/stage/pdb1_clone'
UseSQL*PlustoclonethePDBwithinthesameCDB.
1. Executethefollowingstatement:
createpluggabledatabasepdb1_clonefrompdb1
2.Openthenewpdb.
alterpluggabledatabasepdb1_cloneopen
3. Connecttothenewpdb.
connectsystem/oracle@localhost:1521/pdb1_clone
4. VerifythatyouareconnectedtothenewPDB:
showcon_name
1. ConnecttotherootintheCDB.
connect/assysdba
altersessionsetcontainer=cdb$root
2. Executethefollowingstatement:
alterpluggabledatabasepdb1closeimmediate
3.Openthesourcepdb.
alterpluggabledatabasepdb1open
CloningthePDBWithintheCDB
SettingtheSourcePDBBacktoOpenMode
-
25/9/2015 CloningPluggableDatabases
http://www.oracle.com/webfolder/technetwork/tutorials/obe/db/12c/r1/pdb/pdb_clone/pdb_clone.html 3/3
PerformthefollowingstepstoresetyourenvironmentpriortorepeatingtheactivitiescoveredinthisOBEorstartinganotherOBE.
1. ClosetheclonePDB.
alterpluggabledatabasepdb1_clonecloseimmediate
2. DeletetheclonePDBanditsdatafiles.
droppluggabledatabasepdb1_cloneincludingdatafiles
Inthistutorial,youlearnedhowto:
PrepareanexistingPDBtobeclonedwithinthesameCDBClonethePDB
Resources
Tolearnmoreaboutpluggabledatabases,refertoadditionalOBEsintheOracleLearningLibrary
Credits
CurriculumDevelopers:DominiqueJeunot,JeanFrancoisVerrier
ResettingYourEnvironment
Summary