9 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.
- Supported Releases for Downgrading Oracle Database
The downgrade options you have depend on the original Oracle Database release from which the database was upgraded. - Prepare to Downgrade a Standby Database with the Primary
If you are using an Oracle Data Guard Standby database, then review the procedure you can use to downgrade the standby database with the primary database - Check COMPATIBLE Parameter when Downgrading Oracle Database
IfCOMPATIBLE
has been changed after the upgrade, then it is no longer possible to downgrade an Oracle Database. - Perform a Full Backup Before Downgrading Oracle Database
Oracle strongly recommends that you perform a full backup of your new Oracle Database release before you downgrade to a supported earlier release. - Using Scripts to Downgrade Oracle Database 23ai
To automate downgrades, Oracle provides thedbdowngrade
utility script. When necessary, you can also continue to runcatdwgrd.sql
manually, as in previous releases. - Downgrading a Single Pluggable Oracle Database (PDB)
If you are downgrading Oracle Database, then you can downgrade one PDB without downgrading the whole CDB. - Downgrading PDBs That Contain Oracle APEX
Use this procedure to avoidINVALID OBJECTS OWNED BY APEX_050000
errors when you downgrade PDBs that contain Oracle APEX (formerly Application Express). - Post-Downgrade Tasks for Oracle Database Downgrades
After you downgrade your Oracle Database release, you can be required to complete additional tasks, due to changes that affect compatibility, components, and supported protocols. - Troubleshooting the Downgrade of Oracle Database
Use this troubleshooting information to address issues that may occur when downgrading Oracle Database.
Supported Releases for Downgrading Oracle Database
The downgrade options you have depend on the original Oracle Database release from which the database was upgraded.
Releases Supported for Downgrades
You can downgrade a PDB or CDB from Oracle Database 23ai to Oracle Database 21c or Oracle Database 19c. If you upgraded a non-CDB from 19c and converted to a PDB, you can only downgrade to a PDB on Oracle Database 19c. You can't revert the PDB conversion.
Note:
Starting with Oracle Database 21c, non-CDB architecture is desupported.
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 9-1 Supported Releases and Editions for Downgrading
Oracle Database Release or Edition | Downgradable (Yes/No) | Notes |
---|---|---|
21 |
Yes |
1) Install 21c (21.6) |
19 |
Yes |
No additional information at this time. |
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 |
Oracle Database Express Edition |
No |
You cannot downgrade a database that is upgraded from Oracle Database Express Edition. |
Recommendations to Review Before Downgrading
Before you start the downgrade procedure, Oracle recommends that you install the latest Release Update in both Oracle homes (the one that you downgrade from, and the one to which you downgrade) before you downgrade a CDB, or before you unplug and downgrade a PDB.
The latest Release Update Patches are available for download on My Oracle Support. Review "Primary Note for Database Proactive Patch Program (Doc ID 888.1)" on My Oracle Support for your release.
The minimum compatibility setting for Oracle Database 23ai is 19. You cannot downgrade to releases earlier than the minimum compatibility setting for the new Oracle Database release.
The following recommendations for earlier supported releases affect downgrading for Oracle Database:
- Multitenant architecture provides architecture features for a multitenant container database (CDB), and pluggable databases (PDBs). If you are upgrading to multitenant architecture, and you set the compatible initialization parameter to the highest level after upgrading to this release, then you cannot downgrade the database after an upgrade.
- Downgrade is not supported for Oracle Enterprise Manager. If you downgrade to an earlier supported release, then you must reconfigure Oracle Enterprise Manager controls.
Prepare to Downgrade a Standby Database with the Primary
If you are using an Oracle Data Guard Standby database, then review the procedure you can use to downgrade the standby database with the primary database
You can downgrade a database without breaking the standby database. To downgrade Oracle Database when a physical or logical standby database is present in the Oracle Data Guard configuration, use the procedure for your downgrade scenario as described in " Patching, Upgrading, and Downgrading Databases in an Oracle Data Guard Configuration" in Oracle Data Guard Concepts and Administration
Check COMPATIBLE Parameter when Downgrading Oracle Database
If COMPATIBLE
has been changed after the upgrade, then it is
no longer possible to downgrade an Oracle Database.
If you have updated the COMPATIBLE
parameter to set the
compatibility level of your Oracle Database release to the current release, then you are
not able to downgrade to an earlier release. This issue occurs because new releases have
changes to the Data Dictionary, and can have other feature changes that prevent
downgrades.
To check the COMPATIBLE
parameter setting for your database
before you downgrade, enter the following command:
SQL> SELECT name, value, description FROM v$parameter WHERE name =
‘compatible’;
Note:
For Oracle ASM disk groups, if you changed the compatible.asm
parameter after the upgrade to the upgraded release value, then when you downgrade
to the earlier release, you cannot mount your Oracle ASM disk groups. The value for
compatible.asm
sets the minimum Oracle ASM release that can
mount a disk group.
As part of your downgrade, you must create a new disk group to your downgraded release level, and restore data to that downgraded compatibility ASM disk group.
Parent topic: Downgrading Oracle Database to an Earlier Release
Perform a Full Backup Before Downgrading Oracle Database
Oracle strongly recommends that you perform a full backup of your new Oracle Database release before you downgrade to a supported earlier release.
If time does not allow for you to complete a full level 0 backup, then at least complete a level 1 backup.
Using Scripts to Downgrade Oracle Database 23ai
To automate downgrades, Oracle provides the dbdowngrade
utility script. When necessary, you can also continue to run catdwgrd.sql
manually, as in previous releases.
- Using Dbdowngrade to Downgrade Oracle Databases To an Earlier Release
To downgrade to a previous database release, Oracle recommends that you run the downgrade scriptdbdowngrade
. - Downgrading Oracle Databases Manually with catdwgrd.sql
When you prefer to downgrade Oracle Database manually, or if you are concerned about excessive thread issues, you can run the manualcatdwgrd.sql
script.
Parent topic: Downgrading Oracle Database to an Earlier Release
Using Dbdowngrade to Downgrade Oracle Databases To an Earlier Release
To downgrade to a previous database release, Oracle recommends that you run
the downgrade script dbdowngrade
.
Oracle provides the Downgrade Utility script dbdowngrade
. When you
use the dbdowngrade
utility, it sets appropriate values for the
downgrade, and simplifies how you start a downgrade. Specifically, it ensures that
the underlying calls to catcon.pl
use recommended values, so that
potential errors due to excessive threads being spawned are reduced. This feature is
especially of value for downgrades of multitenant architecture (CDB) databases. If
you prefer to be in control of the number of resources used for a downgrade, then
you can run the catdwgrd.sql
script manually, as in previous
releases. After you
downgrade to the earlier database release, you can then appy any release update to
that earlier release.
The dbdowngrade
shell command is located in the file path $ORACLE_HOME/bin
on Linux and Unix, and %ORACLE_HOME%\bin
on Microsoft Windows based systems. If you are downgrading a CDB, then you can provide the inclusion list as argument to the script.
When you downgrade multitenant architecture databases (CDBs), the dbdowngrade
script has two behaviors, depending on whether you use an inclusion list.
-
Without an inclusion list. The downgrade runs on all the containers that are open in the CDB (PDB and CDB).
Run the downgrade without an inclusion list when you want to downgrade the entire CDB. In this scenario, all open containers are downgraded. You must open all the PDBs in the CDB manually before you start the
dbdowngrade
script. -
With an inclusion list. The downgrade runs only on the PDBs within the inclusion list, and
CDB$ROOT
is not downgraded during the downgrade operation.Run the downgrade with an inclusion list when you want to downgrade only the set of PDBs listed in the inclusion list. In this scenario, where you want to use unplug and plug upgrades, only the set of PDBs that you list in the inclusion list are downgraded. The CDB and the PDBs that are not on the inclusion list remain upgraded to the later release.
Prerequisites:
-
If you are downgrading from Oracle Database 23ai to Oracle Database 21c, Oracle Database 19c, Oracle Database 18c, or Oracle Database 12.2, 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.
- If you are downgrading without an inclusion list, then you must open all PDB containers before you run the
dbdowngrade
script.
As a result of running the dbdowngrade
script, the utility runs
catdwgrd
and catcon.pl
. These scripts perform
the downgrade, using the recommended values for the release to which you are
downgrading.
These scripts create log files. If you run dbdowngrade
with the -l filepath
, where
filepath
is the path where you want log
files created, then dbdowngrade
creates the directory you specify,
and places log files there. For example:
./dbdowngrade -l /databases/downgrade/logs
If you do not specify a directory for log files, then the log files produced by the downgrade scripts are placed under the first directory found of one of these three options, in order of precedence:
-
The Oracle base home identified by the
orabasehome
command -
The Oracle base home identified by the
orabase
command -
The Oracle home identified by the
oracle_home
command
$ $ORACLE_HOME/bin/orabasehome
/u01/app/oracle/product/23.0.0/dbhome_1
In
this example, the $ORACLE_BASE directory is
/u01/app/oracle/product/23.0.0/dbhome_1
, and the logs are located in
/u01/app/oracle/product/23.0.0/dbhome_1/cfgtoollogs/downgrade
.
In the directory, the log files are prefixed with the string
catdwgrd
.
To further manage how the dbdowngrade
script runs, you can specify
the following additional options:
-d directory-path
Specify the directory path, defined bydirectory-path
, where you want thecatdwgrd.sql
file placed-e
Specify that you want to turn echo off whilecatdwgrd.sql
runs (the default is set to on).-n number
Specify the number of parallel processes you want thedbdowngrade
command to use. By default, the number of processes is equal to the number of CPUs divided by 2 (cpu_count/2
).-b log-file-name-base
Specify a different base file name (the value you provide for the variablelog-file-name-base
) for log files generated by the manual downgrade scriptcatdwgrd
. If you do not specify a different base file name, then the default file base name iscatdwgrd
.-h
Specify that you want dbdowngrade to display a list of command options. The dbdowngade script then outputs command options to the screen, and exits.
Note:
-
Read-write Oracle homes: the commands
orabaseconfig
andorabasehome
both return the environment setting for ORACLE_HOME. -
Read-only Oracle homes: the command
orabaseconfig
returns the read-only path configuration for the Oracle base in the path$ORACLE_BASE/homes
.
Related Topics
Parent topic: Using Scripts to Downgrade Oracle Database 23ai
Downgrading Oracle Databases Manually with catdwgrd.sql
When you prefer to downgrade Oracle Database manually, or if you are
concerned about excessive thread issues, you can run the manual
catdwgrd.sql
script.
catdwgrd.sql
script to downgrade Oracle
Database to an earlier a supported major release, or an earlier release update.
If you are downgrading from Oracle Database 23ai to Oracle Database 21c 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.
Note:
Starting with Oracle Database 21c, non-CDB architecture is desupported. If you upgraded a non-CDB and converted to a PDB, you can only downgrade back to a PDB. It's not possible to revert the non-CDB to PDB conversion. Starting with Oracle Database 23ai, Oracle Label Security is desupported.
At the completion of this procedure, your database is downgraded.
Downgrading a Single Pluggable Oracle Database (PDB)
If you are downgrading Oracle Database, then you can downgrade one PDB without downgrading the whole CDB.
You can downgrade individual PDBs. For example, you can unplug a PDB from an upgraded CDB, downgrade the PDB, and then plug it in to an earlier release CDB, or you can convert the PDB database to a standalone database.
Downgrade the PDB
In this procedure example, you downgrade the PDB to release 19c:
-
Start up the PDB in
DOWNGRADE
mode. The CDB can be in normal mode when you do this.SQL> alter pluggable database CDB1_PDB1 open downgrade;
-
Downgrade the PDB, either by using the
dbdowngrade
utility, or by runningcatdwgrd
manually, usingcatcon.pl
.In each of these options, the PDB that you are downgrading is
PDB1
.-
Downgrading with
dbdowngrade
utility.Downgrade the PDB using the
dbdowngrade
script as follows:cd $ORACLE_HOME/bin ./dbdowngrade -c 'PDB1'
-
Manually downgrading with
catdwgrd
, usingcatcon.pl
.Run
catdwgrd
as follows, whereoutput-directory
is the output directory, andcatdwgrd
is the log file base:$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 withcatcon.pl
. The-d
parameter tellscatcon.pl
where to findcatdwgrd
. The-l
parameter specifies the output directory for log files, instead of writing to therdbms/admin
directory). You must use the-r
parameter to run the two scripts together at the same time.The log files for the downgrade are placed in the Oracle base home (the Oracle base identified by the commands
orabasehome
, ororabase
, or the Oracle home identified by the commandoracle_home
, in that order.
-
-
Close the PDB.
Unplug the PDB from the CDB
In this step you unplug the downgraded PDB from the Oracle Database 23ai CDB:
-
Connect to the upgraded CDB.
-
Close the PDB that you want to unplug.
SQL> alter pluggable database PDB1 close;
-
Unplug the downgraded 19c 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 19c PDB
In this step you plug the downgraded 19c PDB into the 19c CDB. To do this, you must create the PDB in this CDB. The following example shows how to create a pluggable database called PDB1:
-
Connect to the 19c CDB.
-
Plug in the 19c PDB.
SQL> create pluggable database PDB1 using 'path/pdb1.xml';
This command returns
Pluggable database created
. -
Open the PDB in upgrade mode:
SQL> alter pluggable database PDB1 open upgrade;
-
Connect to the PDB:
SQL> alter session set container=PDB1;
-
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. -
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 anINVALID
state, such as packages, procedures, types, and so on.
Related Topics
Parent topic: Downgrading Oracle Database to an Earlier Release
Downgrading PDBs That Contain Oracle APEX
Use this procedure to avoid INVALID OBJECTS OWNED BY
APEX_050000
errors when you downgrade PDBs that contain Oracle APEX (formerly
Application Express).
After you downgrade the PDB to an earlier release, enter a SQL statement similar to
the following to drop the Oracle APEX user:, where the log file base is
drop_apex5
:
$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'
.
Parent topic: Downgrading Oracle Database to an Earlier Release
Post-Downgrade Tasks for Oracle Database Downgrades
After you downgrade your Oracle Database release, you can be required to complete additional tasks, due to changes that affect compatibility, components, and supported protocols.
- Reapply Release Update and Other Patches After Downgrade
After the downgrade is run, andcatrelod.sql
completes successfully, if you installed new patches in your original Oracle home after the upgrade, but before the downgrade, then ensure that you apply any patches that you installed. - Reenabling Oracle RAC After Downgrading Oracle Database
After the downgrade, you can re-enable Oracle Real Application Clusters (Oracle RAC). - Reenabling Oracle Database Vault after Downgrading Oracle Database
You must do this if you are instructed during the downgrade to disable Oracle Database Vault. - Downgrade the Oracle Grid Infrastructure Configuration for the Database
\After a downgrade you must change the Oracle Grid Infrastructure registration to start the database release in the earlier release Oracle Database home. - 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. - Restoring Oracle APEX to the Earlier Release
After a downgrade, if you upgraded Oracle APEX (formerly Oracle Application Express) at the same time as you upgraded Oracle Database, then you must complete steps to revert to the earlier release. - Gathering Dictionary Statistics After Downgrading
To help to assure good performance after you downgrade, use this procedure to gather dictionary statistics. - Regathering Fixed Object Statistics After Downgrading
After the downgrade, run representative workloads on Oracle Database, and regather fixed object statistics. - Regathering Stale CBO Statistics After Downgrade
Oracle recommends that you regather Oracle Cost-Based Optimizer (CBO) statistics after completing an Oracle Database downgrade. - Checking Validity of Registry Components After Downgrade
Check the validity of registry components and identify any invalid components.
Parent topic: Downgrading Oracle Database to an Earlier Release
Reapply Release Update and Other Patches After Downgrade
After the downgrade is run, and catrelod.sql
completes successfully, if you installed new patches in your original Oracle home after the upgrade, but before the downgrade, then ensure that you apply any patches that you installed.
If you installed new patches, then run the datapatch
tool to apply
those patches to the downgraded database. If you did not change the binaries and files
in your Oracle Home after the upgrade, then there is no need to run
datapatch
after running catrelod.sql
. However, if
you are in any doubt about whether new patches are installed, then run
datapatch
. There is no safety concern that prevents you from
running datapatch
as many times as you require to be certain that
patches are applied to the database.
Parent topic: Post-Downgrade Tasks for Oracle Database Downgrades
Reenabling Oracle RAC After Downgrading Oracle Database
After the downgrade, you can re-enable Oracle Real Application Clusters (Oracle RAC).
For downgrades with Oracle RAC databases, where you set
CLUSTER_DATABASE=FALSE
for the downgrade, you can now set
CLUSTER_DATABASE=TRUE
again and start with all instances in the RAC
cluster.
Parent topic: Post-Downgrade Tasks for Oracle Database Downgrades
Reenabling 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 databaseTo use Oracle Database Vault after downgrading, you must register it to reenable it.
Related Topics
Parent topic: Post-Downgrade Tasks for Oracle Database Downgrades
Downgrade the Oracle Grid Infrastructure Configuration for the Database
\After a downgrade you must change the Oracle Grid Infrastructure registration to start the database release in the earlier release Oracle Database home.
Later release Oracle Grid Infrastructure can run earlier Oracle Database releases. Oracle
does not recommend that you downgrade Oracle Grid Infrastructure, unless you encounter
an issue related specifically to Oracle Grid Infrastructure. However, after you
downgrade your Oracle Databaes release, you must use the command srvctl
downgrade database
to configure Oracle Clusterware to start the database in
the earlier release Oracle home.
To configure Oracle Clusterware to start the database in the earlier release Oracle
home, use the following command syntax, where
$LATER_RELEASE_ORACLE_HOME
is the path (or environment
variable) to the later release Oracle home, old_release_oracle_home
is the path to the earlier release Oracle home, and old-release
is
the earlier release Oracle Database release:
$LATER_RELEASE_ORACLE_HOME/bin/srvctl downgrade database -d $ORACLE_UNQNAME -o old_release_oracle_home -t old-release
For example:
$ORACLE_HOME/bin/srvctl downgrade database -d $ORACLE_UNQNAME -o /u02/app/oracle/product/12.2/db_1/ -t 12.2.0.4
Parent topic: Post-Downgrade Tasks for Oracle Database Downgrades
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.
- 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 to a release earlier than 12.1 - 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. - Running the emdwgrd utility to restore Enterprise Manager Database Control
You can restore the Oracle Enterprise Manager Database Control and data by using theemdwgrd
utility after you runemca -restore
.
Parent topic: Post-Downgrade Tasks for Oracle Database Downgrades
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 to a release earlier than 12.1
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 new Oracle Database release 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.
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.
- Running emca on a Single-Instance Oracle Database Without Oracle ASM
Use Enterprise Manager Configuration Assistant (emca
) to manage your database. - Running EMCA on an Oracle RAC Database Without Oracle ASM
Use Enterprise Manager Configuration Assistant (emca
) to manage your database: - Running EMCA on a Single-Instance Oracle ASM Instance
Use Enterprise Manager Configuration Assistant (emca
) to manage your database and storage. - Running emca on an Oracle ASM on Oracle RAC Instance
Use Enterprise Manager Configuration Assistant (emca
) to manage your database and storage. - Running emca on a Single-Instance Oracle Database With Oracle ASM
Use Enterprise Manager Configuration Assistant (emca
) to manage your database and storage. - Running emca on an Oracle RAC Database and Oracle ASM Instance
Use Enterprise Manager Configuration Assistant (emca
) to manage your database and storage.
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 new release Oracle Database Oracle home.
The following procedure is for Linux and Unix. To run it on Windows, substitute
emdwgrd.bat
for emdwgrd
.
-
Set ORACLE_HOME to the Oracle home from which the database upgrade originally took place.
-
Set ORACLE_SID to the SID of the database that was upgraded and then downgraded.
-
Set PATH, LD_LIBRARY_PATH and SHLIB_PATH to point to the Oracle home from which the database upgrade originally took place.
-
Go to the new Oracle Database release Oracle home:
cd $ORACLE_HOME/bin
-
Run
emdwgrd
using one of the following procedures:-
For a single-instance database, run the following command, where
SID
is the SID of the database that was upgraded and then downgraded andsave_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
-
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.
-
-
Enter the SYS and SYSMAN passwords when prompted by
emdwgrd
. -
When
emdwgrd
completes, Oracle Enterprise Manager Database Control is downgraded to the old Oracle home.
Restoring Oracle APEX to the Earlier Release
After a downgrade, if you upgraded Oracle APEX (formerly Oracle Application Express) at the same time as you upgraded Oracle Database, then you must complete steps to revert to the earlier release.
To complete the downgrade of Oracle APEX after a database downgrade, complete all the steps listed in Oracle APEX Installation Guide to revert your Oracle APEX 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 APEX at the same time that you upgraded the database.
Related Topics
Parent topic: Post-Downgrade Tasks for Oracle Database Downgrades
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.
Note:
After a downgrade process, be aware that the the data dictionary can have changes that persist in the downgraded dictionary. These changes are insignificant. The downgraded data dictionary is functionally equivalent to an earlier release data dictionary.
-
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 namedSALES1
. The option-b gatherstats
specifies 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.
Related Topics
Parent topic: Post-Downgrade Tasks for Oracle Database Downgrades
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
Parent topic: Post-Downgrade Tasks for Oracle Database Downgrades
Regathering Stale CBO Statistics After Downgrade
Oracle recommends that you regather Oracle Cost-Based Optimizer (CBO) statistics after completing an Oracle Database downgrade.
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, after a downgrade:
-
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 namedSALES1
. The option-b gatherstats
specifies 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.
Related Topics
Parent topic: Post-Downgrade Tasks for Oracle Database Downgrades
Checking Validity of Registry Components After Downgrade
Check the validity of registry components and identify any invalid components.
CDB_REGISTRY
view. You can also check an individual PDB using
DBA_REGISTRY
. Ensure that all components are either
VALID
or OPTION OFF
.
Example 9-1 Check Registry on a CDB with CDB_REGISTRY View
set line 200
set pages 1000
col COMP_ID format a8
col COMP_NAME format a34
col SCHEMA format a12
col STATUS format a10
col VERSION format a12
col CON_ID format 99
select CON_ID, COMP_ID, comp_name, schema, status, version from CDB_REGISTRY order by 1,2;
Example 9-2 Check Registry on a PDB with DBA_REGISTRY View
set line 200
set pages 1000
col COMP_ID format a8
col COMP_NAME format a34
col SCHEMA format a12
col STATUS format a10
col VERSION format a12
select COMP_ID, comp_name, schema, status, version from DBA_REGISTRY order by 1;
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.
- Errors Downgrading Oracle Database Components with catdwgrd.sql Script
Use this section to troubleshoot errors when you run thecatdwgrd.sql
script during a downgrade, such asORA-20001
: Downgrade cannot proceed. - 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. - Errors Downgrading Databases with Oracle Messaging Gateway
If you downgrade a database configured with Oracle Messaging Gateway , then you can encounterORA-02303
errors.
Parent topic: Downgrading Oracle Database to an Earlier Release
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
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.
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.
For example, 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, PDB1, PDB2' -r catdwgrd.sql
Example 9-3 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
You must purge the unified audit trial on CDB$ROOT
and on all PDBs.
-
Look for the presence of unified audit trails:
SQL> SELECT COUNT(*) FROM UNIFIED_AUDIT_TRAIL; COUNT(*) ---------- 4538
-
Purge the audit trail. on the CDB.
For example, where the audit trail type is
DBMS_AUDIT.MGMT.AUDIT
:EXEC DBMS_AUDIT_MGMT.CLEAN_AUDIT_TRAIL DBMS_AUDIT_MGMT.AUDIT
-
Run
catdwngrd.sql
onCDB$ROOT
. If PDBs still have unified audit data, then the script fails with ORA20001:62 execute immediate 63 'select count(*) from audsys.'||'"'||tab_name||'"' into no_rows; 64 65 -- If audit trail has some data, raise the application error 66 IF no_rows > 0 THEN 67 RAISE_APPLICATION_ERROR(-20001, ErrMsg); 68 END IF; 69 END IF; 70 END IF; 71 EXCEPTION 72 WHEN NO_DATA_FOUND THEN 73 NULL; 74 WHEN OTHERS THEN 75 RAISE; 76 END; 77 / 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 75
-
Connect to individual PDBs, and find if they have unified audit trails. Clear the unified audit trail for all PDBs. For example, The PDB named PDB1 has unified audit trails:
ALTER SESSION SET container = PDB1; SQL> SELECT COUNT(*) FROM UNIFIED_AUDIT_TRAIL; COUNT(*) ---------- 1330
-
Identify the unified audit trails:
SQL> CREATE TABLE UA_DATA AS (SELECT * FROM UNIFIED_AUDIT_TRAIL);
-
Purge the audit trails.
In this example, the audit trail type is
DBMS_AUDIT_MGMT.AAUDIT_TRAIL_UNIFIED
, theUSE_LAST_ARCH_TIMESTAMP
value is set toFALSE
, so that all audit records are deleted, without considering last archive timestamp, and theCONTAINER
value is set toDBMS_AUDIT_MGMT.CONTAINER_ALL
, so that audit records on all PDBs are purged.BEGIN DBMS_AUDIT_MGMT.CLEAN_AUDIT_TRAIL( AUDIT_TRAIL_TYPE => DBMS_AUDIT_MGMT.AUDIT_TRAIL_UNIFIED, USE_LAST_ARCH_TIMESTAMP => FALSE, CONTAINER => DBMS_AUDIT_MGMT.CONTAINER_ALL END; /
-
Rerun
catdwngrd.sql
at the PDB and CDB level. For example:$ORACLE_HOME/perl/bin/perl $ORACLE_HOME/rdbms/admin/catcon.pl -c 'CDB$ROOT,PDB1' -d $ORACLE_HOME/rdbms/admin -e -b catdwgrd -l /u01/oracle/product/19.0.0/downgrade_logs -r catdwgrd.sql
-
Repeat the process of finding and purging audit trails and run
catdwgrd.sql
until the script completes successfully on the CDB and PDBs, and you no longer seeORA-20001
errors in logs
Related Topics
Parent topic: Troubleshooting the Downgrade of Oracle Database
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.
Errors Downgrading Databases with Oracle Messaging Gateway
If you downgrade a database configured with Oracle Messaging Gateway , then
you can encounter ORA-02303
errors.
If you downgrade an Oracle Database that contains Oracle Messaging Gateway objects, then you can encounter the following error:
ORA-02303: cannot drop or replace a type with type or table dependents
- Cause The
catrelod.sql
script is attempting to reload Oracle Messaging Gateway objects of a different type than the earlier Oracle Database release. - Action No action. You can ignore this error.
Parent topic: Troubleshooting the Downgrade of Oracle Database