Skip to content

Posts from the ‘upgrade’ Category

Oracle XML Database Invalid After 19c

Problem Summary
—————————————————
Oracle XML Database invalid after 19c

Problem Description
—————————————————

COMP_NAME VERSION STATUS
———————————————— —————————— ———–
Oracle XML Database 19.0.0.0.0 INVALID
Oracle Real Application Clusters 19.0.0.0.0 OPTION OFF
Oracle Database Catalog Views 19.0.0.0.0 UPGRADED
Oracle Database Packages and Types 19.0.0.0.0 UPGRADED

4 rows selected.

18:28:05 SQL> select owner, object_name, object_type, status
from dba_objects
where status = ‘INVALID’ and owner=’SYS’
order by owner, object_name;18:28:34 2 18:28:34 3 18:28:34 4

OWNER OBJECT_NAME OBJECT_TYPE STATUS
——————————————————————————————————————————– ——————————————————————————————————————————– ———————– ——-
SYS PREVENT_REPLTABS_CHANGE_V4 TRIGGER INVALID
SYS X_$KGLCURSOR VIEW INVALID

2 rows selected.

Elapsed: 00:00:00.02
18:28:35 SQL>

CHANGES

CAUSE

XDB related package bodies and other objects where invalid
 
XDB related package bodies and other objects where invalid

XDB                  DBMS_CLOBUTIL                  PACKAGE BODY         INVALID                                                                                                                        
XDB                  DBMS_CSX_ADMIN                 PACKAGE BODY         INVALID                                                                                                                        
XDB                  DBMS_CSX_INT2                  PACKAGE BODY         INVALID                                                                                                                        
XDB                  DBMS_JSON                      PACKAGE BODY         INVALID                                                                                                                        
XDB                  DBMS_JSON_INT                  PACKAGE              INVALID                                                                                                                        
XDB                  DBMS_JSON_INT                  PACKAGE BODY         INVALID                                                                                                                        
XDB                  DBMS_SODA_ADMIN                PACKAGE BODY         INVALID                                                                                                                        
XDB                  DBMS_SODA_DML                  PACKAGE              INVALID                                                                                                                        
XDB                  DBMS_SODA_DML                  PACKAGE BODY         INVALID                                                                                                                        
XDB                  DBMS_SODA_DOM                  PACKAGE BODY         INVALID                                                                                                                        
XDB                  DBMS_SODA_USER_ADMIN           PACKAGE BODY         INVALID                                                                                                                        
XDB                  DBMS_SODA_USER_DML             PACKAGE              INVALID                                                                                                                        
XDB                  DBMS_SODA_USER_DML             PACKAGE BODY         INVALID                                                                                                                        
XDB                  DBMS_XDB                       PACKAGE BODY         INVALID                                                                                                                        
XDB                  DBMS_XDBNFS                    PACKAGE BODY         INVALID                                                                                                                        
XDB                  DBMS_XDBREPOS                  PACKAGE BODY         INVALID                                                                                                                        
XDB                  DBMS_XDBRESOURCE               PACKAGE BODY         INVALID                                                                                                                        
XDB                  DBMS_XDBUTIL_INT               PACKAGE BODY         INVALID                                                                                                                        
XDB                  DBMS_XDBZ0                     PACKAGE BODY         INVALID                                                                                                                        
XDB                  DBMS_XDB_ADMIN                 PACKAGE BODY         INVALID                                                                                                                        
XDB                  DBMS_XDB_CONFIG                PACKAGE BODY         INVALID                                                                                                                        
XDB                  DBMS_XDB_CONSTANTS             PACKAGE BODY         INVALID                                                                                                                        
XDB                  DBMS_XDB_CONTENT               PACKAGE BODY         INVALID                                                                                                                                                                                                                                 
XDB                  DBMS_XDB_PRINT                 PACKAGE BODY         INVALID                                                                                                                        
XDB                  DBMS_XDB_REPOS                 PACKAGE BODY         INVALID                                                                                                                        
XDB                  DBMS_XEVENT                    PACKAGE BODY         INVALID                                                                                                                        
XDB                  DBMS_XLSB                      PACKAGE BODY         INVALID                                                                                                                        
XDB                  DBMS_XMLDOM                    PACKAGE BODY         INVALID                                                                                                                        
XDB                  DBMS_XMLDOM_ICD                PACKAGE              INVALID                                                                                                                        
XDB                  DBMS_XMLINDEX                  PACKAGE BODY         INVALID                                                                                                                        
XDB                  DBMS_XMLINDEX0                 PACKAGE BODY         INVALID                                                                                                                        
XDB                  DBMS_XMLPARSER                 PACKAGE BODY         INVALID                                                                                                                        
XDB                  DBMS_XMLSCHEMA_ANNOTATE        PACKAGE BODY         INVALID                                                                                                                        
XDB                  DBMS_XMLSCHEMA_LSB             PACKAGE BODY         INVALID                                                                                                                        
XDB                  DBMS_XMLSTORAGE_MANAGE         PACKAGE BODY         INVALID                                                                                                                        
XDB                  DBMS_XMLTRANSLATIONS           PACKAGE BODY         INVALID                                                                                                                        
XDB                  DBMS_XSLPROCESSOR              PACKAGE BODY         INVALID                                                                                                                        
XDB                  DEPTH                          OPERATOR             INVALID                                                                                                                        
XDB                  GET_XDB_TABLESPACE             FUNCTION             INVALID                                                                                                                        
XDB                  PATH                           OPERATOR             INVALID                                                                                                                        
XDB                  PRVT_DBMS_MANAGE_XMLSTORAGE    PACKAGE BODY         INVALID                                                                                                                        
XDB                  UNDER_PATH_FUNC                FUNCTION             INVALID                                                                                                                        
XDB                  XDB_ANCOP                      PACKAGE BODY         INVALID                                                                                                                        
XDB                  XDB_DLTRIG_PKG                 PACKAGE BODY         INVALID                                                                                                                        
XDB                  XDB_PV_TRIG                    TRIGGER              INVALID                                                                                                                        
XDB                  XDB_RVTRIG_PKG                 PACKAGE BODY         INVALID                                                                                                                        
XDB                  XDB_RV_TRIG                    TRIGGER              INVALID     
.

 

SOLUTION

COMPILE the invalid procedures and other objects manually

STEP _ 1 :-
——————

conn / as sysdba

ALTER PACKAGE XDB.DBMS_CLOBUTIL COMPILE BODY ;
ALTER PACKAGE XDB.DBMS_CSX_ADMIN COMPILE BODY ;
ALTER PACKAGE XDB.DBMS_CSX_INT2 COMPILE BODY ;
ALTER PACKAGE XDB.DBMS_JSON COMPILE BODY ;
ALTER PACKAGE XDB.DBMS_JSON_INT COMPILE BODY ;
ALTER PACKAGE XDB.DBMS_SODA_ADMIN COMPILE BODY ;
ALTER PACKAGE XDB.DBMS_SODA_DML COMPILE BODY ;
ALTER PACKAGE XDB.DBMS_SODA_DOM COMPILE BODY ;
ALTER PACKAGE XDB.DBMS_SODA_USER_ADMIN COMPILE BODY ;
ALTER PACKAGE XDB.DBMS_SODA_USER_DML COMPILE BODY ;
ALTER PACKAGE XDB.DBMS_XDB COMPILE BODY ;
ALTER PACKAGE XDB.DBMS_XDBNFS COMPILE BODY ;
ALTER PACKAGE XDB.DBMS_XDBREPOS COMPILE BODY ;
ALTER PACKAGE XDB.DBMS_XDBRESOURCE COMPILE BODY ;
ALTER PACKAGE XDB.DBMS_XDBUTIL_INT COMPILE BODY ;
ALTER PACKAGE XDB.DBMS_XDBZ0 COMPILE BODY ;
ALTER PACKAGE XDB.DBMS_XDB_ADMIN COMPILE BODY ;
ALTER PACKAGE XDB.DBMS_XDB_CONFIG COMPILE BODY ;
ALTER PACKAGE XDB.DBMS_XDB_CONSTANTS COMPILE BODY ;
ALTER PACKAGE XDB.DBMS_XDB_CONTENT COMPILE BODY ;
ALTER PACKAGE XDB.DBMS_XDB_PRINT COMPILE BODY ;
ALTER PACKAGE XDB.DBMS_XDB_REPOS COMPILE BODY ;
ALTER PACKAGE XDB.DBMS_XEVENT COMPILE BODY ;
ALTER PACKAGE XDB.DBMS_XLSB COMPILE BODY ;
ALTER PACKAGE XDB.DBMS_XMLDOM COMPILE BODY ;
ALTER PACKAGE XDB.XDB_RVTRIG_PKG COMPILE BODY ;
ALTER PACKAGE XDB.DBMS_XMLINDEX COMPILE BODY ;
ALTER PACKAGE XDB.DBMS_XMLINDEX0 COMPILE BODY ;
ALTER PACKAGE XDB.DBMS_XMLPARSER COMPILE BODY ;
ALTER PACKAGE XDB.DBMS_XMLSCHEMA_ANNOTATE COMPILE BODY ;
ALTER PACKAGE XDB.DBMS_XMLSCHEMA_LSB COMPILE BODY ;
ALTER PACKAGE XDB.DBMS_XMLSTORAGE_MANAGE COMPILE BODY ;
ALTER PACKAGE XDB.DBMS_XMLTRANSLATIONS COMPILE BODY ;
ALTER PACKAGE XDB.DBMS_XSLPROCESSOR COMPILE BODY ;
ALTER PACKAGE XDB.XDB_ANCOP COMPILE BODY ;
ALTER PACKAGE XDB.XDB_DLTRIG_PKG COMPILE BODY ;
ALTER PACKAGE XDB.PRVT_DBMS_MANAGE_XMLSTORAGE COMPILE BODY ;
ALTER FUNCTION XDB.UNDER_PATH_FUNC COMPILE;
ALTER TRIGGER XDB .XDB_PV_TRIG COMPILE;
ALTER TRIGGER XDB .XDB_RV_TRIG COMPILE;
ALTER PACKAGE XDB .DBMS_JSON_INT COMPILE;
ALTER PACKAGE XDB .DBMS_XMLDOM_ICD COMPILE;
ALTER PACKAGE XDB .DBMS_SODA_USER_DML COMPILE;
ALTER PACKAGE XDB .DBMS_SODA_DML COMPILE;
ALTER OPERATOR XDB .DEPTH COMPILE;
ALTER FUNCTION XDB .GET_XDB_TABLESPACE COMPILE;
ALTER OPERATOR XDB .PATH COMPILE;

STEP _ 2 :-
——————

conn / as sysdba

EXECUTE DBMS_REGXDB.VALIDATEXDB;
SHOW ERR;

select schema,comp_name,comp_id,version,status,procedure from dba_registry WHERE COMP_ID=’XDB’;

SQL> select comp_name, version, status
 from dba_registry
 order by status, comp_name;
  2 3
COMP_NAME VERSION STATUS
————————————————————————————————————————————————————————————————————————————————————— —————————— ———–
Oracle Real Application Clusters 19.0.0.0.0 OPTION OFF
Oracle Database Catalog Views 19.0.0.0.0 UPGRADED
Oracle Database Packages and Types 19.0.0.0.0 UPGRADED
Oracle XML Database 19.0.0.0.0 VALID >>>>>>>>>>>>>>>>>>

How Perform Cross-Platform Database Transport to different Endian Platform with RMAN Backup Sets

GOAL

This Document explains the new 12c feature:  Cross-Platform Data transport Using rman Backup Sets across different Endian Platform.

RMAN can transport databases, data files, and tablespaces across platforms using backup sets. Performing cross-platform data transport with backup sets enables you to use block compression to reduce the size of backups. This improves backup performance and reduces the time taken to transport backups over the network.


A cross-platform backup is an RMAN backup that can be restored on a destination platform that is different from the source platform

SOLUTION

For the purposes of this document, the following fictitious environment is used as an example to describe the procedure:

Source database: AIX-Based Systems (64-bit) (Big Endian format)
Destination database: Linux x86 64-bit (Little Endian format)
User RMAN_TEST is granted SYSBACKUP privilege in both source and destination database
Tablespace been transported is TEST1
Source database name is SOURCE
Destination database name is DEST

*******************


Pre-requisite

  • To perform cross-platform data transport using backup sets, the version of the destination database must be Oracle Database 12c Release 1 (12.1) or later.
  • The COMPATIBLE parameter in the server parameter file of the source database and the destination database must be set to 12.0.0 or higher.
  • The tablespaces to be transported are in read-only mode, unless the ALLOW INCONSISTENT clause is used in the BACKUP command.
  • The tablespaces to be transported are self-contained.
  • Execute the DBMS_TTS.TRANSPORT_SET_CHECK procedure to check for dependencies. If the TRANSPORT_SET_VIOLATIONS view contains rows corresponding to the specified tablespaces, then you must resolve the dependencies before creating the cross-platform backup. 

Terms you need to be aware of

Foreign Data File

Data files that do not belong to the destination database are called foreign data files. These data files are being plugged in to the destination database as part of a data transfer to the destination database. In the source database, this data file is identified by its original data file number.

Foreign Tablespace

A foreign tablespace is a set of foreign data files that comprise a tablespace in the source database. These foreign data files do not belong to the destination database, but are being transported into the destination database and are identified by the original tablespace name in the source database.

Foreign Data File Copy

A foreign data file copy is a data file that was restored from a cross-platform backup. It cannot be directly plugged in to the destination database because it is inconsistent. You must apply a cross-platform incremental backup to this data file and recover it before you can plug it in to the destination database.

Data Pump Destination

A Data Pump destination is a location on the disk of the server host of the destination database on which the Data Pump export dump file and the Data Pump log files are stored.

NOTE:  If the tablespace which is part of TTS/migration contains an object owned by a schema which does not exist in the destination database, the following error may occur:

ORA-39083: Object type OBJECT_GRANT failed to create with error:
ORA-01917: user or role ‘DMSTEAM’ does not exist
Failing sql is:GRANT DELETE ON “ADVTVS”.”FT_ENQUIRY_PLAN” TO “DMSTEAM”
ORA-39083: Object type OBJECT_GRANT failed to create with error:
ORA-01917: user or role ‘DMSTEAM’ does not exist

To avoid this issue, identify all the schema(s) on the source and create them on the destination server, if necessary, before executing the plugin process. The following query may be of help:

select distinct OWNER from dba_segments where tablespace_name in (‘<tablespace name which is part of TTS/migration>’);

Steps to Transport Read-Only Tablespaces to a Different Platform Using Backup Sets

Step 1: Connect to the source database (AIX) from which you need to transport tablespaces as TARGET.

$ rman

Recovery Manager: Release 12.1.0.2.0 – Production on Thu May 28 14:38:06 2015

Copyright (c) 1982, 2014, Oracle and/or its affiliates. All rights reserved.

RMAN> Connect target “rman_test@source AS SYSBACKUP”;

Enter the password for the RMAN_TEST user in source when prompted.

Step 2:  Place the tablespaces to be transported in read-only mode.

RMAN> alter tablespace test1 read only;

using target database control file instead of recovery catalog
Statement processed

Step 3:  Back up the tablespace on the source database using the BACKUP command with the TO PLATFORM or FOR TRANSPORT clause.

Use the DATAPUMP clause to indicate that an export dump file for the tablespaces must be created RMAN> BACKUP
TO PLATFORM ‘Linux x86 64-bit’
FORMAT ‘/tmp/xplat_backups/trans_ts.bck’
DATAPUMP FORMAT ‘/tmp/xplat_backups/trans_ts_dmp.bck’
TABLESPACE test1;


This command results in the following output:

RMAN>
Starting backup at 22-MAY-15
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=184 device type=DISK
Running TRANSPORT_SET_CHECK on specified tablespaces
TRANSPORT_SET_CHECK completed successfullyPerforming export of metadata for specified tablespaces…
   EXPDP> Starting “SYSBACKUP”.”TRANSPORT_EXP_SOURCE_asbF”:  
   EXPDP> Processing object type TRANSPORTABLE_EXPORT/PLUGTS_BLK
   EXPDP> Processing object type TRANSPORTABLE_EXPORT/TABLE
   EXPDP> Processing object type TRANSPORTABLE_EXPORT/TABLE_STATISTICS
   EXPDP> Processing object type TRANSPORTABLE_EXPORT/STATISTICS/MARKER
   EXPDP> Processing object type TRANSPORTABLE_EXPORT/POST_INSTANCE/PLUGTS_BLK
   EXPDP> Master table “SYSBACKUP”.”TRANSPORT_EXP_SOURCE_asbF” successfully loaded/unloaded
   EXPDP> ******************************************************************************
   EXPDP> Dump file set for SYSBACKUP.TRANSPORT_EXP_SOURCE_asbF is:
   EXPDP>   /<oracle_home path>/dbs/backup_tts_SOURCE_93693.dmp
   EXPDP> ******************************************************************************
   EXPDP> Datafiles required for transportable tablespace TEST1:
   EXPDP>   /<path>/oradata/SOURCE/test01.dbf
   EXPDP> Job “SYSBACKUP”.”TRANSPORT_EXP_SOURCE_asbF” successfully completed at Fri May 22 11:54:53 2015 elapsed 0 00:02:06
Export completed

channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00002 name=/<path>/oradata/SOURCE/test01.dbf
channel ORA_DISK_1: starting piece 1 at 22-MAY-15
channel ORA_DISK_1: finished piece 1 at 22-MAY-15
piece handle=/<path>/oradata/trans_ts.bck tag=TAG20150522T115158 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
channel ORA_DISK_1: starting full datafile backup set
input Data Pump dump file=/<oracle_home path>/dbs/backup_tts_SOURCE_93693.dmp
channel ORA_DISK_1: starting piece 1 at 22-MAY-15
channel ORA_DISK_1: finished piece 1 at 22-MAY-15
piece handle=/<path>/oradata/trans_ts_dmp.bck tag=TAG20150522T115158 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 22-MAY-15

When the 'TO PLATFORM' clause is used, conversion to the endian format of the destination database is performed on the source database.

Exit this Rman session connected to the source.

Please note :- For Step 3 the export file is created in $ORACLE_HOME/dbs until it completes and then it is moved to the location specified by DATAPUMP FORMAT.  

Ensure this location has enough space.  

Enhancement request 25909942 – RMAN’S BACKUP TO PLATFORM SHOULD NOT CREATE FILE IN $ORACLE_HOME/DBS has been logged for this issue so that file is written directly to DATAPUMP FORMAT location.   
Currently its still in Initial review status

Step 4: Move the backupsets to Destination server

Move the backup sets created by the BACKUP command and the Data Pump export dump file to the destination host. An operating system utility is used to move
the backup sets from the source host to the destination host.

Step 5: Connect to destination database (Linux x86 64-bit)

Connect to the destination database, in which the tablespaces must be transported, as TARGET. The destination database is open in read write mode.

In this example, a TEST1 user is granted the SYSBACKUP privilege within the destination database:

$ rman

Recovery Manager: Release 12.1.0.2.0 – Production on Thu May 28 14:38:06 2015

Copyright (c) 1982, 2014, Oracle and/or its affiliates. All rights reserved.

RMAN> connect target “rman_test@dest AS SYSBACKUP”;

Enter the password for the RMAN_TEST user in destination when prompted.

Step 6: Restore the tablespace from backupset.

Restore the datafiles from the backup sets transported from the source database using the RESTORE command. Use the DUMP FILE clause to import the export dump file containing the tablespace metadata and plug the tablespaces in to the destination database.

In this example the backuppiece and dump file were copied to /u01/app/oracle/oradata/test/.

If db_create_file_dest set in the destination database execute:RMAN> RESTORE
FOREIGN TABLESPACE TEST1 to NEW
FROM BACKUPSET ‘/u01/app/oracle/oradata/test/trans_ts.bck’
DUMP FILE FROM BACKUPSET ‘/u01/app/oracle/oradata/test/trans_ts_dmp.bck’;

NOTE: The use of “to NEW” restores the datafiles in the db_create_file_dest specification.

If using multiple backupsets, specify each like:RMAN> RESTORE
ALL FOREIGN DATAFILES TO NEW
FROM BACKUPSET ‘/mnt/staging_clt_target/tts/all_3tbs_uhrdm8f5_1_1.bck’ BACKUPSET ‘/mnt/staging_clt_target/tts/all_3tbs_uirdm8f6_1_1.bck’
DUMP FILE FROM BACKUPSET ‘/mnt/staging_clt_target/tts/all_3tbs_uhrdm8f5_1_1.bck’ ;

If using multiple backup pieces for each backupset, specify the backup pieces names within each backupset like:RMAN> RESTORE
ALL FOREIGN DATAFILES TO NEW
FROM BACKUPSET ‘/mnt/staging_clt_target/tts/RTODP-a0r8utgu_1_1′,’/mnt/staging_clt_target/tts/RTODP-a0r8utgu_2_1’,
BACKUPSET ‘/mnt/staging_clt_target/tts/RTODP-a1r8utgu_1_1′,’/mnt/staging_clt_target/tts/RTODP-a1r8utgu_2_1’
DUMP FILE FROM BACKUPSET ‘/mnt/staging_clt_target/tts/RTODP_metadata_1.bck’;

If db_create_file_dest is not set you can specify the location of the datafile using:RMAN> RESTORE
FOREIGN TABLESPACE TEST1 format ‘/u01/app/oracle/oradata/%U’
FROM BACKUPSET ‘/u01/app/oracle/oradata/dest/trans_ts.bck’
DUMP FILE FROM BACKUPSET ‘/u01/app/oracle/oradata/dest/trmp.bck’;

The command results in the following output:

Starting restore at 22-MAY-15
using channel ORA_DISK_1

channel ORA_DISK_1: starting datafile backup set restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_DISK_1: restoring all files in foreign tablespace TEST1
channel ORA_DISK_1: reading from backup piece/u01/app/oracle/oradata/dest/trans_ts.bck
channel ORA_DISK_1: restoring foreign file 2 to/u01/app/oracle/oradata/dest/data_D-dest_I-2390668590_TS-TEST1_FNO-2_jvq7is5b
channel ORA_DISK_1: foreign piece handle=/u01/app/oracle/oradata/dest/trans_ts.bck
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:02
channel ORA_DISK_1: starting datafile backup set restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_DISK_1: restoring Data Pump dump file to/u01/app/oracle/product/c12101/dbs/backup_tts_dest_31167.dmp
channel ORA_DISK_1: reading from backup piece/u01/app/oracle/oradata/dest/trans_ts_dmp.bck
channel ORA_DISK_1: foreign piece handle=/u01/app/oracle/oradata/dest/trans_ts_dmp.bck
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:02

Performing import of metadata…
IMPDP> Master table “SYSBACKUP”.”TSPITR_IMP_dest_jykD” successfully loaded/unloaded
IMPDP> import done in WE8MSWIN1252 character set and AL16UTF16 NCHAR character set
export done in US7ASCII character set and AL16UTF16 NCHAR character set
IMPDP> Starting “SYSBACKUP”.”TSPITR_IMP_dest_jykD”:
IMPDP> Processing object type TRANSPORTABLE_EXPORT/PLUGTS_BLK
IMPDP> Processing object type TRANSPORTABLE_EXPORT/TABLE
IMPDP> Processing object type TRANSPORTABLE_EXPORT/TABLE_STATISTICS
IMPDP> Processing object type TRANSPORTABLE_EXPORT/STATISTICS/MARKER
IMPDP> Processing object type TRANSPORTABLE_EXPORT/POST_INSTANCE/PLUGTS_BLK
IMPDP> Job “SYSBACKUP”.”TSPITR_IMP_dest_jykD” successfully completed at Fri May 22 12:19:08 2015 elapsed 0 00:00:05
Import completed

Finished restore at 22-MAY-15

Exit this Rman session connected to the destination.

Step 7: Alter the tablespace to read write

SQL> select status,tablespace_name from dba_tablespaces;

STATUS TABLESPACE_NAME
——— ——————————
ONLINE SYSTEM
ONLINE SYSAUX
ONLINE UNDOTBS1
ONLINE TEMP
ONLINE USERS
READ ONLY TEST1

SQL> Alter tablespace test1 read write ;

Tablespace altered.

SQL> select status,tablespace_name from dba_tablespaces;

STATUS TABLESPACE_NAME
——— ——————————
ONLINE SYSTEM
ONLINE SYSAUX
ONLINE UNDOTBS1
ONLINE TEMP
ONLINE USERS
ONLINE TEST1

Additional information (Difference between TO PLATFORM and FOR Transport)

You can use the BACKUP command to create backup sets for cross-platform data transportation. To indicate that a backup is for cross-platform transportation,
use either the FOR TRANSPORT or TO PLATFORM clauses.

When you use TO PLATFORM, the endian format conversion is performed on the source database.
Therefore, you can restore this cross-platform backup only on the specified platform. If you omit TO PLATFORM, you can restore this cross-platform backup on any supported platform.The target platform specified by the TO PLATFORM clause must be a supported platform for cross-platform transport. The V$TRANSPORTABLE_PLATFORM view
contains the list of supported platforms.

When you use FOR TRANSPORT, the backup set that is created can be transported to any destination database. If the destination database uses an endian format that is
different from that of the source database, then the required endian format conversion is performed on the destination database (This is applicable for tablespace level transport).You can transport a entire database only if the source and destination use the same endian format.. The benefit of this method is that the processing
overhead of the conversion operation is offloaded to the destination database.

Remote_listener Getting Reset To Blank After Cluster Startup

APPLIES TO:

Oracle Database – Enterprise Edition – Version 12.2.0.1 to 19.3.0.0.0 [Release 12.2 to 18]
Information in this document applies to any platform.

SYMPTOMS

users get error while connecting to database

ORA-12514: TNS:listener does not currently know of service requested in connect descriptor


remote_listener value got reset to blank after db node patching on all databases of the cluster causing databases not able to connect from outside, and databases are not getting registered with scan_listeners.
crsd_oraagent_oracle.trc inside <oracle base>/diag/crs/<HOSTNAME>/crs/trace location indicate following messages2019-05-11 19:41:49.764 : USRTHRD:3059689216: {2:49138:41584} LsnrRegThd::setRemoteListener 391 tmpSet endp:<scan name>:<PORT>
2019-05-11 19:41:49.764 : USRTHRD:3059689216: {2:49138:41584} LsnrRegThd::setRemoteListener 440 skip remote listener registration m_runRegRLUpdate:0 isForceRemoteListenerSet:0 isRemoteListenerSet:1
2019-05-11 19:41:49.774 : USRTHRD:3059689216: {2:49138:41584} ORA-01405: fetched column value is NULL

CHANGES

CAUSE

This is due to unpublished Bug 29637215 – FAEOPS: SHELL DB DOESN’T HAVE REMOTE_LISTENER VALUE WITH GRID 19.1.0.3
 

SOLUTION

Bug 29637215 fixed in future release. Apply interim fix 29637215, if available for your platform and Oracle version.

If no patch exists for your version, please contact Oracle Support for a backport request

As a workaround,

Manually update the remote_listener values every time bounce the instances from this cluster.

alter system set remote_listener=’racscan.com:1521′ scope=both sid=’*’;


 

ORA-12514: TNS:listener does not currently know of service requested in connect descriptor after cluster upgrade to 19c

Problem

users get error while connecting to database

ORA-12514: TNS:listener does not currently know of service requested in connect descriptor

Cause:

Cluster upgrade from 12.2 to 19c

Solution:

set remote_listener parameter

alter system set remote_listener=’racscan.com:1521′ scope=both sid=’*’;

Oracle 19c – Complete Checklist for Upgrading to Oracle Database 19c (19.x) using DBUA

PURPOSE

The purpose of this article is to help DBA’s / Support Teams to perform the upgrade of a database using DBUA to 19.x.

SCOPE

DBA, Support

DETAILS

Database Upgrade Assistant (DBUA)

Database Upgrade Assistant (DBUA) provides a graphical user interface to guide you through the upgrade of Oracle Database.

DBUA works for CDB and non-CDB database systems. It is the recommended method for performing a major release upgrade or patchset release upgrade.

You can use DBUA to upgrade multitenant architecture container databases (CDB), pluggable databases (PDBs), and non-CDB databases.
The procedures are the same, but the choices you must make and the behavior of DBUA are different, depending on the type of upgrade.

DBUA automates the upgrade process by performing all of the tasks.

DBUA provides support for Oracle Real Application Clusters (Oracle RAC) databases. In an Oracle RAC environment,
DBUA upgrades all the database and configuration files on all nodes in the cluster.

DBUA, graphical user interface must be invoked within the new Oracle home where the Oracle Database 19c software has been installed.
For windows, Only an Administrator or Installed owner should invoke DBUA for Windows systems.

DBUA runs the Pre-Upgrade Information Tool as part of the prerequisite checks it performs before starting the upgrade.
However, to reduce downtime, Oracle recommends that you run the Pre-Upgrade Information Tool as part of your upgrade planning, so that you can analyze the database,
and take proactive steps before your planned upgrade date.
Once, you address / fix the pre-upgrade recommendation / warnings /errors and continue with the upgrade, DBUA shows the progress of the upgrade for each component of source database.

As with previous releases of DBUA, 19c DBUA restricts the carry over of hidden parameters since Oracle recommends not to have hidden parameters other than those suggested
via support during the upgrade.
To view existing hidden parameters execute the following command while connected AS SYSDBA:

SELECT name,description from SYS.V$PARAMETER WHERE name LIKE ‘\_%’ ESCAPE ‘\’;

DBUA performs some of the checks before actually starting the database upgrade. Some of the checks can be done manually to reduce downtime for the upgrade.

DBUA provides below options:

– Upgrade timezone. The default timezone vetrsion in 19.x is 32.

– Gather dictionary statistics before upgrade.

– Make user tablespaces read only.

– Take RMAN backup before upgrade.

– Create Restore Point for Database Flashback

– Restore database backup to rollback upgrade

– Option to execute Custom scripts before and after upgrade

– show the location of DBUA logs and Alert log files.

– Option to upgrade existing listener to 19.x home or create a new listener in 19.x target home.

About Read-Only Oracle Homes

Starting with Oracle Database 18c, you can configure an Oracle home in read-only mode.
In a read-only Oracle home, all the configuration data and log files reside outside of the read-only Oracle home. This feature allows you to use the read-only Oracle home as a software image that can be distributed across multiple servers.

Upgrade Path / Compatibility Matrix for 19.x Oracle Database

DBUA can upgrade only supported versions of direct upgrade.

Direct Upgrade to 19.x:

Source Database Target Database
11.2.0.4 and Higher 19.x
12.1.0.2 19.x
12.2.0.1 19.x
18.1 19.x

 

Indirect Upgrade to 19.x:

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

 

Requirements and Recommendation for source database

 

– Ensure that all database components/objects provided by Oracle are VALID in the source database prior to starting the upgrade.

– Before you start an upgrade or downgrade process, Oracle strongly recommends that you update both your earlier release and your new release (19.x) Oracle Database to the latest Oracle bundle patch or patch set update (BP or PSU).

– Ensure that you do not have duplicate objects in the SYS and SYSTEM schema. For 1 and 2 refer to:
Doc Id 556610.1 – Script to Collect DB Upgrade/Migrate Diagnostic Information (dbupgdiag.sql)
– dbupgdiag.sql script is a set of sql statements intended to provide a user friendly output to diagnose the status of the database either before (or) after upgrade. The script will create a output file called db_upg_diag_<sid>_<timestamp>.log

– IF APEX is installed then it is recommended to upgrade APEX in the source DB first before upgrading DB

– Timezone should less than or equal to target database timezone version.

– Make sure to have a valid backup of source database prior to upgrade.

– Disable any custom triggers that would get executed before / after DDL statements. Re-enable after the upgrade.

– Check the database server upgrade/downgrade compatibility matrix before upgrading the database.

– Set Archive Log ON during upgrade. Oracle recommends that you set Archive Log ON in order for DBUA to create and update the log file for the upgrade process.

– For Oracle RAC, if you upgrade a cluster database using DBUA, then you must leave the CLUSTER_DATABASE initialization parameter set to TRUE.

– Ensure to run the pre-upgrade utility prior to upgrading the database.

– Examine and follow the recommendation given in the preupgrade log file.

– Materialized views in source database should be stopped before upgrade

Doc ID 1406586.1 – How to Handle Materialized Views When You Upgrade or Clone a Database

– Disable scheduled database custom jobs / cron jobs.

– Min value of COMPATIBLE parameter to upgrade 19.1 is “11.2.0”, make sure you have COMPATIBLE parameter is set to 11.2.0 or greater

 

 

Requirements and Recommendations for Target database

– Verify whether your operating system / platform is certified for 19.x release.

– Download and Install Oracle 19c (19,x) in a new Oracle_Home and make sure there are no binary relinking errors.

– Download and Install the latest available RU or RUR from My Oracle Support (MOS).

– Make sure to set the ORACLE_HOME, PATH, LD_LIBRARY_PATH, LIBPATH etc. to 19.x target home.

– Review patch recommendations as given in the article “Patches to apply before upgrading Oracle GI and DB to 19c or downgrading to previous release (Doc ID 2539751.1)”

Prerequisites for Preparing Oracle Home on Windows

 

Your system must meet these requirements before you can upgrade Oracle Database on Microsoft Windows platforms. For security reasons, different Microsoft Windows user accounts configured as Oracle
home users for different Oracle homes are not allowed to share the same Oracle Base.

– Database upgrade is supported when the same Windows user account is used as the Oracle home user in both the source and destination Oracle homes.

– Database upgrade is supported when the Oracle home from which the database is being upgraded uses the Windows Built-in Account. Releases earlier than Oracle Database 12c (release 11.2 and earlier) only supported the built-in account option for the Oracle home user on Windows.

– The Oracle home user may not have access to files outside its own Oracle Base and Oracle home. If that is the case, then if you choose a different Oracle Base during upgrade, it is possible that Oracle Database services cannot access files in the older Oracle Base. Using DBUA for database upgrade ensures that the Oracle home user has access to files outside of its own Oracle Base and its own Oracle home.

 

 

 

 

 

Pre Upgrade

 

 

 

$Earlier_release_Oracle_home/jdk/bin/java -jar $New_release_Oracle_home/rdbms/admin/preupgrade.jar [FILE|TERMINAL] [TEXT|XML] [DIR output_dir]

 
FILE|TERMINAL – Use this option to direct script output to a file. Use TERMINAL to direct output to the terminal. If it is not specified then defaultr is FILE.
TEXT – Use this option to specify log should be in Text format. Use TEXT to specify text output. Use XML to specify XML output. If you do not specify an output type, then the default is text.
DIR – Logs will be created under <output_dir>. Directs the output to a specific directory. If you do not specify an output directory with the DIR option, then the output is directed to one of the default locations: If you define ORACLE_BASE environment variable then the generated scripts and log files will be created under $ORACLE_BASE/cfgtoollogs/<dbname>/preupgrade/ location else it will create under $ORACLE_HOME/cfgtoollogs/db_name/preupgrade/.

 

For example,

source Oracle Home : /refresh/home/oracle/ora_base/product/18.1

target Oracle Home : /refresh/home/oracle/ora_base/product/19.0.0.0

$ export ORACLE_SID=orcl
$ export ORACLE_BASE=/refresh/home/oracle/ora_base
$ export ORACLE_HOME=/refresh/home/oracle/ora_base/product/18.1

$ $ORACLE_HOME/jdk/bin/java -jar /refresh/home/oracle/ora_base/product/19.0.0.0/rdbms/admin/preupgrade.jar TERMINAL TEXT FILE

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

PREUPGRADE SUMMARY

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

/refresh/home/oracle/ora_base/product/18.1/cfgtoollogs/pdl/preupgrade/preupgrade.log

/refresh/home/oracle/ora_base/product/18.1/cfgtoollogs/pdl/preupgrade/preupgrade_fixups.sql

/refresh/home/oracle/ora_base/product/18.1/cfgtoollogs/pdl/preupgrade/postupgrade_fixups.sql

Execute fixup scripts as indicated below:

Before upgrade:

Log into the database and execute the preupgrade fixups

@/refresh/home/oracle/ora_base/product/18.1/cfgtoollogs/pdl/preupgrade/preupgrade_fixups.sql

After the upgrade:

Log into the database and execute the postupgrade fixups

@/refresh/home/oracle/ora_base/product/18.1/cfgtoollogs/pdl/preupgrade/postupgrade_fixups.sql

Preupgrade complete: 2019-05-22T05:14:05

 

 

Examine the preupgrade.log file and follow the recommendation.

 

 

The latest preupgrade utility for 19.x can be found from :

How to Download and Run Oracle’s Database Pre-Upgrade Utility (Doc ID 884522.1)

 

 

Check for Invalid Objects / Components

 

set pagesize500
set linesize 100
select substr(comp_name,1,40) comp_name, status, substr(version,1,10) version from dba_registry order by comp_name;

select substr(object_name,1,40) object_name,substr(owner,1,15) owner,object_type from dba_objects where status=’INVALID’ order by owner,object_type;

select owner,object_type,count(*) from dba_objects where status=’INVALID’ group by owner,object_type order by owner,object_type ;

 

or

 

SET SERVEROUTPUT ON;

EXECUTE DBMS_PREUP.INVALID_OBJECTS;

 

If you find invalid objects and/or database components then try to VALIDATE the invalid objects and/or database components by executing the following steps:

Run utlrp.sql to validate the invalid objects in the database. You can execute the utlrp.sql scripts multiple times to validate the invalid objects.

$ sqlplus “/ as sysdba”
SQL> @$ORACLE_HOME/rdbms/admin/utlrp.sql

 

 

Gathering Optimizer Statistics to Decrease Oracle Database Downtime

 

Oracle strongly recommends that you use this procedure to gather statistics before performing Oracle Database upgrades.Oracle recommends that you use the DBMS_STATS.GATHER_DICTIONARY_STATS   procedure to gather these statistics. For example, enter the following SQL statement:

SQL> EXEC DBMS_STATS.GATHER_DICTIONARY_STATS;

 

Verifying Materialized View Refreshes are Complete Before Upgrade

Use this procedure to query the system to determine if there are any materialized view refreshes still in progress. Before upgrading Oracle Database, you must wait until all materialized views have
completed refreshing.

SQL> SELECT o.name FROM sys.obj$ o, sys.user$ u, sys.sum$ s WHERE o.type# = 42 AND bitand(s.mflags, 8) =8;

 

How to Handle Materialized Views When You Upgrade or Clone a Database (Doc ID 1406586.1)

 

Check of TIMESTAMP WITH TIMEZONE Datatype

The time zone files that are supplied with Oracle Database 19c is version 32.

Case 1 Timezone version of source database is lower or equal 32.

If the source database is using a timezone file lower than version 32 then there is no DST patch to apply in source oracle home or target 19c home.

Case 2 Timezone version of source database is higher than 32.

If the source database uses a Timezone version higher than 32 then BEFORE the upgrade you MUST patch the target 19c $ORACLE_HOME with a timezone data file of the SAME version as the one used in the source release database.

 

Ensuring That No Files Are in Backup Mode and no files need media recovery Before Upgrading

 

Execute below query to check for the status of the backup:

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

Ensure that no files require media recovery:

SQL> SELECT * FROM v$recover_file;

 

Purging Recycle Bin before upgrade

 

 SQL> PURGE DBA_RECYCLEBIN;

we can purge the recycle bin via DBUA.

 

Databases That Use Oracle Label Security and Oracle Database Vault

Audit Table Preupgrade and Archive Requirements

For Oracle Database releases earlier than 12.1 using Oracle Label Security and Oracle Database Vault, you must run the OLS preprocess script before you upgrade.

If you are upgrading from a database earlier than Oracle Database release 12.1 that uses Oracle Label Security (OLS) and Oracle Database Vault, then you must first run the OLS preprocess script, olspreupgrade.sql, to process the aud$ table contents. The OLS upgrade moves the aud$ table from the SYSTEM schema to the SYS schema. The olspreupgrade.sql script is a preprocessing script required for this move.

Running the olspreupgrade.sql script before upgrading is mandatory for upgrading databases earlier than Oracle Database release 12.1 that use Oracle Label Security and Oracle Database Vault. Once you have upgraded to Oracle Database release 12.1, you do not have to perform the OLS preprocessing procedure going forward to patch or upgrade the database.

Oracle Database Vault and Upgrades of Oracle Database Release 11.2

If Oracle Label Security is installed in the earlier release that you are upgrading, then grant the DV_PATCH_ADMIN role to SYS.

To run the OLS preprocess script on a release 11.2 database before upgrading:

1.    Copy the following scripts script from the newly installed Oracle home (19c) to the Oracle home of the database that needs to be upgraded (11.2):

        ORACLE_HOME/rdbms/admin/olspreupgrade.sql
ORACLE_HOME/rdbms/admin/emremove.sql
ORACLE_HOME/olap/admin/catnoamd.sql

2.    Start SQL*Plus and connect as DVOWNER to the database that you want to upgrade.

3.    Run the following statement:

    SQL> GRANT DV_PATCH_ADMIN to SYS;

4.    At the system prompt, connect SYS as SYSDBA:

    CONNECT SYS AS SYSDBA

5.    Run the preprocess scripts for Data Vault

    ORACLE_HOME/rdbms/admin/olspreupgrade.sql
ORACLE_HOME/rdbms/admin/emremove.sql
ORACLE_HOME/olap/admin/catnoamd.sql

You may continue to run your applications on the database while the preprocess scripts are running.

6.    After the olspreupgrade.sql completes its run successfully, start SQL*Plus and connect to the database as DVOWNER.

7.    Run the following SQL statement:

    SQL> REVOKE DV_PATCH_ADMIN from SYS;

For 12.x Granting the DV_PATCH_ADMIN Role to SYS for Oracle Database Vault

If Oracle Database Vault is enabled, then to perform checks for Oracle Data Vault, the upgrade process requires running three SQL scripts – olspreupgrade.sql, emremove.sql, catnoamd.sql

Start SQL*Plus and connect as DVOWNER to the database that you want to upgrade.

Run the following statement:

    SQL> GRANT DV_PATCH_ADMIN to SYS;

 

 

Save OEM DB Control Configuration (For Oracle Database releases earlier than 12.1)

If you plan to downgrade database after upgrading to 18.x, then before starting the upgrade save the DB Control configuration and data using emdwgrd utility, so that you can restore the files after downgrading.

Steps to Save data:

1. Install the software for the new Oracle Database 12c release.
2. Set ORACLE_HOME to your old Oracle home.
3. Set ORACLE_SID to the SID of the database being upgraded.
4. Set PATH, LD_LIBRARY_PATH, and SHLIB_PATH to point to the upgraded Oracle Database Oracle home.
5. Change directory to the new Oracle Database release Oracle home.
6. Run emdwgrd

 

Single-instance databases:

emdwgrd[sh|bat] -save -sid old_SID -path save_directory

 

Oracle Real Application Clusters (Oracle RAC) databases:

Remote copy must be enabled across all cluster member nodes. Use EM_REMCP environment variable, to indicate which remote copy is configured, for example: export EM_REMCP /usr/bin/scp

emdwgrd -save -cluster -sid old_SID -path save_directory

 

7. Enter the SYS password for the database that you want to upgrade.

 

Removing DB Control with emremove.sql (For Oracle Database releases earlier than 12.1)

Warning :
The below step should not be executed during the upgrade of Enterprise Manager Cloud Control Repository database. Doing so your EM Cloud Control Repository DB will become unusable.

  

Starting with Oracle Database 12c release 1 (12.1), DB Control is removed as part of the upgrade process.

Stop DB Console:

emctl stop dbconsole

Execute emremove.sql script. The script willbe located in target 18.x OH/rdbms/admin/.

SQL>SET ECHO ON
SQL>SET SERVEROUTPUT ON
SQL>@emremove.sql >> Script located in new 12c ORACLE_HOME/rdbms/admin

After emremove.sql completes, you must manually remove ORACLE_HOME/HOSTNAME_SID and ORACLE_HOME/oc4j/j2ee/OC4J_DBConsole_HOSTNAME_SID directories from your file system.

 

Desupport of OLAP Catalog (OLAP AMD) (For Oracle Database releases earlier than 12.1)

Starting with Oracle Database 12c, the OLAP Catalog (OLAP AMD) is desupported and will be removed from the database during the database upgrade. This step can be manually performed before the upgrade to reduce downtime. It can be removed by running the SQL script $ORACLE_HOME/olap/admin/catnoamd.sql script. Do not run the script in UPGRADE mode.

 

Copying Transparent Encryption Oracle Wallets

If you use Oracle wallet with Transparent Data Encryption (TDE), and you use Database Upgrade Assistant (DBUA) to upgrade the database, then copy the sqlnet.ora and wallet file to the new 18.x Oracle home.

You must copy the sqlnet.ora and the wallet file manually before starting the upgrade.
1. Log in as an authorized user.
2. Manually copy the sqlnet.ora file, and the wallet file, ewallet.p12, to the new release Oracle home.
3. Open the Oracle wallet in mount.

For example:
SQL> STARTUP MOUNT;
SQL> ALTER SYSTEM SET ENCRYPTION WALLET OPEN;

 

Check the accounts use Case-Insensitive password version

Log in to SQL*Plus as an administrative user, and enter the following SQL query
SELECT USERNAME,PASSWORD_VERSIONS FROM DBA_USERS;

If there are any 10g versions, suggest you to refer Oracle documentation to fix 10g versions, failing to do so, user accounts with LOCKED after upgrade is completed.

 

About Password Case Sensitivity

Ensure that you do not have the deprecated parameter SEC_CASE_SENSITIVE_LOGON set to FALSE.

 

Requirement for Upgrading Databases that Use Oracle Warehouse Builder (OWB)

Oracle Warehouse Builder must be installed separately. Starting with Oracle Database 12c, Oracle Warehouse Builder (OWB) is not installed as part of the software for Oracle Database. An installer for Oracle Warehouse Builder is available on Oracle Technology Network. OWB components that may exist from earlier releases are not upgraded as part of the Oracle Database upgrade process.

Invoke DBUA

DBUA ( Step 1 of 9 )

Select the database to be upgrade , we have selected test11204

step1

 

DBUA ( Step 2 of 9 )

DBUA will execute the preupgrade script (preupgrade.jar) and return warnings / errors.

 

screen2

DBUA ( Step 3 of 9 )

After the pre-upgrade warnings has been addressed, DBUA shows various options like Enable Parallel Upgrade, Recompile invalid objects in post upgrade phase, upgrading timezone, gather statistics before the upgrade, setting the user tablespaces to read only during upgrade. Also, you can provide any custom SQL scripts before or after the upgrade.

Screen3

 

DBUA ( Step 4 of 9 )

This screen will show various Recovery options to choose from like creating a Guaranteed Restore Point, or Take an RMAN backup or if the backup is already taken outside DBUA then “I have my own backup and restore stratege ” option can be chosen.

 

Screen4

 

DBUA ( Step 5 of 9 )

in this screen, we can create a new listener or upgrade the existing listener to 19c.

 

Screen5

 

DBUA ( Step 6 of 9 )

This screen is for configure EM express or register the upgraded database with EM Cloud control.

Screen6

 

DBUA ( Step 7 of 9 )

This is the summary screen before the actual upgrade starts. Click on Finish to proceed with the upgrade.

Screen7

 

DBUA ( Step 8 of 9 )

The DBUA will start the upgrade process of orcl database. It will perform pre-upgrade, database upgrade and post upgrade steps.

Screen8a

 

DBUA will perform the upgrade of database components like Oracle server, XML etc.

Screen8b

 

DBUA ( Step 9 of 9 )

The final screen will show the result of upgrade.

 

Screen9a

It will show the log file location and the time taken by various steps of upgrade.

 

Screen9b

Post Upgrade

Execute dbupgdiag.sql script to verify status of objects and components. If there are invalid objects then run utlrp.sql to recompile the invalid objects as follows:

sql> connect / as sysdba

sql> @?/rdbms/admin/utlrp.sql

Oracle 19c – Complete Checklist for upgrading Oracle 12c, 18c Container Database (CDB) to Oracle 19c Release using DBUA

PURPOSE

The purpose of this article is to perform upgrade of 12c, 18c container databases (CDB with one or more pluggable databases) using DBUA to Oracle 19c release.

SCOPE

DBA, Support

DETAILS

About Database Upgrade Assistant (DBUA)

  • Database Upgrade Assistant (DBUA) interactively steps you through the upgrade process. configures the database for the new Oracle Database 19c release. It is the recommended method for performing a major release upgrade or patchset release upgrade.
  • DBUA automates the upgrade process by performing all of the tasks. DBUA makes appropriate recommendations for configuration options and then you can act on these recommendations.
  • DBUA provides support for Oracle Real Application Clusters (Oracle RAC) databases. In an Oracle RAC environment, DBUA upgrade all the database and configuration files on all nodes in the cluster.
  • DBUA, graphical user interface must be invoked within the new Oracle home where the Oracle Database 19c software has been installed.
    For Windows, Only an Administrator or Installed owner should invoke DBUA for Windows systems.
  • DBUA starts the Pre-Upgrade Tool, which automatically fixes some configuration settings to the values required for the upgrade. For example, the Pre-Upgrade Tool can change initialization parameters to values required for the upgrade. The Pre-Upgrade Tool also provides you with a list of items that you need to fix manually before you can continue with the upgrade.
  • It also gives certain recommendations on certain areas belonging to the database. The recommendations can then be acted on making the upgrade process user friendly and easy.
  • Once, you address / fix the pre-upgrade recommendation / warnings /errors and continue with the upgrade, DBUA shows the progress of the upgrade for each component of source database.
  • As with previous releases of DBUA, 12c DBUA restricts the carry over of hidden parameters since Oracle recommends not to have hidden parameters other than those suggested via support during the upgrade.
    To view existing hidden parameters execute the following command while connected AS SYSDBA:
SELECT name,description from SYS.V$PARAMETER WHERE name LIKE ‘\_%’ ESCAPE ‘\’;
  • DBUA performs some of the checks before actually starting the database upgrade. Some of the checks can be done manually to reduce downtime for the upgrade.
  • DBUA provides below options:
    – Upgrade timezone. The default timezone version in 19c is 32.- Gather dictionary statistics before upgrade.

    – Make user tablespaces read only.

    – Take RMAN backup before upgrade.

    – Restore database backup to rollback upgrade.

    – Option to execute Custom scripts before and after upgrade

    – Option to upgrade existing listener to 19c home or create a new listener in 19c target home.

  • Starting with Oracle Database 12c release 2 (12.2), you can upgrade the database without disabling Oracle Database Vault. However, if you disabled Oracle Database Vault, then you must enable it manually after an upgrade.
  • For multitenant architecture Oracle Database systems, starting with Oracle Database 12c release 2 (12.2), you can use priority lists to upgrade or exclude specific pluggable databases, or to set a specific upgrade priority order. So priority can be set for the pdbs of container database during DBUA upgrade.

Upgrade Path / Compatibility Matrix for 12.2 Oracle Container Database.

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

Source DatabaseTarget Database
11.2.0.419c
12.1.0.219c
12.2.0.119c
18.119c

DBUA can be used to upgrade Oracle 12.1.0.2 or higher container (CDB) databases to 19c release.

Source DatabaseTarget Database
12.1.0.2 or higher19c

Requirements and recommendations for source database

  • Ensure that all database components/objects provided by Oracle are VALID in the source container database and all the pluggable databases prior to starting the upgrade.
  • Ensure that you do not have duplicate objects in the SYS and SYSTEM schema.

Doc Id 556610.1 – Script to Collect DB Upgrade/Migrate Diagnostic Information (dbupgdiag.sql)

dbupgdiag.sql script is a set of sql statements intended to provide a user friendly output to diagnose the status of the database either before (or) after upgrade.

The script will create a output file called db_upg_diag_<sid>_<timestamp>.log

  • Before you start an upgrade process, Oracle strongly recommends to apply the latest PSU or Proactive Bundle Patch / RU or RUR Patch. Refer Doc Id – 2118136.2 to download the patches.
  • Make sure to have a valid backup of 12.1 source database prior to upgrade.
  • Disable any custom triggers that would get executed before / after DDL statements. Re-enable them after the upgrade.
  • Check the database server upgrade/downgrade compatibility matrix before upgrading the database.
  • Set Archive Log ON during upgrade. Oracle recommends that you set Archive Log ON in order for DBUA to create and update the log file for the upgrade process.
  • For Oracle RAC, if you upgrade a cluster database using DBUA, then you must leave the CLUSTER_DATABASE initialization parameter set to TRUE.
  • Though, DBUA execute the preupgrade steps ( preupgrade.jar ), it is recommended to execute pre-upgrade utility and follow the recommendation like gather stats, purge recylebin etc.
  • Examine and follow the recommendation given in the preupgrade log file.
  • Materialized views in source database should be stopped before upgrade

Doc ID 1406586.1 – How to Handle Materialized Views When You Upgrade or Clone a Database

  • Disable scheduled database custom jobs / cron jobs.

Requirements and Recommendations for Target database

  • Verify whether your operating system / platform is certified for 19c release.
  • Download and Install Oracle 19c in a new Oracle_Home and make sure there are no binary relink errors.
  • Download and Install the latest available RU / RUR patch from My Oracle Support (MOS). Refer Doc Id – 2118136.2 to download patches.
  • Review patch recommendations as given in the article “Patches to apply before upgrading Oracle GI and DB to 19c (Doc ID 2539751.1)”

Prerequisites for Preparing Oracle Home on Windows

Your system must meet these requirements before you can upgrade Oracle Database on Microsoft Windows platforms. For security reasons, different Microsoft Windows user accounts configured as Oracle home users for different Oracle homes are not allowed to share the same Oracle Base.

  • Database upgrade is supported when the same Windows user account is used as the Oracle home user in both the source and destination Oracle homes.
  • Database upgrade is supported when the Oracle home from which the database is being upgraded uses the Windows Built-in Account. Releases earlier than Oracle Database 12c (release 11.2 and earlier) only supported the built-in account option for the Oracle home user on Windows.
  • The Oracle home user may not have access to files outside its own Oracle Base and Oracle home. If that is the case, then if you choose a different Oracle Base during upgrade, it is possible that Oracle Database services cannot access files in the older Oracle Base. Using DBUA for database upgrade ensures that the Oracle home user has access to files outside of its own Oracle Base and its own Oracle home.

Preupgrade

$Earlier_release_Oracle_home/jdk/bin/java -jar $New_release_Oracle_home/rdbms/admin/preupgrade.jar [FILE|TERMINAL] [TEXT|XML] [DIR output_dir]

FILE|TERMINAL – Use this option to direct script output to a file. Use TERMINAL to direct output to the terminal. If it is not specified then default is FILE.

TEXT – Use this option to specify log should be in Text format. Use TEXT to specify text output. Use XML to specify XML output. If you do not specify an output type, then the default is text.

DIR – Logs will be created under <output_dir>. Directs the output to a specific directory. If you do not specify an output directory with the DIR option, then the output is directed to one of the default locations: If you define ORACLE_BASE environment variable then the generated scripts and log files will be created under $ORACLE_BASE/cfgtoollogs/<dbname>/preupgrade/ location else it will create under $ORACLE_HOME/cfgtoollogs/db_name/preupgrade/.

please make sure all the pluggable databases are open before running below preupgrade step:

source Oracle Home : /refresh/app/oracle/product/12.2.0.1.0

target Oracle Home : /refresh/app/oracle/product/19.0.0.0

For example,

$ export ORACLE_HOME=/refresh/app/oracle/product/12.2.0.1.0
$ export PATH=/refresh/app/oracle/product/12.2.0.1.0/bin:$PATH
$ export ORACLE_SID=cdb12201
$ /refresh/app/oracle/product/12.2.0.1.0/jdk/bin/java -jar /refresh/app/oracle/product/19.0.0.0/rdbms/admin/preupgrade.jar FILE TEXT
PREUPGRADE SUMMARY
==================
/refresh/app/oracle/cfgtoollogs/cdb12201/preupgrade/preupgrade.log
/refresh/app/oracle/cfgtoollogs/cdb12201/preupgrade/preupgrade_fixups.sql
/refresh/app/oracle/cfgtoollogs/cdb12201/preupgrade/postupgrade_fixups.sql

Execute fixup scripts across the entire CDB:

Before upgrade:

1. Execute preupgrade fixups with the below command
$ORACLE_HOME/perl/bin/perl -I$ORACLE_HOME/perl/lib -I$ORACLE_HOME/rdbms/admin $ORACLE_HOME/rdbms/admin/catcon.pl -l /refresh/app/oracle/cfgtoollogs/cdb12201/preupgrade/ -b preup_cdb12201 /refresh/app/oracle/cfgtoollogs/cdb12201/preupgrade/preupgrade_fixups.sql

2. Review logs under /refresh/app/oracle/cfgtoollogs/cdb12201/preupgrade/

After the upgrade:

1. Execute postupgrade fixups with the below command
$ORACLE_HOME/perl/bin/perl -I$ORACLE_HOME/perl/lib -I$ORACLE_HOME/rdbms/admin $ORACLE_HOME/rdbms/admin/catcon.pl -l /refresh/app/oracle/cfgtoollogs/cdb12201/preupgrade/ -b postup_cdb12201 /refresh/app/oracle/cfgtoollogs/cdb12201/preupgrade/postupgrade_fixups.sql

2. Review logs under /refresh/app/oracle/cfgtoollogs/cdb12201/preupgrade/.

 

The preupgrade.jar has generated fixup scripts for CDB$ROOT,PDB$SEED and pluggable databases. you may find below scripts in /u01/app/oracle/cfgtoollogs/cdb12102/preupgrade/*.sql.

[oracle@celvpvm14867 preupgrade]$ ls -ltr /refresh/app/oracle/cfgtoollogs/cdb12201/preupgrade/*upgrade*
-rw-rw-r– 1 oracle oracle 7884 May 31 07:33 /refresh/app/oracle/cfgtoollogs/cdb12201/preupgrade/preupgrade_driver.sql
-rw-rw-r– 1 oracle oracle 455876 May 31 07:33 /refresh/app/oracle/cfgtoollogs/cdb12201/preupgrade/preupgrade_package.sql
-rw-rw-r– 1 oracle oracle 100166 May 31 07:33 /refresh/app/oracle/cfgtoollogs/cdb12201/preupgrade/preupgrade_messages.properties
-rw-rw-r– 1 oracle oracle 9855 May 31 07:33 /refresh/app/oracle/cfgtoollogs/cdb12201/preupgrade/preupgrade_fixups_CDB_ROOT.sql
-rw-rw-r– 1 oracle oracle 9259 May 31 07:33 /refresh/app/oracle/cfgtoollogs/cdb12201/preupgrade/postupgrade_fixups_CDB_ROOT.sql
-rw-rw-r– 1 oracle oracle 7780 May 31 07:33 /refresh/app/oracle/cfgtoollogs/cdb12201/preupgrade/preupgrade_CDB_ROOT.log
-rw-rw-r– 1 oracle oracle 8005 May 31 07:33 /refresh/app/oracle/cfgtoollogs/cdb12201/preupgrade/preupgrade_fixups_PDB_SEED.sql
-rw-rw-r– 1 oracle oracle 9258 May 31 07:33 /refresh/app/oracle/cfgtoollogs/cdb12201/preupgrade/postupgrade_fixups_PDB_SEED.sql
-rw-rw-r– 1 oracle oracle 7317 May 31 07:33 /refresh/app/oracle/cfgtoollogs/cdb12201/preupgrade/preupgrade_PDB_SEED.log
-rw-rw-r– 1 oracle oracle 7093 May 31 07:33 /refresh/app/oracle/cfgtoollogs/cdb12201/preupgrade/preupgrade_fixups_PDB12201.sql
-rw-rw-r– 1 oracle oracle 9258 May 31 07:33 /refresh/app/oracle/cfgtoollogs/cdb12201/preupgrade/postupgrade_fixups_PDB12201.sql
-rw-rw-r– 1 oracle oracle 6578 May 31 07:33 /refresh/app/oracle/cfgtoollogs/cdb12201/preupgrade/preupgrade_PDB12201.log
-rw-rw-r– 1 oracle oracle 7077 May 31 07:34 /refresh/app/oracle/cfgtoollogs/cdb12201/preupgrade/preupgrade_fixups_PDB1.sql
-rw-rw-r– 1 oracle oracle 9242 May 31 07:34 /refresh/app/oracle/cfgtoollogs/cdb12201/preupgrade/postupgrade_fixups_PDB1.sql
-rw-rw-r– 1 oracle oracle 6570 May 31 07:34 /refresh/app/oracle/cfgtoollogs/cdb12201/preupgrade/preupgrade_PDB1.log
-rw-rw-r– 1 oracle oracle 7077 May 31 07:34 /refresh/app/oracle/cfgtoollogs/cdb12201/preupgrade/preupgrade_fixups_PDB2.sql
-rw-rw-r– 1 oracle oracle 9242 May 31 07:34 /refresh/app/oracle/cfgtoollogs/cdb12201/preupgrade/postupgrade_fixups_PDB2.sql
-rw-rw-r– 1 oracle oracle 6570 May 31 07:34 /refresh/app/oracle/cfgtoollogs/cdb12201/preupgrade/preupgrade_PDB2.log
-rw-rw-r– 1 oracle oracle 32106 May 31 07:34 /refresh/app/oracle/cfgtoollogs/cdb12201/preupgrade/preupgrade_fixups.sql
-rw-rw-r– 1 oracle oracle 33554 May 31 07:34 /refresh/app/oracle/cfgtoollogs/cdb12201/preupgrade/postupgrade_fixups.sql
-rw-rw-r– 1 oracle oracle 34815 May 31 07:34 /refresh/app/oracle/cfgtoollogs/cdb12201/preupgrade/preupgrade.log 

Examine the preupgrade.log file and follow the recommendation. Execute the preupgrade_fixups_<pdb_name>.sql against all or respective pluggable database.

The below command will run the preupgrade_fixups.sql against all the pluggable databases.

 $ORACLE_HOME/perl/bin/perl $ORACLE_HOME/rdbms/admin/catcon.pl -n 2 -e -b preupgrade_fixups /refresh/app/oracle/cfgtoollogs/cdb12201/preupgradepreupgrade_fixups.sql

To run the preupgrade fixups script against a particular pluggable database, below command can be used:

$ORACLE_HOME/perl/bin/perl catcon.pl -c ‘CDB$ROOT’ -n 2 -e -b /preupgrade_fixups_cdbroot /refresh/app/oracle/cfgtoollogs/cdb12201/preupgrade/preupgrade_fixups_CDB_ROOT.sql

Check for Invalid Objects / Components:

Verify the below queries against the database and all the pluggable databases.

set pagesize500
set linesize 100
select substr(comp_name,1,40) comp_name, status, substr(version,1,10) version from dba_registry order by comp_name;

select substr(object_name,1,40) object_name,substr(owner,1,15) owner,object_type from dba_objects where status=’INVALID’ order by owner,object_type;

select owner,object_type,count(*) from dba_objects where status=’INVALID’ group by owner,object_type order by owner,object_type ;

If you find invalid objects and/or database components then try to VALIDATE the invalid objects and/or database components by executing the following steps:

Run $ORACLE_HOME/rdbms/admin/utlrp.sql to validate the invalid objects in the database. You can execute the utlrp.sql scripts multiple times to validate the invalid objects.

From source home,execute the utlrp.sql against the container and all the pluggable databases.

cd $ORACLE_HOME/rdbms/admin/
$ORACLE_HOME/perl/bin/perl catcon.pl -n 1 -e -b utlrp -d ”’.”’ utlrp.sql

$ sqlplus “/ as sysdba”
SQL> @$ORACLE_HOME/rdbms/admin/utlrp.sql

using -b utlrp, the log file utlrp0.log is generated as the script is run. The log file provides results of the recompile.

Gathering Optimizer Statistics to Decrease Oracle Database Downtime

Oracle strongly recommends that you use this procedure to gather statistics before performing Oracle Database upgrades.Oracle recommends that you use the DBMS_STATS.GATHER_DICTIONARY_STATS procedure to gather these statistics. For example, enter the following command:

$ORACLE_HOME/perl/bin/perl $ORACLE_HOME/rdbms/admin/catcon.pl -l /tmp -b gatherstats — –x”exec dbms_stats.gather_dictionary_stats”

Above command gather dictionary statistics for all PDBs in a container database.

you can use the below command to gather statistics against a particular PDB.

For pdb_1 pluggable database :

$ORACLE_HOME/perl/bin/perl $ORACLE_HOME/rdbms/admin/catcon.pl -l /tmp -c ‘PDB_1’ -b pdb_1_gatherstats — –x”exec dbms_stats.gather_dictionary_stats”

for cdb$root container:

$ORACLE_HOME/perl/bin/perl $ORACLE_HOME/rdbms/admin/catcon.pl -l /tmp -c ‘CDB$ROOT’ -b root_gatherstats — –x”exec dbms_stats.gather_dictionary_stats”

Verifying Materialized View Refreshes are Complete Before Upgrade

Use this procedure to query the system to determine if there are any materialized view refreshes still in progress. Before upgrading Oracle Database, you must wait until all materialized views have
completed refreshing.

$ORACLE_HOME/perl/bin/perl $ORACLE_HOME/rdbms/admin/catcon.pl -l /tmp -b mview_refresh — –x”SELECT o.name FROM sys.obj$ o, sys.user$ u, sys.sum$ s WHERE o.type# = 42 AND bitand(s.mflags, 8) =8″

It will verify against all the pluggable databases or below query can be used to verify against particular PDB:

SQL> SELECT o.name FROM sys.obj$ o, sys.user$ u, sys.sum$ s WHERE o.type# = 42 AND bitand(s.mflags, 8) =8;

Doc ID 1406586.1 – How to Handle Materialized Views When You Upgrade or Clone a Database

Check of TIMESTAMP WITH TIMEZONE Datatype

The time zone files that are supplied with Oracle Database 19c release is version 32.

Case 1 Timezone version of source database is lower or equal 32.

If the source database is using a timezone file lower than version 32 then there is no DST patch to apply in source oracle home or target 12cR2 home.

Case 2 Timezone version of source database is higher than 32.

If the source database uses a Timezone version higher than 32 then BEFORE the upgrade you MUST patch the target 19c Oracle Home with a timezone data file of the SAME version as the one used in the source release database.

Ensuring That No Files Are in Backup Mode and no files need media recovery Before Upgrading

Execute below query to check for the status of the backup:

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

Ensure that no files require media recovery:

SQL> SELECT * FROM v$recover_file;

Purging Recycle Bin before upgrade

below command can be used to purge from all the pdbs:

$ORACLE_HOME/perl/bin/perl $ORACLE_HOME/rdbms/admin/catcon.pl -l /tmp -b purge_recyclebin — –x”PURGE DBA_RECYCLEBIN”or

SQL> PURGE DBA_RECYCLEBIN;

Starting with Oracle Database 12c release 2 (12.2), you can upgrade the database without disabling Oracle Database Vault.

If your target Oracle Database release is 12.2 or later, then you can upgrade without disabling Oracle Database Vault.
If you have Oracle Database Vault enabled in your source Oracle Database release, then you can upgrade Oracle Database to Oracle Database 18c and later releases without first disabling Oracle Database Vault. After the upgrade, if your source Oracle Database release is Oracle Database 12c release 1 (12.1) or later, then Oracle Database Vault is enabled with the same enforcement settings that you had in place before the upgrade.

For example, if your source database is Oracle Database release 12.1, and Oracle Database Vault was disabled in that release, then it remains disabled after you upgrade.

If your source Oracle Database release 12.1 database had Oracle Database Vault enabled before the upgrade, then Oracle Database Vault is enabled after the upgrade.

If you manually disable Oracle Database Vault before the upgrade, then you must enable Oracle Database Vault manually after the upgrade

Schema-Only Accounts and Upgrading EXPIRED Password Accounts

Before starting your upgrade, determine if you want to use password authenticate to default Oracle Database accounts where their passwords are in EXPIRED status, and their account is in LOCKED status

During upgrades to Oracle Database 19c, default Oracle accounts that have not had their passwords reset before upgrade (and are set to EXPIRED status), and that are also set to LOCKED status, are set to NO AUTHENTICATION after the upgrade is complete.

Because of this new feature, default accounts that are changed to schema-only accounts become unavailable for password authentication. The benefit of this feature is that administrators no longer have to periodically rotate the passwords for these Oracle Database-provided schemas. This feature also reduces the security risk of attackers using default passwords to hack into these accounts.

If you want to prevent these Oracle accounts from being set to schema-only accounts during the upgrade, then you must either set a valid strong password for the account before you start the upgrade, or set a valid strong password for these accounts after upgrade, or unlock the accounts before you log in to the upgraded Oracle Database.
After the upgrade, an administrator can also enable password authentication for schema-only accounts. However, for better security, Oracle recommends that you keep these accounts as schema only accounts.

Copying Transparent Encryption Oracle Wallets

If you use Oracle wallet with Transparent Data Encryption (TDE), then copy the sqlnet.ora and wallet file to the new Oracle home.
You must copy the sqlnet.ora and the wallet file manually before starting the upgrade.

1. Log in as an authorized user.
2. Manually copy the sqlnet.ora file, and the wallet file, ewallet.p12, to the new release Oracle home.
3. Open the Oracle wallet in mount.

For example:
SQL> STARTUP MOUNT;
SQL> ALTER SYSTEM SET ENCRYPTION WALLET OPEN;

Understanding Password Case Sensitivity  and SEC_CASE_SENSITIVE_LOGON parameter

Starting with Oracle Database 12c release 2 (12.2), the default password-based authentication protocol configuration excludes the use of the case-insensitive 10G password version. By default, the SQLNET.ORA parameter SQLNET.ALLOWED_LOGON_VERSION_SERVER is set to 12, which is an Exclusive Mode.

For greater security, Oracle recommends that you leave case-sensitive password-based authentication enabled. This setting is the default. However, you can temporarily disable case-sensitive authentication during the upgrade to new Oracle Database releases. After the upgrade, you can then decide if you want to enable the case-sensitive password-based authentication feature as part of your implementation plan to manage your password versions.

Before upgrading, Oracle recommends that you determine if this change to the default password-based authentication protocol configuration affects you. Perform the following checks:

  • Identify if you have accounts that use only 10G case-insensitive password authentication versions.
  • Identify if you have Oracle Database 11g release 2 (11.2.0.3) database or earlier clients that have not applied critical patch update CPUOct2012, or a later patch update, and have any account that does not have the case-insensitive 10G password version.
  • Ensure that you do not have the deprecated parameter SEC_CASE_SENSITIVE_LOGON set to FALSE. Setting this parameter to FALSE prevents the use of the case-sensitive password versions (the 11G and 12C password versions) for authentication.

Running Upgrades with Read-Only Tablespaces

Use the Parallel Upgrade Utility with the -T option to take schema-based tablespaces offline during upgrade. Oracle Database can read file headers created in earlier releases, so you are not required to do anything to them during the upgrade. The file headers of READ ONLY tablespaces are updated when they are changed to READ WRITE.

If the upgrade suffers a catastrophic error, so that the upgrade is unable to bring the tablespaces back online, then review the upgrade log files. The log files contain the actual SQL statements required to make the tablespaces available. To bring the tablespaces back online, you must run the SQL statements in the log files for the database, or run the log files for each PDB.

Deprecated Parameters and Desupported Parameters

Remove desupported initialization parameters and adjust deprecated initialization parameters. In new releases, some parameters are desupported, and other parameters are deprecated. Remove all desupported parameters from any parameter file that starts the new Oracle Database instance. Desupported parameters can cause errors in new Oracle Database releases.
The Pre-Upgrade Information Tool displays any deprecated parameters and desupported parameters it finds in the Deprecated Parameters and Desupported Parameters sections, respectively.

Invoke DBUA

Once all prerequisite checks are successful, run DBUA. Pleaes make sure that environment variables are pointing to Target Oracle 19c.

$ export ORACLE_HOME=/refresh/app/oracle/product/19.0.0.0
$ export PATH=/refresh/app/oracle/product/19.0.0.0/bin:$PATH
$ cd $ORACLE_HOME/bin/
$ ./dbua

DBUA (Step 1 of 10)

Choose the database for upgrade to Oracle 19c. In this case, it is cdb12201 container database.

Select the container Database to be upgraded to 12.2

DBUA (Step 2 of 10)

From 12.2, we can prioritize the upgrade of the pluggable database. In the given screen, the cdb12201 container database is having three pdbs : pdb12201, pdb1, pdb2.
The priority of pdb12201 is set to 1 whereas pdb1,pdb2 set with priority 2. Based on this selection DBUA will upgrade pdb12201 first followed by pdb1, pdb2.

Choose priority for the pdbs

DBUA (Step 3 of 10)

Once you choose the database, the DBUA will perform the pre-upgrade steps. It will execute the preupgrade scripts against all the pdbs and show errors / warnings. Choose “Show All Container” for the reported errors. If the errors are fixable than click on “Fix & Check Again”. If there are any errors which can not be fixed by DBUA then manually fix and verify that there are no errors in the prerequisite checks page.

preupgrade.jar will get executed against all the pdbs. will show warnings / errors.

DBUA (Step 4 of 10)

Once the preupgrade warnings / errors has been addressed, In step 4, we can choose options to Enable Parallel upgrade, Recompile Invalid Objects in post-upgrade, Timezone upgrade for all the pdbs (The timezone version on 19c is 32), Gather statistics for all the pdbs.

Choose appropriate options for enable parallel upgrade, recompile invalid objects, timezone update and gather stats before upgrade

DBUA (Step 5 of 10)

In the given screen, there are recovery options available. you can choose to Create a Guranteed Restore Point or RMAN backup incase of failure of upgrade.

Database recovery options

DBUA (Step 6 of 10)

We can configure new listener or upgrade the existing “LISTENER_12101” listener which is running from 12.2.0.1 home to Target 19c home.

create a new listener or upgrade the existing 12.2.0.1 listener

DBUA (Step 7 of 10)

This screen is to configure EM express or register the upgraded database with EM Cloud control.

Configure EM Express / Cloud Control

DBUA (Step 8 of 10)

This is the summary screen before the actual upgrade starts. Click on Finish to proceed with the upgrade.

Upgrade Summary Page

DBUA (Step 9 of 10)

Once the ugprade stats, DBUA will configure and bring up the database in upgrade mode from 19c home and it will perform the upgrade of CDB$ROOT container.

Upgrading CDB$ROOT Container

Based on the priority order choosen on Step 2 of 10. DBUA will configure P1, P2 priority list for PDBs : pdb12201, pdb1 and pdb2. Priority of PDB12201 is set to 1 and priority of pdb1, pdb2 is set to 2.
PDBs in P1 priority list (PDB$SEED, PDB12201) will be upgraded after the upgrade of CDB$ROOT. and PDBs in P2 priority list (PDb1, PDB2) will be upgraded after the upgrade of PDBs of P1 priority list.

Displays P1, P2 Priority List

After completing the upgrade to root container, DBUA will perform the upgrade of P1 priority list PDBs (PDB$SEED, PDB12201).

Upgraede of PDB$SEED and PDB12201.

then DBUA will perform the upgrade of P2 priority list (pdb1, pdb2).

Upgraede of PDB1, PDB2

DBUA (Step 10 of 10)

Once DBUA complete the upgrade, it will show the results.

Upgrade Results

Below screen shows the total duration and Timezone information.

Upgrade Duration and Timezone.

Oracle 19c – Complete Checklist for Manual Upgrades to Non-CDB Oracle Database 19c

PURPOSE

This document is created for use as a guideline and checklist when manually upgrading from Oracle 11gR2 (11.2) or Oracle 12c Release 1 (12.1) or Oracle 12c Release 2 (12.2) to Oracle 19c Release

SCOPE

Database Administrators, Support

DETAILS

Step 1: Upgrade Path for 19c Oracle database

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

Intermediate upgrades needs 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

For any multi-step upgrade, if you must carry out two upgrades to upgrade to the current release, then you must run the preupgrade script twice: First, for the intermediate upgrade release, and second, for the target upgrade target release.  For example, if the database from which you are upgrading is running Oracle Database 10g, then follow these steps:

  • Upgrade release 10.2.0.5 to release 12.1.0.2 using the instructions in Oracle Database Upgrade Guide 12c Release 1 (12.1), including running the pre-upgrade script for 12.1.0.2.
  • Upgrade Oracle Database 12c release 1 (12.1.0.2) directly to Oracle Database 19c. Use the instructions in this article, Oracle Database Upgrade Guide, including running the preupgrade script for 19c.

Upgrade to an intermediate Oracle Database release that can be directly upgraded to the current release. Upgrade Oracle Database releases that are not supported for direct upgrade in this release to an intermediate Oracle Database release that is supported for direct upgrade.

This restriction does not apply if you use Oracle Data Pump export/import to migrate data to the new release.

For example:

  • If you are upgrading from release 11.2.0.2 or 11.1.0.7, then you must first upgrade to Oracle Database 11g release 2 (11.2.0.4).
  • If you are upgrading from release 10.2.0.2, 10.2.0.3, 10.2.0.4,10.2.0.5 or 10.1.0.5, then you must first upgrade to release 11.2. or 12.1
  • If you are upgrading from release 9.2.0.8, then you must first upgrade to a sequence of intermediate Oracle Database releases:
  • Upgrade from release 9.2.0.8 to release 11.2.0.4. Then upgrade from release 11.2 to 19c

Changes in 19c release

Support for DBMS_JOB

Oracle continues to support the DBMS_JOB package. However, you must grant the CREATE JOB privilege to the database schemas that submit DBMS_JOB jobs.

Oracle Scheduler replaces the DBMS_JOB package. Although DBMS_JOB is still supported for backward compatibility, Oracle strongly recommends that you switch from DBMS_JOB to Oracle Scheduler.

  • During the 19c upgrade for each job in DBMS_JOB a corresponding entry will be created with DBMS_SCHEDULER
  • The old DBMS_JOB interface still works. But using it will always create a corresponding entry in the scheduler
  • Pre-upgrade check in preupgrade.jar checks for inconsistencies or any issues

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.

Desupport of Oracle Streams

Starting in Oracle Database 19c (19.1), Oracle Streams is desupported. Oracle GoldenGate is the replication solution for Oracle Database.

Note that Oracle Database Advanced Queuing is not deprecated, and is fully supported in Oracle Database 19c. Oracle Streams did not support features added in Oracle Database 12c (12.1) and later releases, including the multitenant architecture, LONG VARCHAR, and other new features. Oracle Streams replication functionality is superseded by GoldenGate.

Preupgrade check “STREAMS_SETUP” will warn if Oracle Streams is presented.  To remove Oracle streams in 18c refer to Oracle documentation, similarly refer to section “Removing an Oracle Streams Configuration” in the Oracle Streams Concepts and Administration Guide specific for the Oracle release from which you are removing.

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

Step3: Requirements and recommendations for target ORACLE_HOME

  • Verify the whether your operating system is certified for 19c.  Click here to launch certification portal
  • Install 19c, verify there are no installation related issues.
  • Download and install latest RU if any
  • Copy spfile or pfile from source ORACLE_HOME (under $ORACLE_HOME/dbs) to target home
    • Remove any _ (underscore) parameter, obsolete and deprecated parameters in pfile
    • Note min value of COMPATIBLE parameter to upgrade 19c is “11.2.0”, make sure you have COMPATIBLE parameter is set to 11.2.0 or greater
  • Review patch recommendations as given in the article “Patches to apply before upgrading Oracle GI and DB to 19c (Doc ID 2539751.1)”
  • Apply patch 29213893 on target ORACLE_HOME to avoid ORA-01422 error – refer: Database Upgrade to 12.2, 18c, 19c fails with ORA-01422, ORA-06512 for SYS.DBMS_STATS (Doc ID 2525596.1)

Step 4: Pre-upgrade checks

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

Note: These will be taken care by preupgrade.jar.

Check materialized views

Check the status of all materialized views (MV), and refresh any materialized views that are not fresh.
Check the size of your materialized view logs. If any materialized view logs have non-zero rows, then refresh the base table materialized views.
Check the size of direct loader logs and PMOP logs (partition maintenance operation logs). If any direct loader logs or PMOP logs have non-zero rows, then refresh the MVs indicated by the logs
Before upgrading Oracle Database, you must wait until all materialized views have completed refreshing.

Run the following SQL query:

SQL> SELECT o.name FROM sys.obj$ o, sys.user$ u, sys.sum$ s WHERE o.type# = 42 AND bitand(s.mflags, 8) =8;

Note: These will be taken care by preupgrade.jar.  Review the preupgrade logs

Schema-Only Accounts and Upgrading EXPIRED Password Accounts

Before starting your upgrade, determine if you want to use password authenticate to default Oracle Database accounts where their passwords are in EXPIRED status, and their account is in LOCKED status

During upgrades to Oracle Database 19c, default Oracle accounts that have not had their passwords reset before upgrade (and are set to EXPIRED status), and that are also set to LOCKED status, are set to NO AUTHENTICATION after the upgrade is complete.

Because of this new feature, default accounts that are changed to schema-only accounts become unavailable for password authentication. The benefit of this feature is that administrators no longer have to periodically rotate the passwords for these Oracle Database-provided schemas. This feature also reduces the security risk of attackers using default passwords to hack into these accounts.

If you want to prevent these Oracle accounts from being set to schema-only accounts during the upgrade, then you must either set a valid strong password for the account before you start the upgrade, or set a valid strong password for these accounts after upgrade, or unlock the accounts before you log in to the upgraded Oracle Database.

After the upgrade, an administrator can also enable password authentication for schema-only accounts. However, for better security, Oracle recommends that you keep these accounts as schema only accounts.

Copying Transparent Encryption Oracle Wallets

If Oracle wallet used with Transparent Data Encryption (TDE), then copy the sqlnet.ora and wallet file to the new Oracle home.  You must copy the sqlnet.ora and the wallet file manually before starting the upgrade.

  1. Log in as an authorized user.
  2. Manually copy the sqlnet.ora file, and the wallet file, ewallet.p12, to the new release Oracle home.

Open the Oracle wallet in mount.

For example:

      SQL> STARTUP MOUNT;
SQL> ALTER SYSTEM SET ENCRYPTION WALLET OPEN

 

Understanding Password Case Sensitivity

Starting with Oracle Database 12c release 2 (12.2), the default password-based authentication protocol configuration excludes the use of the case-insensitive 10G password version. By default, the SQLNET.ORA parameter SQLNET.ALLOWED_LOGON_VERSION_SERVER is set to 12, which is an Exclusive Mode.

For greater security, Oracle recommends that you leave case-sensitive password-based authentication enabled. This setting is the default. However, you can temporarily disable case-sensitive authentication during the upgrade to new Oracle Database releases. After the upgrade, you can then decide if you want to enable the case-sensitive password-based authentication feature as part of your implementation plan to manage your password versions.

Before upgrading, Oracle recommends that you determine if this change to the default password-based authentication protocol configuration affects you. Perform the following checks:

  • Identify if you have accounts that use only 10G case-insensitive password authentication versions.
  • Identify if you have Oracle Database 11g release 2 (11.2.0.3) database or earlier clients that have not applied critical patch update CPUOct2012, or a later patch update, and have any account that does not have the case-insensitive 10G password version.
  • Ensure that you do not have the deprecated parameter SEC_CASE_SENSITIVE_LOGON set to FALSE. Setting this parameter to FALSE prevents the use of the case-sensitive password versions (the 11G and 12C password versions) for authentication.

For more information refer 19c Oracle database documentation

 

Checking for Accounts Using Case-Insensitive Password Version

Identify if the Oracle Database that getting upgraded has accounts or configuration parameters that are using a case-insensitive password version.

By default, in Oracle Database 12c release 2 (12.2) and later releases, the 10G password version is not generated or allowed.

If you do not set SQLNET.ALLOWED_LOGON_VERSION_SERVER to a permissive authentication protocol that permits case-insensitive versions, and you do not want user accounts authenticated with case-insensitive password versions to be locked out of the database, then you must identify affected accounts, and ensure that they are using case-sensitive password versions.

For more information refer 19c Oracle database documentation

Running Upgrades with Read-Only Tablespaces

Use the Parallel Upgrade Utility with the -T option to take schema-based tablespaces offline during upgrade.  Oracle Database can read file headers created in earlier releases, so you are not required to do anything to them during the upgrade. The file headers of READ ONLY tablespaces are updated when they are changed to READ WRITE.  If the upgrade suffers a catastrophic error, so that the upgrade is unable to bring the tablespaces back online, then review the upgrade log files. The log files contain the actual SQL statements required to make the tablespaces available. To bring the tablespaces back online, you must run the SQL statements in the log files for the database, or run the log files for each PDB.

Viewing Tablespace Commands In Upgrade Log Files

If a catastrophic upgrade failure occurs, then you can navigate to the log directory (Oracle_base/cfgtoologs/dbua), and run commands in the log files manually to bring up tablespaces. You can view tablespace commands in the following log files:

Non-CDB Upgrades: catupgrd0.log
PDB databases: catupgrdpdbname0.log, where pdbname is the name of the PDB that you are upgrading.

At the beginning of each log file, you find SQL statements such as the following, which sets tables to READ ONLY:

SQL> ALTER TABLESPACE <Tablespace Name> READ ONLY;
Tablespace altered.

Near the end of each log file, you find SQL statements to reset tables to READ WRITE:

SQL> ALTER TABLESPACE <Tablespace Name> READ WRITE;
Tablespace altered.

 

Preparing the New Oracle Home for Upgrading

  • Copy configuration files from the Oracle home of the database being upgraded to the new release Oracle Database Oracle home.
  • If you have a password file that resides within the old environment Oracle home, then move or copy the password file to the new Oracle home.  It is recommended to recreate the password file freshly to leverage the new features (if any) provided by orapwd utility.
  • Remove desupported initialization parameters and adjust deprecated initialization parameters. In new releases, some parameters are desupported, and other parameters are deprecated. Remove all desupported parameters from any parameter file that starts the new Oracle Database instance. Desupported parameters can cause errors in new Oracle Database releases. Also, alter any parameter whose syntax has changed in the new release.
  • If you are upgrading a cluster database, then you need to change CLUSTER_DATABASE=FALSE before starting upgrade

 

Prerequisites for Preparing Oracle Home on Windows

System must meet these requirements before starting Oracle Database upgrade on Microsoft Windows platforms.

For security reasons, different Microsoft Windows user accounts configured as Oracle home users for different Oracle homes are not allowed to share the same Oracle Base.

  • Database upgrade is supported when the same Windows user account is used as the Oracle home user in both the source and destination Oracle homes.
  • Database upgrade is supported when the Oracle home from which the database is being upgraded uses the Windows Built-in Account. Releases earlier than Oracle Database 12c (release 11.2 and earlier) only supported the built-in account option for the Oracle home user on Windows.
  • The Oracle home user may not have access to files outside its own Oracle Base and Oracle home. If that is the case, then if you choose a different Oracle Base during upgrade, it is possible that Oracle Database services cannot access files in the older Oracle Base. Using DBUA for database upgrade ensures that the Oracle home user has access to files outside of its own Oracle Base and its own Oracle home.
  • Before upgrading manually, or before using the custom files from the older Oracle Base (for example, wallets, configuration files and other custom files ), you must grant access to the Oracle home user for these outside files, or copy these files to the new Oracle Base.

 

Databases That Use Oracle Label Security and Oracle Database Vault

Audit Table Preupgrade and Archive Requirements

For Oracle Database releases earlier than 12.1 using Oracle Label Security and Oracle Database Vault, you must run the OLS preprocess script before you upgrade.

If you are upgrading from a database earlier than Oracle Database release 12.1 that uses Oracle Label Security (OLS) and Oracle Database Vault, then you must first run the OLS preprocess script, olspreupgrade.sql, to process the aud$ table contents. The OLS upgrade moves the aud$ table from the SYSTEM schema to the SYS schema. The olspreupgrade.sql script is a preprocessing script required for this move.

Running the olspreupgrade.sql script before upgrading is mandatory for upgrading databases earlier than Oracle Database release 12.1 that use Oracle Label Security and Oracle Database Vault. Once you have upgraded to Oracle Database release 12.1, you do not have to perform the OLS preprocessing procedure going forward to patch or upgrade the database.

The olspreupgrade.sql script creates a temporary table PREUPG_AUD$ in the SYS schema and moves the SYSTEM.aud$ records to SYS.PREUPG_AUD$. As a safety measure, Oracle recommends that you archive your audit trail before running the olspreupgrade.sql script. If Oracle Label Security is installed on your database, and you are upgrading from an earlier release, then you must run the OLS preprocess script before upgrading.

Oracle Database Vault and Upgrades of Oracle Database Release 11.2

If Oracle Label Security is installed in the earlier release that you are upgrading, then grant the DV_PATCH_ADMIN role to SYS.

To run the OLS preprocess script on a release 11.2 database before upgrading:

1.    Copy the following scripts script from the newly installed Oracle home (19c) to the Oracle home of the database that needs to be upgraded (11.2):

        ORACLE_HOME/rdbms/admin/olspreupgrade.sql
ORACLE_HOME/rdbms/admin/emremove.sql
ORACLE_HOME/olap/admin/catnoamd.sql

2.    Start SQL*Plus and connect as DVOWNER to the database that you want to upgrade.

3.    Run the following statement:

    SQL> GRANT DV_PATCH_ADMIN to SYS;

4.    At the system prompt, connect SYS as SYSDBA:

    CONNECT SYS AS SYSDBA

5.    Run the preprocess scripts for Data Vault

    ORACLE_HOME/rdbms/admin/olspreupgrade.sql
ORACLE_HOME/rdbms/admin/emremove.sql
ORACLE_HOME/olap/admin/catnoamd.sql

You may continue to run your applications on the database while the preprocess scripts are running.

6.    After the olspreupgrade.sql completes its run successfully, start SQL*Plus and connect to the database as DVOWNER.

7.    Run the following SQL statement:

    SQL> REVOKE DV_PATCH_ADMIN from SYS;

Granting the DV_PATCH_ADMIN Role to SYS for Oracle Database Vault

If Oracle Database Vault is enabled, then to perform checks for Oracle Data Vault, the upgrade process requires running three SQL scripts – olspreupgrade.sql, emremove.sql, catnoamd.sql

Start SQL*Plus and connect as DVOWNER to the database that you want to upgrade.

Run the following statement:

    SQL> GRANT DV_PATCH_ADMIN to SYS;

 

Manually remove DB control with emremove.sql

Stop/shutdown DB control

emctl stop dbconsole

 
Login as sysdba

SQL>SET ECHO ON
SQL>SET SERVEROUTPUT ON
SQL>@emremove.sql >> Script located in new 12c ORACLE_HOME/rdbms/admin

Manually remove ORACLE_HOME/HOSTNAME_SID/ and ORACLE_HOME/oc4j/j2ee/OC4J_DBConsole_HOSTNAME_SID directory from the system
On windows delete DB Console service OracleDBConsoleSID

Ensure no files are in Back up mode before starting the upgrade

Run the following statement:

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

Purge Recycle bin

To empty the database recycle bin, run the following command:

SQL> PURGE DBA_RECYCLEBIN

Note: The database recycle bin must be empty during the upgrade process to avoid possible ORA-00600 errors, and to minimize the upgrade time.

Performance

Preserve performance statistics
Check network performance
Gather Optimizer statistics

To decrease the amount of downtime, gather statistics. Oracle recommends that you use the DBMS_STATS.GATHER_DICTIONARY_STATS procedure to gather these statistics. For example, enter the following SQL statement:

SQL> EXEC DBMS_STATS.GATHER_DICTIONARY_STATS;

Checking Time zone settings

Time zone should less than or equal to target database time zone version. If source is having higher time zone, then apply time zone patch on target ORACLE_HOME to match the source.

 

About Upgrading Oracle OLAP Data Security Policies

Data security roles defined in a release 11g Oracle Database instance are not automatically converted to ORAS. Before upgrading Oracle Database Release 11g to a current Oracle Database release, delete any data security roles that are defined in the 11g database. After the upgrade, you can use the new release Oracle Database Analytic Workspace Manager to define the data security roles again.

If DB us upgraded from an 11g database without deleting the 11g data security roles, then any data security policies that include a data security role are invalid in the later Oracle Database releases.

 

Step 5: Preupgrade step

Execute Preupgrade script from source home

$Earlier_release_Oracle_home/jdk/bin/java -jar $New_release_Oracle_home/rdbms/admin/preupgrade.jar FILE TEXT DIR output_dir

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>

Note: You can download latest preupgrade script from the document – How to Download and Run Oracle’s Database Pre-Upgrade Utility (Doc ID 884522.1)

The Pre-Upgrade Tool (preupgrade.jar) creates the following files:

The log file preupgrade.log.
The preupgrade_fixups_pdbname.sql (for PDBs, where pdbname is the name of the PDB) or preupgrade_fixups.sql script (Non-CDB databases).
The postupgrade_fixups_pdbname.sql (for PDBs, where pdbname is the name of the PDB) or postupgrade_fixups.sql script (Non-CDB databases).   Execute this script once upgrade is completed.

It is recommended to execute pre-upgrade fixup script, if any, which are AUTO FIXABLE

Preupgrade fixup script

Before upgrade is started, execute preupgrade fixups (preupgrade_fixups.sql) script manually in SQL*Plus to resolve many of the issues identified by the preupgrade tool.

Dependencies on Network Utility Packages

After executing preupgrade script, verify the preupgrade log

WARNING: --> Database contains schemas with objects dependent on network packages.
.... Refer to the Database Upgrade Guide for instructions to configure Network ACLs.
.... USER WKSYS has dependent objects.
.... USER SYSMAN has dependent objects.
.... USER FLOWS_010600 has dependent objects.

Execute the following query to view DBA_DEPENDIENCIES

SQL> 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’);

To ensure that the new access controls are part of your upgrade testing, prepare a post-upgrade script to make the scripts available in your database environment.  After the upgrade, grant specific required privileges. Access is based on the usage in the original database.

Check Time zone version

Check if target database’s time zone version is lower than the source database time zone version.  If yes, before starting upgrade time zone should be upgrade without fail.  RDBMS DST patches are available in Note 412160.1

Backing Up Oracle Database for Upgrading

Suggested to backup Oracle database after you run the Pre-Upgrade Information Tool.  Take backup or create a guaranteed restore point or both.  Test your backup.  Ensure there is a proper fallback plan in case of any issues.

    rman “target / nocatalog”

RUN
{
ALLOCATE CHANNEL chan_name TYPE DISK;
BACKUP DATABASE FORMAT ‘some_backup_directory%U’ TAG before_upgrade;
BACKUP CURRENT CONTROLFILE FORMAT ‘controlfile location and name’;
}

Back Up Files to Preserve Downgrade and Recovery Options

Oracle Data Guard Broker Configuration File and Downgrades

With upgrades to Oracle Database 19c and later releases, you must back up the Data Guard broker configuration file to preserve the capability to downgrade to an earlier release.

In releases before Oracle Database 19c, Oracle Database settings that are mapped to Oracle Data Guard broker properties are maintained in the Oracle Data Guard broker configuration file, and can be modified using the DGMGRL command-line interface. However, starting with Oracle Database 19c, these database settings are no longer stored in the broker configuration file. As a result of this change, although you can continue to modify these properties using DGMGRL, the values that you modify are no longer stored in the Oracle Data Guard broker configuration file. Instead, the DGMGRL commands directly modify the Oracle Database initialization parameters or database settings to which these Oracle Data Guard Broker properties are mapped.

Because of this change to the way that property settings are managed, if you use Oracle Data Guard broker, then Oracle recommends that you export your earlier release Oracle Data Guard broker configuration file to a secure backup location before you start the upgrade. If you do not back up the Oracle Data Guard broker configuration file before the upgrade, then after the upgrade, you cannot downgrade to an earlier release and retain the property options you previously selected for Oracle Data Guard

Exporting a Broker Configuration

Use the EXPORT CONFIGURATION command to export the metadata contained in the broker configuration file to a text file.

The directory in which the broker configuration file is stored must be accessible to the Oracle server process.

Connect to the primary database.

DGMGRL> CONNECT sysdg@North_Sales.example.com;
Password: password
Connected to “North_Sales”
Connected as SYSDG.
Export the broker configuration.

The following command exports the broker configuration and stores it in a file named myconfig.txt in the trace directory.

DGMGRL> EXPORT CONFIGURATION TO ‘myconfig.txt’;
Succeeded.

 

Step 6: Upgrade Database to 19c

Start the upgrade

Shut down the database.

SQL> SHUTDOWN IMMEDIATE

 

Steps specific to Windows :

If your operating system is Windows, then complete the following steps:

a. Stop the OracleServiceSID Oracle service of the database you are upgrading,where SID is the instance name. For example, if your SID is ORCL, then enter the following at a command prompt:

C:\> NET STOP OracleServiceORCL

b. Delete the Oracle service at a command prompt using ORADIM. Refer to your platform guide for a complete list of the ORADIM syntax and commands.
For example, if your SID is ORCL, then enter the following command.

C:\> ORADIM -DELETE -SID ORCL

c. Create the service for the new release Oracle Database at a command prompt using the ORADIM command of the new Oracle Database release.
For example:

C:\> ORADIM -NEW -SID SID -SYSPWD PASSWORD -MAXUSERS USERS  -STARTMODE AUTO -PFILE ORACLE_HOME\DATABASE\INITSID.ORA

 

For Unix/Linux

Set the environment variables to point to target ORACLE_HOME

export ORACLE_HOME=<path to Oracle 19c>
export PATH=$ORACLE_HOME/bin:$PATH
export ORACLE_BASE=<path to Oracle_Base set during installation>

Copy the SPFILE.ORA or INIT.ORA file from the old Oracle home to the target Oracle home.

Start DB in upgrade mode from target ORACLE_HOME

CONNECT / AS SYSDBA
SQL> startup upgrade;
SQL> exit

On Linux/Unix

cd $ORACLE_HOME/bin
./dbupgrade 

On Windows

cd %ORACLE_HOME%\bin
dbupgrade

Execute Post-Upgrade Status Tool, utlusts.sql and review the upgrade spool log file.  You run the Post-Upgrade Status Tool in the environment of the new release.

$ sqlplus “/as sysdba”
SQL> STARTUP
SQL> @utlusts.sql

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

Note: While executing utlusts.sql, if  “ORA-06502: PL/SQL: numeric or value error: character string buffer too small” is received, execute
$ sqlplus “/as sysdba”
SQL> STARTUP
SQL> @utlusts.sql TEXT

 

If you are using Oracle Clusterware, set CLUSTER_DATABASE=TRUE and you must upgrade the Oracle Clusterware keys for the database.  Run srvctl for Oracle Database 19c to upgrade the database. For example:

ORACLE_HOME/bin/srvctl upgrade database -db name -o ORACLE_HOME

Check upgrade status

Execute dbupgdiag.sql and review the logs.  To download this script refer to Note 556610.1

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

Step 7: Post-upgrade

 

Setting Environment variables on Linux and Unix

Confirm that the following environment variables point to the directories of the new Oracle home:

ORACLE_HOME
PATH

 

Update oratab entries

Modify the corresponding entry in the /etc/oratab file to point to the new ORACLE_HOME location.

Post-upgrade fixup script

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

SQL> @postupgrade_fixups.sql

Create or Migrate Your Password File with ORAPWD

If the REMOTE_LOGIN_PASSWORDFILE initialization parameter is set to EXCLUSIVE, then create or migrate the password file with ORAPWD. Oracle Database 12c and later releases provide a new option to ORAPWD for migrating the password file from your existing database.

With Oracle Database 12c release 2 (12.2) and later releases, if REMOTE_LOGIN_PASSWORDFILE is set to SHARED, then you receive a pre-upgrade check validation warning. You can choose one of the following options to correct this issue:

Disable the password file-based authentication entirely by setting REMOTE_LOGIN_PASSWORDFILE = NONE

Limit the password file-based authentication by setting REMOTE_LOGIN_PASSWORD = EXCLUSIVE

Recovery Catalog Upgrade

If you use a version of the recovery catalog schema that is older than that required by the RMAN client, then you must upgrade it. You can upgrade the Recovery catalog by executing the UPGRADE CATALOG command

Please refer to Oracle documentation under “Upgrading the Recovery Catalog” for complete information and steps

Upgrade the Time Zone File Version After Upgrading Oracle Database

If the Pre-Upgrade Information Tool instructed you to upgrade the time zone files after completing the database upgrade, then use the DBMS_DST PL/SQL package to update the RDBMS DST (timezone) version.

For latest DST patch refer to Note 412160.1.

The following scripts get delivered with Oracle Database 18c onward

$ORACLE_HOME/rdbms/admin/utltz_countstats.sql
Script to gives how much TIMESTAMP WITH TIME ZONE data there is in a database using stats info. No restart required.

$ORACLE_HOME/rdbms/admin/utltz_countstar.sql
Script to approximate how much TIMESTAMP WITH TIME ZONE data there is in a database using a COUNT(*) for each table that has a TSTZ column. This script is useful when using DBMS_DST package or the scripts of utlz_upg_check.sql and utlz_upg_apply.sql scripts.

$ORACLE_HOME/rdbms/admin/utltz_upg_check.sql
Time zone upgrade check script

?/rdbms/admin/utltz_upg_apply.sql
Time zone apply script. Warning: This script will restart the database and adjust time zone data.

Upgrading Statistics Tables

If you created statistics tables using the DBMS_STATS.CREATE_STAT_TABLE procedure, then upgrade these tables by running DBMS_STATS.UPGRADE_STAT_TABLE.  In the following example, SYS is the owner of the statistics table and ‘dictstattab’ is the name of the statistics table.

EXECUTE DBMS_STATS.UPGRADE_STAT_TABLE(‘SYS’, ‘dictstattab’);

Perform this procedure for each statistics table.

Oracle 18c – DBUA In Silent Mode

GOAL

How to Run DBUA in Silent mode ?

SOLUTION

You can use DBUA with the -silent command line option to carry out noninteractive (“silent”) upgrades.

In silent mode, DBUA does not present a user interface. DBUA writes messages (including information, errors, and warnings) to a log file in ORACLE_HOME/cfgtools/dbua/upgradesession_timestamp, where session_timestamp represents the timestamp for the upgrade that DBUA has run.

 

All the features of the Interactive DBUA are available in non-interactive as well ,some of those

  • It is the recommended method for performing Database upgrade at Release and patch level.
  • DBUA performs major release upgrade of oracle database that are supported for direct upgrade.
  • It performs all the upgrade tasks automatically.
  • DBUA performs preupgrade check and lists the unsatisfied prerequisites.
  • DBUA has option to upgrade timezone information, make user tablespaces to read only, take RMAN backup before upgrade starts.
  • DBUA also provides opportunity to restore database backup to rollback DB upgrade.
  • It can upgrade existing Listener to 18c or create new listener in 18c during upgrade.
  • DBUA shows progress of Upgrade activity in an enhanced manner.

 

DBUA captures all the activities in logs located at

If Oracle Base is set then the log files will be generated under $ORACLE_BASE/cfgtoollogs/dbua/upgradesession_<timestamp>/<SID>/

If Oracle Base is not set then the log files will be generated under $ORACLE_HOME/cfgtoollogs/dbua/upgradesession_<timestamp>/<SID>/

If Oracle Home is Read Only then the log files will be generated under $ORACLE_BASE/cfgtoollogs/dbua/upgradesession_<timestamp>/<SID>/

Note:
-l flag can be used for custom log directory.

 

Supported Oracle Versions for 18c Upgrade

 

  • DBUA can upgrade only supported versions of direct upgrade.

    Direct Upgrade to 18.x:

    Source Database Target Database
    11.2.0.3 and Higher 18.x
    12.1.0.x (12.1.0.1 – 12.1.0.2) 18.x
    12.2.0.1 18.x

     

    Indirect Upgrade to 18.x:

     
    Source Database Intermediate upgrade path Target database
    11.2.0.1/11.2.0.2 –> 11.2.0.3/11.2.0.4 –> 18.x
    11.1.0.6/11.1.0.7 –> 11.2.0.3/11.2.0.4 –> 18.x
    10.2.0.2, 10.2.0.3, 10.2.0.4, 10.2.0.5 –> 11.2.0.3/11.2.0.4/12.1.0.1/12.1.0.2 –> 18.x
    10.1.0.5 –> 11.2.0.3/11.2.0.4/12.1.0.1/12.1.0.2 –> 18.x
    9.2.0.8 or earlier –> 11.2.0.3/11.2.0.4 –> 18.x

DBUA Silent Mode

Execution steps:

When you run DBUA by using the command-line option, you can specify all valid DBUA options in a script form. The script form enables you to avoid entering configuration information in a graphic user interface dialog.

dbua -silent [<command> [options]]

-silent

-sid | -dbName

-sid

-dbName

Following are the possible options:

[-asmsnmpPassword ]

[-backupLocation ]

[-changeUserTablespacesReadOnly – <true | false> ]

[-createGRP – <true | false> ]

[-createListener – <true | false> ]

[-dbName  ]

[-oracleHome ]

[-sysDBAUserName ]

[-sysDBAPassword ]

[-dbsnmpPassword ]

[-disableUpgradeScriptLogging – <true | false> ]

[-emConfiguration – <DBEXPRESS | CENTRAL | BOTH | NONE>]

[-dbsnmpPassword ]

[-emPassword ]

[-emUser ]

[-emExpressPort ]

[-omsHost ]

[-omsPort ]

[-asmsnmpPassword ]

[-ignorePreReqs – <true | false> ]

[-ignoreScriptErrors – <true | false> ]

[-initParam ]

[-initParamsEscapeChar ]

[-excludeInitParams ]

[-keepDeprecatedParams – <true | false> ]

[-localListenerWithoutAlias ]

[-listeners ]

[-localRacSid ]

[-logDir ]

[-newGlobalDbName ]

[-newSid ]

[-oracleHomeUserPassword ]

[-pdbs ]

-sid | -dbName

-sid

[-oracleHome ]

[-sysDBAUserName ]

[-sysDBAPassword ]

-dbName

[-oracleHome ]

[-sysDBAUserName ]

[-sysDBAPassword ]

[-pdbsWithPriority ]

-sid | -dbName

-sid

[-oracleHome ]

[-sysDBAUserName ]

[-sysDBAPassword ]

-dbName

[-oracleHome ]

[-sysDBAUserName ]

[-sysDBAPassword ]

[-performFixUp – <true | false> ]

[-postUpgradeScripts ]

[-preUpgradeScripts ]

[-recompile_invalid_objects – <true | false> ]

[-upgrade_parallelism ]

[-upgradeTimezone – <true | false> ]

[-upgradeXML ]

[-useExistingBackup – <true | false> ]

[-useGRP ]

Below is the description of options / flags :

[-asmsnmpPassword – <Specify ASMSNMP user password>]
[-backupLocation – <Specify directory to back-up your database before starting the upgrade>]
[-changeUserTablespacesReadOnly – <true | false> Change user tablespaces read only for the duration of the upgrade.]
[-createGRP – <true | false> To create a guaranteed restore point when database is in archive log and flashback mode.]
[-createListener – <true | false> To create a listener in newer release Oracle home specify listenrName:lsnrPort.]
[-dbName – <Specify Database Name>]
[-oracleHome – <Specify the Oracle home path of the database>]
[-sysDBAUserName – <User name with SYSDBA privileges>]
[-sysDBAPassword – <Password for sysDBAUserName user name>]
[-dbsnmpPassword – <Specify DBSNMP user password>]
[-disableUpgradeScriptLogging – <true | false> This command disables the detailed log generation for running SQL scripts during the upgrade process. By default this is enabled. To enable the log generation, don’t specify this command.]
[-emConfiguration – <DBEXPRESS | CENTRAL | BOTH | NONE>]
[-dbsnmpPassword – <Specify DBSNMP user password>]
[-emPassword – <Specify EM admin user password>]
[-emUser – <Specify EM admin username to add or modify targets>]
[-emExpressPort – <Specify the port where EM Express will be configured>]
[-omsHost – <Specify EM management server host name>]
[-omsPort – <Specify EM management server port number>]
[-asmsnmpPassword – <Specify ASMSNMP user password>]
[-ignorePreReqs – <true | false> Ignore error conditions in pre-upgrade checks.]
[-ignoreScriptErrors – <true | false> Specify this flag for ignoring ORA errors during custom scripts.]
[-initParam – <Specify a comma separated list of initialization parameter values of the format name=value,name=value>]
[-initParamsEscapeChar – <Specify escape character for comma when a specific initParam has multiple values. If the escape character is not specified backslash is the default escape character>]
[-excludeInitParams – <Specify a comma separated list of initialization parameters to be excluded.>]
[-keepDeprecatedParams – <true | false> To retain deprecated parameters during database upgrade.]
[-localListenerWithoutAlias – To set LOCAL_LISTENER without TNS Alias.]
[-listeners – <To register the database with existing listeners, specify listeners by comma separated listenerName:Oracle Home. Listeners from lower release home are migrated to newer release home. Specifying -listeners lsnrName1,lsnrName2 or -listeners lsnrName1:<Oracle home path>,-listeners lsnrName2:<Oracle home path>, DBUA searches specified listeners from GI home (if configured), target home and source home>]
[-localRacSid – <Specify the local System Identifier of the cluster database if the cluster database is not registered in OCR>]
[-logDir – <Specify the path to a custom log directory>]
[-newGlobalDbName – <Specify New Global Database Name. This option can only be used for Oracle Express Edition upgrade>]
[-newSid – <Specify New System Identifier. This option can only be used for Oracle Express Edition upgrades>]
[-oracleHomeUserPassword – <Specify Oracle Home user password>]
[-pdbs – <Specify a comma separated list with the names of the pluggable databases (PDB) that will be upgraded. Specify ALL to select all or NONE to select none of the pluggable databases for upgrade>]
-sid | -dbName
-sid – <Specify System Identifier>
[-oracleHome – <Specify the Oracle home path of the database>]
[-sysDBAUserName – <User name with SYSDBA privileges>]
[-sysDBAPassword – <Password for sysDBAUserName user name>]
-dbName – <Specify Database Name>
[-oracleHome – <Specify the Oracle home path of the database>]
[-sysDBAUserName – <User name with SYSDBA privileges>]
[-sysDBAPassword – <Password for sysDBAUserName user name>]
[-pdbsWithPriority – <Specify a comma separated list of pluggable databases (PDB) to be upgraded along with its corresponding priorities (being 1 the top priority) of the format <pdb name>:<upgrade priority>,<pdb name>:<upgrade priority> >]
-sid | -dbName
-sid – <Specify System Identifier>
[-oracleHome – <Specify the Oracle home path of the database>]
[-sysDBAUserName – <User name with SYSDBA privileges>]
[-sysDBAPassword – <Password for sysDBAUserName user name>]
-dbName – <Specify Database Name>
[-oracleHome – <Specify the Oracle home path of the database>]
[-sysDBAUserName – <User name with SYSDBA privileges>]
[-sysDBAPassword – <Password for sysDBAUserName user name>]
[-performFixUp – <true | false> Enable or disable fix ups for the silent upgrade mode.]
[-postUpgradeScripts – <Specify a comma separated list of SQL scripts with their complete pathnames. These scripts will be executed at the end of the upgrade>]
[-preUpgradeScripts – <Specify a comma separated list of SQL scripts with their complete pathnames. These scripts will be executed before the upgrade>]
[-recompile_invalid_objects – <true | false> Recompile invalid objects as part of the upgrade.]
[-upgrade_parallelism – <Specify number of CPU’s to be used for parallel upgrade>]
[-upgradeTimezone – <true | false> Upgrade the timezone files of the database.]
[-upgradeXML – <Specify the path to the existing pre-upgrade XML file> This option only applies to in-place database upgrades.]
[-useExistingBackup – <true | false> To restore database using existing RMAN backup.]
[-useGRP – <Specify the name of the existing guaranteed restore point> To restore the database using a specified guaranteed restore point.]

Example

The following command selects the database orcl for upgrade using the noninteractive (“silent”) option:

dbua -silent -sid orcl

 

Few more Cases for Running DBUA in Noninteractive (”Silent”) Mode

dbua -silent -sid sidb112 -backupLocation /u01/sidb1123/backup -sysDBAUserName sys -sysDBAPassword <password> -oracleHome /u01/app/product/11.2.0/dbhome_1 -upgradeTimezone true

dbua -silent -sid sidb1123 -backupLocation /u01/sidb1123/backup -sysDBAUserName sys -sysDBAPassword <password> -oracleHome /u01/app/product/11.2.0/dbhome_1 -upgrade_parallelism 1 -upgradeTimezone true

dbua -silent -sid db1124 -backupLocation /u01/sidb1123/backup -sysDBAUserName sys -sysDBAPassword <password> -performFixUp true -upgradeTimezone true

dbua -silent -dbName rdbcdb -oracleHome /u01/app/product/11.2.0/dbhome_1 -sysDBAUserName sys -sysDBAPassword <password> -backupLocation /u01/sidb1123/backup -recompile_invalid_objects true -upgradeTimezone true

dbua -silent -dbName amdb -oracleHome /u01/app/product/11.2.0/dbhome_1 -sysDBAUserName sys -sysDBAPassword <password> -recompile_invalid_objects true -useGRP GRP_20170620bfupgrade -upgradeTimezone true

dbua -silent -dbName rdb121 -oracleHome /u01/app/product/12.1.0/dbhome_2 -sysDBAUserName sys -sysDBAPassword <password> -backupLocation /u01/sidb1123/backup -recompile_invalid_objects true -upgradeTimezone true

dbua -silent -dbName ronedb -oracleHome /u01/app/product/12.1.0/dbhome_2 -sysDBAUserName sys -sysDBAPassword <password> -changeUserTablespacesReadOnly true -recompile_invalid_objects true -upgradeTimezone true -createGRP true

Oracle 18c – Complete Checklist for upgrading Oracle 12.x Container Database (CDB) to Oracle Database 18c (18.x) using DBUA

PURPOSE

The purpose of this article is to help DBA’s / Support Teams to perform the upgrade of a database using DBUA to 18.x.

SCOPE

DBA, Support

DETAILS

Database Upgrade Assistant (DBUA)

Database Upgrade Assistant (DBUA) provides a graphical user interface to guide you through the upgrade of Oracle Database.

DBUA works for CDB and non-CDB database systems. It is the recommended method for performing a major release upgrade or patchset release upgrade.

You can use DBUA to upgrade multitenant architecture container databases (CDB), pluggable databases (PDBs), and non-CDB databases.
The procedures are the same, but the choices you must make and the behavior of DBUA are different, depending on the type of upgrade.

DBUA automates the upgrade process by performing all of the tasks.

DBUA provides support for Oracle Real Application Clusters (Oracle RAC) databases. In an Oracle RAC environment,
DBUA upgrades all the database and configuration files on all nodes in the cluster.

DBUA, graphical user interface must be invoked within the new Oracle home where the Oracle Database 18c software has been installed.
For windows, Only an Administrator or Installed owner should invoke DBUA for Windows systems.

DBUA runs the Pre-Upgrade Information Tool as part of the prerequisite checks it performs before starting the upgrade.
However, to reduce downtime, Oracle recommends that you run the Pre-Upgrade Information Tool as part of your upgrade planning, so that you can analyze the database,
and take proactive steps before your planned upgrade date.
Once, you address / fix the pre-upgrade recommendation / warnings /errors and continue with the upgrade, DBUA shows the progress of the upgrade for each component of source database.

As with previous releases of DBUA, 18c DBUA restricts the carry over of hidden parameters since Oracle recommends not to have hidden parameters other than those suggested
via support during the upgrade.
To view existing hidden parameters execute the following command while connected AS SYSDBA:

SELECT name,description from SYS.V$PARAMETER WHERE name LIKE ‘\_%’ ESCAPE ‘\’;

DBUA performs some of the checks before actually starting the database upgrade. Some of the checks can be done manually to reduce downtime for the upgrade.

DBUA provides below options:

– Upgrade timezone. The default timezone vetrsion in 18.x is 26.

– Gather dictionary statistics before upgrade.

– Make user tablespaces read only.

– Take RMAN backup before upgrade.

– Create Restore Point for Database Flashback

– Restore database backup to rollback upgrade

– Option to execute Custom scripts before and after upgrade

– show the location of DBUA logs and Alert log files.

– Option to upgrade existing listener to 18.x home or create a new listener in 18.x target home.

About Read-Only Oracle Homes

Starting with Oracle Database 18c, you can configure an Oracle home in read-only mode.
In a read-only Oracle home, all the configuration data and log files reside outside of the read-only Oracle home. This feature allows you to use the read-only Oracle home as a software image that can be distributed across multiple servers.

Upgrade Path / Compatibility Matrix for 18.x Oracle Database

DBUA can upgrade only supported versions of direct upgrade.

Direct Upgrade to 18.x:

Source Database Target Database
12.1.0.x (12.1.0.1 – 12.1.0.2) 18.x
12.2.0.1 18.x

 

Requirements and Recommendation for source database

 

– Ensure that all database components/objects provided by Oracle are VALID in the source database prior to starting the upgrade.

– Before you start an upgrade or downgrade process, Oracle strongly recommends that you update both your earlier release and your new release (18.x) Oracle Database to the latest Oracle bundle patch or patch set update (BP or PSU).

– Ensure that you do not have duplicate objects in the SYS and SYSTEM schema. For 1 and 2 refer to:
Doc Id 556610.1 – Script to Collect DB Upgrade/Migrate Diagnostic Information (dbupgdiag.sql)
– dbupgdiag.sql script is a set of sql statements intended to provide a user friendly output to diagnose the status of the database either before (or) after upgrade. The script will create a output file called db_upg_diag_<sid>_<timestamp>.log

– IF APEX is installed then it is recommended to upgrade APEX in the source DB first before upgrading DB

– Timezone should less than or equal to target database timezone version.

– Make sure to have a valid backup of source database prior to upgrade.

– Disable any custom triggers that would get executed before / after DDL statements. Re-enable after the upgrade.

– Check the database server upgrade/downgrade compatibility matrix before upgrading the database.

– Set Archive Log ON during upgrade. Oracle recommends that you set Archive Log ON in order for DBUA to create and update the log file for the upgrade process.

– For Oracle RAC, if you upgrade a cluster database using DBUA, then you must leave the CLUSTER_DATABASE initialization parameter set to TRUE.

– Ensure to run the pre-upgrade utility prior to upgrading the database.

– Examine and follow the recommendation given in the preupgrade log file.

– Materialized views in source database should be stopped before upgrade

Doc ID 1406586.1 – How to Handle Materialized Views When You Upgrade or Clone a Database

– Disable scheduled database custom jobs / cron jobs.

– Make sure you have COMPATIBLE parameter is set to 12.1.0 or greater

 

 

Requirements and Recommendations for Target database

– Verify whether your operating system / platform is certified for 18.x release.

– Download and Install Oracle 18c (18.x) in a new Oracle_Home and make sure there are no binary relinking errors.

– Download and Install the latest available RU or RUR from My Oracle Support (MOS).

– Make sure to set the ORACLE_HOME, PATH, LD_LIBRARY_PATH, LIBPATH etc. to 18.x target home.

– Review patch recommendations as given in the article “Patches to apply before upgrading Oracle GI and DB to 18c (Doc ID 2414935.1)”

– Apply patch 29213893 on target ORACLE_HOME to avoid ORA-01422 error – refer: Database Upgrade to 12.2, 18c, 19c fails with ORA-01422, ORA-06512 for SYS.DBMS_STATS (Doc ID 2525596.1)

 

Prerequisites for Preparing Oracle Home on Windows

 

Your system must meet these requirements before you can upgrade Oracle Database on Microsoft Windows platforms. For security reasons, different Microsoft Windows user accounts configured as Oracle
home users for different Oracle homes are not allowed to share the same Oracle Base.

– Database upgrade is supported when the same Windows user account is used as the Oracle home user in both the source and destination Oracle homes.

– Database upgrade is supported when the Oracle home from which the database is being upgraded uses the Windows Built-in Account. Releases earlier than Oracle Database 12c (release 11.2 and earlier) only supported the built-in account option for the Oracle home user on Windows.

– The Oracle home user may not have access to files outside its own Oracle Base and Oracle home. If that is the case, then if you choose a different Oracle Base during upgrade, it is possible that Oracle Database services cannot access files in the older Oracle Base. Using DBUA for database upgrade ensures that the Oracle home user has access to files outside of its own Oracle Base and its own Oracle home.

 

 

 

Pre Upgrade

 

$Earlier_release_Oracle_home/jdk/bin/java -jar $New_release_Oracle_home/rdbms/admin/preupgrade.jar [FILE|TERMINAL] [TEXT|XML] [DIR output_dir]

 
FILE|TERMINAL – Use this option to direct script output to a file. Use TERMINAL to direct output to the terminal. If it is not specified then defaultr is FILE.
TEXT – Use this option to specify log should be in Text format. Use TEXT to specify text output. Use XML to specify XML output. If you do not specify an output type, then the default is text.
DIR – Logs will be created under <output_dir>. Directs the output to a specific directory. If you do not specify an output directory with the DIR option, then the output is directed to one of the default locations: If you define ORACLE_BASE environment variable then the generated scripts and log files will be created under $ORACLE_BASE/cfgtoollogs/<dbname>/preupgrade/ location else it will create under $ORACLE_HOME/cfgtoollogs/db_name/preupgrade/.

 

For example,

source Oracle Home : /refresh/home/oracle/ora_base/product/12.1.0.2/dbhome_1

target Oracle Home : /refresh/home/oracle/ora_base/product/18.1

$ export ORACLE_SID=orcl
$ export ORACLE_BASE=/refresh/home/oracle/ora_base
$ export ORACLE_HOME=/refresh/home/oracle/ora_base/product/12.1.0.2/dbhome_1

$ $ORACLE_HOME/jdk/bin/java -jar /refresh/home/oracle/ora_base/product/18.1/rdbms/admin/preupgrade.jar FILE TEXT

==================
PREUPGRADE SUMMARY
==================
/refresh/home/oracle/ora_base/product/12.1.0.2/dbhome_1/cfgtoollogs/ORCL/preupgrade/preupgrade.log
/refresh/home/oracle/ora_base/product/12.1.0.2/dbhome_1/cfgtoollogs/ORCL/preupgrade/preupgrade_fixups.sql
/refresh/home/oracle/ora_base/product/12.1.0.2/dbhome_1/cfgtoollogs/ORCL/preupgrade/postupgrade_fixups.sql

Execute fixup scripts across the entire CDB:

Before upgrade:

1. Execute preupgrade fixups with the below command
$ORACLE_HOME/perl/bin/perl -I$ORACLE_HOME/perl/lib -I$ORACLE_HOME/rdbms/admin $ORACLE_HOME/rdbms/admin/catcon.pl -l /refresh/home/oracle/ora_base/product/12.1.0.2/dbhome_1/cfgtoollogs/ORCL/preupgrade/ -b preup_ORCL /refresh/home/oracle/ora_base/product/12.1.0.2/dbhome_1/cfgtoollogs/ORCL/preupgrade/preupgrade_fixups.sql

2. Review logs under /refresh/home/oracle/ora_base/product/12.1.0.2/dbhome_1/cfgtoollogs/ORCL/preupgrade/

After the upgrade:

1. Execute postupgrade fixups with the below command
$ORACLE_HOME/perl/bin/perl -I$ORACLE_HOME/perl/lib -I$ORACLE_HOME/rdbms/admin $ORACLE_HOME/rdbms/admin/catcon.pl -l /refresh/home/oracle/ora_base/product/12.1.0.2/dbhome_1/cfgtoollogs/ORCL/preupgrade/ -b postup_ORCL /refresh/home/oracle/ora_base/product/12.1.0.2/dbhome_1/cfgtoollogs/ORCL/preupgrade/postupgrade_fixups.sql

2. Review logs under /refresh/home/oracle/ora_base/product/12.1.0.2/dbhome_1/cfgtoollogs/ORCL/preupgrade/

You may find the below scripts :

$ ls -l /refresh/home/oracle/ora_base/product/12.1.0.2/dbhome_1/cfgtoollogs/ORCL/preupgrade/
-rw-r–r– 1 oracle oinstall 8237 Jul 10 05:37 postupgrade_fixups_CDB_ROOT.sql
-rw-r–r– 1 oracle oinstall 8221 Jul 10 05:38 postupgrade_fixups_PDB1.sql
-rw-r–r– 1 oracle oinstall 8221 Jul 10 05:38 postupgrade_fixups_PDB2.sql
-rw-r–r– 1 oracle oinstall 8221 Jul 10 05:38 postupgrade_fixups_PDB3.sql
-rw-r–r– 1 oracle oinstall 8237 Jul 10 05:37 postupgrade_fixups_PDB_SEED.sql
-rw-r–r– 1 oracle oinstall 28440 Jul 10 05:39 postupgrade_fixups.sql
-rw-r–r– 1 oracle oinstall 8778 Jul 10 05:37 preupgrade_fixups_CDB_ROOT.sql
-rw-r–r– 1 oracle oinstall 8693 Jul 10 05:38 preupgrade_fixups_PDB1.sql
-rw-r–r– 1 oracle oinstall 8693 Jul 10 05:38 preupgrade_fixups_PDB2.sql
-rw-r–r– 1 oracle oinstall 8693 Jul 10 05:38 preupgrade_fixups_PDB3.sql
-rw-r–r– 1 oracle oinstall 8709 Jul 10 05:37 preupgrade_fixups_PDB_SEED.sql
-rw-r–r– 1 oracle oinstall 36645 Jul 10 05:39 preupgrade_fixups.sql

 

 

Examine the preupgrade.log file and follow the recommendation. Execute the preupgrade_fixups_<pdb_name>.sql against all or respective pluggable database

 

cd $ORACLE_HOME/rdbms/admin/
$ORACLE_HOME/perl/bin/perl catcon.pl -n 1 -e -b /tmp/preupgrade_fixups /refresh/home/oracle/ora_base/product/12.1.0.2/dbhome_1/cfgtoollogs/ORCL/preupgrade/preupgrade_fixups.sql

or

$ORACLE_HOME/perl/bin/perl catcon.pl -n 2 -e -b /tmp/preupgrade_fixups /refresh/home/oracle/ora_base/product/12.1.0.2/dbhome_1/cfgtoollogs/ORCL/preupgrade/preupgrade_fixups.sql

 

 

Above command will run the preupgrade_fixups.sql against all the pluggable databases.

To run the preupgrade_fixups.sql against individual pluggable database, below command can be used:

cd $ORACLE_HOME/rdbms/admin/

$ORACLE_HOME/perl/bin/perl catcon.pl -c ‘CDB$ROOT’ -n 1 -e -b /tmp/preupgrade_fixups /refresh/home/oracle/ora_base/product/12.1.0.2/dbhome_1/cfgtoollogs/ORCL/preupgrade/preupgrade_fixups_CDB_ROOT.sql

or

$ORACLE_HOME/perl/bin/perl catcon.pl -c ‘PDB1’ -n 1 -e -b /tmp/preupgrade_fixups /refresh/home/oracle/ora_base/product/12.1.0.2/dbhome_1/cfgtoollogs/ORCL/preupgrade/preupgrade_fixups_CDB_PDB1.sql

 

 

 

 

The latest preupgrade utility for 18.x can be found from :

How to Download and Run Oracle’s Database Pre-Upgrade Utility (Doc ID 884522.1)

 

 

Check for Invalid Objects / Components

 

set pagesize500
set linesize 100
select substr(comp_name,1,40) comp_name, status, substr(version,1,10) version from dba_registry order by comp_name;

select substr(object_name,1,40) object_name,substr(owner,1,15) owner,object_type from dba_objects where status=’INVALID’ order by owner,object_type;

select owner,object_type,count(*) from dba_objects where status=’INVALID’ group by owner,object_type order by owner,object_type ;

 

If you find invalid objects and/or database components then try to VALIDATE the invalid objects and/or database components by executing the following steps:

Run utlrp.sql to validate the invalid objects in the database. You can execute the utlrp.sql scripts multiple times to validate the invalid objects.

From 12.1 home,execute the utlrp.sql against the container and all the pluggable databases.

cd $ORACLE_HOME/rdbms/admin/
$ORACLE_HOME/perl/bin/perl catcon.pl -n 1 -e -b utlrp -d ”’.”’ utlrp.sql

$ sqlplus “/ as sysdba”
SQL> @$ORACLE_HOME/rdbms/admin/utlrp.sql

using -b utlrp, the log file utlrp0.log is generated as the script is run. The log file provides results of the recompile.

Gathering Optimizer Statistics to Decrease Oracle Database Downtime

 

Oracle strongly recommends that you use this procedure to gather statistics before performing Oracle Database upgrades.Oracle recommends that you use the DBMS_STATS.GATHER_DICTIONARY_STATS   procedure to gather these statistics. For example, enter the following SQL statement:

$ORACLE_HOME/perl/bin/perl $ORACLE_HOME/rdbms/admin/catcon.pl -l /tmp -b gatherstats — –x”exec dbms_stats.gather_dictionary_stats”

Above command gather dictionary statistics for all PDBs in a container database.

you can use the below command to gather statistics against a particular PDB.

For PDB1 pluggable database :

$ORACLE_HOME/perl/bin/perl $ORACLE_HOME/rdbms/admin/catcon.pl -l /tmp -c ‘PDB1’ -b pdb1_gatherstats — –x”exec dbms_stats.gather_dictionary_stats”

For CDB$ROOT container:

$ORACLE_HOME/perl/bin/perl $ORACLE_HOME/rdbms/admin/catcon.pl -l /tmp -c ‘CDB$ROOT’ -b root_gatherstats — –x”exec dbms_stats.gather_dictionary_stats”

 

Verifying Materialized View Refreshes are Complete Before Upgrade

Use this procedure to query the system to determine if there are any materialized view refreshes still in progress. Before upgrading Oracle Database, you must wait until all materialized views have
completed refreshing.

$ORACLE_HOME/perl/bin/perl $ORACLE_HOME/rdbms/admin/catcon.pl -l /tmp -b mview_refresh — –x”SELECT o.name FROM sys.obj$ o, sys.user$ u, sys.sum$ s WHERE o.type# = 42 AND bitand(s.mflags, 8) =8″

 It will verify against all the pluggable databases or below query can be used:

SQL> SELECT o.name FROM sys.obj$ o, sys.user$ u, sys.sum$ s WHERE o.type# = 42 AND bitand(s.mflags, 8) =8;

 

How to Handle Materialized Views When You Upgrade or Clone a Database (Doc ID 1406586.1)

 

Check of TIMESTAMP WITH TIMEZONE Datatype

The time zone files that are supplied with Oracle Database 12c release 2 (18.x) is version 26.

Case 1 Timezone version of source database is lower or equal 26.

If the source database is using a timezone file lower than version 26 then there is no DST patch to apply in source oracle home or target 12cR2 home.

Case 2 Timezone version of source database is higher than 26.

If the source database uses a Timezone version higher than 26 then BEFORE the upgrade you MUST patch the target 12cR2 $ORACLE_HOME with a timezone data file of the SAME version as the one used in the source release database.

 

Ensuring That No Files Are in Backup Mode and no files need media recovery Before Upgrading

 

Execute below query to check for the status of the backup:

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

Ensure that no files require media recovery:

SQL> SELECT * FROM v$recover_file;

 

Purging Recycle Bin before upgrade

Below command can be used to purge from all the pdbs:

 $ORACLE_HOME/perl/bin/perl $ORACLE_HOME/rdbms/admin/catcon.pl -l /tmp -b purge_recyclebin — –x”PURGE DBA_RECYCLEBIN”

or

SQL> PURGE DBA_RECYCLEBIN;

we can purge the recycle bin via DBUA.

 

Databases That Use Oracle Label Security and Oracle Database Vault

Audit Table Preupgrade and Archive Requirements

For Oracle Database releases earlier than 12.1 using Oracle Label Security and Oracle Database Vault, you must run the OLS preprocess script before you upgrade.

If you are upgrading from a database earlier than Oracle Database release 12.1 that uses Oracle Label Security (OLS) and Oracle Database Vault, then you must first run the OLS preprocess script, olspreupgrade.sql, to process the aud$ table contents. The OLS upgrade moves the aud$ table from the SYSTEM schema to the SYS schema. The olspreupgrade.sql script is a preprocessing script required for this move.

Running the olspreupgrade.sql script before upgrading is mandatory for upgrading databases earlier than Oracle Database release 12.1 that use Oracle Label Security and Oracle Database Vault. Once you have upgraded to Oracle Database release 12.1, you do not have to perform the OLS preprocessing procedure going forward to patch or upgrade the database.

Granting the DV_PATCH_ADMIN Role to SYS for Oracle Database Vault
If Oracle Database Vault is enabled, then to perform checks for Oracle Data Vault, the upgrade process requires running three SQL scripts – olspreupgrade.sql, emremove.sql, catnoamd.sql

Start SQL*Plus and connect as DVOWNER to the database that you want to upgrade.

Run the following statement:

    SQL> GRANT DV_PATCH_ADMIN to SYS;

 

Copying Transparent Encryption Oracle Wallets

If you use Oracle wallet with Transparent Data Encryption (TDE), and you use Database Upgrade Assistant (DBUA) to upgrade the database, then copy the sqlnet.ora and wallet file to the new 18.x Oracle home.

You must copy the sqlnet.ora and the wallet file manually before starting the upgrade.
1. Log in as an authorized user.
2. Manually copy the sqlnet.ora file, and the wallet file, ewallet.p12, to the new release Oracle home.
3. Open the Oracle wallet in mount.

For example:
SQL> STARTUP MOUNT;
SQL> ALTER SYSTEM SET ENCRYPTION WALLET OPEN;

 

Check the accounts use Case-Insensitive password version

Log in to SQL*Plus as an administrative user, and enter the following SQL query
SELECT USERNAME,PASSWORD_VERSIONS FROM DBA_USERS;

If there are any 10g versions, suggest you to refer Oracle documentation to fix 10g versions, failing to do so, user accounts with LOCKED after upgrade is completed.

 

About Password Case Sensitivity

Ensure that you do not have the deprecated parameter SEC_CASE_SENSITIVE_LOGON set to FALSE.

 

Invoke DBUA

 

Invoke DBUA

DBUA ( Step 1 of 10 )

Select the database to be upgrade , as there is only 1 database in example , it is auto selected — ORCL

DBUA_STEP_1

DBUA ( Step 2 of 10 )

We can prioritize the upgrade of the pluggable database. in the given screen, the ORCL container database is having three pdbs : pdb1, pdb2, pdb3. The priority of pdb1 is set to 1 whereas for pdb2,pdb3 it is 2. Based on this selection DBUA will upgrade pdb1 first followed by pdb2, pdb3.

 

DBUA Step 2

DBUA ( Step 3 of 10 )

Once the selection is done, DBUA will perform the pre-upgrade steps. It will execute the preupgrade scripts against all the pdbs and show errors / warnings. Choose “Show All Container” for the reported errors. If the errors are fixable than click on “Fix & Check Again”. If there are any errors which can not be fixed by DBUA then manually fix and verify that there are no errors in the prerequisite checks page.

DBUA_STEP_3a  DBUA_STEP_3b

DBUA ( Step 4 of 10 )

Once the preupgrade warnings / errors has been addressed, In step 4, we can choose options like Enable Parallel upgrade, Recompile Invalid Objects in post-upgrade, Timezone upgrade for all the pdbs (The timezone version on 18.x is 26), Gather statistics for all the pdbs.

DBUA_STEP_4

DBUA ( Step 5 of 10 )

In the given screen, there are recovery options available. you can choose to Create a Guaranteed Restore Point or RMAN backup in case of failure of upgrade.

DBUA_STEP_5

DBUA ( Step 6 of 10 )

We can configure new listener or upgrade the existing “LISTENER_ORCL” listener which is running from 12.1.0.2 home to Target 18.x home.

 

DBUA_STEP_6

 

 

DBUA ( Step 7 of 10 )

This screen is to configure EM express or register the upgraded database with EM Cloud control.

DBUA_STEP_7

 

DBUA ( Step 8 of 10 )

 

DBUA will show the summary of what actions it will perform

DBUA_STEP_8a DBUA_STEP_8b

 

DBUA ( Step 9 of 10 )

The DBUA will start the upgrade process of ORCL database. Once the upgrade starts, DBUA will first perform the upgrade of CDB$ROOT container. it will perform the pre-upgrade steps and then it will start upgrading Oracle Server,XML component followed by other components except Oracle APEX ( which is not upgraded as a part of Database Upgrade , you need to do it separately )

DBUA_STEP_9a

 

 

Once the upgrade completed for CDB$ROOT, database will be restarted and DBUA will perform the post upgrade steps like running catuppst.sql, configuring listener for 18.x home, recompile invalid objects and upgrading timezone,configuring EM Express.

 

DBUA_STEP_9b

 

 

Once the CDB$ROOT gets upgraded successfully, DBUA will use the priority list where the PDB1 will be upgraded first. The PDB1 priority is set to 1.So based on the priority, DBUA will consider priority list “P1” for pluggable database PDB$SEED and PDB1 to be upgraded first. In below screen, DBUA will parallely perform the upgrade for PDB$SEED and PDB1. It will perform the upgrade of components viz Oracle Server, XDB, Workspace Manager component for both PDB$SEED, PDB1 pdbs.

Note that the CDB$ROOT and PDB$SEED has highest priority.

DBUA_STEP_9g

 

 

DBUA_STEP_9c DBUA_STEP_9d

 

After completing the upgrade of PDB$SEED and PDB1, DBUA will start the post upgrade process for “P1” priority list for PDB$SEED and PDB1 pdbs. DBUA will bounce back both the pdbs PDB$SEED and PDB1 for post upgrade steps.

 

DBUA_STEP_9e DBUA_STEP_9f

 

 

Once the upgrade of P1 list gets completed, DBUA will start the upgrade of P2 priority list which contains PDB2 and PDB3. In the below screen we can see that the PDB2 and PDB3 pdbs are getting upgraded parallely.Followed by the post upgrade steps for both the PDB’s respectively.

 

DBUA_STEP_9h DBUA_STEP_9i

 

DBUA ( Step 10 of 10 )

The final screen will show the result of the container database upgraded to 18.x. It will show the list of pluggable databases upgraded. It will show the detailed summary for the time taken by DBUA to complete the upgrade of individual PDBs

DBUA_STEP_10a DBUA_STEP_10b

 

It will show the timezone upgrade details for CDB$ROOT and all the pluggable databases.

DBUA_STEP_10c DBUA_STEP_10d

 

 

Post Upgrade

Execute dbupgdiag.sql script against the CDB$ROOT container and all the pluggable databases PDB1, PDB2, PDB3 to verify the status of objects and components . If there are invalid objects then run utlrp.sql to recompile the invalid objects as follows:

cd $ORACLE_HOME/rdbms/admin/

$ORACLE_HOME/perl/bin/perl catcon.pl -n 1 -e -b utlrp -d ”’.”’ utlrp.sql                  ===> To run the utlrp.sql against all the PDBs.

or

$ORACLE_HOME/perl/bin/perl catcon.pl -l /tmp -n 2 -e -b utlrp -c ‘PDB1’ utlrp.sql         ===> To recompile invalid objects for PDB1 pluggable database.

 

sql> connect / as sysdba

sql> @?/rdbms/admin/utlrp.sql

Oracle 18c – Complete checklist for Manual Upgrade for Multitenant Architecture Oracle Databases from 12.1.x.x to 18.x.x.x

PURPOSE

This document is created for use as a guideline and checklist when upgrading 12cR1, 12cR2 multitenant database to higher version 18.x.x.x

SCOPE

Database Administrators, Support

DETAILS

Introduction

Multitenant architecture database can either be upgraded in parallel, or in sequence.

Starting with Oracle Database 12c release 1 (12.1), Oracle provides multitenant architecture, which enables the creation and administration of pluggable databases (PDBs) in a container database (CDB). You can upgrade multitenant architecture systems using either Oracle Database Upgrade Assistant (DBUA), or using the Parallel Upgrade Utility to carry out manual upgrades.

There are two techniques for upgrading Oracle Databases using the multitenant architecture:

  • In parallel. With this technique, you carry out one upgrade operation that upgrades the CDB, and then upgrades the PDBs in parallel.
  • Sequentially. With this technique, you install a new release CDB, prepare and unplug PDBs from the earlier release CDB, plug the PDBs into a later release CDB, and then complete the upgrade for each PDB.

Upgrading Oracle Multitenant In Parallel

With the In Parallel technique, you first upgrade CDB$ROOT using the Parallel Upgrade Utility (catctl.pl), using parameters to set the degree of parallel processing and availability:

The -n parameter defines how many parallel processes run the upgrade, up to 8.

The -M parameter determines if the CDB$ROOT stays in UPGRADE mode through the entire upgrade, or becomes available for access after the CDB upgrade is complete. If you do not run the upgrade with the -M parameter, then when the CDB$ROOT upgrade is complete, PDBs then become available for access as soon as each PDB completes its upgrade. If you run the upgrade with the -M parameter, then CDB$ROOT stays in UPGRADE mode, and PDBs do not become available until upgrade of all PDBs is complete.

Upgrading Oracle Multitenant In Sequence

With the In Sequence technique, you install the new release multitenant architecture CDB. Next, in the earlier release multitenant architecture CDB, you issue SQL commands to run preupgrade scripts to prepare one or more PDBs to upgrade, and shut them down. You then unplug PDBs, plug them into the new release multenant architecture CDB, and complete the upgrade sequentially for each PDB.

Manually Upgrading a Multitenant Container Oracle Database (CDB)

Step 1: Recommendations for source CDB / PDB database
  • Make sure there are no INVALID objects/components in the source database.  Verify the database health by executing dbupgdiag.sql (refer Note 556610.1 to download this script).
    • If there are any INVALID objects are found execute $ORACLE_HOME/rdbms/admin/utlrp.sql multiple times to validate them

$ cd $ORACLE_HOME/rdbms/admin

$ sqlplus “/ as sysdba”

SQL> alter session set container=<PDB_Name>

SQL> @utlrp.sql

  • Take a cold or hot backup of the source database
  • Disable any custom triggers that would get executed before / after DDL. You can enable it once upgrade is completed.

Check the status of PDB. It should be in open with Read write mode

These commands will also make sure the Multitenant Option is enabled.

Example:

 

SQL> select name, open_mode,cdb,i.con_id, version from V$database,v$instance i;

NAME OPEN_MODE CDB CON_ID VERSION
——— ——————– — ———- —————–
DB18C READ WRITE YES 0 18.0.0.0.0

SQL> select CON_ID, NAME, OPEN_MODE from V$PDBS;

CON_ID NAME OPEN_MODE

———- —————————— ———-

2 PDB$SEED READ ONLY

3 PDB1 READ WRITE

  • Execute Preupgrade scripts before upgrade and review the preupgrade log for any issues.
  • Check the status of all materialized views (MV), and refresh any materialized views that are not fresh.
  • Before upgrading Oracle Database, you must wait until all materialized views have completed refreshing.

Step2: Requirements and recommendations for target ORACLE_HOME
  • Verify the whether your operating system is certified for 18.1. Click here to launch certification portal
  • Install 18.1.0.0, verify there are no installation related issues.
  • Download and install latest RU / RUR if any
  • Copy spfile or pfile from source ORACLE_HOME (under $ORACLE_HOME/dbs) to target homeReview patch recommendations as given in the article “Patches to apply before upgrading Oracle GI and DB to 18c (Doc ID 2414935.1)”
    • Remove any _ (underscore) parameter, obsolete and deprecated parameters in pfile
    • Note min value of COMPATIBLE parameter to upgrade 18.1 is “11.2.0”, make sure you have COMPATIBLE parameter is set to 11.2.0 or greater
  • Review patch recommendations as given in the article “Patches to apply before upgrading Oracle GI and DB to 18c (Doc ID 2414935.1)”
  • Apply patch 29213893 on target ORACLE_HOME to avoid ORA-01422 error – refer: Database Upgrade to 12.2, 18c, 19c fails with ORA-01422, ORA-06512 for SYS.DBMS_STATS (Doc ID 2525596.1)

Step 3: Pre-Upgrade Steps

1. Open all PDBs

SQL> alter pluggable database all open;

2. Run the Pre-Upgrade Information Tool (preupgrade.jar), using the following syntax:

java -jar $New_release_Oracle_home/rdbms/admin/preupgrade.jar [TERMINAL|FILE|DIR outputdir] [TEXT|XML] [-c InclusionListOfPDBs] [-C ExclusionListOfPDBs]

Use space-delimitation for lists. On Linux and UNIX, define the list by placing the list inside single quotes: ‘. On Windows systems, define the list by placing the list inside double quotes “.

Linux and UNIX:

java -jar $ORACLE_HOME_18.1/rdbms/admin/preupgrade.jar -c ‘pdb1 pdb2 pdb3 pdb4 pdb5 pdb6 pdb7 pdb8 pdb9 pdb10 pdb11 pdb12 pdb13 pdb14 pdb15 pdb16 pdb17 pdb18 pdb19 pdb20 pdb21 pdb22 pdb23 pdb24 pdb25’

Windows:

java -jar %ORACLE_HOME_18.1%/rdbms/admin/preupgrade.jar -c “pdb1 pdb2 pdb3 pdb4 pdb5 pdb6 pdb7 pdb8 pdb9 pdb10 pdb11 pdb12 pdb13 pdb14 pdb15 pdb16 pdb17 pdb18 pdb19 pdb20 pdb21 pdb22 pdb23 pdb24 pdb25”

Note: You must use Java 1.5 or later to run the Pre-Upgrade Information too.
If no parameters are passed to the preupgrade.jar , it is run against all the container databases ( CDB and PDB’s ).

3. Review any generated fixup scripts and log files.

If ORACLE_BASE is defined, then the fixup files are placed in

Linux and UNIX:

$ORACLE_BASE/cfgtoollogs/db_unique_name/preupgrade

Windows:

%ORACLE_BASE%\cfgtoollogs\db_unique_name\preupgrade

If ORACLE_BASE is not defined, then fixup files are placed in one of the following paths:

Linux and UNIX:

$ORACLE_HOME/cfgtoollogs/db_unique_name/preupgrade

Windows:

%ORACLE_HOME\cfgtoollogs\db_unique_name\preupgrade

4. Execute the preupgrade_fixups script, or individual PDB scripts.\

Note: fixup script for PDB$SEED is preupgrade_fixups_pdb_seed.sql

5. For Oracle RAC database set CLUSTER_DATABASE to false

ALTER SYSTEM SET cluster_database=FALSE SCOPE=spfile;

6. Shut down the database in the old Oracle home.

For example, where db_unique_name is your database name:

$ srvctl stop database -d db_unique_name

7. Copy the PFILE or SPFILE from the old Oracle home to the new Oracle home

Step 4: Upgrade Steps

8. Connect with SQL*Plus:

sqlplus / as sysdba

Note: Make sure that you have set ORACLE_HOME, PATH which points to target version

9. Bring the CDB$ROOT instance into upgrade mode:

STARTUP UPGRADE

10. Bring all PDBs into upgrade mode:

ALTER PLUGGABLE DATABASE ALL OPEN UPGRADE;

11. Check the status of PDBs to confirm that they are ready to upgrade:

SHOW PDBS

For all PDBs, ensure that the status is set to MIGRATE.
12. Exit from SQL*Plus, and change directory to the new Oracle home $ORACLE_HOME/rdbms/admin:

SQL> EXIT
$ ORACLE_HOME/bin

13. Start the upgrade using the Parallel Upgrade Utility (catctl.pl, using the shell command dbupgrade), where -d specifies the location of the directory:

dbupgrade -d $ORACLE_HOME/rdbms/admin

If you do not specify any parameters, then the Parallel Upgrade Utility runs the upgrade in parallel on the number of PDBs equivalent to the number of CPUs divided by 2. On a server with 64 CPUs, 64 divided by 2 equals 32 PDBs upgraded in parallel, carried out with two SQL processors for each PDB. CDB$ROOT remains in NORMAL mode for the duration of the upgrade.

14. Review the upg_summary.log to confirm that the upgrade was successful, and if necessary, review other logs.

Step 5: Post-Upgrade Steps

15. Open all PDBs, so that you can recompile the databases:

ALTER PLUGGABLE DATABASE ALL OPEN;

16. Exit from SQL*Plus, and change directory to the new Oracle home path $ORACLE_HOME/rdbms/admin:

SQL> EXIT
cd $ORACLE_HOME/rdbms/admin

17. Run the catcon.pl script and the postupgrade_fixups.sql script that is supplied with the new release Oracle Database.

The following example shows the command strings for running catcon.pl, using the -n parameter to specify one parallel processor for each PDB, using the -d parameter to specify the path where the preupgrade script that you want to run is located, using the -l parameter to specify the location where you want the scripts to place log files, and using the -b flag to specify the log file prefixes for the postupgrade_fixups.sql script:

$ORACLE_HOME/perl/bin/perl $ORACLE_HOME/rdbms/admin/catcon.pl -n 1 -d $ORACLE_HOME/cfgtoollogs/cdbupgr/preupgrade -l /home/oracle/upgrdDBA -b postupgrade_fixups postupgrade_fixups.sql

18. Run postupgrade_fixups.sql.

$ORACLE_HOME/perl/bin/perl catcon.pl -n 1 -e -b postupgradefixups -d ”’.”’ postupgradefixups.sql

19. Run utlu122s.sql to verify that there are no upgrade issues.

$ORACLE_HOME/perl/bin/perl catcon.pl -n 1 -e -b utlu122s -d ”’.”’ utlu122s.sql

log file utlu122s0.log is generated.

20. For Oracle RAC environments set the initialization parameter value for CLUSTER_DATABASE to TRUE, and to start the Oracle RAC database

ALTER SYSTEM SET CLUSTER_DATABASE=TRUE SCOPE=SPFILE;
srvctl start database -db db_unique_name

Upgrading PDBs Using the Parallel Upgrade Utility with Priority Lists

Oracle Database 12.2 and later releases, you can upgrade PDBs using a priority list to upgrade a set of PDBs ahead of other PDBs, and we can modify that upgrade priority.  This list enables to group and upgrade PDBs based on the priority.  A priority list is a text file with comma-delimited lists defining the order of upgrade priority, and the PDBs in each numeric priority group. We can execute the Parallel Upgrade Utility (dbupgrade, dbupgrade.cmd, or catctl.pl) using the -L option to run the upgrade using a priority list, and to call that list as the upgrade runs.

Format for creating priority list

Number, Pdb
numeral,pdb1,pdb2,pdb3
numeral,pdb4
numeral,pdb5,pdb6,pdb7,pdb8
.
.
.

Note:

  • Create priority lists using a plain text editor, such as vi on Linux and UNIX, or Notepad on Windows.
  • Here numeral represents the priority for the PDB.
When you run the Parallel Upgrade Utility, the following processing rules apply:

CDB$ROOT and PDB$SEED are always processed first, even if they are not present in the priority list.
All PDBs that are in priority lists are processed in order of priority
Any PDBs that are not listed in priority lists are processed after the PDBs named in the priority list.

Syntax to run the Parallel Upgrade utility using a priority list:

dbupgrade -L priority_list_name

After upgrade is complete PDB priority states are maintained in the CDB.  If we upgrade the database to next release, it uses the same priority.  To change this we have to execute

SQL> alter session set container = CDB$ROOT
SQL> alter pluggable database PDBName upgrade priorityPDBPriorityNumber

PDB Upgrades Using Priority Lists, Inclusion Lists, and Exclusion Lists

The following terms designate types of upgrade list processing:

    Priority lists: Comma-delimited lists that designate the upgrade priority of PDBs in the list.
Inclusion lists: Comma-delimited lists that designate PDBs that you want to upgrade. PDBs in these lists are upgraded after the PDBs listed in priority lists.
Exclusion lists: Comma-delimited lists that designate PDBs that you do not want to be upgraded.

 

Example of Inclusion List

With following priority list

1,CDB$ROOT
1,PDB$SEED
1,CDB1_PDB2,CDB1_PDB4
2.CDB1_PDB5

catctl -L priority.lst -c ‘CDB1_PDB2 CDB1_PDB4 CDB1_PDB5’ catupgrd.sql

The upgrade order is carried out in the following sequence:

CDB1_PDB2, CDB1_PDB4
CDB1_PDB5

The Parallel Upgrade Utility processes only the PDBs that are in the inclusion list, and in the order of the priority list.

Example of Exclusion List

With following priority list

1,CDB$ROOT
1,PDB$SEED
1,CDB1_PDB1,CDB1_PDB2
2,CDB1_PDB3,CDB1_PDB4
3,CDB1_PDB5

catctl -L priority.lst -C ‘CDB$ROOT’ catupgrd.sql

Because CDB$ROOT is excluded, the priority processing shifts. The upgrade order is carried out in the following sequence:

PDB$SEED, CDB_PDB1
CDB_PDB2, CDB_PDB3
CDB1_PDB4, CDB1_PDB5

Exclusion List using CATCTL_LISTONLY

With following priority list

1,CDB$ROOT
1,PDB$SEED
1,CDB1_PDB1,CDB1_PDB2
2,CDB1_PDB3
3,CDB1_PDB5

catctl -L priority.lst -C ‘CATCTL_LISTONLY’ catupgrd.sql

With the CATCTL_LISTONLY option, PDBs that are not in the priority list are excluded from the upgrade.  Specifying the keyword CATCTL_LISTONLY in the exclusion list turns the priority list into an inclusion priority list. Only PDBs in the list are processed.

Upgrading Pluggable Databases (PDBs) In Parallel

Using the In-Parallel technique, you can upgrade the CDB, and then immediately upgrade PDBs using parallel SQL processors.

Container databases (CDBs) can contain zero, one, or more pluggable databases (PDBs). By default, the Parallel Upgrade Utility (catctl.pl) updates the CDB and all of its PDBs in the same upgrade window. The Parallel Upgrade Utility uses the number of computer processing units (CPUs) to determine the maximum number of PDBs that are upgraded simultaneously. The number of PDBs that are upgraded in parallel is determined by dividing the parallel SQL process count (-n option) by the parallel PDB SQL process count (-N option).

dbupgrade [-M] -n [-N]

-M Specifies if CDB$ROOT is kept in upgrade mode, or if it becomes available when it completes upgrade:

If you run the Parallel Upgrade Utility with the -M parameter, then the upgrade places CDB$ROOT and all of its PDBs in upgrade mode, which can reduce total upgrade time. However, you cannot bring up any of the PDBs until the CDB and all of its PDBs are upgraded.

If you do not run the Parallel Upgrade Utility with the -M parameter, then CDB$ROOT is upgraded and restarted in normal mode, and the normal background processes are started. After a successful upgrade, only CDB$ROOT is opened in read/write mode. All the PDBs remain in MOUNT mode. As each PDB is upgraded, you can bring each PDB online while other PDBs are still being upgraded.

-n Specifies the number of in-parallel PDB upgrade processors.

If you do not specify a value for -n, then the default for -n is the CPU_COUNT value.

If you do specify a value for -n, then that value is used to determine the number of parallel SQL processes. The maximum value is unlimited. The minimum value is 4.

-N Specifies the number of SQL processors to use when upgrading PDBs. The maximum value is 8. The minimum value is 1. If you do not specify a value for -N, then the default value is 2.

The maximum PDB upgrades running concurrently is the value of -n divided by the value of -N.

Steps to upgrade PDBs in parallel

1. Take necessary backup
2. Execute pre-upgrade tool, fix up any issues found, make sure there are no INVALID objects/components
3. un the Parallel Upgrade Utility. In sequence, the following upgrades are carried out:

a. Cycle 1: CDB$ROOT is upgraded to the new Oracle release
b. Cycle 2 to Cycle x: PDB$SEED and PDBs are upgraded in parallel, with the number of cycles of upgrades as determined by the parameter settings you specify with -n.
4. Complete post-upgrade steps.

Upgrading Multitenant Container Databases In Parallel

Use this technique to upgrade CDB$ROOT, PDB$SEED, and all PDBS in the CDB in one upgrade operation.
Oracle recommends that you use this approach if you can schedule downtime, because it provides a direct procedure for upgrades and simplicity of maintenance. Using this procedure upgrades in parallel all the PDBs in the multitenant architecture container database, depending on your server’s available processors (CPUs).

1. Ensure that you have a proper backup strategy in place.
2. Open all PDBs.
For example:

SQL> alter pluggable database all open;

3. Run the Pre-Upgrade Information Tool (preupgrade.jar), using the following syntax:

java -jar $New_release_Oracle_home/rdbms/admin/preupgrade.jar [TERMINAL|FILE|DIR outputdir] [TEXT|XML] [-c InclusionListOfPDBs] [-C ExclusionListOfPDBs]

Linux and UNIX:

java -jar $ORACLE_HOME_18.1/rdbms/admin/preupgrade.jar -c ‘pdb1 pdb2 pdb3 pdb4 pdb5 pdb6 pdb7 pdb8 pdb9 pdb10 pdb11 pdb12 pdb13 pdb14 pdb15 pdb16 pdb17 pdb18 pdb19 pdb20 pdb21 pdb22 pdb23 pdb24 pdb25’

Windows:

java -jar %ORACLE_HOME_18.1%/rdbms/admin/preupgrade.jar -c “pdb1 pdb2 pdb3 pdb4 pdb5 pdb6 pdb7 pdb8 pdb9 pdb10 pdb11 pdb12 pdb13 pdb14 pdb15 pdb16 pdb17 pdb18 pdb19 pdb20 pdb21 pdb22 pdb23 pdb24 pdb25”

4. Review any generated fixup scripts and log files.

By default, if ORACLE_BASE is defined, then the fixup files are placed in one of the following paths:

Linux and UNIX:

$ORACLE_BASE/cfgtoollogs/db_unique_name/preupgrade

Windows

%ORACLE_BASE%\cfgtoollogs\db_unique_name\preupgrade

If ORACLE_BASE is not defined, then fixup files are placed in one of the following paths:

Linux and UNIX:

$ORACLE_HOME/cfgtoollogs/db_unique_name/preupgrade

Windows:

%ORACLE_HOME\cfgtoollogs\db_unique_name\preupgrade

5. Run the preupgrade_fixups script, or individual PDB scripts.

6. For Oracle RAC databases, set the cluster database initialization parameter to false:

For example;

ALTER SYSTEM SET cluster_database=FALSE SCOPE=spfile;

7. Shut down the database in the old Oracle home.

8. Copy the PFILE or SPFILE from the old Oracle home to the new Oracle home
9. Connect with SQL*Plus:

sqlplus / as sysdba

10. Bring the CDB$ROOT instance into upgrade mode:

STARTUP UPGRADE

11. Bring all PDBs into upgrade mode:

ALTER PLUGGABLE DATABASE ALL OPEN UPGRADE;

12. Check the status of PDBs to confirm that they are ready to upgrade:

SHOW PDBS

For all PDBs, ensure that the status is set to MIGRATE.

13. Exit from SQL*Plus, and change directory to the new Oracle home $ORACLE_HOME/rdbms/admin:

SQL> EXIT
$ ORACLE_HOME/bin

14. Start the upgrade using the Parallel Upgrade Utility (catctl.pl, using the shell command dbupgrade), where -d specifies the location of the directory:

dbupgrade -d $ORACLE_HOME/rdbms/admin

15. Review the upg_summary.log to conf8irm that the upgrade was successful, and if necessary, review other logs.
16. Open all PDBs, so that you can recompile the databases:

ALTER PLUGGABLE DATABASE ALL OPEN;

17. Exit from SQL*Plus, and change directory to the new Oracle home path $ORACLE_HOME/rdbms/admin:

SQL> EXIT
cd $ORACLE_HOME/rdbms/admin

18. Run the catcon.pl script and the postupgrade_fixups.sql script that is supplied with the new release Oracle Database.

The following example shows the command strings for running catcon.pl, using the -n parameter to specify one parallel processor for each PDB, using the -d parameter to specify the path where the preupgrade script that you want to run is located, using the -l parameter to specify the location where you want the scripts to place log files, and using the -b flag to specify the log file prefixes for the postupgrade_fixups.sql script:

$ORACLE_HOME/perl/bin/perl $ORACLE_HOME/rdbms/admin/catcon.pl -n 1 -d \
$ORACLE_HOME/cfgtoollogs/cdbupgr/preupgrade -l /home/oracle/upgrdDBA -b \
postupgrade_fixups postupgrade_fixups.sql

19. Run postupgrade_fixups.sql.

$ORACLE_HOME/perl/bin/perl catcon.pl -n 1 -e -b postupgradefixups -d ”’.”’ postupgradefixups.sql

20. Run utlu122s.sql to verify that there are no upgrade issues.

$ORACLE_HOME/perl/bin/perl catcon.pl -n 1 -e -b utlu122s -d ”’.”’ utlu122s.sql

When you use catcon.pl to run utlu122s.sql, the log file utlu122s0.log is generated.

21. For Oracle RAC environments only, enter the following commands to set the initialization parameter value for CLUSTER_DATABASE to TRUE, and to start the Oracle RAC database, where dbname is the name of the Oracle RAC database:

ALTER SYSTEM SET CLUSTER_DATABASE=TRUE SCOPE=SPFILE;
srvctl start database -db db_unique_name