Shutdown the 12c Release 2 CDB and PDBs
[oracle@host02 bin]$ sqlplus sys as sysdba Connected to: Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production SQL> show pdbs CON_ID CON_NAME OPEN MODE RESTRICTED ---------- ------------------------------ ---------- ---------- 2 PDB$SEED READ ONLY NO 3 PDB1 READ WRITE NO 4 PDB2 READ WRITE NO SQL> alter pluggable database all close immediate; Pluggable database altered. SQL> shutdown immediate; Database closed. Database dismounted. ORACLE instance shut down.
Start the CDB and PDBs in UPGRADE mode from the Oracle 18c environment
[oracle@host02 dbs]$ cp /u03/app/oracle/product/12.2.0/dbhome_1/dbs/spfilecdb1.ora /u02/app/oracle/dbs/ [oracle@host02 dbs]$ sqlplus sys as sysdba SQL*Plus: Release 18.0.0.0.0 - Production on Sun Dec 9 15:12:05 2018 Version 18.3.0.0.0 Connected to an idle instance. SQL> startup upgrade ORACLE instance started. Total System Global Area 838857584 bytes Fixed Size 8901488 bytes Variable Size 322961408 bytes Database Buffers 503316480 bytes Redo Buffers 3678208 bytes Database mounted. Database opened. SQL> alter pluggable database all open upgrade; Pluggable database altered. SQL> show pdbs CON_ID CON_NAME OPEN MODE RESTRICTED ---------- ------------------------------ ---------- ---------- 2 PDB$SEED MIGRATE YES 3 PDB1 MIGRATE YES 4 PDB2 MIGRATE YES
Create the Priority List file. The requirement is for PDB2 database to be upgraded before other PDBs.
[oracle@host02 dbs]$ cat /tmp/priority_list 1,PDB2 2,PDB1
Verify the upgrade parameter settings using the dbupgrade Emulation flag -E
[oracle@host02 dbs]$ dbupgrade -E -L /tmp/priority_list
Verify the priority order for the upgrade by viewing the contents of the catctl_priority_run.lst file
[oracle@host02 dbs]$ cat /u02/app/oracle/homes/OraDB18Home1/cfgtoollogs/cdb1/upgrade20181209152557/catctl_priority_run.lst 0,CDB$ROOT ------------------------------------------------------ 1,PDB$SEED ------------------------------------------------------ 1,PDB2 ------------------------------------------------------ 2,PDB1 ------------------------------------------------------
Note – the default location of the upgrade log files is $ORACLE_BASE/cfgtoollogs/dbname/upgradedatetime directory. This can be overrided via the -l flag in the dbupgrade command.
Note whether the PDBs will be upgraded in parallel or not and also the number of SQL processes which will be used for loading the data dictionary
PDB Parallel SQL Process Count = [2] is higher or equal to CPU Count = [1] Concurrent PDB Upgrades defaulting to CPU Count [1] Parallel SQL Process Count (PDB) = 2 Parallel SQL Process Count (CDB$ROOT) = 4 Concurrent PDB Upgrades = 1
Execute the upgrade via the dbupgrade command with the -L flag pointing to the location of the Priority List file
[oracle@host02 dbs]$ dbupgrade -L /tmp/priority_list
The dbupgrade is a wrapper script for catctl.pl – note Perl is being used to call the catctl.pl script located in the 18c $ORACLE_HOME/rdbms/admin directory location
oracle 25478 1 0 17:15 pts/0 00:00:08 /u02/app/oracle/product/18.0.0/dbhome_1/perl/bin/perl -I/u02/app/oracle/product/18.0.0/dbhome_1/perl/lib /u02/app/oracle/product/18.0.0/dbhome_1/rdbms/admin/catctl.pl -L /tmp/priority_list /u02/app/oracle/product/18.0.0/dbhome_1/rdbms/admin/catupgrd.sql
While the upgrade is in progress, we will shutdown the CDB to simulate a failure in the database upgrade process
[oracle@host02 upgrade20181209151821]$ sqlplus sys as sysdba SQL*Plus: Release 18.0.0.0.0 - Production on Sun Dec 9 17:29:40 2018 Version 18.3.0.0.0 SQL> shutdown abort ORACLE instance shut down. SQL>
Note the catupgrd0.log will start showing error messages ….
17:31:58 SQL> GRANT execute ON sys.dbms_gsm_fixed TO ggsys; GRANT execute ON sys.dbms_gsm_fixed TO ggsys * ERROR at line 1: ORA-01034: ORACLE not available Process ID: 0 Session ID: 0 Serial number: 0 Elapsed: 00:00:00.00 17:31:58 SQL> GRANT execute ON sys.dbms_network_acl_admin TO ggsys; GRANT execute ON sys.dbms_network_acl_admin TO ggsys * ERROR at line 1: ORA-01034: ORACLE not available Process ID: 0 Session ID: 0 Serial number: 0
Restart the CDB and PDBs in UPGRADE mode
SQL> startup upgrade ORACLE instance started. Total System Global Area 838857584 bytes Fixed Size 8901488 bytes Variable Size 322961408 bytes Database Buffers 503316480 bytes Redo Buffers 3678208 bytes Database mounted. Database opened. SQL> alter pluggable database all open upgrade; Pluggable database altered. SQL> show pdbs CON_ID CON_NAME OPEN MODE RESTRICTED ---------- ------------------------------ ---------- ---------- 2 PDB$SEED MIGRATE YES 3 PDB1 MIGRATE YES 4 PDB2 MIGRATE YES SQL>
Run the dbupgrade command using the -R flag
[oracle@host02 dbs]$ dbupgrade -L /tmp/priority_list -R
The catupgrd0.log will indicate the restart of the upgrade process and we can see that earlier upgrade phases which had been completed before the failure are not being executed again
*******Upgrade being restarted on database CDB$ROOT from failed phase 23******* ------------------------------------------------------ Phases [23-108] Start Time:[2018_12_09 18:11:20] Container Lists Inclusion:[CDB$ROOT] Exclusion:[NONE] ------------------------------------------------------ Time: 5s Parallel Phase #:23 [CDB$ROOT] Files:24
After the CDB and the Seed PDB upgrade is completed, the individual PDB upgrades will commence. PDB2 is being upgraded first as per the priority specified.
SQL> show pdbs CON_ID CON_NAME OPEN MODE RESTRICTED ---------- ------------------------------ ---------- ---------- 2 PDB$SEED READ ONLY NO 3 PDB1 MIGRATE YES 4 PDB2 MIGRATE YES
We can see what parameters are being executed by the catctl.pl upgrade script
[/u02/app/oracle/product/18.0.0/dbhome_1/perl/bin/perl /u02/app/oracle/product/18.0.0/dbhome_1/rdbms/admin/catctl.pl -L /tmp/priority_list -R -I -i pdb2 -n 2 -c 'PDB2' -l /u02/app/oracle/homes/OraDB18Home1/cfgtoollogs/cdb1/upgrade20181209210348 /u02/app/oracle/product/18.0.0/dbhome_1/rdbms/admin/catupgrd.sql]
When the upgrade is completed and the Post Upgrade steps are being carried out, the PDB is now in MOUNT state as opposed to MIGRATE state
SQL> show pdbs CON_ID CON_NAME OPEN MODE RESTRICTED ---------- ------------------------------ ---------- ---------- 2 PDB$SEED READ ONLY NO 3 PDB1 MIGRATE YES 4 PDB2 MOUNTED catupgrd0.log Serial Phase #:98 [PDB2] Files:1 Time: 3s ************* Final Upgrade scripts ************ Serial Phase #:99 [PDB2] Files:1 Time: 102s ******************* Migration ****************** Serial Phase #:100 [PDB2] Files:1 Time: 1s *** End PDB Application Upgrade Pre-Shutdown *** Serial Phase #:101 [PDB2] Files:1 Time: 1s Serial Phase #:102 [PDB2] Files:1 Time: 8s Serial Phase #:103 [PDB2] Files:1 Time: 37s ***************** Post Upgrade ***************** Serial Phase #:104 [PDB2] Files:1 Time: 6s **************** Summary report **************** Serial Phase #:105 [PDB2] Files:1 Time: 1s *** End PDB Application Upgrade Post-Shutdown ** Serial Phase #:106 [PDB2] Files:1 Time: 1s Serial Phase #:107 [PDB2] Files:1 Time: 2s Serial Phase #:108 [PDB2] Files:1 Time: 0s ------------------------------------------------------ Phases [0-108] End Time:[2018_12_09 21:44:48]
We now see that the PDB1 upgrade has commenced
Start processing of PDBs (PDB1) [/u02/app/oracle/product/18.0.0/dbhome_1/perl/bin/perl /u02/app/oracle/product/18.0.0/dbhome_1/rdbms/admin/catctl.pl -L /tmp/priority_list -R -I -i pdb1 -n 2 -c 'PDB1' -l /u02/app/oracle/homes/OraDB18Home1/cfgtoollogs/cdb1/upgrade20181209210348 /u02/app/oracle/product/18.0.0/dbhome_1/rdbms/admin/catupgrd.sql] Argument list for [/u02/app/oracle/product/18.0.0/dbhome_1/rdbms/admin/catctl.pl] Run in c = PDB1 Do not run in C = 0 Input Directory d = 0 Echo OFF e = 1 Simulate E = 0 Forced cleanup F = 0 Log Id i = pdb1 Child Process I = 1 Log Dir l = /u02/app/oracle/homes/OraDB18Home1/cfgtoollogs/cdb1/upgrade20181209210348 Priority List Name L = /tmp/priority_list
Open the pluggable database PDB2 while PDB1 is still being upgraded
SQL> alter pluggable database pdb2 open; Pluggable database altered. SQL> show pdbs CON_ID CON_NAME OPEN MODE RESTRICTED ---------- ------------------------------ ---------- ---------- 2 PDB$SEED READ ONLY NO 3 PDB1 MIGRATE YES 4 PDB2 READ WRITE NO SQL>