Before You Begin
This 15-minute tutorial shows you how to upgrade a 12c container
database (CDB) to an Oracle Database 18c CDB.
Background
The process and utilities to upgrade a 12.1 CDB to an Oracle Database 12.2 CDB are the same as an upgrade of a 12c CDB to an oracle Database 18c CDB.
What Do You Need?
- Oracle Database 18c installed
- Oracle Database 12c Release 2 (12.2) installed
- One Oracle Database 12c Release 2 (12.2) CDB
cdb12with one PDB opened,PDB12. You can use thedbca.shshell script to createcdb12.Download the shell script to the labs directory created on your server/home/oracle/labs.Replace the password in the shell script with your own complex password - The SQL script, create_test_user_bigtab.sql downloaded
to the labs directory created on your server
/home/oracle/labswith user password updated
Back
up 12c CDB Before Upgrade
In this section, you'll back up cdb12 before
you upgrade the 12c CDB to an Oracle Database 18c CDB. Before
you back up the CDB, use the create_test_user_bigtab.sql
SQL script to create a test user and a table with rows in the
PDB12 PDB.
- Log in to
PDB12to create thetest.bigtabtable loaded with 10000 rows. This is Session 12.
sqlplus sys@PDB12 AS SYSDBA
Enter password: password - Execute the SQL script
create_test_user_bigtab.sqlthat creates theTESTuser and thetest.bigtabtable that is loaded with 10000 rows.@/home/oracle/labs/create_test_user_bigtab.sql - Launch
rmanto back upcdb12.
rman target sys@cdb12
target database Password: password - Back up
cdb12.BACKUP DATABASE PLUS ARCHIVELOG; - Quit the session.
EXIT;
Prepare
the 12c CDB for Upgrade
In this section, you'll prepare cdb12 to be
upgraded to an Oracle Database 18c CDB.
- The current terminal window is still set with
ORACLE_HOMEset to Oracle Database 12c Release 2 (12.2) andORACLE_SIDset tocdb12.This session is called Session 12c.
export ORACLE_HOME=/u01/app/oracle/product/12.2.0/dbhome_1export ORACLE_SID=cdb12 - Open another terminal window and set
ORACLE_HOMEto Oracle Database 18c andORACLE_SIDset tocdb12.This session is called Session 18c.
export ORACLE_HOME=/u01/app/oracle/product/18.1.0/dbhome_1export ORACLE_SID=cdb12 - In Session 12c, change the directory to Oracle
Database 18c
/u01/app/oracle/product/18.1.0/dbhome_1/rdbms/admin.
cd /u01/app/oracle/product/18.1.0/dbhome_1/rdbms/admin - Prepare
CDB12to be upgraded into an Oracle Database 18c CDB. First, execute the Pre-Upgrade Information Tool on the 12ccdb12by executing thepreupgrade.jarfile.$ORACLE_HOME/jdk/bin/java -jar preupgrade.jar TERMINAL TEXT - Read the Preupgrade Summary report from preupgrade_summary.
- Before the upgrade operation, the report suggests that you
execute the pre-upgrade fixups scripts on the entire CDB
cdb12.Copy and paste the command suggested in the "Before upgrade" paragraph.$ORACLE_HOME/perl/bin/perl -I$ORACLE_HOME/perl/lib -I$ORACLE_HOME/rdbms/admin $ORACLE_HOME/rdbms/admin/catcon.pl -l /u01/app/oracle/cfgtoollogs/cdb12/preupgrade/ -b preup_cdb12 /u01/app/oracle/cfgtoollogs/cdb12/preupgrade/preupgrade_fixups.sql catcon: ALL catcon-related output will be written to [/u01/app/oracle/cfgtoollogs/cdb12/preupgrade//preup_cdb12_catcon_5393.lst] catcon: See [/u01/app/oracle/cfgtoollogs/cdb12/preupgrade//preup_cdb12*.log] files for output generated by scripts catcon: See [/u01/app/oracle/cfgtoollogs/cdb12/preupgrade//preup_cdb12_*.lst] files for spool files, if any catcon.pl: completed successfully - After the fixup script completes, shut the instance down by
logging in to the CDB root as
SYSDBA.sqlplus / AS SYSDBA - Shut down
cdb12.SHUTDOWN IMMEDIATE - Quit the session.
EXIT
Upgrade
the 12c CDB to an Oracle Database 18c CDB
In this section, you'll upgrade cdb12 to
Oracle Database 18c.
- In Session 18c, copy the
cdb12 spfilefrom the 12cORACLE_HOMEto the 18cORACLE_HOMEbefore you start thecdb12instance in the 18c environment.
cp/u01/app/oracle/product/12.2.0/dbhome_1/dbs/spfilecdb12.ora/u01/app/oracle/product/18.1.0/dbhome_1/dbs/sqlplus / AS SYSDBA - Start up the
cdb12instance inUPGRADEmode.STARTUP UPGRADE - Open all PDBs in
UPGRADEmode.
ALTER PLUGGABLE DATABASE ALL OPEN UPGRADE; - Display the open mode of the PDBs.
SHOW PDBS
CON_ID CON_NAME OPEN MODE RESTRICTED ---------- ------------------------------ ---------- ---------- 2 PDB$SEED MIGRATE YES 3 PDB12 MIGRATE YES - Quit the session.
EXIT - Upgrade
cdb12.mkdir /tmp/upgrade_cdb12cd $ORACLE_HOME/rdbms/admin$ORACLE_HOME/perl/bin/perl catctl.pl -l /tmp/upgrade_cdb12 catupgrd.sql - Read the result of the upgrade operation from the upgrade report.
- Log in to the CDB to open the PDBs.
sqlplus / AS SYSDBA - Open the PDBs.
ALTER PLUGGABLE DATABASE ALL OPEN; - Quit the session.
EXIT
Execute
the Post-Upgrade Steps
In this section, after your upgrade is complete, run the post-upgrade script that your preupgrade_summary report indicates as required for your upgrade.
- Copy and paste the command suggested in the "After the
upgrade" paragraph.
$ORACLE_HOME/perl/bin/perl -I$ORACLE_HOME/perl/lib -I$ORACLE_HOME/rdbms/admin $ORACLE_HOME/rdbms/admin/catcon.pl -l /u01/app/oracle/cfgtoollogs/cdb12/preupgrade/ -b postup_cdb12 /u01/app/oracle/cfgtoollogs/cdb12/preupgrade/postupgrade_fixups.sql catcon::set_log_file_base_path: ALL catcon-related output will be written to [/u01/app/oracle/cfgtoollogs/cdb12/preupgrade/postup_cdb12_catcon_26887.lst] catcon::set_log_file_base_path: catcon: See [/u01/app/oracle/cfgtoollogs/cdb12/preupgrade/postup_cdb12*.log] files for output generated by scripts catcon::set_log_file_base_path: catcon: See [/u01/app/oracle/cfgtoollogs/cdb12/preupgrade/postup_cdb12_*.lst] files for spool files, if any
catcon.pl: completed successfully - Log in to
PDB12.sqlplus / AS SYSDBAALTER SESSION SET CONTAINER=PDB12; - Verify that the
TEST.BIGTABstill holds 10000 rows.SELECT count(*) FROM test.bigtab; - Quit the session.
EXIT - Change the Oracle home for
CDB12by editing the/etc/oratabfile so that it points to the new 18c Oracle home.
cdb12:/u01/app/oracle/product/18.1.0/dbhome_1:N - Create the new
cdb12password file in Oracle Database 18.1 environment.
cd /u01/app/oracle/product/18.1.0/dbhome_1/dbs
orapwd file=orapwcdb12 entries=5 password=password
Upgrading
a 12c CDB to an Oracle Database 18c CDB