Вы находитесь на странице: 1из 18

19c

1 Scope

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).

1.1 System Configuration

Operation System Red Hat Linux 7.7


Server orctestcomp
Database CUCDEV
Source Database Version 12c (12.1.0.2)
Target Database Version 19.0.0.0.0
Database Name CUCDEV
Oracle Edition Enterprise
Environment AWS Cloud
Database Size 400 GB
Duration for db upgrade 2 hours

1.2 Upgrade Requirements

Before staring the upgrade need to ensure the below requirements are met.

1.Oracle Binary software installation


2.OLS and DBVault disable
3.Check for the backup
4.Put server on maintenance mode to avoid alert during change window.
5. Check Size of database
6.Special instruction
7. Apply latest Patch
8.Collect list components list
9.Space - File system and /var/tmp

2 Upgrade Path for 19c Oracle Database

2
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.

2.1 Minimum version of the database that can be directly upgraded to Oracle 19c

Upgrade Matrix
Source Target
11.2.0.4 19c
12.1.0.2 19c
12.2.0.1 19c
18.1 19c

2.2 Intermediate upgrades need to be carried for following releases

Indirect Upgrade Matrix


Source Database Intermediate upgrade path Target database
12.1.0.1 --> 12.1.0.2/12.2.0.1 --> 19c
11.2.0.1/11.2.0.2/11.2.0.3 --> 11.2.0.4 --> 19c
11.1.0.6/11.1.0.7 --> 11.2.0.4 --> 19c
10.2.0.2, 10.2.0.3, 10.2.0.4, 10.2.0.5 --> 11.2.0.4/12.1.0.2 --> 19c
10.1.0.5 --> 11.2.0.4/12.1.0.2 --> 19c
9.2.0.8 or earlier --> 11.2.0.4 --> 19c

Desupport of Oracle Multimedia


Oracle Multimedia is desupported in Oracle Database 19c, and the implementation is removed.

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.

2.3 Requirements and recommendations for source database

 Take a cold or hot back up of the source database.


 Disable any custom triggers that would get executed before / after DDL. You can enable it once upgrade is
completed.
 Data security roles defined in a release 11g Oracle Database instance are not automatically converted to ORAS.
Before you upgrade an 11g database to Oracle Database 19c, you must delete any data security roles that are
defined in the 11g database. After the upgrade, you may use Analytic Workspace Manager 19c to define the data

3
security roles again.
 If you upgrade an 11g database to Oracle Database 19c without deleting the 11g data security roles, then any data
security policies that include a data security role are invalid in the Oracle Database 19c database.
 If your source version's time zone is already higher than the destination's home, then apply the matching or any
higher time zone patch to your destination home before upgrade. For latest DST patch refer to Note 412160.1
 IF APEX is installed then it is recommended to upgrade APEX in the source DB first before upgrading DB. Refer
to Note 1088970.1
 No INVALID object / Components in Source
 Execute Preupgrade scripts before upgrade and review the preupgrade log for any issues.
 Execute dbupgdiag.sql (refer Note 556610.1 to download this script) and verify whether there are any INVALID
components or objects owned by SYS/SYSTEM. If any, fix them before proceeding to upgrade the database. You
can execute utlrp.sql multiple times to VALIDate them, if still objects are INVALID, create a service request with
Oracle support.

2.3.1 Pre-upgrade checks

2.3.1.1 Clean up database:

Empty the recycle bin


Check for INVALID objects in SYS and SYSTEM
Check for duplicate objects in SYS and SYSTEM
Check for INVALID, mandatory, obsolete components

Execute Pre-upgrade script from source home:

/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/

FILE - Use this option to direct output to a file


TEXT - Use this option to specify log should be in Text format (other option is to have XML output)
DIR - Logs will be created under <output_dir>

The below 3 Logfile generated on the mentioned location:

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
-------------------------------
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.

SQL> alter database backup controlfile to trace as '/location/filename/Ctrl_date.txt'

Active sessions and user:


---------------------------------

SELECT username, status, logon_time

4
FROM v$session
WHERE status = 'ACTIVE'

-- To check what he running


select a.sid, a.serial#, b.sql_text
from v$session a, v$sqlarea b
where a.sql_address=b.address
and a.username='';

Check for the OS Components


--------------------------------------

SQL>select parameter,value from v$option;

opatch lsinventory details. -- For safety get the list of all installed patches
----------------------------------
$hostname
$cd $ORACLE_HOME/OPatch
$ls -ltr
$./opatch lsinventory

Check timezone details


------------------------------

SQL> conn / as sysdba


Connected.
SQL>SELECT version FROM v$timezone_file;

VERSION
----------
18

Note
-------
If version is 32 then leave as it is. If its lower than 18 then follow post upgrade step.

Check the value of Compatibility parameter:


-----------------------------------------------------

SQL> SELECT name, value FROM v$parameter


WHERE name = 'compatible';

-- Leave as it is.No need to change before upgrade.

Backup and recovery mode:


-----------------------------------

Make sure no files need media recovery and no files are in backup mode.

$export ORACLE_SID=SID
$export ORACLE_HOME=OLDHOME

5
$echo $ORACLE_SID
$echo $ORACLE_HOME
$sqlplus '/as sysdba'

SQL>SELECT * FROM v$recover_file;

SQL>SELECT * FROM v$backup WHERE status != 'NOT ACTIVE';

Check any standby database exists:


--------------------------------------------

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%';

It should not return any rows.

Check default tablespace for sys and system


---------------------------------------------------

SQL> SELECT username, default_tablespace FROM dba_users WHERE username in ('SYS','SYSTEM');

if its other than system tablespace follow components invalid document.

Table no logging:
----------------------

select OWNER,TABLE_NAME,LOGGING from dba_tables where LOGGING='NO';

Check whether aud$ table exists and using system tablespace:


----------------------------------------------------------------------------

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.

Check for dependencies:


-------------------------------

SELECT * FROM DBA_DEPENDENCIES


WHERE referenced_name IN ('UTL_TCP','UTL_SMTP','UTL_MAIL','UTL_HTTP','UTL_
INADDR','DBMS_LDAP') AND owner NOT IN ('SYS','PUBLIC','ORDPLUGINS');

ACL backup (Copy the output and save):

6
--------------------------------------------------

SQL>select * from v$instance;


SQL>set serveroutput on

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')||''','
TZR'')') START_DATE,
decode(END_DATE,null,'null','to_timestamp_tz('''||to_char(END_DATE,'YYYYMMDDHH24MISSXFFTZR'||''',''YYYY
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;
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 ;

for rec2 in (select


HOST,decode(LOWER_PORT,null,'null',to_char(LOWER_PORT))LOWER_PORT,decode(UPPER_PORT,null,'null',to
from dba_network_acls
where acl = i.acl and ACLID= i.aclid) loop
v_param_list:='acl=>'''||substr(rec2.acl,instr(rec2.acl,'/',-

7
1)+1)||''',host=>'''||rec2.host||''',lower_port=>'||rec2.lower_port||',upper_port=>'||rec2.upper_port||');';
dbms_output.put_line('exec
DBMS_NETWORK_ACL_ADMIN.ASSIGN_ACL('||v_param_list);
end loop;
end loop;
end;
/
SQL>spool off

MDSYS object should not be in other schemas:


---------------------------------------------------------

SQL>SELECT OBJECT_NAME,OBJECT_TYPE,OWNER FROM DBA_OBJECTS WHERE OBJECT_NAME in


(Select OBJECT_NAME from DBA_OBJECTS where owner='MDSYS') and owner not
in('MDSYS','PUBLIC');

If it return any row run the below. -- Check notes once before process

select 'drop java class '||owner||'."'||object_name||'";' from DBA_OBJECTS WHERE OBJECT_NAME in


(Select OBJECT_NAME from DBA_OBJECTS where owner='MDSYS') and owner not
in('MDSYS','PUBLIC');

Resolving Outstanding Distributed Transactions:


------------------------------------------------------------

You must resolve outstanding distributed transactions before performing the upgrade.

SQL> SELECT * FROM dba_2pc_pending;

If returns any row follow components invalid document.

Check for Duplicate object in sys and system.


-------------------------------------------------------

column object_name format a30


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';

Following objects duplicate can be ignored.


------------------------------ -------------------
AQ$_SCHEDULES TABLE
AQ$_SCHEDULES_PRIMARY INDEX
DBMS_REPCAT_AUTH PACKAGE
DBMS_REPCAT_AUTH PACKAGE BODY

8
Check for Hidden & deprecated paramters:
------------------------------------------------------

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';

SELECT name FROM v$parameter WHERE isdeprecated = 'TRUE';

Check for Trace events :


================

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
-------------------------

MV should not be running while upgrade.Check whether any mv in progress.

SQL> select distinct(trunc(last_refresh)) from dba_snapshot_refresh_times;

SQL> select s.obj#,o.obj#,s.containerobj#,lastrefreshdate,pflags,xpflags,o.name,o.owner#,


bitand(s.mflags, 8)
from obj$ o, sum$ s
where o.obj# = s.obj# and o.type# = 42 AND bitand(s.mflags, 8) = 8;

(or)

SQL> SELECT FROM sys.obj$ o, sys.user$ u, sys.sum$ s


WHERE o.type# = 42 AND bitand(s.mflags, 8) = 8;

Check Whether XDB objects need to be dropped


-----------------------------------------------------------

Note: If XDB_INSTALLATION_TRIGGER exist data loss will happen.

sqlplus '/as sysdba'

SQL>set serveroutput on

DECLARE
v_xdb_installation_trigger number;
v_dropped_xdb_instll_trigger number;
v_dropped_xdb_instll_tab number;

9
BEGIN
select count(*) into v_xdb_installation_trigger
from dba_triggers
where trigger_name = 'XDB_INSTALLATION_TRIGGER' and owner = 'SYS';

select count(*) into v_dropped_xdb_instll_trigger


from dba_triggers
where trigger_name = 'DROPPED_XDB_TRIGGER' and owner = 'SYS';

select count(*) into V_dropped_xdb_instll_tab


from dba_tables
where table_name = 'DROPPED_XDB_INSTLL_TAB' and owner = 'SYS';

IF v_xdb_installation_trigger > 0 OR v_dropped_xdb_instll_trigger > 0 OR v_dropped_xdb_instll_tab


> 0 then

IF v_xdb_installation_trigger > 0 THEN

dbms_output.put_line('Please proceed to run the command SQL> drop trigger


sys.xdb_installation_trigger');
-- drop trigger sys.xdb_installation_trigger;
END IF;

IF v_dropped_xdb_instll_trigger > 0 THEN


dbms_output.put_line('Please proceed to run the command SQL> drop trigger
sys.dropped_xdb_instll_trigger');
-- drop trigger sys.dropped_xdb_instll_trigger;
END IF;

IF v_dropped_xdb_instll_tab > 0 THEN


dbms_output.put_line('Please proceed to run the command SQL> drop table
sys.dropped_xdb_instll_tab');
-- drop table sys.dropped_xdb_instll_tab;
END IF;

ELSE
dbms_output.put_line('Please proceed to run the XDB install or upgrade. No objects need to be
dropped');

END IF;

END;
/

Take invalid objects list.


-------------------------------

ps -ef|grep smon
echo $ORACLE_SID
echo $ORACLE_HOME
$sqlplus '/as sysdba'
SQL>select * from v$instance;

10
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;

get the invalid objects list again

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

Note:
-----

Identifying Invalid Objects

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 for the Invalid Components:


------------------------------------------

SQL>select comp_name,VERSION,status from dba_registry

Backup oracle home and db files,redo logfile,archive logfile,controlfile as trace

11
----------------------------------------------------------------------------------------

Check the Scn no and archive log file last generated.For safety take control file trace backup.

SQL>select to_char(current_scn) FROM V$DATABASE;

SQL>alter system archive log current;


SQL>alter system archive log current;
SQL>alter system archive log current;

SQL>select max(sequence#) from v$archived_log;

DBSIZE:
----------

select sum(bytes/1024/1024/1024) from dba_segments;


select sum(bytes/1024/1024/1024) from dba_data_files;
select sum(bytes/1024/1024/1024) from dba_free_space;

Physical file locations:


---------------------------

select name from v$datafile;


select select member from v$logfile;
select select name from v$controlfile;
select select name from v$tempfile;

Purge Recyclebin:
----------------------

SQL> purge dba_recyclebin

Gather statistics
---------------------------

Oracle recommends collecting statistics the night before starting the upgrade to decrease the amount
of downtime

$ sqlplus "/as sysdba"


SQL> EXEC DBMS_STATS.GATHER_DICTIONARY_STATS;

Down Time starts Here:


-----------------------------

Make sure you have the pfile backed up.

Shutdown the database.

Before that note down the previous values;

12
show parameter shared_pool_size;
show parameter java_pool_size;
show parameter sga_target;
show parameter sga_max;
show parameter memory;
show parameter job_queue_processes;
show parameter cluster;
show parameter pga;
show parameter spfile;

start the database in pfile.

SQL> startup pfile='/path/pfile'

SQL>

show parameter shared_pool_size;


show parameter java_pool_size;
show parameter sga_target;
show parameter sga_max;
show parameter memory;
show parameter job_queue_processes;
show parameter cluster;
show parameter spfile;
archive log list;

Change database to no archive log mode:


---------------------------------------------------

$export ORACLE_SID=SID
$export ORACLE_HOME=OLDHOME
$echo $ORACLE_SID
$echo $ORACLE_HOME

$sqlplus '/as sysdba'


SQL>archive log list;
SQL>shutdown immediate;

SQL>startup mount pfile='/Path/Initdbname.ora';


SQL>alter database noarchivelog;
SQL>alter database open;
SQL>archive log list;

Bounce the db and check the values again

ShutDown the database


------------------------------

ps -ef|grep smon

13
$export ORACLE_SID=SID
$export ORACLE_HOME=OLDHOME
echo $ORACLE_SID
echo $ORACLE_HOME
$sqlplus '/as sysdba'
SQL>Shutdown immediate;

Step:Check for any cronjobs and oratab


---------------------------------------

Login to the oracle user and disable database releated job in the cron jobs.

$crontab -l
$crontab -e

cat /etc/oratab

PART 2: Upgradation Process:


============================
After complete all the pre upgradation tool recommendation follow the below steps:

Everything should point new oracle_home

go to new oracle home,

echo $ORACLE_SID
echo $ORACLE_HOME
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'

$ sqlplus '/ as sysdba'


SQL> startup UPGRADE pfile='/newlocation/newinitsid.ora'
SQL>select * from v$instance;
SQL>exit

cd $ORACLE_HOME/bin

nohup sh dbupgrade &

Based on Oracle component upgrade will take couple of hours. Need to monitor upgrade logfile and
alert log file during DB upgrade window.

Note: In 19c Earlier version utluNNNs.sql is replaced by utlusts.sql

14
$ sqlplus "/as sysdba"
SQL> STARTUP
SQL> @?/rdbms/admin/utlusts.sql;

Recompile INVALID Objects


Execute utlrp.sql multiple times till the number of INVALID objects becomes constant

$ sqlplus "/ AS SYSDBA"


SQL> @Oracle_home/rdbms/admin/utlrp.sql;

Post-upgrade fixup script:

Execute post-upgrade fixup scripts generated by the pre-upgrade script.

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

APEX component upgrade:

Kindly execute the below apex verification script in 19c database.

APEX Installation Verification Script (Doc ID 1254932.1)

15
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.

Latest APEX 19.2.x from OTN: http://www.oracle.com/technetwork/developer-tools/apex/downloads/index.html

Download APEX 19.2 All language Software.

Note: Incase Apex workspace ID more than 5 digit please follow the document then proceed apex upgradation.

Install APEX as per the install guide https://docs.oracle.com/en/database/oracle/application-express/19.2/htmig/installing-AE-and-configuring-


Oracle-REST-data-services.html#GUID-8EE981AD-B1F9-46C2-BB5A-C9FE60CCD4AA

Post Step : Take invalid objects list.


-----------------------------------

ps -ef|grep smon
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

Recompile the invalid objects;


------------------------------
$ cd $ORACLE_HOME/rdbms/admin
$ sqlplus "/ as sysdba"
SQL> @$ORACLE_HOME/rdbms/admin/utlrp.sql;

16
Post:Check Components status
---------------------------

select COMP_NAME,VERSION,STATUS from dba_registry;


select parameter,value from v$option;

Step : Change database to archive log mode


----------------------------------------------

$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;

Post: Compatibility parameter (Careful while doing this)


-----------------------------
SQL> SELECT name, value FROM v$parameter
WHERE name = 'compatible';

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

Bounce the db once.

Post : Revert back the Cron jobs and oratab


-------------------------------------------

crontab -e

cat /etc/oratab

17
After complete DB upgrade need to enable Maintenance mode and hand Over database to application team for
testing purpose.

18

Вам также может понравиться