r12 upgrade document
DESCRIPTION
Oracle R12 Upgrade documentTRANSCRIPT
1
Hand-On-Lab November24,2015
OracleDatabase12c-Upgrade,Migration&Consolidation
RoySwongerSeniorDirectorandProductManagerST–DatabaseUtilitiesORACLECorporation
MikeDietrichSeniorPrincipalTechnologistST–UpgradeDevelopmentGroupORACLECorporation
The4partsoftheLab:
1. UpgradeanOracle11.2.0.4database(SID:UPGR)toOracle12.1.0.22. PlugintheupgradeUPGRdatabaseintoanexistingOracle12.1.0.2containerdatabase(SID:CDB2)3. MigrateanOracle11.2.0.4database(SID:FTEX)toOracle12.1.0.2usingFullTransportableExport/Importintoa
newpluggabledatabasePDB2
[optional]:
4. WorkwithMultitenantdatabasesandimplementnewOracleDatabase12cfeatures
Beforeyoucanstartyoumayhavetosetupafewthingsandmakeyourselffamiliarwiththeenvironment
2
SetupTasksKeyboardLayoutThedefaultkeyboardlayoutmaybeGermanorUSEnglish.Ifyouwouldlikeadifferentlayout,thenyoucanaddanotherkeyboardasfollows:
1. LogintotheLinuxdesktop(user/passwordareboth“oracle”)2. Ifyouwanttochangethekeyboard'slayout(defaultis:US)toGerman
pleasejustCLICKONCEonthetiny"US"symbolnexttotheclock:
3. Ifyou'dliketodomoregeneralchangespleaseentertheKDECONTROLCENTERbyCLICKingonthepenguinintheleftbottomcorner:
3
!!!IMPORTANT!!!THINGSTOKNOWANDUNDERSTAND!!!Allpasswordsaresetto: oracleSwitchenvironmentsforinstance: . cdb2(typeinonshellprompt:<dot><blank>cdb2)Thereisanenvironmentvariable$OH12definedforconvenience.Thispointstothe12.1.0.2OracleHome,andisusedseveraltimesinpart1ofthelab.Darkgraybackground,whitecharactersmean: Executeonthecommandprompt(OSshell)Lightgraybackground,blackcharactersmean: ExecuteinSQL*Plus
4
HOWTOCOPY/PASTEWITHTHEOKULARPDFVIEWER
ThisVMincludestheokularPDFreader,whichisavailableintheLinuxdistribution.Inordertocopy/pastewithokular,youneedtousethe“SelectTool.”IfyouhavetheseinstructionsopenwithintheVM,thenyoucanseetheselecttoolatthetopofthewindow.Itistheboxwiththedashedoutlineasshownhere:
OnceyouchoosetheSelectTool,thiswillbethedefaultunlessyouchangeit.Thenyoucanselectanareaandcopytheselectionastext.ChoosetheText->“CopytoClipboard”optionasinthisexamplefromthefirststepsinthelab:
5
IMPORTANT!!!SystemOverview-Thenumbersonthepicturedescribepart1-4oftheHands-On-Lab!!!
6
�
HOL–Part1–UpgradetheOracle11.2.0.4databaseUPGRtoOracleDatabase12.1.0.2
Databasefileslocation: /oradata/UPGRInitializationparameterandpasswordfilelocation: /u01/app/oracle/product/11.2.0/dbsListenerconfiguration: /u01/app/oracle/product/12.1.0.2/network/admin
TasksHOLPart1
YourtaskinHOLPart1willbeasimpleandstraightforwarddatabaseupgradetoOracleDatabase12c.Everythingisinstalledalready.YourOracleDatabase11gRelease2(11.2.0.4)database(SID:UPGR)isstartupalreadyandreadytogo.Nowfollowallstepsandupgradeit.
Youwillusethenewpre-upgradecheckscriptpreupgrd.sqlwhichwillexamineyourUPGRdatabase.ThisscriptisshippedwiththenewOracle12chomein/u01/app/oracle/product/12.1.0.2/rdbms/admin
YouwillthenprepareyourUPGRdatabasefortheupgradetoOracleDatabase12candupgradeit.Thedatabasewillstayinplaceanddoesn’tgetmovedtoanotherlocation.
Remarks:Forthishands-onlabwehaveprovidedeasycommandstoswitchenvironments!Youcanswitchbetweenenvironmentsonthebashshellprompttyping((don’ttype“$>“!!!)ineveryTerminal/xterm:
7
SID:UPGR–Oracle11.2.0.4home SID:UPGR–Oracle12.1.0.2home$> . upgr <dot> <space> upgr fortheOracle11.2.0.4environmentwithyourdatabasetobeupgraded(SID:UPGR)
$> . upgr12 <dot> <space> upgr12fortheOracle12cenvironmentwithyourdatabasetobeupgraded(SID:UPGR)
***STARTHERE***CommandLineUpgradefromOracle11.2.0.4toOracle12.1.0.2***
Inthissectionyou’llexecutethenewpreupgrd.sqlcheckscript,verifytheoutput,executesomecommandsandafixupscriptandprepareanewspfilefortheupgrade.Thenyou’llcopythespfileandthepasswordfiletothenewOracleDatabase12chome.
SID:UPGROracle11.2.0.4home
SID:UPGROracle12.1.0.2home
Executepre-upgradepreparationsteps
1. Openanxterm(Terminalicon)-(rightmouseclick è Konsole ...) . upgr sqlplus / as sysdba
2. Runthenewpreupgradecheckscriptpreupgrd.sql,inyour11.2.0.4environment–itwillgenerate3files:@$OH12/rdbms/admin/preupgrd.sql
3. Verifythepreupgrade.logandmakenecessarychangesOpena2ndxterm(rightmouseclick è Konsole ...):less /u01/app/oracle/cfgtoollogs/UPGR/preupgrade/preupgrade.log
8
The11.2.0.4databasehastheOLAPCatalog(AMD)componentinstalled,andthiscomponentisnolongerincludedinOracleDatabasestartingwithOracleDatabase12c.RemovetheOLAPCatalog(AMD)componentusingthescriptfromthe12.1.0.2OracleHome($OH12):@$OH12/olap/admin/catnoamd.sql commit; Thepreupgradelogincludesamessageaboutmovingauditdatafromsystem.aud$tosys.aud$becauseOracleLabelSecurityisinstalled.MovetheAUD$tablenowusingthe olspreupgrade.sqlscriptfromtheOracleDatabase12chomefromSYSTEMtoSYS:@$OH12/rdbms/admin/olspreupgrade.sqlPrepareyourspfileforthe12cupgradeaccordingtotheoutputfrompreupgrade.log:(Pleasenote:BestPracticewouldbetoedittheinit.orafortheupgrademanually.Youcoulddoso–thewayweproposehereisjustashortcutavoidingmanualeditsteps)create pfile from spfile; alter system set processes=300 scope=spfile; RaiseCOMPATIBILEfortheupgrade,sothatwecanusethisdatabaselaterinpart2ofthelab. alter system set COMPATIBLE='12.1.0' scope=spfile;
4. Gatherdictionarystatspriortotheupgrade:EXECUTE dbms_stats.gather_dictionary_stats;
5. Executethepreupgrade_fixups.sql –itwascreatedbypreupgrd.sqlindirectory/u01/app/oracle/cfgtoollogs/UPGR/preupgrade
9
Beawarethatthepreupgrade_fixups.sqlwilldisplaywarningsaboutthingsyoumayhavefixedalready.Pleaseignorethisasitisstaticinformationwhichgotcreatedduringtherunofpreupgrd.sqlanddoesnotgetupdatedwhenyoufixissuesbeingsignaled.ThisisaknownissueandwillbechangedinafuturereleaseofOracle.@/u01/app/oracle/cfgtoollogs/UPGR/preupgrade/preupgrade_fixups.sql Pleasenotethatthepreupgrade_fixups.sqlscriptwillstillcomplainaboutPROCESSESbeingsettoolow.ThisisbecausewehaveusedtheALTERSYSTEMcommandtoadjusttheparameter,butthatadjustmentwillnottakeeffectuntilthedatabaseisshutdownandrestarted.BecausewespecifiedSCOPE=SPFILE,thisparameterwillbesetcorrectlyfortheupgrade.
6. ShutdowntheUPGRdatabase:shutdown immediate exit
7. CopyyournewspfileandyourpasswordfileintotheOracle12chome’sdbs($OH12/dbs)directory: cp $ORACLE_HOME/dbs/spfileUPGR.ora $OH12/dbs/ cp $ORACLE_HOME/dbs/orapwUPGR $OH12/dbs/
10
SID:UPGROracle11.2.0.4home
SID:UPGROracle12.1.0.2home
ExecuteallparallelupgradestepsNowyou’llupgradeyourUPGRdatabasetoOracleDatabase12cusingthenewparallelupgradescripts.Furthermoreyou’llrecompileandcheckforinvalidobjectsbefore/aftertheupgrade.
1. Openanxterm(Terminalicon)-(rightmouseclick è Konsole ...) . upgr12 sqlplus / as sysdba
2. BringtheUPGRdatabaseintoUPGRADEmodestartup upgrade exit
3. UpgradetheUPGRdatabasewiththeparallelupgradescriptStartthenewparallelupgrade–itwillbedrivenbyaPERLscriptcatctl.ploutsideofSQL*Plusandexecutein4parallelthreads–inmaximumyoucouldrunwith8parallelthreadsbyspecifyingtheparameteroption-n 8 cd $ORACLE_HOME/rdbms/admin $ORACLE_HOME/perl/bin/perl catctl.pl catupgrd.sql Youwillnowseethatasmanyas73phaseswillbelisted–somecanactinparallel,otherrequireserialexecution.Thiswillnowtakeupto15-30minutesdependingonyoursystem.IfyouwonderabouttheRESTARTphases:thosehappeniftimingdependenciesmakeitnecessarytorerunacertainaction.Thelogfileswillbewrittenbydefaultintothedirectoryfromwhichyoustartedcatctl.pl,$ORACLE_HOME/rdbms/admin
11
Oncetheupgradeisfinisheditwillshutdownthedatabaseandinthenextphaseyou’llrestartitinnormalmode.
IFYOURMACHINEISWELLEQUIPPEDWITHRAM/CPUYOUMAYDOTASKSINPARALLELANDSTARTWITHPART3(FULLTRANSPORTABLEEXPORT).
GOTOPAGE15–HOLPART3
SID:UPGROracle11.2.0.4home
SID:UPGROracle12.1.0.2home
FinalizetheupgradewithallrequiredpostupgradestepsDuringthispartyou’llfinalizetheupgradewithrecompilation,postupgrade_fixups.sqlandthetimezoneadjustmenttoTZV18.Startupthedatabase–postupgradeitisshutdown:
1. Openanxterm(Terminalicon)-(rightmouseclick è Konsole ...) . upgr12 sqlplus / as sysdba
2. StartuptheUPGRdatabaseandrecompileeverything:startup @?/rdbms/admin/utlrp.sql
12
3. Executethepostupgrade_fixups.sql:@/u01/app/oracle/cfgtoollogs/UPGR/preupgrade/postupgrade_fixups.sql
4. AdjustTimeZonesettings–youmaylookintothescriptstakenfromMOSNote:1509653.1beforeexecutingthem:@/home/oracle/DST/DST_prepare.sql @/home/oracle/DST/DST_adjust.sql exit
***COMPLETED***TasksHOLPart1***
13
�
HOL–Part2–PluginUPGRintoCDB2,anOracleDatabase12.1.0.2containerdatabase
Databasefileslocation: /oradata/UPGRInitializationparameterandpasswordfilelocation: /u01/app/oracle/product/12.1.0.2/dbsListenerconfiguration: /u01/app/oracle/product/12.1.0.2/network/admin
TasksHOLPart2
OracleMultitenantOptionisawaytoconsolidateseveralindependentdatabasesintoonelargeContainerDatabase.TheCDB$ROOTistheadministrativelayerandcontainsabsolutelynouserorapplicationdata.ThePDBsthatarepluggedintotheCDBcontaintheuserandapplicationdata.WithOracleDatabase12cRelease1youcanhaveupto252PDBswithinoneCDB.
ApplicationsandclientswillconnecttothePDBjustastheywouldconnecttoanon-CDB.TheentireCDB/PDBsharesoneSGA,onesetofbackgroundprocesses,oneredologstream.
InHOLPart2youwillpluginthealreadyupgradedUPGRdatabaseasanewpluggabledatabasePDB1intothealreadyexistingContainerDatabaseCDB2.ThedatafilesofUPGRwillstayinplace.
SID:UPGR–Oracle12.1.0.2home SID:CDB2–Oracle12.1.0.2home$> . upgr12 <dot> <space> upgr12 fortheOracle12.1.0.2environmentwithyourdatabasetobepluggedinlater(SID:UPGR)
$> . cdb2 <dot> <space> cdb2fortheOracle12cenvironmentconnectingtotheContainerDatabase(SID:CDB2)
14
***STARTHERE***PluginUPGRintoCDB2***
InthissectionanXMLdescriptionfileforUPGRwillbecreatedandusedtoplugUPGRintoCDB2asnewPDB1.FinallysanityoperationswillhavetobedonetoassimilateUPGRfinallyasPDB2.
Pleasenote:There'snoALTERPLUGGABLEDATABASE…RECONVERTcommandavailable.Tomigrateadatabasebackintoastand-alonedatabaseeitherDataPump,TransportableTablespacesorsimilartechniqueswillneedtobeused.
SID:UPGROracle12.1.0.2home
SID:CDB2Oracle12.1.0.2home
PreparetheUPGRdatabaseforplugin
1. SwitchtotheUPGROracle12.1.0.2environment:
. upgr12 sqlplus / as sysdba
2. StarttheUPGRdatabaseinread-onlymode:
shutdown immediate startup open read only;
3. GeneratetheXMLdescriptionfile–thisfilewillcontaintheinformationdescribingthedatabase
structure.TocreateitthedatabaseUPGRhastobeinreadonlymode:
exec DBMS_PDB.DESCRIBE('/tmp/pdb1.xml');
4. Shutdownthedatabaseshutdown immediate exit
15
SID:UPGROracle12.1.0.2home
SID:CDB2Oracle12.1.0.2home
PreparetheUPGRdatabaseforplugin
1. SwitchtotheCDB2Oracle12.1.0.2environment:
. cdb2 sqlplus / as sysdba
2. StartuptheCDB2,aprecreatedOracle12c(12.1.0.2)ContainerDatabase:startup
3. Checkplugincompatibilityfirst:
SET SERVEROUTPUT ON DECLARE compatible CONSTANT VARCHAR2(3) := CASE DBMS_PDB.CHECK_PLUG_COMPATIBILITY( pdb_descr_file => '/tmp/pdb1.xml', pdb_name => 'PDB1') WHEN TRUE THEN 'YES' ELSE 'NO' END; BEGIN DBMS_OUTPUT.PUT_LINE(compatible); END; /
4. NowpluginthedatabasewithitsnewnamePDB1–fromthispointthere’snoUPGRdatabaseanymore.Inarealworldenvironmentyouwouldhaveabackuporuseabackup/copytoplugin.InourlabthedatabaseUPGRwillstayinplaceandbecomePDB1aspartofCDB2.PleaseusetheproposednamingastheTNSsetuphasbeendonealready.UsetheNOCOPYoptionforthislabtoavoidadditional2-3minutescopytime
16
create pluggable database PDB1 using '/tmp/pdb1.xml' nocopy tempfile reuse;
5. ConnecttothisnewPDB1andperformsanityoperations:alter session set container=PDB1; @?/rdbms/admin/noncdb_to_pdb.sql SanityoperationsrequiredinsidethePDBtoconnectthePDBwiththeCDBcorrectly.Thereforerunthescriptnoncdb_to_pdb.sql–thismaytakeaapprox10-20minutestocompleteduetorecompilations.Ifthescriptdidn'tgetexecutedthePDB1wouldopeninrestrictedmodeonly.
5. NowthedatabaseUPGRispluggedin–butnotopenyet.Itwillneedtobestarted.startup show pdbs exit
6. ToconnecttotheconsolidatedPDB1fromthecommandpromptthefollowingcommandsyntaxneedstobeused:sqlplus "sys/oracle@pdb1 as sysdba" AsanalternativeyoucouldusetheEZconnectsyntax: sqlplus "sys/oracle@//localhost:1521/pdb1 as sysdba"
***COMPLETED***TasksHOLPart2***
17
�
HOL–Part3–MigrateFTEXdatabasewithFullTransportableExport/ImportintoPDB2
Databasefileslocation: /oradata/FTEXPluggabledatabasefileslocation: /oradata/CDB2/pdb2Initializationparameterandpasswordfilelocation: /u01/app/oracle/product/11.2.0.4/dbsListenerconfiguration: /u01/app/oracle/product/12.1.0.2/network/admin
TasksHOLPart3
FullTransportableExport/ImportisanewOracleDatabase12cupgradeandmigrationfeaturecombiningthespeedofTransportableTablespaceswiththeease-of-useofDataPumptakingcareofallmetadataandnon-transportabledata.
YourtaskinHOLPart3willbetouseFullTransportableExport/ImporttomigratetheexistingOracle11.2.0.4databaseFTEXintoanewPDB2whichwillbelongtothecontainerdatabaseCDB2.Pleasestaywiththeproposednames(PDB2)astheTNSsetuphasbeensetupalreadytoallowconnectionsetc.
ThisfeatureworksindependentofOracleMultitenantandplatformandcanbeusedtomigratecrossEndiannessaswell.SourcedatabaseversionhastobeatleastOracle11.2.0.3,targetversionneedstobeatleastOracle12.1.0.1.Forcross-platformmigrationsRMANbackupswithCONVERToperationswillbenecessary.
SID:FTEX–Oracle11.2.0.4home SID:CDB2–Oracle12.1.0.2home$> . ftex <dot> <space> ftex fortheOracle11.2.0.4environmentwithyourdatabasetobepluggedinlater(SID:FTEX)
$> . cdb2 <dot> <space> cdb2fortheOracle12cenvironmentconnectingtotheContainerDatabase(SID:CDB2)
18
***STARTHERE***MigrateFTEXwithFullTransportableExport/ImportintoPDB2***
Thefirsttaskinthelabwillbetoprovideanemptydatabase–somethingwewoulddoforafullimportorfortransportabletablespacesaswell.Butinthisspecificcasewewanttoconsolidate,andthereforepre-createanemptyPDB2(aPluggableDatabase)insidethealreadyexistingCDB2(theContainerDatabase).
SID:FTEXOracle11.2.0.4home
SID:CDB2Oracle12.1.0.2home
ProvisionPDB2fromPDB$SEED:
1. SwitchtotheOracle12cCDB2environment:
. cdb2 sqlplus / as sysdba startup [ONLY ISSUE THIS COMMAND IF YOU ARE STILL RUNNING HOL PART1]
2. CreateanewpluggabledatabasePDB2:TheeasiestwaytocreateanemptyPDBistocloneitfromthetemplatePDBcalledPDB$SEEDwhichexistsineverycontainerdatabase.ThelocationtocreateitisdefinedbytheinitparameterPDB_FILE_NAME_CONVERT.ItisalreadysetinCDB2tohavethenewandemptyPDB2createdin/oradata/CDB2/pdb2directory.
CreateanemptyPDBbycloningthePDB$SEED:create pluggable database PDB2 admin user adm identified by adm file_name_convert=('/oradata/CDB2/pdbseed', '/oradata/CDB2/pdb2'); Thiswilltake1-2minutes.
19
StartthenewpluggabledatabasePDB2:alter session set container=pdb2; startup
3. CreateadirectoryobjectandadatabaselinkinsidethePDB2–youwillneedthisforthefulltransportoperation-thedirectory/oradata/CDB2/mydirhasbeenprecreatedaswellforDataPumpcreate directory mydir as '/oradata/CDB2/mydir'; grant read, write on directory mydir to system; create public database link SOURCEDB connect to system identified by oracle using 'FTEX'; exit
SID:FTEXOracle11.2.0.4home
SID:CDB2Oracle12.1.0.2home
PreparetheFTEXdatabasefortheFullTransportableExport/Import
InordertoruntheFullTransportableoperationwemustsetalldatatablespacesintoread-onlymode.Thisisthesameprocedurewewouldfollowforaregulartransportabletablespaceoperation.Oncethetablespaceisinread-onlymodewecancopythefile(s)tothetargetlocation
1. SwitchtotheOracle12cUPGRenvironment:
. ftex sqlplus / as sysdba
20
2. StarttheFTEXdatabaseandswitchdatatablespaces(here:USERS)intoread-onlymode:startup alter tablespace users read only; exit
3. Copythefilestothetargetlocation
cp /oradata/FTEX/users01.dbf /oradata/CDB2/pdb2
SID:FTEXOracle11.2.0.4home
SID:CDB2Oracle12.1.0.2home
DatamigrationviaFullTransportableExport/ImportfromFTEXintoPDB2
TheDataPumpimportwillberunthroughthedatabaselinkyoucreatedearlier–thusnoneedforanexportoradumpfile.DataPumpwilltakecareofeverything(currentlyexceptXDBandAWR)youneedfromthesystemtablepacesandmoveviews,synonyms,triggeretcovertothetargetdatabase(inourcase:PDB2).
1. SwitchtotheOracle12cCDB2environment:
. cdb2
2. ExecutetheFullTransportableExport/ImportwithDataPump impdp system/oracle@pdb2 network_link=sourcedb version=12 full=y \ transportable=always metrics=y exclude=statistics directory=mydir \ logfile=pdb2.log \ transport_datafiles='/oradata/CDB2/pdb2/users01.dbf'
21
Incasecopy&pastedoesnotworkwehavepreparedaparfilein/home/oracle/IMP.ThePDB2isopenandreadytouseaftertheTransportmigrationhascompleted:sqlplus "system/oracle@PDB2"
***COMPLETED***TasksHOLPart3***
22
�[optional]HOL–Part4–CreatePDB3inOracle12.1.0.1andupgradeviaplugout/intoOracle12.1.0.2
Databasefileslocation: /oradata/CDB1/pdb3Pluggabledatabasefileslocation: /oradata/CDB2/pdb3Initializationparameterandpasswordfilelocation: /u01/app/oracle/product/12.1.0.1/dbsListenerconfiguration: /u01/app/oracle/product/12.1.0.2/network/admin
TasksHOLPart4
OnetechniquetoupgradepluggabledatabasesinaMultitenantenvironmentisunplug-plugin.Thisapproachgivesalotofcontroloverapluggabledatabaseupgradebutrequiresmanualsteps,similartothecommandlineupgrade.
InthispartoftheHOLanewPDBwillbecreatedinanOracle12.1.0.1CDB1andupgradedviaunplug/pluginintotheOracle12.1.0.2CDB2.
SID:CDB1–Oracle12.1.0.1home SID:CDB2–Oracle12.1.0.2home$> . cdb1 <dot> <space> cdb1 fortheOracle12.1.0.1environmentwithyourdatabasetobepluggedinlater(SID:CDB1)
$> . cdb2 <dot> <space> cdb2fortheOracle12cenvironmentconnectingtotheContainerDatabase(SID:CDB2)
23
***STARTHERE***CreatePDB3,upgradeittoOracle12.1.0.2viaplugout/in***
Thefirsttaskinthelabwillbetoprovideanemptydatabase–somethingwewoulddoforafullimportorfortransportabletablespacesaswell.Butinthisspecificcasewewanttoconsolidate,andthereforepre-createanemptyPDB2(aPluggableDatabase)insidethealreadyexistingCDB2(theContainerDatabase).
SID:CDB1èPDB3Oracle12.1.0.1home
SID:CDB2èPDB3Oracle12.1.0.2home
CreateanewpluggabledatabasePDB3:
1. SwitchtotheOracle12.1.0.1CDB1environment:. cdb1 sqlplus / as sysdba
2. StarttheCDB1containerdatabase–ithasnoPDBsyet(exceptforPDB$SEED):
startup
3. CreateanewpluggabledatabasePDB3andstartit:create pluggable database PDB3 admin user adm identified by adm file_name_convert=('/oradata/CDB1/pdbseed', '/oradata/CDB1/pdb3'); Thiswilltake1-2minutes.alter session set container=pdb3; startup
4. Executethepreupgradecheckscript@/u01/app/oracle/product/12.1.0.2/rdbms/admin/preupgrd.sql
24
4. Verifythepreupgrade.logandmakenecessarychangesOpena2ndxterm(rightmouseclick è Konsole ...):less /u01/app/oracle/cfgtoollogs/CDB1/preupgrade/preupgrade.log
5. Gatherdictionarystatspriortotheupgrade:EXECUTE dbms_stats.gather_dictionary_stats;
6. Executethepreupgrade_fixups.sql –itgotcreatedbypreupgrd.sqlrunindirectory/u01/app/oracle/cfgtoollogs/CDB1/preupgrade@/u01/app/oracle/cfgtoollogs/CDB1/preupgrade/preupgrade_fixups.sql
7. SwitchtotheCDB$ROOTlayer,closethepluggabledatabasePDB3andunplugitalter session set container=CDB$ROOT; alter pluggable database PDB3 close; alter pluggable database PDB3 unplug into '/tmp/pdb3.xml';drop pluggable database PDB3 keep datafiles; shutdown immediate exit
SID:CDB1èPDB3Oracle12.1.0.1home
SID:CDB2èPDB3Oracle12.1.0.2home
PluginthePDB3intoCDB2andupgradeittoOracle12.1.0.2:
1. SwitchtotheOracle12.1.0.2CDB2environment:
. cdb2
25
sqlplus / as sysdba
2. ExecutethePlugInCheckandcheckPDB_PLUG_IN_VIOLATIONSwhentheresultoftheplugincheckis"NO":SET SERVEROUTPUT ON
DECLARE compatible CONSTANT VARCHAR2(3) := CASE DBMS_PDB.CHECK_PLUG_COMPATIBILITY( pdb_descr_file => '/tmp/pdb3.xml', pdb_name => 'PDB3') WHEN TRUE THEN 'YES' ELSE 'NO' END; BEGIN DBMS_OUTPUT.PUT_LINE(compatible); END; / select message, status from pdb_plug_in_violations where type like '%ERR%';
3. PluginthePDB3intoCDB2create pluggable database pdb3 using '/tmp/pdb3.xml' file_name_convert=( '/oradata/CDB1/pdb3', '/oradata/CDB2/pdb3');
4. OpenPDB3inUPGRADEmodeandupgradeitalter pluggable database PDB3 open upgrade; exit cd $ORACLE_HOME/rdbms/admin $ORACLE_HOME/perl/bin/perl catctl.pl -c 'PDB3' catupgrd.sql
26
5. Recompileafterupgradesqlplus / as sysdba alter session set container=PDB3; startup @?/rdbms/admin/utlrp.sql show pdbs exit
NN SID:CDB2èPDB3Oracle12.1.0.2home
FinallyafewCDB/PDBexercisesFirsttestwillintroduceyoutothenewCDBviews.Thereforewecreateasimpletableandcheckitsvisibilitywithinthedictionaryviews
1. ConnectdirectlytoPDB1intheOracle12.1.0.2environment:
. cdb2 sqlplus "sys/oracle@//localhost:1521/pdb1 as sysdba"
2. Createatableandinsertdata:create table HOL (col1 number); insert into HOL values (1); commit;
3. ConnectdirectlytoPDB2:
27
alter session set container=PDB2;4. Createatableandinsertdata:
create table HOL (col1 number); insert into HOL values (2); commit;
5. ConnectdirectlytoPDB3:alter session set container=PDB3;
6. Createatableandinsertdata:
create table HOL (col1 number); insert into HOL values (2); commit;
7. ConnectdirectlytoCDB$ROOT:alter session set container=cdb$root;
8. QuerythedatafromtheCDB_Views:
select CON_ID, SUBSTR(TABLE_NAME,1,10) TNAME from CDB_TABLES WHERE TABLE_NAME='HOL'; You'llseethateachtableHOLwithinacertainPDBisvisibletotheCDB$ROOT.Butifyou'drepeattheexercisewithineachofthePDBsyou'llseejustthecontentsonaPDBlevel.RecognizetheCON_IDwhichrepresentswhereanobjectexists.
***COMPLETED***TasksHOLPart4***
28
ThankyourforcompletingourUpgrade,Migrate&ConsolidatetoOracleDatabase12cHands-On-Lab.
Ifyouhavefurtherquestionsyoumaypleasedownloadthe+500slidedeckcontainingalmosteverythingaboutupgradesandmigrations.Andalwaysfeelfreetocontactusdirectly.
http://blogs.oracle.com/UPGRADE
Thanksandsuccessfulupgrades!
RoySwonger&MikeDietrich&TheDatabaseUpgradeTeam