This post uses as guideline and checklist when manually upgrading from Oracle 10gR2 (10.2) , Oracle 11gR1 (11.1) or Oracle 11gR2 (11.2) or Oracle 12c Release 1 (12.1) to Oracle 12c Release 2 (12.2)
Step 1: Upgrade Path for 12.2 Oracle database
Minimum version of the database that can be directly upgraded to Oracle 12c Release 1 (12.2)
Source Database | Target Database |
11.2.0.3 / 11.2.0.4 | 12.2.x |
12.1.0.1 / 12.1.0.2 | 12.2.x |
Intermediate upgrades needs to be carried for following releases
Source Database | | Intermediate upgrade path | | Target database |
11.2.0.1 / 11.2.0.2 | --> | 11.2.0.4 | --> | 12.2.x |
11.1.0.6 / 11.1.0.7 | --> | 11.2.0.4 | --> | 12.2.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 | --> | 12.2.x |
10.1.0.5 | --> | 11.2.0.4 / 12.1.0.2 | --> | 12.2.x |
9.2.0.8 | --> | 11.2.0.3 / 11.2.0.4 | --> | 12.2.x |
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.0.4 or 12.1.0.2.
- 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.3 or 11.2.0.4. Then upgrade from release 11.2.0.4 to 12.2
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 12c, you must delete any data security roles that are defined in the 11g database. After the upgrade, you may use Analytic Workspace Manager 12c to define the data security roles again.
- If you upgrade an 11g database to Oracle Database 12c without deleting the 11g data security roles, then any data security policies that include a data security role are invalid in the Oracle Database 12c database.
- Timezone should less than or equal to target database timezone version.
- IF APEX is installed then it is recommended to upgrade APEX in the source DB first before upgrading DB
Step3: Requirements and recommendations for target ORACLE_HOME
- Verify the whether your operating system is certified for 12.2. Click here to launch certification portal
- Install 12.2.0.1, verify there are no installation related issues.
- Download and install latest PSU if any
- Copy spfile or pfile from source ORACLE_HOME (under $ORACLE_HOME/dbs) to target home
- Remove any _parameter, obsolete and deprecated parameters in pfile
- Note min value of COMPATIBLE parameter to upgrade 12.2 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 12.2.0.1 (Doc ID 2180188.1)"
Step 4: Check the health of the source database
- 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.
- Execute utlrp.sql multiple times and verify there are no INVALID objects.
Step 5: 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
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.
1. 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;
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
Default time zone for Oracle database 12.2 is V26
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.
Back up the database
Back up the database, create a guaranteed flashback restore point, or both.
Test your fallback strategies at least once before your upgrade window.
Ensure that you have fallback strategies for issues both during upgrade, and after upgrade.
Connect to RMAN
rman "target / nocatalog"
Execute RMAN command to backup
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';
}
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.
Save Oracle EM DB Control Configuration and Data
If you plan to downgrade database after upgrading to 12.2, 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.
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
Drop JSON-Enabled Context search Indexes
If you created a JSON search index using Oracle Database 12c Release 1 (12.1.0.2) then Oracle recommends that you drop that index and create a new search index for use with later releases.
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.
Remove Unified Auditing Schema and Roles
Note: If you have created AUDIT_ADMIN
and AUDIT_VIEWER
users or roles with Oracle Database 12c release 1 (12.1) or if the database was created in 12.1, then you do not drop these roles and AUDSYS user.
Log into SQL*Plus as SYS with SYSDBA privilege. Drop AUDSYS schema if exists. Start DB in migrate mode and drop AUDSYS user
SQL> startup migrate pfile=$T_WORK/t_init1.ora
ORACLE instance started.
SQL> drop user audsys cascade;
Drop AUDIT_ADMIN and AUDIT_VIEWER roles
DROP ROLE AUDIT_ADMIN;
DROP ROLE AUDIT_VIEWER;
Put Schema based tablespaces offline during upgrade
Note down the table space names which needs to be offline during upgrade. Use -T option followed by table space name
dbupgrade –T
Starting with Oracle Database 12c release 2, you can run the Parallel Upgrade Utility with the -T option to have schema-based tablespaces (user tablespaces) taken offline during the upgrade. Taking these tablespaces offline can reduce the necessity of backing up before upgrades. The Parallel Upgrade Utility (catctl.pl) analyzes tablespaces, and automatically selects the right set of tablespaces to set to read only. The utility does not set to READ ONLY any tablespaces that contain Oracle-Maintained objects
Preserve Downgrade capability
If you have any plans to downgrade the database to its previous version, then you must have patch 20898997 installed in source ORACLE_HOME, else downgrade will not be possible.
On source ORACLE_HOME
$ORACLE_HOME/OPatch/opatch lsinventory -bugs_fixed |grep –i "20898997"
If patch is not installed, download patch 20898997 from MOS and install
Audit table preupgrade requirements
If upgrading from pre 12.1 release and using Oracle database Vault, Oracle Label Security, then you must first run olspreupgrade.sql. Copy $ORACLE_HOME/rdbms/admin/olspreupgrade.sql from target home (12.2). Connect as DVOWNER to the source db
SQL> GRANT DV_PATCH_ADMIN to SYS;
Grant DV_PATCH_ADMIN to SYS. Connect SYS as SYSDBA
CONNECT SYS AS SYSDBA
Execute olspreupgrade.sql
SQL>ORACLE_HOME/rdbms/admin/olspreupgrade.sql
After completion, connect as DVOWNER and revoke DV_PATCH_ADMIN to SYS
SQL> REVOKE DV_PATCH_ADMIN from SYS;
Cluster DB Requirements
Upgrade GI first before upgrading the database. If RAC, then database set CLUSTER_DATABASE to false in the init parameter file.
Other Checks
Ensure you have enough space in ARCHIVE_LOG and FLASHBACK location.
Step 6: 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>
It is recommended to execute pre-upgrade fixup script, if any, which are AUTO FIXABLE
Dependencies on Network Utility Packages
Execute the following query
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
Step7: Upgrade Database to 12.2
Set the environment variables to point to target ORACLE_HOME
export ORACLE_HOME=<path to Oracle 12.2>
export PATH=$ORACLE_HOME/bin:$PATH
export ORACLE_BASE=<path to Oracle_Base set during installation>
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, utlu122s.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> @utlu122s.sql
Verify the upgrade log whether catuppst.sql has been executed or not. If not, execute it manually from new ORACLE_HOME, located at $ORACLE_HOME/rdbms/admin directory
SQL> @catuppst.sql
Run utlrp.sql to recompile any remaining stored PL/SQL and Java code in another session.
SQL> @utlrp.sql
Check the state of the Oracle Data Dictionary for diagnosing upgrades and migrations. The dbupgdiag.sql script collects upgrade and migration diagnostic information about the current state of the data dictionary. You can run the script in SQL*Plus on the upgraded database as the SYS user. Refer
Note 556610.1 Script to Collect DB Upgrade/Migrate Diagnostic Information (dbupgdiag.sql)
If the dbupgdiag.sql script reports any invalid objects, run $ORACLE_HOME/rdbms/admin/utlrp.sql (multiple times) to validate the invalid objects in the database, until there is no change in the number of invalid objects. After validating the invalid objects, re-run dbupgdiag.sql in the upgraded database once again and make sure that everything is fine.
If you are using Oracle Clusterware, then you must upgrade the Oracle Clusterware keys for the database. Run srvctl for Oracle Database 12c to upgrade the database. For example:
ORACLE_HOME/bin/srvctl upgrade database -db name -o ORACLE_HOME
Step 8: 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.
Upgrading Tables Dependent on Oracle-Maintained Types
Starting with Oracle Database 12c release 2 (12.2), you must manually upgrade user tables that depend on Oracle-Maintained types.
To identify tables that need to be upgraded after the database upgrade, connect AS SYSDBA and run the following query:
COLUMN owner FORMAT A30
COLUMN table_name FORMAT A30
SELECT DISTINCT owner, table_name
FROM dba_tab_cols
WHERE data_upgraded = 'NO'
ORDER BY 1,2;
Execute utluptabdata.sql script either with a user account with the privileges to ALTER all of the tables dependent on Oracle-Maintained types, or with a user granted the SYSDBA system privileges that is logged in AS SYSDBA.
SET SERVEROUTPUT ON
@utluptabdata.sql
Enabling the New Extended Data Type Capability
Enabling a system to take advantage of the new extended data types requires specific upgrade actions.
Oracle Database 12c introduces MAX_STRING_SIZE to control the maximum size of VARCHAR2, NVARCHAR2, and RAW data types in SQL. Setting MAX_STRING_SIZE = EXTENDED enables the 32767 byte limit introduced in Oracle Database 12c.
You must set the COMPATIBLE initialization parameter to 12.0.0.0 or higher to be able to set MAX_STRING_SIZE = EXTENDED.
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.
Follow the procedure in Oracle documentation under "Steps to Upgrade Time Zone File and Timestamp with Time Zone Data" and
Note 1509653.1 "Updating the RDBMS DST version in 12c Release 1 (12.1.0.1 and up) using DBMS_DST"
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.
Upgrade Externally Authenticated SSL Users
If you are upgrading from Oracle9i Release 2 (9.2) or Oracle Database 10g Release 1 (10.1), and you are using externally authenticated SSL users, then you must run the SSL external users conversion (extusrupgrade) script to upgrade those users.
ORACLE_HOME/rdbms/bin/extusrupgrade --dbconnectstring hostname:port_no:sid --dbuser db_admin --dbuserpassword password -a
Install Oracle Text Supplied Knowledge Bases After Upgrading Oracle Database
The Oracle Text-supplied knowledge bases are part of the companion products for Oracle Database 12c and are not immediately available after an upgrade to Oracle Database 12c. Any Oracle Text features dependent on the supplied knowledge bases which were available before the upgrade do not function after the upgrade. To re-enable such features, you must install the Oracle Text supplied knowledge bases from the installation media.
Update Oracle Application Express Configuration After Upgrading Oracle Database
If the Oracle Database release that you upgrade includes Oracle Application Express release 3.2 or later, then you do not need to carry out additional configuration after upgrading to Oracle Database 12c. However, if Oracle Application Express is in the registry, so that Oracle Application Express is included in the upgrade, then set the open_cursors parameter to a minimum of 200.
Configure Access Control Lists (ACLs) to External Network Services
if you have applications that use UTL_TCP, UTL_SMTP, UTL_MAIL, UTL_HTTP, or UTL_INADDR packages, then after upgrading Oracle Database you must configure network access control lists (ACLs) in the database before these packages can work as they did in earlier releases. Without the ACLs, your applications may fail with the error "ORA-24247: network access denied by access control list (ACL)."
Enabling Oracle Database Vault After Upgrading Oracle Database
Refer to the following documents for enabling Oracle Database Vault:
Note 453903.1 - Enabling and Disabling Oracle Database Vault in UNIX
Note 453902.1 - Enabling and Disabling Oracle Database Vault in WINDOWS
Check for the SQLNET.ALLOWED_LOGON_VERSION Parameter Behavior
Connections to Oracle Database from clients earlier than release 10g fail with the error ORA-28040: No matching authentication protocol. Refer to Oracle documentation for fixing the ORA-28040: No matching authentication protocol.
Known issues
For known issues refer to
Oracle Database Upgrade Known issues - 12.2 (Doc ID 2243613.1)