6 Downgrading Oracle Database to an Earlier Release

For supported releases of Oracle Database, you can downgrade a database to the release from which you last upgraded.

For example, if you recently upgraded from release 11.2.0.4 to Oracle Database 12c release 2 (12.2), and you did not change the compatible initialization parameter to 12.1 or higher, then you can downgrade to release 11.2.0.4. If you upgraded your Oracle Database 12c release from 12.1.0.2 to release 12.2.0.1, and you did not change the compatible initialization parameter to 12.2.0.1, then you can downgrade to release 12.1.0.2.

See Also:

Oracle Database Installation Guide for your operating system for downgrading information specific to your operating platform

Topics:

Topics:

Supported Releases for Downgrading Oracle Database

You can downgrade both major releases and patchset releases, based on the original Oracle Database release from which the database was upgraded.

You can downgrade a non-PDB Oracle Database from Oracle Database 12c release 2 (12.2) to Oracle Database 12c releases 12.1.0.2, 12.1.0.1; and you can downgrade to Oracle Database 11g releases 11.2.0.4 and 11.2.0.3.

You can downgrade a PDB from Oracle Database 12c release 2 (12.2) to Oracle Database 12c release 12.1.0.2, but not to 12.1.0.1.

You can downgrade a CDB from Oracle Database 12c release 2 (12.2) to 12.1.0.2, but not to 12.1.0.1.

Note:

Starting with Oracle Database 12c, release 1 (12.1), non-CDB architecture is deprecated. It can be desupported in a future release.

The following table provides additional information about releases supported for downgrading. When using this table, also read about compatibility in "Checking for Incompatibilities When Downgrading Oracle Database."

Table 6-1 Supported Releases and Editions for Downgrading

Oracle Database Release or Edition Downgradable (Yes/No) Notes

12.1.0.2

Yes

You cannot downgrade a database after you set the compatible initialization parameter to 12.1.0.2.

You can downgrade a non-CDB from 12.2 to 12.1.0.2, 12.1.0.1, 11.2.0.4, 11.2.0.3 (all supported upgrade releases).

You can downgrade a PDB from 12.2 to 12.1.0.2, but not to 12.1.0.1.

You can downgrade a CDB from 12.2 to 12.1.0.2, but not to 12.1.0.1.

Install the latest bundle patch or patch set update (BP or PSU) before you downgrade a CDB, or before you unplug and downgrade a PDB. Patches (PSU, BP) are available for download on My Oracle Support. Refer to My Oracle Support note 756671.1 to obtain the latest patch set.

You cannot downgrade to releases earlier than the minimum compatibility setting for the new Oracle Database release.

12.1.0.1

Yes for non-CDBs

No for CDBs and PDBs

If you unplug an Oracle Database 12c Release 1 (12.1.0.1) PDB from a 12.1.0.1 database, and then plug this PDB into a 12.1.0.2 database for upgrade, then you cannot downgrade this PDB if the compatible initialization parameter in the 12.1.0.2 database is higher than '12.1.0.1.0'.

You cannot downgrade a PDB from 12.2 to 12.1.0.1.

You cannot downgrade a CDB from 12.2 to 12.1.0.1.

Oracle Enterprise Manager

No

If you downgrade to an earlier supported release, then you must reconfigure Oracle Enterprise Manager controls.

Before you start your upgrade, you must use the emdwgrd utility to save DB Control files and data, so that you can restore Oracle Enterprise Manager Database Control (DB Control) after a downgrade.

Oracle Database Express Edition

No

You cannot downgrade a database that is upgraded from Oracle Database Express Edition.

The following recommendations for earlier supported releases affect downgrading for Oracle Database:

  • This release includes multitenant architecture, which provides architecture features for a multitenant container database (CDB), and pluggable databases (PDBs). Because of these architecture changes, you cannot downgrade if you set the compatible initialization parameter to the highest level after upgrading to this release.

  • This release contains a new object privilege, READ, in addition to SELECT. After you downgrade, note the following implications of this object privilege:

    • If you have the SELECT and READ object privileges, then the READ privilege is removed.

    • If you previously only had the READ object privilege, then the READ object privilege is transformed into the SELECT object privilege.

    Refer to Oracle Database Security Guide for more information about the READ and SELECT object privileges.

  • If Oracle XML DB is not installed in the database that you upgrade, then during a downgrade, Oracle XML DB is uninstalled. For example, if you did not install Oracle XML DB with Oracle Database 11g Release 2 (11.2), then Oracle XML DB is installed with Oracle Database 12c. If you downgrade the database, then Oracle XML DB is uninstalled as part of the downgrade. Oracle XML DB is included by default with Oracle Database 12c release 1 (12.1), and later releases.

  • During upgrade to Oracle Database 12c, the Database (DB) Control repository is removed. If you downgrade to an earlier release, then you must reconfigure the Database (DB) Control to use it after the downgrade.

  • Downgrade is not supported for Oracle Enterprise Manager. If you downgrade to an earlier supported release, then you must reconfigure Oracle Enterprise Manager controls.

Caution:

Before you start an upgrade, you must understand the following information regarding compatibility to be able to downgrade:

  • You cannot downgrade a database after you set the compatible initialization parameter to 12.1.0.2.

  • You can only downgrade a pluggable database (PDB) if you set the compatibility to 12.1.0.1.

  • If you unplug a release 12.1.0.1 PDB from a 12.1.0.1 database, and then plug this PDB into a release 12.1.0.2 database, then you cannot downgrade this PDB.

  • Install the latest bundle patch or patch set update (BP or PSU) before you try to downgrade a CDB or unplug and downgrade a PDB. See My Oracle Support Note 756671.1 to obtain the latest patch set.

Check for Incompatibilities When Downgrading Oracle Database

To see if the database has incompatibilities that can prevent you from downgrading, check the compatibility level of your database.

If the compatibility level of your Oracle Database 12c database is 12.1.0, then you are not able to downgrade.

If you are downgrading to Oracle Database 11g release 2, then set the COMPATIBLE initialization parameter to 11.2.0 or lower.

Note:

For Oracle ASM disk groups, if you change disk group compatibility to 12.1.0.0.0 when you upgrade your database, then when you downgrade to the earlier release, you cannot mount your Oracle ASM disk groups.

You must manually restore compatibility of Oracle ASM disk groups before downgrade. Otherwise, the instance cannot mount the disk groups after downgrade.

See Also:

Oracle Automatic Storage Management Administrator's Guide for information about Oracle ASM disk group compatibility

Perform a Full Backup Before Downgrading Oracle Database

Oracle strongly recommends that you perform a full backup of your Oracle Database 12c database before you downgrade to a supported earlier release.

See Also:

Oracle Database Backup and Recovery User's Guide for information about performing RMAN backups

Performing Required Predowngrade Steps for Oracle Database

Complete the required preparation steps described here before you downgrade Oracle Database to the earlier release from which you upgraded.

Before you start a downgrade, you must resolve incompatibilities between database releases. For example, determine if you must disable components in the database before you start the downgrade.

  1. If you are downgrading a CDB or unplugging and downgrading a PDB in Oracle Database, then you must first apply the latest bundle patch or patch set update (BP or PSU) available, and apply any required set of additional fixes on My Oracle Support Note 756671.1:

    https://support.oracle.com/rs?type=doc&id=756671.1

  2. If you have enabled Oracle Database Vault on your database, then disable Oracle Database Vault before downgrading the database.

    Use DBA_DV_STATUS to find out if Oracle Database Vault is enabled:

    SQL> SELECT * FROM DBA_DV_STATUS;
    

    If the output is TRUE, then Oracle Database Vault is enabled, so you must disable it.

    On multitenant architecture Oracle Database systems, use CDB_DV_STATUS on CDB$ROOT to find out the Oracle Database Vault status on all PDBs plugged in to the CDB:

    SQL> SELECT * FROM CDB_DV_STATUS;
    
  3. If your database uses Oracle Label Security, and you are downgrading to release 11.2, then run the Oracle Label Security (OLS) preprocess downgrade olspredowngrade.sql script in the new Oracle Database 12c Oracle home.

    Caution:

    Run olspredowngrade.sql before you downgrade from Oracle Database 12c to database release 11.2 for databases that use Oracle Label Security and Oracle Database Vault.

    1. Query the V$OPTION dynamic view. Determine if Oracle Label Security is enabled. For example:

      SQL> SELECT VALUE FROM V$OPTION WHERE PARAMETER = 'Oracle Label Security';
      
    2. Run the olspredowngrade.sql script:

      SQL> @ORACLE_HOME/rdbms/admin/olspredowngrade.sql
      
  4. If you have enabled Unified Auditing, then you can choose to back up and purge the unified audit trail:

    1. Find if unified audit records exist.

      SQL> SELECT COUNT(*) FROM UNIFIED_AUDIT_TRAIL;
      
    2. Back up the existing audit data to a table. For example:

      SQL> CREATE TABLE UA_DATA AS (SELECT * FROM UNIFIED_AUDIT_TRAIL);
      
    3. Clean up the audit trail.

      EXEC DBMS_AUDIT_MGMT.CLEAN_AUDIT_TRAIL(audit_trail_type => DBMS_AUDIT_MGMT.AUDIT_TRAIL_UNIFIED, use_last_arch_timestamp => FALSE);
      
  5. Before downgrade, ensure that the target Oracle Home for the downgraded database contains the version of the time zone file that your database is using.

    To find which time zone file version your database is currently using, query V$TIMEZONE_FILE using the following command:

    SQL> select * from  V$TIMEZONE_FILE;
    

    For example:

    If the query returns timezlrg_18.dat in the column V$TIMEZONE_FILE.FILENAME, then check if the file is present in the target Oracle Home:

    Linux and UNIX

    $ORACLE_HOME/oracore/zoneinfo/timezlrg_18.dat
    

    Windows

    %ORACLE_HOME%\oracore\zoneinfo\timezlrg_18.dat

    If the required time zone file is missing from the target Oracle Home, then do one of the following:

    • If you installed the current version of the time zone file as a patch, and you still know the patch number, then use the same patch number to download the corresponding time zone file for the target release from the My Oracle Support website.

    • Locate the correct patch by using the My Oracle Support website patch search function. Enter the following search criteria: "Product is 'Oracle Database'", "Release is 'target release'", and "Description contains 'DST'".

    • If you cannot locate the patch on the My Oracle Support website, then log a service request with Oracle Support.

    After you find and download the required patch, install it in the target Oracle Home.

  6. If you created objects based on fixed objects, then drop these objects to avoid possible ORA-00600 errors. You can re-create these objects after the downgrade.

  7. If you have Oracle Enterprise Manager configured in your database, then drop the Enterprise Manager user:

    DROP USER sysman CASCADE;

    Note:

    After you drop the Enterprise Manager user, you can find that MGMT* synonyms are invalid. You must reconfigure Oracle Enterprise Manager to use any Oracle Enterprise Manager controls in the downgraded database.

  8. If you are downgrading to Oracle Database 12c release 1 (12.1.0.2) that has the JSON bundled patch applied, and that uses Simple Oracle Document Access (SODA), then ensure that you apply the JSON bundle patch (JSON Patch Bundle 1 or JSON Patch Bundle 2) to the Oracle Database 12.1.0.2 binary. For more information, review the following My Oracle Support note:

    https://support.oracle.com/rs?type=doc&id=1992767.1

  9. Obtain the appropriate ARUs for your server operating system from the PSE listed for your release. Download and install all the patches listed for your earlier release before you start the downgrade:

    1. Log in to My Oracle Support:

      https://support.oracle.com

    2. Select Patches & Updates. In the Patch Search frame, provide the bug number listed for your release, and provide the platform for your server.

    3. Download and install the patch

    4. Repeat until you have installed all required patches for your server.

    Obtain the patches for your release:

    Downgrade from 12.2.0.1.0 to 12.1.0.2.0 with CDB and PDB

    • 20594149: DATABASE BUNDLE PATCH 12.1.0.2.7, or the latest 12.1.0.2 bundle patch set update

    • 20898997: XMLTYPESUP: QCTOXSNLB SHOULD NOT CHECK AGAINST SNAPSHOT SIZE

    • 20348910: ALTER TYPE REPLACE IN PRVTAQJI.SQL TO BE REPLACE WITH CREATE OR REPLACE TYPE

    • 20958816: INVALID OBJECTS AFTER DOWNGRADE FROM 12.2.0.1 TO 12.1.0.2

    Downgrade from 12.2.0.1.0 to 12.1.0.2.0 non-CDB

    • 20594149: DATABASE BUNDLE PATCH 12.1.0.2.7, or the latest 12.1.0.2 bundle patch set update

    • 21856522: UPGRADE OF 12.1 TO 12.2 CAUSE XOQ COMPONENT TO BE INVALID

    • 20898997: XMLTYPESUP: QCTOXSNLB SHOULD NOT CHECK AGAINST SNAPSHOT SIZE

    • 20348910: ALTER TYPE REPLACE IN PRVTAQJI.SQL TO BE REPLACE WITH CREATE OR REPLACE TYPE

    • 20958816: INVALID OBJECTS AFTER DOWNGRADE FROM 12.2.0.1 TO 12.1.0.2

    Downgrade from 12.2.0.1.0 to 12.1.0.1.0 non-CDB

    • 23054354: DATABASE PATCH SET UPDATE 12.1.0.1

    • 20898997: XMLTYPESUP: QCTOXSNLB SHOULD NOT CHECK AGAINST SNAPSHOT SIZE

    • 20348910: ALTER TYPE REPLACE IN PRVTAQJI.SQL TO BE REPLACE WITH CREATE OR REPLACE TYPE

    Downgrade from 12.2.0.1.0 to 11.2.0.4.0

    • 23054359: DATABASE PATCH SET UPDATE 11.2.0.4

    • 20898997: XMLTYPESUP: QCTOXSNLB SHOULD NOT CHECK AGAINST SNAPSHOT SIZE

    • 20348910: ALTER TYPE REPLACE IN PRVTAQJI.SQL TO BE REPLACE WITH CREATE OR REPLACE TYPE

    Downgrade from 12.2.0.1.0 to 11.2.0.3.0

    • 20299017: DATABASE PATCH SET UPDATE 11.2.0.3.14 (INCLUDES CPUAPR2015)

    • 20898997: XMLTYPESUP: QCTOXSNLB SHOULD NOT CHECK AGAINST SNAPSHOT SIZE

    • 20348910: ALTER TYPE REPLACE IN PRVTAQJI.SQL TO BE REPLACE WITH CREATE OR REPLACE TYPE

Downgrading a CDB or Non-CDB Oracle Database

Run catdwgrd.sql to downgrade your Oracle Database 12c database to a supported major release, or a relevant patchset upgrade.

Note:

Starting with Oracle Database 12c release 1 (12.1), non-CDB architecture is deprecated. It can be desupported in a future release.

If you are downgrading from release 12.2 to release 12.1, then you can downgrade all databases in a multitenant container database (CDB) or one pluggable database (PDB) within a CDB. Oracle Database releases earlier than Oracle Database 12c did not use multitenant architecture.

  1. Log in to the system as the owner of the Oracle Database Oracle home directory.

  2. At a system prompt, change to the directory ORACLE_HOME/rdbms/admin, where ORACLE_HOME is the Oracle home on your system.

    Note:

    If you are downgrading a cluster database, then shut down the database completely, and change the value for the initialization parameter CLUSTER_DATABASE to FALSE. After the downgrade, set this parameter back to TRUE.

  3. Using SQL*Plus, connect to the database instance as a user with SYSDBA privileges:

    sqlplus sys as sysdba
    Enter password: password
    
  4. Log in to the system as the owner of the Oracle home under the new Oracle Database 12c.

  5. Change directory to ORACLE_HOME/rdbms/admin, and start SQL*Plus.

  6. Connect to the database that you want to upgrade using an account with DBA privileges:

    CONNECT / AS SYSDBA
    
  7. Start the instance in downgrade mode by issuing the following SQL*Plus command for your Oracle Database instance type. You can be required to use the PFILE option to specify the location of your initialization parameter file.

    Non-CDB instances:

    SQL> startup downgrade pfile=pfile_name
    

    CDB instances:

    SQL> startup downgrade pfile=pfile_name
    
    SQL> alter pluggable database all open downgrade;

    Specify the location of your initialization parameter file PFILE.

    See Also:

    Oracle Database Administrator’s Guide for information about specifying initialization parameters at startup and the initialization parameter file

  8. (Optional) If you are downgrading a non-CDB, then you can set the system to spool results to a log file so you can track the changes and issues.

    If you are downgrading a CDB, then you do not need to perform this step. CDBs automatically spool output to the catcon_logs.

    On a non-CDB, enter the following command to spool results to a log file, where downgrade.log is the name of the log file:

    SQL> SPOOL downgrade.log
    
  9. Use the following command to start the downgrade, depending on your configuration:

    Non-CDB:

    SQL> @catdwgrd.sql
    

    CDB:

    $ORACLE_HOME/perl/bin/perl $ORACLE_HOME/rdbms/admin/catcon.pl -d $ORACLE_HOME/rdbms/admin -e -b catdwgrd -l output directory -r catdwgrd.sql
    

    In the CDB example, catdwgrd.sql is run on containers using catcon.pl. To run commands with the catcon.pl utility, you first start Perl. The -d parameter tells catcon.pl where to find catdwgrd. The -l parameter specifies the output directory for log files (instead of writing to the rdbms/admin directory). Specifying the -r parameter causes catdwgrd to run first on the PDBs, and second on CDB_ROOT.

    Run catdwgrd using the -r parameter when you downgrade a CDB. The –r parameter changes the default order that scripts are run, so that scripts run in all PDBs, and then in CDB_ROOT.

    Note:

    • Use the version of the catdwgrd.sql script included with Oracle Database 12c.

    • You must run catdwgrd using the -r parameter when downgrading a CDB.

    • Run catdwgrd.sql in the Oracle Database 12c environment.

    • The catdwgrd.sql script downgrades all Oracle Database components in the database to the release from which you upgraded. The downgrade is either to the supported major release from which you upgraded, or to the patch release from which you upgraded.

    If you are downgrading a multitenant environment database, and the catdwgrd.sql command encounters a failure, then review the error message. Check to see what issues are present in the CDB$ROOT or PDBs before proceeding. Check the section "Troubleshooting the Downgrade of Oracle Database." Fix the issues as stated in the errors. After you resolve the errors, rerun catdgwrd.sq with the catcon.pl utility, using the syntax catcon.pl -c 'cdb,pdb' -r.

    Caution:

    If the downgrade for a component fails, then an ORA-39709 error is displayed. The SQL*Plus session terminates without downgrading the Oracle Database data dictionary. All components must be successfully downgraded before the Oracle Database data dictionary is downgraded. Identify and fix the problem before rerunning the catdwgrd.sql script.

  10. For Non-CDB only, if you turned the spool on, then turn off the spooling of script results to the log file:

    SQL> SPOOL OFF
    

    Next, check the spool file, and verify that no errors occurred during the downgrade. You named the spool file in Step 8, and the suggested name was downgrade.log. Correct any problems that you find in this file. If necessary, rerun the downgrade script.

    Note:

    You can save the results from the first time you ran the downgrade script. Before you rerun the downgrade script, rename the file downgrade.log to a different name, so that it is not overwritten when you rerun the script.

  11. Shut down the instance:

    SQL> SHUTDOWN IMMEDIATE
    
  12. Exit SQL*Plus.

  13. If your operating system is Linux or UNIX, then change the following environment variables to point to the directories of the release to which you are downgrading:

    • ORACLE_HOME

    • PATH

    Also check that your oratab file, and any client scripts that set the value of ORACLE_HOME, point to the downgraded Oracle home.

    See Also:

    Oracle Database Installation Guide for your operating system for information about setting other important environment variables on your operating system

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

    1. Stop all Oracle services, including the OracleServiceSID Oracle service of the Oracle Database 12c database, 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
      

      See Also:

      Oracle Database Platform Guide for Microsoft Windows for more information about stopping Oracle services on Windows

    2. Delete the Oracle service at a command prompt by issuing the command ORADIM.

      For example, if your SID is ORCL, then enter the following command:

      C:\> ORADIM -DELETE -SID ORCL
      
    3. Create the Oracle service of the database that you are downgrading at a command prompt using the command ORADIM:

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

      The syntax for ORADIM includes the following variables:

      Variable Description

      SID

      Same system identifier (SID) name as the SID of the database being downgraded.

      PASSWORD

      Password for the database instance. This password is the password for the user connected with SYSDBA privileges. The -INTPWD option is not required. If you are prompted for a password, then use the password for the standard user account for this Windows platform.

      USERS

      Maximum number of users that can be granted SYSDBA and SYSOPER privileges.

      ORACLE_HOME

      Oracle home directory of the database to which you are downgrading. Ensure that you specify the full path name with the option -PFILE, including the drive letter where the Oracle home directory is mounted.

      See Oracle Database Administrator’s Guide for information about specifying initialization parameters at startup, and for information about the initialization parameter file.

      For example, if your SID is ORCL, your PASSWORD is TWxy5791, the maximum number of USERS is 10, and the ORACLE_HOME directory is C:\ORANT, then enter the following command:

      C:\> ORADIM -NEW -SID ORCL -INTPWD TWxy5791 -MAXUSERS 10
           -STARTMODE AUTO -PFILE C:\ORANT\DATABASE\INITORCL.ORA

      Note:

      The ORADIM command prompts you for the password for the Oracle home user account. You can specify other options using ORADIM.

      You are not required to change any Windows Registry settings when downgrading a database. The ORADIM utility makes all necessary changes automatically.

      See Also:

      Oracle Database Platform Guide for Microsoft Windows for information about administering an Oracle Database instance using ORADIM

  15. Restore the configuration files (for example, parameter files, password files, and so on) of the release to which you are downgrading.

    If the database is an Oracle RAC database, then run the following command to return the database to single instance mode:

    SET CLUSTER_DATABASE=FALSE

    Note:

    If you are downgrading a cluster database, then perform this step on all nodes on which this cluster database has instances configured. Set the value for the initialization parameter CLUSTER_DATABASE to FALSE. After the downgrade, set this initialization parameter back to TRUE.

    See Also:

    Oracle Real Application Clusters Administration and Deployment Guide for information about initialization parameter use in Oracle RAC

  16. At a system prompt, change to the admin directory in the Oracle home directory of the earlier release to which you are downgrading. (ORACLE_HOME/rdbms/admin, where ORACLE_HOME is the path to the earlier release Oracle home.)

  17. Start SQL*Plus, and connect to the database instance as a user with SYSDBA privileges.

    For a non-CDB:

    SQL> CONNECT / AS SYSDBA
    SQL> STARTUP UPGRADE

    For a CDB:

    connect / as sysdba
    startup upgrade;
    alter pluggable database all open upgrade;
    
  18. (Optional) For a non-CDB, set the system to spool results to a log file to track changes and issues. This step is not needed for a CDB.

    SQL> SPOOL reload.log
    
  19. Run catrelod.sql on non-CDB databases, or use catcon.pl to run utlrp.sql on CDB databases.

    For a non-CDB:

    SQL> $ORACLE_HOME/rdbms/admin/catrelod.sql

    For a CDB:

     $ORACLE_HOME/perl/bin/perl $ORACLE_HOME/rdbms/admin/catcon.pl -n 1 -e -b catrelod -d $ORACLE_HOME/rdbms/admin catrelod.sql

    reloads the appropriate version for each of the database components in the downgraded database.

  20. If you turned on spooling for a non-CDB, then turn off the spooling of script results to the log file:

    SQL> SPOOL OFF
    

    Check the spool file, and verify that the packages and procedures compiled successfully. Correct any problems that you find in this log file, and rerun the appropriate script, if necessary.

  21. Shut down and restart the instance for normal operation:

    SQL> SHUTDOWN IMMEDIATE
    SQL> STARTUP
    

    You can be required to use the optionPFILE to specify the location of your initialization parameter file.

    See Also:

    Oracle Database Administrator’s Guide for information about specifying initialization parameters at startup, and in the initialization parameter file

  22. If you configured your database to use Oracle Label Security, then complete this step. If you did not configure your database to use Oracle Label Security, then proceed to the next step.

    1. Copy the script olstrig.sql from the Oracle home under Oracle Database 12c to the Oracle home of the release number to which you are downgrading the database.

    2. From the Oracle home of the downgrade release, run olstrig.sql to recreate DML triggers on tables with Oracle Label Security policies:

      SQL> @olstrig.sql
      
  23. (Optional) For a non-CDB, set the system to spool results to a log file to track changes and issues. This step is not needed for a CDB. Example:

    SQL> SPOOL utlrp.log
  24. Run the utlrp.sql script to recompile any remaining stored PL/SQL and Java code. Use the procedure for your configuration:

    non-CDB:

    SQL> $ORACLE_HOME/rdbms/admin/utlrp.sql 

    CDB:

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

    The utlrp.sql script recompiles all existing PL/SQL modules previously in INVALID state, such as packages, procedures, types, and so on. The log file utlrp0.log is generated. That log file lists the recompilation results.

  25. If you turn on spooling for a non-CDB when you run utlrp.sql, then turn off the spooling of script results to the log file:

    SQL> SPOOL OFF
    

    Check the spool file, and verify that the packages and procedures compiled successfully. Correct any problems that you find in this log file. If necessary, rerun the appropriate script.

  26. Exit SQL*Plus.

  27. If you are downgrading a cluster database, then you must run the following command to downgrade the Oracle Clusterware database configuration. :

    $ srvctl downgrade database -d db-unique-name -o oraclehome -t to_version
    

    Replace the variables in this syntax example with the values for your system:

    • db-unique-name is the database name (not the instance name).

    • oraclehome is the location of the old Oracle home for the downgraded database.

    • to_version is the database release to which the database is downgraded. (For example: 12.1.0.2.0.)

    Note:

    Run this command from the current Oracle Database 12c Oracle home, not from the Oracle home to which the database is being downgraded.

At the completion of this procedure, your database is downgraded.

Downgrading a Single Pluggable Oracle Database (PDB)

If you are downgrading the latest release of Oracle Database 12c, then you can downgrade one PDB without downgrading the whole CDB.

For example, you can unplug a PDB from a release 12.2.0.1 CDB, downgrade it, and then plug it in to a release 12.1.0.2 CDB, or you can convert the database to a standalone database.

Downgrade the PDB

In this procedure, you downgrade the PDB to release 12.1.0.2:

  1. Start up the release 12.2.0.1 PDB in DOWNGRADE mode. The CDB can be in normal mode when you do this.

    SQL> alter pluggable database CDB1_PDB1 open downgrade;
    
  2. Downgrade the PDB by running catdwgrd, which in this example is PDB1.

    Run catdwgrd as follows:

    $ORACLE_HOME/perl/bin/perl $ORACLE_HOME/rdbms/admin/catcon.pl -d
     $ORACLE_HOME/rdbms/admin -n 1 -l <output directory> -e -b catdwgrd -c 'PDB1'
     catdwgrd.sql
    

    In the example, catdwgrd is run with catcon.pl. The -d parameter tells catcon.pl where to find catdwgrd. The -l parameter specifies the output directory for log files, instead of writing to the rdbms/admin directory). You must use the -r parameter to run the two scripts together at the same time.

  3. Close the PDB.

Unplug the PDB from the CDB

In this step you unplug the downgraded PDB from the release 12.2.0.1 CDB:

  1. Connect to the 12.2.0.1 CDB.

  2. Close the PDB that you want to unplug.

    SQL> alter pluggable database PDB1 close;
    
  3. Unplug the downgraded 12.1.0.2 PDB, replacing the variable path with the path on your system:

    SQL> alter pluggable database PDB1 unplug into 'path/pdb1.xml';
    

    You receive the following response when the unplug is completed:

    Pluggable database altered

Plug in the Downgraded 12.1.0.2 PDB

In this step you plug the downgraded 12.1.0.2 PDB into the 12.1.0.2 CDB. To do this, you must create the PDB in this CDB. The following example shows how to create a pluggable database called PDB1:

  1. Connect to the 12.1.0.2 CDB.

  2. Plug in the 12.1.0.2 PDB.

    SQL> create pluggable database PDB1 using 'path/pdb1.xml';
    

    You will see Pluggable database created.

  3. Open the PDB in upgrade mode:

    SQL> alter pluggable database PDB1 open upgrade;
    
  4. Connect to the PDB:

    SQL> alter session set container=PDB1;
    
  5. Run catrelod in the PDB:

    SQL> @$ORACLE_HOME/rdbms/admin/catrelod.sql
    

    The catrelod.sql script reloads the appropriate version for each of the database components in the downgraded database.

  6. Run utlrp in the PDB:

    SQL> @$ORACLE_HOME/rdbms/admin/utlrp.sql
    

    The utlrp.sql script recompiles all existing PL/SQL modules that were previously in an INVALID state, such as packages, procedures, types, and so on.

Downgrading PDBs That Contain Oracle Application Express

Use this procedure to avoid INVALID OBJECTS OWNED BY APEX_050000 errors when you downgrade PDBs that contain Oracle Application Express.

After you downgrade the PDB to an earlier release, enter a SQL statement similar to the following to drop the Oracle Application Express user:

$ORACLE_HOME/perl/bin/perl $ORACLE_HOME/rdbms/admin/catcon.pl -b drop_apex5
-c 'PDB1' -- --x'drop user apex_050000 cascade'

In this example, the PDB name is 'PDB1'.

Post-Downgrade Tasks for Oracle Database Downgrades

Additional tasks may be required after downgrading an Oracle database due to changes that affect compatibility, components, and supported protocols.

Topics:

Oracle XML DB Authentication Recommendations for an Oracle Database Downgrade

Upgrades from releases earlier than 12.1 result in digest authentication being disabled.

If you downgrade to a release that is earlier than Oracle Database 12c, in which digest authentication is not supported, digest authentication is disabled and made unavailable as an authentication choice. This affects HTTP authentication for Oracle XML DB Repository. If you did not take advantage of digest authentication and instead used the default configuration, then no further actions are necessary.

See Also:

Oracle XML DB Developer's Guide for information about authentication with Oracle XML DB for database installation, upgrade, and downgrade

Re-enabling Oracle Database Vault after Downgrading Oracle Database

You must do this if you are instructed during the downgrade to disable Oracle Database Vault.

If you use Oracle Database Vault, then you may have been instructed to disable it before downgrading your database. To use Oracle Database Vault after downgrading, you must re-enable it.

See Also:

Oracle Database Vault Administrator's Guide for the procedure to re-enable Oracle Database Vault

Restoring the Configuration for Oracle Clusterware

To restore the configuration, you must restore the release from which you were upgrading.

You can restore the Oracle Clusterware configuration to the state it was in before the Oracle Clusterware 12c Release 2 (12.2) upgrade. Any configuration changes that you have performed during or after the Oracle Database 12c upgrade process are removed and cannot be recovered.

Restoring Oracle Enterprise Manager after Downgrading Oracle Database

The restore task described in this section is required only if you are performing a downgrade, and Oracle Enterprise Manager is configured on the host.

To restore Oracle Enterprise Manager, you first run Oracle Enterprise Manager configuration assistant (EMCA), and then you run the emdwgrd utility.

Topics:

Requirements for Restoring Oracle Enterprise Manager After Downgrading

You must complete these requirements before you upgrade to be able to restore Oracle Enterprise Manager after a downgrade.

The following must be true to use emca -restore to restore Oracle Enterprise Manager to its previous state:

  • Before the upgrade, you saved a backup of your Oracle Enterprise Manager configuration files and data

  • You run the emca binary located in the Oracle Database 12c Oracle home for this procedure

On Oracle Clusterware systems, to restore Oracle Enterprise Manager on an Oracle RAC database, you must have the database registered using srvctl before you run emca -restore. You must run emca -restore from the ORACLE_HOME/bin directory of the earlier Oracle Database release to which the database is being downgraded.

Run the emca -restore command with the appropriate options to restore Oracle Enterprise Manager Database Control or Grid Control to the old Oracle home.

Specify different emca options, depending on whether the database you want to downgrade is a single-instance database, an Oracle RAC database, or an Oracle ASM database.

See Also:

Oracle Clusterware Administration and Deployment Guide for information about srvctl

Running EMCA to Restore Oracle Enterprise Manager After Downgrading

Review these topics and select your restoration scenario to restore Oracle Enterprise Manager after a downgrade.

Topics:

Running emca on a Single-Instance Oracle Database Without Oracle ASM

Use Enterprise Manager Configuration Assistant (emca) to manage your database.

Use this command to run Enterprise Manager Configuration Assistant.

ORACLE_HOME/bin/emca -restore db

You are prompted to enter the following information:

  • Oracle home for the database that you want to restore

  • Database SID

  • Listener port number

Running EMCA on an Oracle RAC Database Without Oracle ASM

Use Enterprise Manager Configuration Assistant (emca) to manage your database:

Use this procedure to run Enterprise Manager Configuration Assistant:

ORACLE_HOME/bin/emca -restore db -cluster

You are prompted to enter the following information:

  • Oracle home for the database that you want to restore

  • Database unique name

  • Listener port number

Running EMCA on a Single-Instance Oracle ASM Instance

Use Enterprise Manager Configuration Assistant (emca) to manage your database and storage.

Use this command to run Enterprise Manager Configuration Assistant.

ORACLE_HOME/bin/emca -restore asm

You are prompted to enter the following information:

  • Oracle home for the database that you want to restore

  • Oracle ASM port

  • Oracle ASM SID

Running emca on an Oracle ASM on Oracle RAC Instance

Use Enterprise Manager Configuration Assistant (emca) to manage your database and storage.

Use this command to run Enterprise Manager Configuration Assistant.

ORACLE_HOME/bin/emca -restore asm -cluster

You are prompted to enter the following information:

  • Oracle home for the database that you want to restore

  • Oracle ASM port

Running emca on a Single-Instance Oracle Database With Oracle ASM

Use Enterprise Manager Configuration Assistant (emca) to manage your database and storage.

Use this command to run Enterprise Manager Configuration Assistant.

ORACLE_HOME/bin/emca -restore db_asm

You are prompted to enter the following information:

  • Oracle home for the Oracle Database that you want to restore

  • Database SID

  • Listener port number

  • Oracle ASM port

  • Oracle ASM home

  • Oracle ASM SID [+ASM]

Running emca on an Oracle RAC Database and Oracle ASM Instance

Use Enterprise Manager Configuration Assistant (emca) to manage your database and storage.

Use this command to run Enterprise Manager Configuration Assistant:

ORACLE_HOME/bin/emca -restore db_asm -cluster

You are prompted to enter the following information:

  • Oracle home for the database that you want to restore

  • Database unique name

  • Listener port number

  • Oracle ASM port

  • Oracle ASM Oracle home

  • Oracle ASM SID [+ASM]

The output of emca varies according to the options that you specify and the values that you enter at the prompts. In Oracle RAC environments, you must repeat this step on all Oracle RAC cluster member nodes.

You must now run the emdwgrd utility to restore Oracle Enterprise Manager Database Control and data.

Running the emdwgrd utility to restore Enterprise Manager Database Control

You can restore the Oracle Enterprise Manager Database Control and data by using the emdwgrd utility after you run emca -restore.

To use emdwgrd, you must do the following:

  • Set ORACLE_HOME and other environment variables to point to the Oracle home from which the upgrade originally took place.

  • Run the emdwgrd utility from the Oracle Database 12c home

The following procedure is for Linux and UNIX. To run it on Windows, substitute emdwgrd.bat for emdwgrd.

  1. Set ORACLE_HOME to the Oracle home from which the database upgrade originally took place.

  2. Set ORACLE_SID to the SID of the database that was upgraded and then downgraded.

  3. Set PATH, LD_LIBRARY_PATH and SHLIB_PATH to point to the Oracle home from which the database upgrade originally took place.

  4. Go to the Oracle Database 12c Oracle home:

    cd $ORACLE_HOME/bin
    
  5. Run emdwgrd using one of the following procedures:

    1. For a single-instance database, run the following command, where SID is the SID of the database that was upgraded and then downgraded and save_directory is the path to the storage location you chose when saving your database control files and data:

      emdwgrd -restore -sid SID -path save_directory -tempTablespace TEMP
      
    2. For an Oracle RAC database, remote copy is required across the cluster nodes. Define an environment variable to indicate which remote copy is configured. For example:

      setenv EM_REMCP /usr/bin/scp
      

      Then, run emdwgrd —restore with the following options:

      emdwgrd -restore -tempTablespace TEMP -cluster -sid SID_OldHome -path save_directory
      

      If the Oracle home is on a shared device, then add -shared to the emdwgrd command options.

  6. Enter the SYS and SYSMAN passwords when prompted by emdwgrd.

  7. When emdwgrd completes, Oracle Enterprise Manager Database Control is downgraded to the old Oracle home.

Restoring Oracle Application Express to the Earlier Release

After a downgrade, if you upgraded Oracle Application Express at the same time as you upgraded Oracle Database, then you must complete steps to revert to the earlier Oracle Application Express release.

To complete the downgrade of Oracle Application Express after a database downgrade, complete all the steps listed in Oracle Application Express Installation Guide to revert your Oracle Application Express release to the earlier release. The steps to revert are different, depending on whether your architecture is a Non-CDB or a multitenant architecture (CDB) Oracle Database.

Note:

You only need to complete these steps if you upgraded Oracle Application Express at the same time that you upgraded the database.

Gathering Dictionary Statistics After Downgrading

To help to assure good performance after you downgrade, use this procedure to gather dictionary statistics.

Oracle recommends that you gather dictionary statistics after downgrading the database, so that the statistics are collected for the downgraded release Data Dictionary tables.

  • Non-CDB Oracle Database: 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;
    
  • CDB (multitenant architecture) Oracle Database: Oracle recommends that you use catcon to gather Data Dictionary statistics across the entire multitenant architecture.

    To gather dictionary statistics for all PDBs in a container database, use the following syntax:

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

    To gather dictionary statistics on a particular PDB, use syntax similar to the following:

    $ORACLE_HOME/perl/bin/perl $ORACLE_HOME/rdbms/admin/catcon.pl -l /tmp -c
    'SALES1' -b gatherstats -- --x"exec dbms_stats.gather_dictionary_stats"

    In the preceding example the -c SALES1 option specifies a PDB inclusion list for the command that you run, specifying the database named SALES1. The option -b gatherstatsspecifies the base name for the logs. The option --x specifies the SQL command that you want to execute. The SQL command itself is inside the quotation marks.

Regathering Fixed Object Statistics After Downgrading

After the downgrade, run representative workloads on Oracle Database, and regather fixed object statistics.

Fixed objects are the X$ tables and their indexes. V$ performance views are defined through X$ tables. After you downgrade, regather fixed object statistics to ensure that the optimizer for the restored database can generate good execution plans. These execution plans can improve database performance. Failing to obtain representative statistics can lead to suboptimal execution plans, which can cause performance problems

Gather fixed objects statistics by using the DBMS_STATS.GATHER_FIXED_OBJECTS_STATS PL/SQL procedure. DBMS_STATS.GATHER_FIXED_OBJECTS_STATS also displays recommendations for removing all hidden or underscore parameters and events from init.ora and SPFILE.

To gather statistics for fixed objects, run the following PL/SQL procedure:

SQL> execute dbms_stats.gather_fixed_objects_stats;

See Also:

Oracle Database PL/SQL Packages and Types Reference for more information about using the GATHER_FIXED_OBJECTS_STATS procedure

Regathering Stale CBO Statistics After Downgrade

Oracle recommends that you regather Oracle Cost-Based Optimizer (CBO) statistics after completing a downgrade of Oracle Database from 12c release 2 (12.2).

When you upgrade Oracle Database and gather new CBO statistics, the upgraded database has new database statistics. The upgraded database also can include new histogram types. For this reason, when you downgrade the database, the statistics that you collected for the new release can be different from the previous release. This issue is applicable both to data dictionary tables, and to regular user tables.

Regather stale statistics either by using GATHER_DATABASE_STATS, or by using gather commands that you typically use to update stale statistics in the dictionary and application schemas.

For example:

  • Non-CDB Oracle Database: To regather statistics, Oracle recommends that you use the GATHER_DATABASE_STATS procedure, with the option 'GATHER STALE'. For example:

    SQL> execute dbms_stats.gather_database_stats(options=>'GATHER STALE');
  • CDB (multitenant architecture) Oracle Database: to regather Data Dictionary statistics across the entire multitenant architecture, Oracle recommends that you use catcon.

    To regather stale dictionary statistics for all PDBs in a container database, use the following syntax:

    $ORACLE_HOME/perl/bin/perl $ORACLE_HOME/rdbms/admin/catcon.pl -l /tmp -b gatherstats -- --x"exec dbms_stats.gather_database_stats(options=>'GATHER STALE')"

    To gather dictionary statistics on a particular PDB, use syntax similar to the following:

    $ORACLE_HOME/perl/bin/perl $ORACLE_HOME/rdbms/admin/catcon.pl -l /tmp -c
    'SALES1' -b gatherstats -- --x"exec dbms_stats.gather_database_stats(options=>'GATHER STALE')"

    In the preceding example, the -c SALES1 option specifies a PDB inclusion list for the command that you run, specifying the database named SALES1. The option -b gatherstatsspecifies the base name for the logs. The option --x specifies the SQL command that you want to execute. The SQL command itself is inside the quotation marks.

Troubleshooting the Downgrade of Oracle Database

Use this troubleshooting information to address issues that may occur when downgrading Oracle Database.

This section contains known errors that may occur during downgrades, and workarounds to address those errors.

Topics:

Errors Downgrading Oracle Database Components with catdwgrd.sql Script

Use this section to troubleshoot errors when you run the catdwgrd.sql script during a downgrade, such as ORA-20001: Downgrade cannot proceed.

The catdwgrd.sql script downgrades all Oracle Database components in the database to the major release from which you originally upgraded. This script must run before the Data Dictionary can be downgraded. If you encounter any problems when you run the script, then correct the causes of the problems, and rerun the script.

Errors you can see include ORA-39709: incomplete component downgrade; string downgrade aborted, and ORA-06512. When these errors occur, downgrades cannot proceed.

  • Cause: One or more components that must be downgraded before proceeding with the Data Dictionary downgrade did not downgrade.

  • Action: Review the log files to determine what errors occurred before the catdwgrd.sql script halted, and the downgrade was stopped.

Review these examples to understand how to correct this issue.

Example 6-1 ORA-20001 Error Due To ORA-06512

Your downgrade stops. When you review the log files, you find that catdwgrd.sql terminates on this error:

DECLARE * ERROR at line 1: ORA-20001: Downgrade cannot proceed - 
Unified Audit Trail data exists. Please clean up the data first 
using DBMS_AUDIT_MGMT.CLEAN_AUDIT_TRAIL. ORA-06512: at line 65 
ORA-06512: at line 42

Errors typically describe what you must do to fix the issue that is preventing the downgrade to complete. Follow the instructions in the error message. After you have fixed the cause of the error, rerun the catdwgrd.sql script.

If the CDB downgrade fails during the downgrade of CDB$ROOT due to a check, then follow the instructions in the error message to fix the condition error. After you fix the error, rerun catdwgrd.sql with catcon.pl. Use the -c option to run the command with the inclusion list 'CDB$ROOT PDB1'. Use the -r option to run the command first on the PDB, and then on CDB$ROOT. For example:

$ORACLE_HOME/perl/bin/perl $ORACLE_HOME/rdbms/admin/catcon.pl -d $ORACLE_HOME/rdbms/admin -e -b catdwgrd -l /scratch/rac/downgradeLogs -c 'CDB$ROOT' -r catdwgrd.sql

Oracle Multimedia Downgrade and imrelod.sql Script Error

Review if you encounter ORA-20000: Oracle ORDIM component in registry is status: DOWNGRADED.

When downgrading Oracle Database from release 12.1 to release 11.2.0.2, an error may be raised from the imrelod.sql script, which is included with release 11.2.0.2.

ORA-20000: Oracle ORDIM component in registry is status: DOWNGRADED. Oracle ORDIM must be installed and valid prior to Oracle Multimedia upgrade, downgrade, or patch.

  • Cause The imrelod.sql script raises this error because it does not know the status of ORDIM.

  • Action No action. You can ignore this error.

Oracle Database Vault and dvrelod.sql Script Error

Review if you encounter ORA-31011: XML parsing failed.

When downgrading Oracle Database from release 12.1 to release 11.2.0.3, databases that use Oracle Database Vault may encounter the following error, which is a result of the dvrelod.sql script that is included with release 11.2.0.3:

ORA-31011: XML parsing failed; Oracle Database Vault downgrade to release 11.2.0.3
  • Cause The dvrelod.sql script does not know the status of XML parsing.

    Action No action. You can ignore this message.

Downgrading Oracle Grid Infrastructure (Oracle Restart) After Successful or Failed Upgrade

To downgrade Oracle Restart, you must deconfigure and then reinstall Oracle Grid Infrastructure. You can then add back the databases and services.

Oracle ACFS and Oracle Grid Infrastructure Downgrades to 11g Release 2 (11.2)

You must run acfsroot install before you attempt to start the software stack.

If you use Oracle ASM Cluster File System (Oracle ACFS), and you upgrade to Oracle Grid Infrastructure 12c, either for a cluster or for an Oracle Restart standalone server, and you choose to downgrade to Oracle Grid Infrastructure 11g Release 2 (11.2), then before you attempt to start the release 11.2 software stack, you must run the command acfsroot install from the release 11.2 Oracle Grid Infrastructure Oracle home (Grid home).

See Also:

Oracle Database Readme, and the release notes for your operating system platform for the latest information about issues and solutions

Database Links Passwords After Downgrading Oracle Database 11g Release 1 (11.1)

Reset the passwords for any database links that were created in releases 11.2 or 12.1.

After downgrading to Oracle Database release 11.1, you are required to reset the passwords for any database links that were created in releases 11.2 or 12.1.

Topics:

ORA-00600 Errors with Database Links Passwords After Downgrading to Oracle Database 11.1 Release 1

This error can occur if you do not reset the database link password.

If you do not reset the database link password, then an internal error is displayed when anyone attempts to make use of the database link. For reference, this is the internal error that is reported in the Oracle trace file when the Oracle server fails to retrieve the password of the database link:
ORA-00600: [kzdlk_zt2 err], [18446744073709551601]

To reset the password for the database link after downgrading to release 11.1, use the ALTER DATABASE LINK command to change the password back to the original password by specifying the original password in the IDENTIFIED BY clause.

To create new database links while running Oracle Database release 11.2 or 12.1 that do not have this password issue, contact Oracle support for information about how to use the IDENTIFIED BY VALUES clause of the CREATE DATABASE LINK command.

See Also:

Oracle Database SQL Language Reference for information about ALTER DATABASE LINK

Oracle Database Administrator's Guide for information about controlling connections established by database links

Using Oracle Data Pump Export to Create a Dump File Containing All Existing Database Links

Before performing the downgrade, use this Oracle Data Pump export procedure to create a dump file that contains all the existing database links.

The dump file you create includes any newly-created database links. The procedure uses the FULL=Y and INCLUDE=DB_LINK parameters with the expdp command.

  1. Log in to SQL*Plus.

    For example:

    sqlplus system/manager
    
  2. Drop the dump directory in case one exists.

    For example:

    SQL> DROP DIRECTORY dpump_dir;
    SQL> CREATE DIRECTORY dpump_dir AS '/location_to_write_datapump_dump_file';
    
  3. Export the database links.

    For example:

    $ expdp system/manager FULL=Y directory=dpump_dir 
      dumpfile=saved_dblinks.dmp INCLUDE=DB_LINK;
    
  4. After the downgrade, if any of the downgraded database links are not working properly, then drop these links, and import them from the dump file:

    $ impdp system/manager directory=dpump_dir dumpfile=saved_dblinks.dmp;

    For example, if you find that links are showing the internal error ORA-00600, then dropping and importing the links from the dump file should cause those links to work as intended.