Above is the recommended practice we have all been hearing about to make upgrades of your Oracle Database easier. Unplug from your current CDB (CDBPROD122) plug into a new CDB (CDB19C) that has the new release. What you need to think about however, is how am I going to ensure that I can recover my pluggable database to any point in time, all the way this migration without a huge amount of downtime?
- Preplugin Backups
(Doc ID 2358523.1)
Pre-unplug
RMAN> backup incremental level 0 pluggable database PDBDWPROD plus archivelog delete input;
Starting backup at 15-APR-22
current log archived
allocated channel: ORA_SBT_TAPE_1
channel ORA_SBT_TAPE_1: SID=426 device type=SBT_TAPE
channel ORA_SBT_TAPE_1: Oracle Database Backup Service Library VER=23.0.0.1
channel ORA_SBT_TAPE_1: starting compressed archived log backup set
channel ORA_SBT_TAPE_1: specifying archived log(s) in backup set
input archived log thread=1 sequence=185 RECID=186 STAMP=1102096068
input archived log thread=1 sequence=186 RECID=187 STAMP=1102096071
input archived log thread=1 sequence=187 RECID=188 STAMP=1102096147
input archived log thread=1 sequence=188 RECID=189 STAMP=1102096166
input archived log thread=1 sequence=189 RECID=190 STAMP=1102096288
channel ORA_SBT_TAPE_1: starting piece 1 at 15-APR-22
channel ORA_SBT_TAPE_1: finished piece 1 at 15-APR-22
piece handle=6l0r19t1_213_1_1 tag=TAG20220415T175129 comment=API Version 2.0,MMS Version 23.0.0.1
channel ORA_SBT_TAPE_1: backup set complete, elapsed time: 00:00:03
channel ORA_SBT_TAPE_1: deleting archived log(s)
archived log file name=/u01/app/oracle/fast_recovery_area/OLDCDB/archivelog/2022_04_15/o1_mf_1_185_k5mcy4w8_.arc RECID=186 STAMP=1102096068
archived log file name=/u01/app/oracle/fast_recovery_area/OLDCDB/archivelog/2022_04_15/o1_mf_1_186_k5mcy7xv_.arc RECID=187 STAMP=1102096071
archived log file name=/u01/app/oracle/fast_recovery_area/OLDCDB/archivelog/2022_04_15/o1_mf_1_187_k5md0m8l_.arc RECID=188 STAMP=1102096147
archived log file name=/u01/app/oracle/fast_recovery_area/OLDCDB/archivelog/2022_04_15/o1_mf_1_188_k5md16rt_.arc RECID=189 STAMP=1102096166
archived log file name=/u01/app/oracle/fast_recovery_area/OLDCDB/archivelog/2022_04_15/o1_mf_1_189_k5md50qy_.arc RECID=190 STAMP=1102096288
Finished backup at 15-APR-22
Starting backup at 15-APR-22
using channel ORA_SBT_TAPE_1
channel ORA_SBT_TAPE_1: starting compressed incremental level 0 datafile backup set
channel ORA_SBT_TAPE_1: specifying datafile(s) in backup set
input datafile file number=00066 name=/u01/app/oracle/oradata/OLDCDB/PDBDWPROD/sysaux01.dbf
input datafile file number=00065 name=/u01/app/oracle/oradata/OLDCDB/PDBDWPROD/system01.dbf
input datafile file number=00068 name=/u01/app/oracle/oradata/OLDCDB/PDBDWPROD/PDBDWPROD.dbf
input datafile file number=00067 name=/u01/app/oracle/oradata/OLDCDB/PDBDWPROD/undotbs01.dbf
channel ORA_SBT_TAPE_1: starting piece 1 at 15-APR-22
channel ORA_SBT_TAPE_1: finished piece 1 at 15-APR-22
piece handle=6m0r19t5_214_1_1 tag=TAG20220415T175132 comment=API Version 2.0,MMS Version 23.0.0.1
channel ORA_SBT_TAPE_1: backup set complete, elapsed time: 00:00:15
Finished backup at 15-APR-22
Starting backup at 15-APR-22
current log archived
using channel ORA_SBT_TAPE_1
channel ORA_SBT_TAPE_1: starting compressed archived log backup set
channel ORA_SBT_TAPE_1: specifying archived log(s) in backup set
input archived log thread=1 sequence=190 RECID=191 STAMP=1102096309
channel ORA_SBT_TAPE_1: starting piece 1 at 15-APR-22
channel ORA_SBT_TAPE_1: finished piece 1 at 15-APR-22
piece handle=6n0r19tm_215_1_1 tag=TAG20220415T175150 comment=API Version 2.0,MMS Version 23.0.0.1
channel ORA_SBT_TAPE_1: backup set complete, elapsed time: 00:00:03
channel ORA_SBT_TAPE_1: deleting archived log(s)
archived log file name=/u01/app/oracle/fast_recovery_area/OLDCDB/archivelog/2022_04_15/o1_mf_1_190_k5md5osn_.arc RECID=191 STAMP=1102096309
Finished backup at 15-APR-22
Starting Control File and SPFILE Autobackup at 15-APR-22
piece handle=c-1180802953-20220415-07 comment=API Version 2.0,MMS Version 23.0.0.1
Finished Control File and SPFILE Autobackup at 15-APR-22
RMAN>
RMAN> backup archivelog all delete input;
Starting backup at 15-APR-22
current log archived
allocated channel: ORA_SBT_TAPE_1
channel ORA_SBT_TAPE_1: SID=442 device type=SBT_TAPE
channel ORA_SBT_TAPE_1: Oracle Database Backup Service Library VER=23.0.0.1
channel ORA_SBT_TAPE_1: starting compressed archived log backup set
channel ORA_SBT_TAPE_1: specifying archived log(s) in backup set
input archived log thread=1 sequence=191 RECID=192 STAMP=1102096412
input archived log thread=1 sequence=192 RECID=193 STAMP=1102096418
input archived log thread=1 sequence=193 RECID=194 STAMP=1102096424
input archived log thread=1 sequence=194 RECID=195 STAMP=1102096502
channel ORA_SBT_TAPE_1: starting piece 1 at 15-APR-22
channel ORA_SBT_TAPE_1: finished piece 1 at 15-APR-22
piece handle=6p0r1a3n_217_1_1 tag=TAG20220415T175503 comment=API Version 2.0,MMS Version 23.0.0.1
channel ORA_SBT_TAPE_1: backup set complete, elapsed time: 00:00:07
channel ORA_SBT_TAPE_1: deleting archived log(s)
archived log file name=/u01/app/oracle/fast_recovery_area/OLDCDB/archivelog/2022_04_15/o1_mf_1_191_k5md8w57_.arc RECID=192 STAMP=1102096412
archived log file name=/u01/app/oracle/fast_recovery_area/OLDCDB/archivelog/2022_04_15/o1_mf_1_192_k5md926n_.arc RECID=193 STAMP=1102096418
archived log file name=/u01/app/oracle/fast_recovery_area/OLDCDB/archivelog/2022_04_15/o1_mf_1_193_k5md9893_.arc RECID=194 STAMP=1102096424
archived log file name=/u01/app/oracle/fast_recovery_area/OLDCDB/archivelog/2022_04_15/o1_mf_1_194_k5mdcpko_.arc RECID=195 STAMP=1102096502
Finished backup at 15-APR-22
Starting Control File and SPFILE Autobackup at 15-APR-22
piece handle=c-1180802953-20220415-08 comment=API Version 2.0,MMS Version 23.0.0.1
Finished Control File and SPFILE Autobackup at 15-APR-22
SQL> alter pluggable database PDBDWPROD close immediate;
Pluggable database altered.
SQL> ALTER PLUGGABLE DATABASE PDBDWPROD UNPLUG INTO '/tmp/PDBDWPROD.xml';
Pluggable database altered.
SQL>
Plug
SQL> create pluggable database PDBDWPROD using '/tmp/PDBDWPROD.xml' nocopy tempfile reuse KEYSTORE IDENTIFIED BY "change-on-install" ;
Pluggable database created.
SQL> alter pluggable database PDBDWPROD open;
Pluggable database altered.
Update database and set restore point
SQL> alter session set container=PDBDWPROD;
Session altered.
SQL> create table bgrenn.postmove as select * from dba_objects ;
Table created.
############################ perform a couple of log switches
SQL> alter session set container=CDB$ROOT;
Session altered.
SQL> alter system archive log current;
System altered.
SQL> alter system archive log current;
System altered.
SQL> alter session set container=PDBDWPROD;
Session altered.
############################ create a restore point
SQL> create restore point PDBDWPROD_restore;
Restore point created.
############################ create a second table
SQL> create table bgrenn.postrestorepoint as select * from dba_objects ;
Table created.
############################ perform a couple of log switches
SQL> alter session set container=CDB$ROOT;
Session altered.
SQL> alter system archive log current;
System altered.
SQL> alter system archive log current;
System altered.
SQL> alter system archive log current;
System altered.
Backups available post plugin
rman> SET PREPLUGIN CONTAINER=PDBDWPROD;rman> list preplugin backup of pluggable database PDBDWPROD;
RMAN> list preplugin backup of pluggable database PDBDWPROD;
starting full resync of recovery catalog
full resync complete
List of Backup Sets
===================
BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
209 Incr 0 284.50M SBT_TAPE 00:00:07 15-APR-22
BP Key: 209 Status: AVAILABLE Compressed: YES Tag: TAG20220415T175132
Handle: 6m0r19t5_214_1_1 Media: objectstorage.us-ashburn-1.oraclecloud.com/n/xxx/oldcdb
List of Datafiles in backup set 209
Container ID: 5, PDB Name: PDBDWPROD
File LV Type Ckp SCN Ckp Time Abs Fuz SCN Sparse Name
---- -- ---- ---------- --------- ----------- ------ ----
59 0 Incr 6346380 15-APR-22 NO /u01/app/oracle/oradata/OLDCDB/PDBDWPROD/system01.dbf
60 0 Incr 6346380 15-APR-22 NO /u01/app/oracle/oradata/OLDCDB/PDBDWPROD/sysaux01.dbf
61 0 Incr 6346380 15-APR-22 NO /u01/app/oracle/oradata/OLDCDB/PDBDWPROD/undotbs01.dbf
62 0 Incr 6346380 15-APR-22 NO /u01/app/oracle/oradata/OLDCDB/PDBDWPROD/PDBDWPROD.dbf
list preplugin backup of archivelog all;
List of Backup Sets
===================
BS Key Size Device Type Elapsed Time Completion Time
------- ---------- ----------- ------------ ---------------
208 2.25M SBT_TAPE 00:00:01 15-APR-22
BP Key: 208 Status: AVAILABLE Compressed: YES Tag: TAG20220415T175129
Handle: 6l0r19t1_213_1_1 Media: objectstorage.us-ashburn-1.oraclecloud.com/n/xxx/oldcdb
List of Archived Logs in backup set 208
Thrd Seq Low SCN Low Time Next SCN Next Time
---- ------- ---------- --------- ---------- ---------
1 185 6345022 15-APR-22 6345387 15-APR-22
1 186 6345387 15-APR-22 6345399 15-APR-22
1 187 6345399 15-APR-22 6345803 15-APR-22
1 188 6345803 15-APR-22 6345912 15-APR-22
1 189 6345912 15-APR-22 6346322 15-APR-22
BS Key Size Device Type Elapsed Time Completion Time
------- ---------- ----------- ------------ ---------------
210 256.00K SBT_TAPE 00:00:00 15-APR-22
BP Key: 210 Status: AVAILABLE Compressed: YES Tag: TAG20220415T175150
Handle: 6n0r19tm_215_1_1 Media: objectstorage.us-ashburn-1.oraclecloud.com/n/xxx/oldcdb
List of Archived Logs in backup set 210
Thrd Seq Low SCN Low Time Next SCN Next Time
---- ------- ---------- --------- ---------- ---------
1 190 6346322 15-APR-22 6346391 15-APR-22
BS Key Size Device Type Elapsed Time Completion Time
------- ---------- ----------- ------------ ---------------
212 512.00K SBT_TAPE 00:00:02 15-APR-22
BP Key: 212 Status: AVAILABLE Compressed: YES Tag: TAG20220415T175503
Handle: 6p0r1a3n_217_1_1 Media: objectstorage.us-ashburn-1.oraclecloud.com/n/id20skavsofo/oldcdb
List of Archived Logs in backup set 212
Thrd Seq Low SCN Low Time Next SCN Next Time
---- ------- ---------- --------- ---------- ---------
1 191 6346391 15-APR-22 6346585 15-APR-22
1 192 6346585 15-APR-22 6346593 15-APR-22
1 193 6346593 15-APR-22 6346601 15-APR-22
1 194 6346601 15-APR-22 6346663 15-APR-22
Restore from preplugin
RMAN> alter pluggable database PDBDWPROD close;
Statement processed
starting full resync of recovery catalog
full resync complete
RMAN> restore pluggable database PDBDWPROD from preplugin;
Starting restore at 15-APR-22
using channel ORA_SBT_TAPE_1
using channel ORA_DISK_1
channel ORA_SBT_TAPE_1: starting datafile backup set restore
channel ORA_SBT_TAPE_1: specifying datafile(s) to restore from backup set
channel ORA_SBT_TAPE_1: restoring datafile 00059 to /u01/app/oracle/oradata/OLDCDB/PDBDWPROD/system01.dbf
channel ORA_SBT_TAPE_1: restoring datafile 00060 to /u01/app/oracle/oradata/OLDCDB/PDBDWPROD/sysaux01.dbf
channel ORA_SBT_TAPE_1: restoring datafile 00061 to /u01/app/oracle/oradata/OLDCDB/PDBDWPROD/undotbs01.dbf
channel ORA_SBT_TAPE_1: restoring datafile 00062 to /u01/app/oracle/oradata/OLDCDB/PDBDWPROD/PDBDWPROD.dbf
channel ORA_SBT_TAPE_1: reading from backup piece 6m0r19t5_214_1_1
channel ORA_SBT_TAPE_1: piece handle=6m0r19t5_214_1_1 tag=TAG20220415T175132
channel ORA_SBT_TAPE_1: restored backup piece 1
channel ORA_SBT_TAPE_1: restore complete, elapsed time: 00:00:25
Finished restore at 15-APR-22
Recover from preplugin
recover pluggable database PDBDWPROD from preplugin;
RMAN>
Starting recover at 15-APR-22
using channel ORA_SBT_TAPE_1
using channel ORA_DISK_1
starting media recovery
channel ORA_SBT_TAPE_1: starting archived log restore to default destination
channel ORA_SBT_TAPE_1: restoring archived log
archived log thread=1 sequence=190
channel ORA_SBT_TAPE_1: reading from backup piece 6n0r19tm_215_1_1
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of recover command at 04/15/2022 18:23:58
ORA-19870: error while restoring backup piece 6n0r19tm_215_1_1
ORA-19827: Restoring preplugin files to a recovery area is not supported.
RMAN>
RMAN> restore archivelog sequence 190;
Starting restore at 15-APR-22
starting full resync of recovery catalog
full resync complete
allocated channel: ORA_SBT_TAPE_1
channel ORA_SBT_TAPE_1: SID=449 device type=SBT_TAPE
channel ORA_SBT_TAPE_1: Oracle Database Backup Service Library VER=23.0.0.1
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=71 device type=DISK
channel ORA_SBT_TAPE_1: starting archived log restore to default destination
channel ORA_SBT_TAPE_1: restoring archived log
archived log thread=1 sequence=190
channel ORA_SBT_TAPE_1: reading from backup piece 6n0r19tm_215_1_1
channel ORA_SBT_TAPE_1: piece handle=6n0r19tm_215_1_1 tag=TAG20220415T175150
channel ORA_SBT_TAPE_1: restored backup piece 1
channel ORA_SBT_TAPE_1: restore complete, elapsed time: 00:00:01
Finished restore at 15-APR-22
RMAN> list archivelog sequence 190;
List of Archived Log Copies for database with db_unique_name OLDCDB
=====================================================================
Key Thrd Seq S Low Time
------- ---- ------- - ---------
8134 1 190 A 15-APR-22
Name: /u01/app/oracle/fast_recovery_area/OLDCDB/archivelog/2022_04_15/o1_mf_1_190_k5mgd1h2_.arc
RMAN> restore archivelog sequence 190;
Starting restore at 15-APR-22
starting full resync of recovery catalog
full resync complete
allocated channel: ORA_SBT_TAPE_1
channel ORA_SBT_TAPE_1: SID=449 device type=SBT_TAPE
channel ORA_SBT_TAPE_1: Oracle Database Backup Service Library VER=23.0.0.1
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=71 device type=DISK
channel ORA_SBT_TAPE_1: starting archived log restore to default destination
channel ORA_SBT_TAPE_1: restoring archived log
archived log thread=1 sequence=190
channel ORA_SBT_TAPE_1: reading from backup piece 6n0r19tm_215_1_1
channel ORA_SBT_TAPE_1: piece handle=6n0r19tm_215_1_1 tag=TAG20220415T175150
channel ORA_SBT_TAPE_1: restored backup piece 1
channel ORA_SBT_TAPE_1: restore complete, elapsed time: 00:00:01
Finished restore at 15-APR-22
RMAN> list archivelog sequence 190;
List of Archived Log Copies for database with db_unique_name OLDCDB
=====================================================================
Key Thrd Seq S Low Time
------- ---- ------- - ---------
8134 1 190 A 15-APR-22
Name: /u01/app/oracle/fast_recovery_area/OLDCDB/archivelog/2022_04_15/o1_mf_1_190_k5mgd1h2_.arc
RMAN> recover pluggable database PDBDWPROD from preplugin;
Starting recover at 15-APR-22
using channel ORA_SBT_TAPE_1
using channel ORA_DISK_1
starting media recovery
archived log for thread 1 with sequence 191 is already on disk as file /tmp/o1_mf_1_191_k5mgw2fr_.arc
archived log for thread 1 with sequence 192 is already on disk as file /tmp/o1_mf_1_192_k5mgw83q_.arc
archived log for thread 1 with sequence 193 is already on disk as file /tmp/o1_mf_1_193_k5mgwlf8_.arc
archived log for thread 1 with sequence 194 is already on disk as file /tmp/o1_mf_1_194_k5mgx0t1_.arc
unable to find archived log
archived log thread=1 sequence=195
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of recover command at 04/15/2022 18:40:31
RMAN-06054: media recovery requesting unknown archived log for thread 1 with sequence 195 and starting SCN of 6346663
SQL> select sequence#,status from v$log;
SEQUENCE# STATUS
---------- ----------------
195 CURRENT
193 INACTIVE
194 INACTIVE
RMAN> recover pluggable database PDBDWPROD from preplugin;
Starting recover at 15-APR-22
using channel ORA_SBT_TAPE_1
using channel ORA_DISK_1
starting media recovery
archived log for thread 1 with sequence 195 is already on disk as file /tmp/o1_mf_1_195_k5mhf79h_.arc
media recovery complete, elapsed time: 00:00:01
Finished recover at 15-APR-22
Recover post plugin
RMAN>
RMAN> recover pluggable database PDBDWPROD until restore point PDBDWPROD_restore;
Starting recover at 15-APR-22
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=4 device type=DISK
starting media recovery
archived log for thread 1 with sequence 101 is already on disk as file /u01/app/oracle/fast_recovery_area/NEWCDB/archivelog/2022_04_15/o1_mf_1_101_k5mf0rr5_.arc
archived log for thread 1 with sequence 102 is already on disk as file /u01/app/oracle/fast_recovery_area/NEWCDB/archivelog/2022_04_15/o1_mf_1_102_k5mf0s8b_.arc
archived log for thread 1 with sequence 103 is already on disk as file /u01/app/oracle/fast_recovery_area/NEWCDB/archivelog/2022_04_15/o1_mf_1_103_k5mf1wof_.arc
archived log for thread 1 with sequence 104 is already on disk as file /u01/app/oracle/fast_recovery_area/NEWCDB/archivelog/2022_04_15/o1_mf_1_104_k5mf1zqm_.arc
archived log for thread 1 with sequence 105 is already on disk as file /u01/app/oracle/fast_recovery_area/NEWCDB/archivelog/2022_04_15/o1_mf_1_105_k5mf22sk_.arc
archived log for thread 1 with sequence 106 is already on disk as file /u01/app/oracle/fast_recovery_area/NEWCDB/archivelog/2022_04_15/o1_mf_1_106_k5mf91fn_.arc
archived log for thread 1 with sequence 107 is already on disk as file /u01/app/oracle/fast_recovery_area/NEWCDB/archivelog/2022_04_15/o1_mf_1_107_k5mf94g2_.arc
archived log for thread 1 with sequence 108 is already on disk as file /u01/app/oracle/fast_recovery_area/NEWCDB/archivelog/2022_04_15/o1_mf_1_108_k5mf9wk2_.arc
media recovery complete, elapsed time: 00:00:01
Finished recover at 15-APR-22
RMAN> alter pluggable database PDBDWPROD open resetlogs;
Statement processed
starting full resync of recovery catalog
full resync complete
SQL> alter session set container=PDBDWPROD;
Session altered.
SQL> select table_name from dba_tables where owner='BGRENN';
TABLE_NAME
--------------------------------------------------------------------------------
POSTMOVE
SQL> select count(1) from bgrenn.postmove;
COUNT(1)
----------
73610