0% found this document useful (0 votes)
217 views

Oracle 12c To 19c Database Upgrade

The document discusses two methods for upgrading an Oracle database from version 12c to 19c: using the Database Upgrade Assistant (DBUA) or performing a manual upgrade. It outlines the necessary pre-upgrade tasks such as backups, compatibility checks, and upgrading prerequisites. The DBUA guided method is described as installing the 19c software, running DBUA, and allowing it to perform the upgrade. The manual method requires running pre-upgrade tools, fixing issues, and migrating the database configuration before validating the upgrade.

Uploaded by

Aqeel Nawaz
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
217 views

Oracle 12c To 19c Database Upgrade

The document discusses two methods for upgrading an Oracle database from version 12c to 19c: using the Database Upgrade Assistant (DBUA) or performing a manual upgrade. It outlines the necessary pre-upgrade tasks such as backups, compatibility checks, and upgrading prerequisites. The DBUA guided method is described as installing the 19c software, running DBUA, and allowing it to perform the upgrade. The manual method requires running pre-upgrade tools, fixing issues, and migrating the database configuration before validating the upgrade.

Uploaded by

Aqeel Nawaz
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 52

3/1/22, 1:04 PM Oracle 12c to 19c Database Upgrade

Oracle 12c to 19c Database Upgrade


In this article, we will be looking at two most commonly used methods of upgrading Oracle database from 12c to
19c.

Pre-upgrade tasks

Upgrade using DBUA

Upgrade using Manual Method

You can perform a direct upgrade to 19c from 11.2.0.4, 12.1.0.2,


12.2.0.1 and 18c

Pre-Upgrade Tasks

Make sure you backup your database before performing the upgrade and also check application compatibility with
the new version of the Oracle database.

Direct upgrade to 19c is possible for 11.2.0.4, 12.1.0.2, 12.2.0.1 and 18c versions. The upgrade steps are all
same for the various supported versions.

Run the 19c pre-install package on Linux to complete all OS level pre-requisites

yum install -y oracle-database-preinstall-19c

yum update -y

Upgrade using DBUA

Install 19cR3 Software on Linux host

unzip LINUX.X64_193000_db_home.zip

./runinstaller

https://www.support.dbagenesis.com/post/oracle-12c-to-19c-database-upgrade#viewer-b2cii 1/52
3/1/22, 1:04 PM Oracle 12c to 19c Database Upgrade

Choose to Install the database software only option

https://www.support.dbagenesis.com/post/oracle-12c-to-19c-database-upgrade#viewer-b2cii 2/52
3/1/22, 1:04 PM Oracle 12c to 19c Database Upgrade

https://www.support.dbagenesis.com/post/oracle-12c-to-19c-database-upgrade#viewer-b2cii 3/52
3/1/22, 1:04 PM Oracle 12c to 19c Database Upgrade

https://www.support.dbagenesis.com/post/oracle-12c-to-19c-database-upgrade#viewer-b2cii 4/52
3/1/22, 1:04 PM Oracle 12c to 19c Database Upgrade

https://www.support.dbagenesis.com/post/oracle-12c-to-19c-database-upgrade#viewer-b2cii 5/52
3/1/22, 1:04 PM Oracle 12c to 19c Database Upgrade

https://www.support.dbagenesis.com/post/oracle-12c-to-19c-database-upgrade#viewer-b2cii 6/52
3/1/22, 1:04 PM Oracle 12c to 19c Database Upgrade

https://www.support.dbagenesis.com/post/oracle-12c-to-19c-database-upgrade#viewer-b2cii 7/52
3/1/22, 1:04 PM Oracle 12c to 19c Database Upgrade

https://www.support.dbagenesis.com/post/oracle-12c-to-19c-database-upgrade#viewer-b2cii 8/52
3/1/22, 1:04 PM Oracle 12c to 19c Database Upgrade

https://www.support.dbagenesis.com/post/oracle-12c-to-19c-database-upgrade#viewer-b2cii 9/52
3/1/22, 1:04 PM Oracle 12c to 19c Database Upgrade

https://www.support.dbagenesis.com/post/oracle-12c-to-19c-database-upgrade#viewer-b2cii 10/52
3/1/22, 1:04 PM Oracle 12c to 19c Database Upgrade

Check for Invalid objects

SQL> select count(*) from dba_objects where status='INVALID';

Run pre-upgrade script

/u01/app/oracle/product/12.2.0.1/db_home/jdk/bin/java -jar /u
01/app/oracle/product/19.3.0/db_home/rdbms/admin/preupgrade.jar FILE
DIR /home/oracle/preupgrade

https://www.support.dbagenesis.com/post/oracle-12c-to-19c-database-upgrade#viewer-b2cii 11/52
3/1/22, 1:04 PM Oracle 12c to 19c Database Upgrade

View Pre upgrade log

cat /home/oracle/preupgrade/preupgrade.log

Run Oracle Generated FIXUP SCRIPT

@/home/oracle/preupgrade/preupgrade_fixups.sql

https://www.support.dbagenesis.com/post/oracle-12c-to-19c-database-upgrade#viewer-b2cii 12/52
3/1/22, 1:04 PM Oracle 12c to 19c Database Upgrade

All looks good in our case, lets move to verify tablespace sizes for upgrade

set line 1000

set pages 5000

col tablespace_name for a30

col file_name for a80

col free_space for 9999999

compute sum of total_space on report

compute sum of free_space on report

compute sum of MAX_SPACE on report

https://www.support.dbagenesis.com/post/oracle-12c-to-19c-database-upgrade#viewer-b2cii 13/52
3/1/22, 1:04 PM Oracle 12c to 19c Database Upgrade

break on tablespace_name on report nodup

select
c.tablespace_name,a.autoextensible,a.file_name,a.total_space,b.free_spa
ce, round(b.free_space/a.total_space *100,2) "Free%",a.max_space from
(select file_id,file_name,sum(bytes)/1024/1024
total_space,sum(MAXBYTES)/1024/1024/1024 max_space,autoextensible from
dba_data_files group by file_id,file_name,autoextensible) a,(select
file_id,nvl(sum(bytes)/1024/1024,0) free_space from dba_free_space
group by file_id) b, (select tablespace_name,file_id from
dba_data_files) c where a.file_id=b.file_id(+) and a.file_id=c.file_id
order by tablespace_name;

Gather DICTIONARY STATS

SET ECHO ON;

SET SERVEROUTPUT ON;

EXECUTE DBMS_STATS.GATHER_DICTIONARY_STATS;

Purge Recycle bin

PURGE DBA_RECYCLEBIN;

Refresh MVs

declare

list_failures integer(3) :=0;

begin

DBMS_MVIEW.REFRESH_ALL_MVIEWS(list_failures,'C','', TRUE, FALSE);

end;

Verify archive log dest size and Create Flashback Guaranteed Restore Point

archive log list

alter system set db_recovery_file_dest_size=10G;

https://www.support.dbagenesis.com/post/oracle-12c-to-19c-database-upgrade#viewer-b2cii 14/52
3/1/22, 1:04 PM Oracle 12c to 19c Database Upgrade

select flashback_on from v$database;

select name,open_mode,log_mode from v$database;

show parameter compatible

show parameter recovery

select * from V$restore_point;

create restore point pre_upgrade guarantee flashback database;

col name for a20

col GUARANTEE_FLASHBACK_DATABASE for a10

col TIME for a60

set lines 190

select NAME,GUARANTEE_FLASHBACK_DATABASE,TIME from V$restore_point;

https://www.support.dbagenesis.com/post/oracle-12c-to-19c-database-upgrade#viewer-b2cii 15/52
3/1/22, 1:04 PM Oracle 12c to 19c Database Upgrade

Run DBUA

cd /u01/app/oracle/product/19.3.0/db_home/bin/

./dbua

https://www.support.dbagenesis.com/post/oracle-12c-to-19c-database-upgrade#viewer-b2cii 16/52
3/1/22, 1:04 PM Oracle 12c to 19c Database Upgrade

https://www.support.dbagenesis.com/post/oracle-12c-to-19c-database-upgrade#viewer-b2cii 17/52
3/1/22, 1:04 PM Oracle 12c to 19c Database Upgrade

https://www.support.dbagenesis.com/post/oracle-12c-to-19c-database-upgrade#viewer-b2cii 18/52
3/1/22, 1:04 PM Oracle 12c to 19c Database Upgrade

https://www.support.dbagenesis.com/post/oracle-12c-to-19c-database-upgrade#viewer-b2cii 19/52
3/1/22, 1:04 PM Oracle 12c to 19c Database Upgrade

https://www.support.dbagenesis.com/post/oracle-12c-to-19c-database-upgrade#viewer-b2cii 20/52
3/1/22, 1:04 PM Oracle 12c to 19c Database Upgrade

https://www.support.dbagenesis.com/post/oracle-12c-to-19c-database-upgrade#viewer-b2cii 21/52
3/1/22, 1:04 PM Oracle 12c to 19c Database Upgrade

https://www.support.dbagenesis.com/post/oracle-12c-to-19c-database-upgrade#viewer-b2cii 22/52
3/1/22, 1:04 PM Oracle 12c to 19c Database Upgrade

https://www.support.dbagenesis.com/post/oracle-12c-to-19c-database-upgrade#viewer-b2cii 23/52
3/1/22, 1:04 PM Oracle 12c to 19c Database Upgrade

https://www.support.dbagenesis.com/post/oracle-12c-to-19c-database-upgrade#viewer-b2cii 24/52
3/1/22, 1:04 PM Oracle 12c to 19c Database Upgrade

Database upgrade has been completed successfully, and the database is ready for use!

Post Upgrade Tasks

Verify /etc/oratab and check if ORACLE_HOME location has changed to 19c home

cat /etc/oratab | grep -i prod

Verify Timezone version

SQL> SELECT version FROM v$timezone_file;

https://www.support.dbagenesis.com/post/oracle-12c-to-19c-database-upgrade#viewer-b2cii 25/52
3/1/22, 1:04 PM Oracle 12c to 19c Database Upgrade

Verify INVALID objects

SQL> select count(1) from dba_objects where status='INVALID';

Verify DBA_REGISTRY

col COMP_ID for a10

col COMP_NAME for a40

col VERSION for a15

set lines 180

set pages 999

select COMP_ID,COMP_NAME,VERSION,STATUS from dba_registry;

Run postupgrade_fixups.sql, this script already ran by DBUA under the post-upgrade section. However, we have
executed it again

SQL> @/home/oracle/preupgrade/postupgrade_fixups.sq

https://www.support.dbagenesis.com/post/oracle-12c-to-19c-database-upgrade#viewer-b2cii 26/52
3/1/22, 1:04 PM Oracle 12c to 19c Database Upgrade

https://www.support.dbagenesis.com/post/oracle-12c-to-19c-database-upgrade#viewer-b2cii 27/52
3/1/22, 1:04 PM Oracle 12c to 19c Database Upgrade

Drop Restore point

col name for a20

col GUARANTEE_FLASHBACK_DATABASE for a10

col TIME for a60

set lines 190

https://www.support.dbagenesis.com/post/oracle-12c-to-19c-database-upgrade#viewer-b2cii 28/52
3/1/22, 1:04 PM Oracle 12c to 19c Database Upgrade

select NAME,GUARANTEE_FLASHBACK_DATABASE,TIME from V$restore_point;

SQL> drop restore point PRE_UPGRADE;

SQL> select NAME,GUARANTEE_FLASHBACK_DATABASE,TIME from


V$restore_point;

Update COMPATIBLE parameter

If the value of the COMPATIBLE parameter is changed to 19.0.0 then if for some reasons database needs to be
downgraded to 12.2.0.1 the DBA would not have any option other than export/import to downgrade the database.
But if this parameter is left unchanged for some time to see how the database performs after upgrade then it is
very easy and fast to downgrade the database if for some reason it is required to be downgraded.

Good practice - Change this parameter only after 1 month of


database upgrade!

SQL> show parameter COMPATIBLE

SQL> ALTER SYSTEM SET COMPATIBLE = '19.0.0' SCOPE=SPFILE;

SQL> shut immediate;

SQL> startup;

SQL> show parameter COMPATIBLE

SQL> select name,open_mode,version from v$database,v$instance;

https://www.support.dbagenesis.com/post/oracle-12c-to-19c-database-upgrade#viewer-b2cii 29/52
3/1/22, 1:04 PM Oracle 12c to 19c Database Upgrade

Upgrade using Manual Method

All the steps will be same until we fire DBUA in our previous upgrade method. Shutdown the database
https://www.support.dbagenesis.com/post/oracle-12c-to-19c-database-upgrade#viewer-b2cii 30/52
3/1/22, 1:04 PM Oracle 12c to 19c Database Upgrade

SQL> SELECT NAME,OPEN_MODE FROM V$DATABASE;

Copy init and password files from 12c to 19c dbs home

cd $ORACLE_HOME/dbs

ls -ltr

cp orapwprod spfileprod.ora /u01/app/oracle/product/19.3.0/db_home/dbs

ls -ltr /u01/app/oracle/product/19.3.0/db_home/dbs/

Startup DB in Upgrade mode from 19c home

export ORACLE_HOME=/u01/app/oracle/product/19.3.0/db_home

export ORACLE_SID=prod

sqlplus / as sysdba

SQL> startup upgrade;

https://www.support.dbagenesis.com/post/oracle-12c-to-19c-database-upgrade#viewer-b2cii 31/52
3/1/22, 1:04 PM Oracle 12c to 19c Database Upgrade

select name,open_mode,cdb,version,status from v$database, v$instance;

Run dbupgrade

cd /u01/app/oracle/product/19.3.0/db_home/bin

ls -ltr dbupgrade

nohup ./dbupgrade & --> Press enter 2 times

jobs -l

disown

ps -ef | grep -i catctl.pl

Monitor upgrade log

https://www.support.dbagenesis.com/post/oracle-12c-to-19c-database-upgrade#viewer-b2cii 32/52
3/1/22, 1:04 PM Oracle 12c to 19c Database Upgrade

cd /u01/app/oracle/product/19.3.0/db_home/bin

more nohup.out

cd
/u01/app/oracle/product/19.3.0/db_home/cfgtoollogs/prod/upgrade20210131
020428/

ls -ltr *.log

tail -f catupgrd0.log

tail -f catupgrd1.log

tail -f catupgrd2.log

tail -f catupgrd3.log

https://www.support.dbagenesis.com/post/oracle-12c-to-19c-database-upgrade#viewer-b2cii 33/52
3/1/22, 1:04 PM Oracle 12c to 19c Database Upgrade

Summary Report

Startup DB from 19c home

export ORACLE_HOME=/u01/app/oracle/product/19.3.0/db_home

export ORACLE_SID=prod

sqlplus / as sysdba

https://www.support.dbagenesis.com/post/oracle-12c-to-19c-database-upgrade#viewer-b2cii 34/52
3/1/22, 1:04 PM Oracle 12c to 19c Database Upgrade

startup;

select name,open_mode,cdb,version,status from v$database, v$instance;

col COMP_ID for a10

col COMP_NAME for a40

col VERSION for a15

set lines 180

set pages 999

select COMP_ID,COMP_NAME,VERSION,STATUS from dba_registry;

https://www.support.dbagenesis.com/post/oracle-12c-to-19c-database-upgrade#viewer-b2cii 35/52
3/1/22, 1:04 PM Oracle 12c to 19c Database Upgrade

Post Upgrade Steps

Run utlrp.sql, run catcon.pl to start utlrp.sql, and to recompile any remaining invalid objects

cd /u01/app/oracle/product/19.3.0/db_home/rdbms/admin/ nohup sqlplus "/


as sysdba" @utlrp.sql > /home/oracle/utlrp.out 2>&1 &

SQL> select count(*) from dba_objects where status='INVALID';

SQL> select count(*) from dba_objects where status='INVALID' and owner


in ('SYS','SYSTEM');

SQL> @/u01/app/oracle/product/19.3.0/db_home/rdbms/admin/utlrp.sql

https://www.support.dbagenesis.com/post/oracle-12c-to-19c-database-upgrade#viewer-b2cii 36/52
3/1/22, 1:04 PM Oracle 12c to 19c Database Upgrade

Use the following queries to track recompilation progress. Query returning the number of invalid objects
remaining. This number should decrease with time

SQL> SELECT COUNT(*) FROM obj$ WHERE status IN (4, 5, 6)

https://www.support.dbagenesis.com/post/oracle-12c-to-19c-database-upgrade#viewer-b2cii 37/52
3/1/22, 1:04 PM Oracle 12c to 19c Database Upgrade

https://www.support.dbagenesis.com/post/oracle-12c-to-19c-database-upgrade#viewer-b2cii 38/52
3/1/22, 1:04 PM Oracle 12c to 19c Database Upgrade

Run postupgrade_fixups.sql

@/home/oracle/preupgrade/postupgrade_fixups.sql

https://www.support.dbagenesis.com/post/oracle-12c-to-19c-database-upgrade#viewer-b2cii 39/52
3/1/22, 1:04 PM Oracle 12c to 19c Database Upgrade

https://www.support.dbagenesis.com/post/oracle-12c-to-19c-database-upgrade#viewer-b2cii 40/52
3/1/22, 1:04 PM Oracle 12c to 19c Database Upgrade

Upgrade Timezone file

SQL> SELECT version FROM v$timezone_file;

SQL>
@/u01/app/oracle/product/19.3.0/db_home/rdbms/admin/utltz_upg_check.sql

https://www.support.dbagenesis.com/post/oracle-12c-to-19c-database-upgrade#viewer-b2cii 41/52
3/1/22, 1:04 PM Oracle 12c to 19c Database Upgrade

SQL>
@/u01/app/oracle/product/19.3.0/db_home/rdbms/admin/utltz_upg_apply.sql

https://www.support.dbagenesis.com/post/oracle-12c-to-19c-database-upgrade#viewer-b2cii 42/52
3/1/22, 1:04 PM Oracle 12c to 19c Database Upgrade

SQL> SELECT version FROM v$timezone_file;


https://www.support.dbagenesis.com/post/oracle-12c-to-19c-database-upgrade#viewer-b2cii 43/52
3/1/22, 1:04 PM Oracle 12c to 19c Database Upgrade

Run utlusts.sql

SQL> @/u01/app/oracle/product/19.3.0/db_home/rdbms/admin/utlusts.sql
TEXT

Run catuppst.sql

https://www.support.dbagenesis.com/post/oracle-12c-to-19c-database-upgrade#viewer-b2cii 44/52
3/1/22, 1:04 PM Oracle 12c to 19c Database Upgrade

Do not run this in UPGRADE mode.

SQL> @/u01/app/oracle/product/19.3.0/db_home/rdbms/admin/catuppst.sql

https://www.support.dbagenesis.com/post/oracle-12c-to-19c-database-upgrade#viewer-b2cii 45/52
3/1/22, 1:04 PM Oracle 12c to 19c Database Upgrade

https://www.support.dbagenesis.com/post/oracle-12c-to-19c-database-upgrade#viewer-b2cii 46/52
3/1/22, 1:04 PM Oracle 12c to 19c Database Upgrade

Re-Run postupgrade_fixups.sql

@/home/oracle/preupgrade/postupgrade_fixups.sql

https://www.support.dbagenesis.com/post/oracle-12c-to-19c-database-upgrade#viewer-b2cii 47/52
3/1/22, 1:04 PM Oracle 12c to 19c Database Upgrade

Reverify INVALID OBJECTS

SQL> select count(*) from dba_objects where status='INVALID';

Drop Restore point

SQL> col name for a20

col GUARANTEE_FLASHBACK_DATABASE for a10

col TIME for a60

https://www.support.dbagenesis.com/post/oracle-12c-to-19c-database-upgrade#viewer-b2cii 48/52
3/1/22, 1:04 PM Oracle 12c to 19c Database Upgrade

set lines 190

select NAME,GUARANTEE_FLASHBACK_DATABASE,TIME from V$restore_point;

SQL> drop restore point PRE_UPGRADE;

SQL> select NAME,GUARANTEE_FLASHBACK_DATABASE,TIME from


V$restore_point;

Set COMPATIBLE parameter value to 19.0.0

SQL> show parameter COMPATIBLE

SQL> ALTER SYSTEM SET COMPATIBLE = '19.0.0' SCOPE=SPFILE;

SQL> shut immediate;

SQL> startup;

SQL> show parameter COMPATIBLE

https://www.support.dbagenesis.com/post/oracle-12c-to-19c-database-upgrade#viewer-b2cii 49/52
3/1/22, 1:04 PM Oracle 12c to 19c Database Upgrade

Verify DBA_REGISTRY

SQL> col COMP_ID for a10

col COMP_NAME for a40

col VERSION for a15

set lines 180

set pages 999

select COMP_ID,COMP_NAME,VERSION,STATUS from dba_registry;

https://www.support.dbagenesis.com/post/oracle-12c-to-19c-database-upgrade#viewer-b2cii 50/52
3/1/22, 1:04 PM Oracle 12c to 19c Database Upgrade

Edit oratab

cat /etc/oratab | grep -i prod

vi /etc/oratab

Done!

https://www.support.dbagenesis.com/post/oracle-12c-to-19c-database-upgrade#viewer-b2cii 51/52
3/1/22, 1:04 PM Oracle 12c to 19c Database Upgrade

https://www.support.dbagenesis.com/post/oracle-12c-to-19c-database-upgrade#viewer-b2cii 52/52

You might also like