Database Upgrade From 12c To 19c
Database Upgrade From 12c To 19c
Content AreaArea
Content
Content
AreaArea
Content
Content
AreaArea
Content
Content
AreaArea
VERTICALS
Grow Digital >>
Shrink IT <<
Content Area Content Area Content Area
The scope of this document is to provide the technical steps/activities to do the 19c upgrade
from lower version of Oracle 12c.
This document will suit for 19c upgrade from 12c release (only).
2 System Configuration
Server orctestcomp
Database CUCDEV
Before staring the upgrade need to ensure the below requirements are met.
2
3
3 Upgrade Path for 19c Oracle Database
Following are the possible upgrade path which need to be checked before upgrading to 19c. Its
strongly suggested to follow the intermediate upgrade patch if source and target not possible in direct
method.
Upgrade Matrix
Source Target
11.2.0.4 19c
12.1.0.2 19c
12.2.0.1 19c
18.1 19c
As an alternative for image processing and conversion, Oracle recommends that you store multimedia content in
SecureFiles LOBs, and use third party products, such as Piction. The ORDIM component remains in the registry and still
has a VALID status. Oracle Multimedia objects and packages remain in the database. However, these objects and
packages no longer function, and raise exceptions if there is an attempt made to use them. Oracle Locator is not affected
by the desupport of Oracle Multimedia.
4
6 Requirements and recommendations for source
database
/opt/app/oracle/product/12.1.0.2/db_1/jdk/bin/java -jar
/opt/app/oracle/product/19.3/db_1/rdbms/admin/preupgrade.jar FILE DIR /opt/app/oracle/product/
PREUPGRADE SUMMARY
==================
/opt/app/oracle/product/preupgrade.log
/opt/app/oracle/product/preupgrade_fixups.sql
/opt/app/oracle/product/postupgrade_fixups.sql
Check the preupgrade.log and Run the preupgrade_fixups.sql check for any manual action required.
Create pfile from spfile (backup the oldspfile) -- Keep it safe
-------------------------------
5
SQL>create pfile='/PATH/initdbname.ora' from spfile. -- Copy the pfile immediately
If you dont mention path then go to the $ORACLE_HOME/dbs and rename(backup) the pfile.
opatch lsinventory details. -- For safety get the list of all installed patches
----------------------------------
$hostname
$cd $ORACLE_HOME/OPatch
$ls -ltr
$./opatch lsinventory
VERSION
----------
18
Note
-------
If version is 32 then leave as it is. If its lower than 18 then follow post upgrade step.
6
-- Leave as it is.No need to change before upgrade.
Make sure no files need media recovery and no files are in backup mode.
$export ORACLE_SID=SID
$export ORACLE_HOME=OLDHOME
$echo $ORACLE_SID
$echo $ORACLE_HOME
$sqlplus '/as sysdba'
SQL>SELECT SUBSTR(value,INSTR(value,'=',INSTR(UPPER(value),'SERVICE'))+1)
FROM v$parameter
WHERE name LIKE 'log_archive_dest%' AND UPPER(value) LIKE 'SERVICE%';
Table no logging:
----------------------
SQL>SELECT owner,tablespace_name
FROM dba_tables
WHERE table_name='AUD$';
Note: If the AUD$ table exists and is in use, upgrade performance can be effected depending on the
number of records in the table.
7
Check for dependencies:
-------------------------------
declare
v_param_list varchar2(2000);
cursor rec_c ( i_ACLID dba_network_acl_privileges.ACLID%type, i_ACL
dba_network_acl_privileges.ACL%type ) is
select rownum POSITION ,
ACL,
PRINCIPAL,
decode(privilege,'use-cli','use-client-certificates','use-pas','use-passwords',privilege) PRIVILEGE,
IS_GRANT,INVERT,
decode(START_DATE,null,'null','to_timestamp_tz('''||
to_char(START_DATE,'YYYYMMDDHH24MISSXFFTZR')||''',''YYYYMMDDHH24MISSXFF TZR'')')
START_DATE,
decode(END_DATE,null,'null','to_timestamp_tz('''||
to_char(END_DATE,'YYYYMMDDHH24MISSXFFTZR'||''',''YYYYMMDDHH24MISSXFF TZR'')')) END_DATE
from dba_network_acl_privileges a
where a.ACLID = i_ACLID and a.ACL = i_ACL ;
rec rec_c%rowtype ;
begin
for i in ( select distinct ACLID,ACL from dba_network_acl_privileges ) loop
open rec_c ( i.ACLID , i.acl ) ;
fetch rec_c into rec;
v_param_list:='acl=>'''||substr(rec.acl,instr(rec.acl,'/',-1)+1)||'''';
v_param_list:=v_param_list||',description=>'''||substr(rec.acl,11,length(rec.acl))||'''';
v_param_list:=v_param_list||',principal=>'''||rec.principal||'''';
v_param_list:=v_param_list||',privilege=>'''||rec.privilege||'''';
v_param_list:=v_param_list||',is_grant=>'||rec.is_grant;
v_param_list:=v_param_list||',start_date=>'||rec.END_DATE;
v_param_list:=v_param_list||',end_date=>'||rec.END_DATE||');';
dbms_output.put_line('exec dbms_network_acl_admin.create_acl('||v_param_list);
-- fetch rec_c into rec ; NOT FETCHING HERE TO AVOID DUPLICATES
while rec_c%FOUND loop
v_param_list:='acl=>'''||substr(rec.acl,instr(rec.acl,'/',-1)+1)||'''';
v_param_list:=v_param_list||',principal=>'''||rec.principal||'''';
v_param_list:=v_param_list||',is_grant=>'||rec.is_grant;
8
v_param_list:=v_param_list||',privilege=>'''||rec.privilege||'''';
v_param_list:=v_param_list||',position=>'||rec.POSITION;
v_param_list:=v_param_list||',start_date=>'||rec.END_DATE;
v_param_list:=v_param_list||',end_date=>'||rec.END_DATE||');';
dbms_output.put_line('exec DBMS_NETWORK_ACL_ADMIN.ADD_PRIVILEGE('||v_param_list);
fetch rec_c into rec ;
end loop;
close rec_c ;
If it return any row run the below. -- Check notes once before process
You must resolve outstanding distributed transactions before performing the upgrade.
9
select object_name, object_type
from dba_objects
where object_name||object_type in
(select object_name||object_type
from dba_objects
where owner = 'SYS')
and owner = 'SYSTEM';
Note: If any hidden parameter in parameter file you comment after DB upgrade then uncomment it
SQL>select name from sys.V$PARAMETER where name like '\_%' escape '\' and ISDEFAULT='FALSE';
Events:
SELECT (translate(value,chr(13)||chr(10),' ')) FROM sys.v$parameter2
WHERE UPPER(name) ='EVENT' AND isdefault='FALSE'
Trace Events:
SELECT (translate(value,chr(13)||chr(10),' ')) from sys.v$parameter2
WHERE UPPER(name) = '_TRACE_EVENTS' AND isdefault='FALSE'
Materialized views
-------------------------
(or)
10
SQL> SELECT FROM sys.obj$ o, sys.user$ u, sys.sum$ s
WHERE o.type# = 42 AND bitand(s.mflags, 8) = 8;
SQL>set serveroutput on
DECLARE
v_xdb_installation_trigger number;
v_dropped_xdb_instll_trigger number;
v_dropped_xdb_instll_tab number;
BEGIN
select count(*) into v_xdb_installation_trigger
from dba_triggers
where trigger_name = 'XDB_INSTALLATION_TRIGGER' and owner = 'SYS';
11
ELSE
dbms_output.put_line('Please proceed to run the XDB install or upgrade. No objects need to be
dropped');
END IF;
END;
/
ps -ef|grep smon
echo $ORACLE_SID
echo $ORACLE_HOME
$sqlplus '/as sysdba'
SQL>select * from v$instance;
SQL>spool invalid_objects_before_upgrade_on_20Feb16.log
SQL>set lines 150
set pages 100
COLUMN object_name FORMAT A50
SELECT owner,
object_type,
object_name,
status
FROM dba_objects
WHERE status = 'INVALID'
ORDER BY owner, object_type, object_name;
SQL>spool off
$ cd $ORACLE_HOME/rdbms/admin
$ sqlplus "/ as sysdba"
SQL> @$ORACLE_HOME/rdbms/admin/utlrp.sql;
SQL>spool invalid_objects_before1_date.log
SQL>set lines 150
set pages 100
COLUMN object_name FORMAT A50
SELECT owner,
object_type,
object_name,
status
FROM dba_objects
WHERE status = 'INVALID'
ORDER BY owner, object_type, object_name;
SQL>spool off
12
Note:
-----
Any invalid SYS/SYSTEM objects found before upgrading the database are stored in the table named
registry$sys_inv_objs. Any invalid non-SYS/SYSTEM objects found before upgrading the database are
stored in registry$nonsys_inv_objs.
Check the Scn no and archive log file last generated.For safety take control file trace backup.
DBSIZE:
----------
Purge Recyclebin:
----------------------
13
Gather statistics
---------------------------
Oracle recommends collecting statistics the night before starting the upgrade to decrease the amount
of downtime
SQL>
$export ORACLE_SID=SID
14
$export ORACLE_HOME=OLDHOME
$echo $ORACLE_SID
$echo $ORACLE_HOME
ps -ef|grep smon
$export ORACLE_SID=SID
$export ORACLE_HOME=OLDHOME
echo $ORACLE_SID
echo $ORACLE_HOME
$sqlplus '/as sysdba'
SQL>Shutdown immediate;
Login to the oracle user and disable database releated job in the cron jobs.
$crontab -l
$crontab -e
cat /etc/oratab
echo $ORACLE_SID
echo $ORACLE_HOME
15
echo $PATH
echo $LD_LIBRARY_PATH
echo $ORA_NLS10
$env
go to new oracle home location and start the database in upgrade mode with 'new pfile'
cd $ORACLE_HOME/bin
Based on Oracle component upgrade will take couple of hours. Need to monitor upgrade logfile and
alert log file during DB upgrade window.
Sql>@/opt/app/oracle/product/postupgrade_fixups.sql;
Upgrade the Time Zone File Version After Upgrading Oracle Database:
Please go throw the below link for time zone upgradation from 18 to 32 version.
https://oracle-base.com/articles/misc/update-database-time-zone-file#check-current-timezone-version
16
Kindly execute the below apex verification script in 19c database.
Apex_verification.sq Sample_Apex_verify
l.txt _output.html
Oracle saying Workspace ID is less than 5 digits is not required to upgrade apex components.
Note: Incase Apex workspace ID more than 5 digit please follow the document then proceed apex upgradation.
ps -ef|grep smon
17
echo $ORACLE_SID
echo $ORACLE_HOME
$sqlplus '/as sysdba'
SQL>select * from v$instance;
SQL>spool invalid_objects_after_20Feb16.log
SQL>set lines 150
set pages 100
COLUMN object_name FORMAT A50
SELECT owner,
object_type,
object_name,
status
FROM dba_objects
WHERE status = 'INVALID'
ORDER BY owner, object_type, object_name;
SQL>spool off
$export ORACLE_SID=SID
$export ORACLE_HOME=NewHOME
$echo $ORACLE_SID
$echo $ORACLE_HOME
$sqlplus '/as sysdba'
SQL>archive log list;
SQL>shutdown immediate;
SQL>startup mount;
SQL>alter database archivelog;
SQL>alter database open;
SQL>archive log list;
SQL>alter system archive log current;
18
SQL> ALTER SYSTEM SET COMPATIBLE = '19.0.0' SCOPE=SPFILE;
crontab -e
cat /etc/oratab
After complete DB upgrade need to enable Maintenance mode and hand Over database to application team for
testing purpose.
19