You are on page 1of 25

Upgrade Oracle 12c non-CDB to Oracle 19c CDB

Prepare for Oracle 19c upgrade

oracle@db21:~$ sqlplus sys as sysdba

Connected to:
Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production

Gather Dictonary Statistics

SQL> exec dbms_stats.gather_dictionary_stats;

PL/SQL procedure successfully completed.

Gather Fixed Objects Statistics

SQL> exec dbms_stats.gather_fixed_objects_stats;

PL/SQL procedure successfully completed.

Purge the Recycle Bin

SQL> purge dba_recyclebin;

Oracle 12c to Oracle 19c database upgrade with Multitenancy


Oracle 1
DBA Recyclebin purged.

Check any SYS or SYSTEM owned INVALID objects

SQL>select object_name,object_type from dba_objects where owner in ('SYS','SYSTEM') and status='INVALID';

no rows selected

Make a note of current INVALID objects

SQL> create table system.invalid_objects


as select owner,object_name,object_type from dba_objects where status='INVALID';

Table created.

SQL> select count(*) from system.invalid_objects;

COUNT(*)
----------
475

Create a Flashback Database Restore Point

SQL> create restore point before_upgrade guarantee flashback database;

Restore point created.

Oracle 12c to Oracle 19c database upgrade with Multitenancy


Oracle 2
Run preupgrade.jar

oracle@db21:~$ cd /d_admin/dba/scripts/

oracle@db21:/d_admin/dba/scripts$ cp /opt/oracle/product/19.0.0/dbhome_1/rdbms/admin/preupgrade.jar .

oracle@db21:/d_admin/dba/scripts$ $ORACLE_HOME/jdk/bin/java -jar preupgrade.jar


==================
PREUPGRADE SUMMARY
==================
/opt/oracle/cfgtoollogs/DGPDEVL/preupgrade/preupgrade.log
/opt/oracle/cfgtoollogs/DGPDEVL/preupgrade/preupgrade_fixups.sql
/opt/oracle/cfgtoollogs/DGPDEVL/preupgrade/postupgrade_fixups.sql

Execute fixup scripts as indicated below:

Before upgrade:

Log into the database and execute the preupgrade fixups


@/opt/oracle/cfgtoollogs/DGPDEVL/preupgrade/preupgrade_fixups.sql

After the upgrade:

Log into the database and execute the postupgrade fixups


@/opt/oracle/cfgtoollogs/DGPDEVL/preupgrade/postupgrade_fixups.sql

Preupgrade complete: 2020-05-21T09:55:45

Executing Oracle PRE-Upgrade Fixup Script

Auto-Generated by: Oracle Preupgrade Script

Oracle 12c to Oracle 19c database upgrade with Multitenancy


Oracle 3
Version: 19.0.0.0.0 Build: 1
Generated on: 2020-05-21 09:55:40

For Source Database: DGPDEVL


Source Database Version: 12.2.0.1.0
For Upgrade to Version: 19.0.0.0.0

Preup Preupgrade
Action Issue Is
Number Preupgrade Check Name Remedied Further DBA Action
------ ------------------------ ---------- --------------------------------
1. invalid_objects_exist NO Manual fixup recommended.
2. sync_standby_db NO Informational only.
Further action is optional.
3. rman_recovery_version NO Informational only.
Further action is optional.

The fixup scripts have been run and resolved what they can. However,
there are still issues originally identified by the preupgrade that
have not been remedied and are still present in the database.
Depending on the severity of the specific issue, and the nature of
the issue itself, that could mean that your database is not ready
for upgrade. To resolve the outstanding issues, start by reviewing
the preupgrade_fixups.sql and searching it for the name of
the failed CHECK NAME or Preupgrade Action Number listed above.
There you will find the original corresponding diagnostic message
from the preupgrade which explains in more detail what still needs
to be done.

Oracle 12c to Oracle 19c database upgrade with Multitenancy


Oracle 4
Perform Oracle 19c upgrade

Execute DBUA (Database Upgrade Assistant)

Oracle 12c to Oracle 19c database upgrade with Multitenancy


Oracle 5
Oracle 12c to Oracle 19c database upgrade with Multitenancy
Oracle 6
Oracle 12c to Oracle 19c database upgrade with Multitenancy
Oracle 7
Oracle 12c to Oracle 19c database upgrade with Multitenancy
Oracle 8
Oracle 12c to Oracle 19c database upgrade with Multitenancy
Oracle 9
Oracle 12c to Oracle 19c database upgrade with Multitenancy
Oracle 10
Oracle 12c to Oracle 19c database upgrade with Multitenancy
Oracle 11
Oracle 12c to Oracle 19c database upgrade with Multitenancy
Oracle 12
Oracle 12c to Oracle 19c database upgrade with Multitenancy
Oracle 13
Oracle 12c to Oracle 19c database upgrade with Multitenancy
Oracle 14
Oracle 12c to Oracle 19c database upgrade with Multitenancy
Oracle 15
Monitor Upgrade Logs

Oracle 12c to Oracle 19c database upgrade with Multitenancy


Oracle 16
Oracle 12c to Oracle 19c database upgrade with Multitenancy
Oracle 17
Oracle 12c to Oracle 19c database upgrade with Multitenancy
Oracle 18
Oracle 12c to Oracle 19c database upgrade with Multitenancy
Oracle 19
Post-Upgrade

Check the current state of the Oracle Data Dictionary

spool regInvalid.txt
column comp_id format A15
column comp_name format A30
column version format A10
set echo on
-- query registry
set lines 132 pages 100
select substr(comp_id,1,15) comp_id,
substr(comp_name,1,30) comp_name,
substr(version,1,10) version,
status
from dba_registry
order by modified
/

COMP_ID COMP_NAME VERSION STATUS


--------------- ------------------------------ ---------- -----------
RAC Oracle Real Application Cluste 19.0.0.0.0 OPTION OFF
CATALOG Oracle Database Catalog Views 19.0.0.0.0 VALID
CATPROC Oracle Database Packages and T 19.0.0.0.0 VALID
XDB Oracle XML Database 19.0.0.0.0 VALID
OWM Oracle Workspace Manager 19.0.0.0.0 VALID
JAVAVM JServer JAVA Virtual Machine 19.0.0.0.0 VALID
XML Oracle XDK 19.0.0.0.0 VALID
CATJAVA Oracle Database Java Packages 19.0.0.0.0 VALID
CONTEXT Oracle Text 19.0.0.0.0 VALID
ORDIM Oracle Multimedia 19.0.0.0.0 VALID
APS OLAP Analytic Workspace 19.0.0.0.0 VALID
SDO Spatial 19.0.0.0.0 VALID
XOQ Oracle OLAP API 19.0.0.0.0 VALID
OLS Oracle Label Security 19.0.0.0.0 VALID
DV Oracle Database Vault 19.0.0.0.0 VALID

15 ows selected.

Oracle 12c to Oracle 19c database upgrade with Multitenancy


Oracle 20
Application System Testing

Once the database has been upgraded to the satisfaction of the DBA, further testing by users and or developers is required.

Check/Set Initialization parameter : COMPATIBLE

Set the COMPATIBLE initialization parameter to an appropriate value. Oracle recommends increasing the COMPATIBLE parameter only after complete
testing of the upgraded database has been performed.

After you increase the COMPATIBLE parameter, the database cannot subsequently be downgraded to releases earlier than what is set for compatibility.

Convert Oracle 19c Non-CDB to PDB

Execute DBMS_PDB.DESCRIBE

oracle@db21:/opt/oracle/product/19.0.0/dbhome_1/network/admin$ sqlplus sys as sysdba

Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.6.0.0.0

SQL> shutdown immediate;


Database closed.
Database dismounted.
ORACLE instance shut down.

SQL> startup mount;


ORACLE instance started.

Oracle 12c to Oracle 19c database upgrade with Multitenancy


Oracle 21
Total System Global Area 2147478488 bytes
Fixed Size 8874968 bytes
Variable Size 1258291200 bytes
Database Buffers 872415232 bytes
Redo Buffers 7897088 bytes
Database mounted.

SQL> alter database open read only;

Database altered.

SQL> exec DBMS_PDB.DESCRIBE ('/export/home/oracle/dgpdevl.xml');

PL/SQL procedure successfully completed.

SQL> shutdown immediate;


Database closed.
Database dismounted.
ORACLE instance shut down.

Plug in the database to existing Oracle 19c CDB

SQL> show pdbs

CON_ID CON_NAME OPEN MODE RESTRICTED


---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO

SQL> create pluggable database dgpdevl using '/export/home/oracle/dgpdevl.xml' nocopy tempfile reuse;

Pluggable database created.

Oracle 12c to Oracle 19c database upgrade with Multitenancy


Oracle 22
SQL> show pdbs

CON_ID CON_NAME OPEN MODE RESTRICTED


---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
3 DGPDEVL MOUNTED

SQL> alter pluggable database open;

Pluggable database altered.

Execute noncdb_to_pdb.sql script

SQL> alter session set container=DGPDEVL;

Session altered.

SQL> @?/rdbms/admin/noncdb_to_pdb.sql

….
….

13:47:57 SQL> set tab OFF


13:47:57 SQL> set termout ON
13:47:57 SQL> set time OFF
SQL> set timing OFF
SQL> set trimout ON
SQL> set trimspool ON
SQL> set underline "-"

Oracle 12c to Oracle 19c database upgrade with Multitenancy


Oracle 23
SQL> set verify OFF
SQL> set wrap ON
SQL> set xmloptimizationcheck OFF

Verify PDB plug-in operation via PDB_PLUG_IN_VIOLATIONS

SQL> select con_id, type, message, status


from PDB_PLUG_IN_VIOLATIONS
where status <>'RESOLVED'
order by time;

CON_ID TYPE MESSAGE STATUS


---------- --------- ---------------------------------------------------------------------------------------------------- ---------
4 WARNING Character set mismatch: PDB character set US7ASCII. CDB character set AL32UTF8. PENDING
4 WARNING Database option APS mismatch: PDB installed version NULL. CDB installed version 19.0.0.0.0. PENDING
4 WARNING Database option CATJAVA mismatch: PDB installed version NULL. CDB installed version 19.0.0.0.0. PENDING
4 WARNING Database option CONTEXT mismatch: PDB installed version NULL. CDB installed version 19.0.0.0.0. PENDING
4 WARNING Database option DV mismatch: PDB installed version NULL. CDB installed version 19.0.0.0.0. PENDING
4 WARNING Database option JAVAVM mismatch: PDB installed version NULL. CDB installed version 19.0.0.0.0. PENDING
4 WARNING Database option OLS mismatch: PDB installed version NULL. CDB installed version 19.0.0.0.0. PENDING
4 WARNING Database option ORDIM mismatch: PDB installed version NULL. CDB installed version 19.0.0.0.0. PENDING
4 WARNING Database option OWM mismatch: PDB installed version NULL. CDB installed version 19.0.0.0.0. PENDING
4 WARNING Database option SDO mismatch: PDB installed version NULL. CDB installed version 19.0.0.0.0. PENDING
4 WARNING Database option XML mismatch: PDB installed version NULL. CDB installed version 19.0.0.0.0. PENDING
4 WARNING Database option XOQ mismatch: PDB installed version NULL. CDB installed version 19.0.0.0.0. PENDING

Verify PDB is open in READ WRITE mode

SQL> conn / as sysdba


Connected.

Oracle 12c to Oracle 19c database upgrade with Multitenancy


Oracle 24
SQL> show pdbs

CON_ID CON_NAME OPEN MODE RESTRICTED


---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
3DGPDEVL READ WRITE NO

Oracle 12c to Oracle 19c database upgrade with Multitenancy


Oracle 25

You might also like