These topics address how to upgrade and downgrade an Oracle database when a physical or logical standby database is present in the Oracle Data Guard configuration.
Before You Patch or Upgrade the Oracle Database Software
Before you patch or upgrade your Oracle Database software, review the prerequisites for different use case scenarios.
If you are using the Oracle Data Guard broker to manage your configuration, follow the instructions in Oracle Data Guard Broker
Use procedures described in these topics in conjunction with other upgrade procedures and guidelines provided in Oracle Database Upgrade Guide.
NOLOGGINGoperations have been performed then you must update the standby database.
Make note of any tablespaces or data files that need recovery due to
OFFLINE IMMEDIATE. Before starting an upgrade, tablespaces or data files should be recovered, and either online or offline.
In an Oracle Data Guard configuration, all physical and snapshot standby databases must use a copy of the password file from the primary database. Password file changes done on the primary database are automatically propagated to standby databases. Password file changes are events such as when an administrative privilege (
SYSDBA, and so on) is granted or revoked, and when the password of any user with administrative privileges is changed.
Far sync instances are an exception to the automatic updating feature. Updated password files must still be manually copied to far sync instances, because far sync instances receive redo, but do not apply it. When a password file is manually updated at a far sync instance, the redo containing the same password changes from the primary database is automatically propagated to any standby databases that are set up to receive redo from that far sync instance. The password file is updated on the standby when the redo is applied.
If there are cascaded standbys in your configuration, then those cascaded standbys must follow the same rules as any other standby, but should be shut down last, and restarted in the new home first.
Patching Oracle Database with Standby First Patching
Oracle Data Guard Standby-First Patch Apply provides support for different database home software between a primary database and its physical standby database(s).
This support is provided for the purpose of applying and validating Oracle patches and patch bundles in rolling fashion with minimal risk to the primary database. For example, with Data Guard Standby-First Patch Apply you apply a database home patch first to a physical standby database. The standby is used to run read-only workload, or read-write workload if it is a snapshot standby, for testing and evaluation of the patch. After passing evaluation, the patch is then installed on the primary system with greater assurance of the effectiveness and stability of the database home patch.
Oracle Data Guard Standby-First Patch Apply is supported only for certified interim patches and patch bundles (for example, Patch Set Update, or Database Patch for Exadata) for Oracle Database 126.96.36.199 and later, on both Oracle Engineered Systems (e.g. Exadata, SuperCluster) and non-Engineered Systems. A patch and patch bundle that is Data Guard Standby-First certified states the following in the patch README:
Data Guard Standby-First Installable
The following types of patches are candidates to be Data Guard Standby-First certified:
Database home interim patches
Exadata bundle patches (e.g. Monthly and quarterly database patches for Exadata)
Database patch set updates
Patches and patch bundles that update modules that may potentially disrupt the interoperability between primary and physical standby systems running different database home software are not certified “Data Guard Standby-First Installable” and do not state so in the patch README.
Oracle patch sets and major release upgrades do not qualify for Data Guard Standby-First Patch Apply. For example, upgrades from 188.8.131.52 to 184.108.40.206 or 11.2 to 12.1 do not qualify. Use the Data Guard transient logical standby rolling upgrade process for database patch sets and major releases.
Additionally, as of Oracle Database 11g Release 2 (220.127.116.11), a physical standby database can be used to install eligible one-off patches, patch set updates (PSUs), and critical patch updates (CPUs), in rolling fashion. For more information about this functionality, see the My Oracle Support note 1265700.1 at
Upgrading Oracle Database with a Physical Standby Database in Place
These steps show how to upgrade to Oracle Database when a physical standby database is present in the configuration.
Note:If the database being upgraded is a member of an Oracle Data Guard broker configuration, then before proceeding, you must disable fast-start failover and shut down the broker. For information about how to do this, see Oracle Data Guard Broker .
- Review and perform the standard preupgrade preparation tasks described in Oracle Database Upgrade Guide.
- Install the new release of the Oracle software into a new Oracle home on the physical standby database and primary database systems, as described in Oracle Database Upgrade Guide
- Shut down the primary database.
- Shut down physical standby databases.
- Stop all listeners, agents, and other processes running in the Oracle homes that you want to upgrade (Source Oracle homes). Perform this step on all nodes in an Oracle Real Application Clusters (Oracle RAC) environment.
- In the new Oracle home (Target Oracle home), restart all listeners, agents, and other processes that you stopped in the source Oracle home
- Mount physical standby databases on the target Oracle home (upgraded version).
Do not open standby databases until the primary database upgrade is completed.
See Start the Physical Standby Database for information on how to start a physical standby database.
- Start Redo Apply on the physical standby databases.
Note:By default, AutoUpgrade disables log shipping. If you have modified your AutoUpgrade configuration file to enable log shipping, then modify your AutoUpgrade configuration file to set the AutoUpgrade locally modifiable global parameter
no. For example:
upg1.defer_standby_log_shipping=noSee Start the Physical Standby Database for information on how to start Redo Apply.
- Upgrade the primary database. Physical standby databases are upgraded when the redo generated by the primary database as it is upgraded is applied to standbys.
- Open the upgraded primary database.
- If Oracle Active Data Guard was being used before the upgrade, then you must
reenable it after upgrading.
See Real-time query
- (Optional) When ready. modify the
On Microsoft Windows platforms, it is necessary to use the ORADIM utility to delete the database service (for the old database version), and to create a new database service for the new database version. You must replace the
OracleServiceSIDon both the primary and standby servers.
Upgrading Oracle Database with a Logical Standby Database in Place
These steps describe the traditional method for upgrading your Oracle Database software with a logical standby database in place.
Using SQL Apply to Upgrade the Oracle Database presents an alternative method to perform an upgrade with a logical standby database in place in a rolling fashion to minimize downtime. Use the steps from only one method to perform the complete upgrade. Do not attempt to use both methods or to combine the steps from the two methods as you perform the upgrade process.
Perform the following steps to upgrade to Oracle Database 12c Release 2 (12.2) when a logical standby database is present in the configuration. These steps assume that the primary database is running in
MAXIMUM PERFORMANCE data protection mode.
- Set the data protection mode to
MAXIMUM PERFORMANCEat the primary database, if needed:
SQL> ALTER DATABASE SET STANDBY DATABASE TO MAXIMIZE PERFORMANCE;
- On the primary database, stop all user activity and defer the remote archival destination associated with the logical standby database (for this procedure, it is assumed that
LOG_ARCHIVE_DEST_2is associated with the logical standby database):
SQL> ALTER SYSTEM SET LOG_ARCHIVE_DEST_STATE_2=DEFER SCOPE=BOTH; SQL> ALTER SYSTEM ARCHIVE LOG CURRENT;
- Stop SQL Apply on the logical standby database:
SQL> ALTER DATABASE STOP LOGICAL STANDBY APPLY;
- On the primary database install the newer release of the Oracle software. .
- On the logical standby database, install the newer release of the Oracle software.
Steps 4 and 5 can be performed concurrently (in other words, the primary and the standby databases can be upgraded concurrently) to reduce downtime during the upgrade procedure.
- On the upgraded logical standby database, restart SQL Apply. If you are using Oracle RAC, start up the other standby database instances:
SQL> ALTER DATABASE START LOGICAL STANDBY APPLY IMMEDIATE;
- Open the upgraded primary database and allow users to connect. If you are using Oracle RAC, start up the other primary database instances.
Also, enable archiving to the upgraded logical standby database, as follows:
SQL> ALTER SYSTEM SET LOG_ARCHIVE_DEST_STATE_2=ENABLE;
- Optionally, reset to the original data protection mode if you changed it in Step 1.
- Optionally, modify the
Modifying the COMPATIBLE Initialization Parameter After Upgrading
When you upgrade to a new release of Oracle Database, certain new features might make your database incompatible with your previous release.
After the upgrade is complete, you can increase the setting of the
COMPATIBLE initialization parameter to the maximum level for the new Oracle Database release. When you are certain that you no longer need the ability to downgrade your database back to its original version, set the
COMPATIBLE initialization parameter based on the compatibility level you want for your new database.
In an Oracle Data Guard configuration, if you decide to increase the setting of the
COMPATIBLE initialization parameter after upgrading, then it is important that you perform the following steps in the order shown (be sure the standby database has a
COMPATIBLE setting equal to, or higher than, the primary):
Increase the value of the
COMPATIBLEinitialization parameter on all standby databases in the configuration first, as follows:
Ensure that apply is current on the standby database(s).
On one instance of each standby database, execute the following SQL statement:
ALTER SYSTEM SET COMPATIBLE=<value> SCOPE=SPFILE;
If Redo Apply or SQL Apply is running, then stop them.
Restart all instances of the standby database(s).
If you previously stopped Redo Apply or SQL Apply, then restart them.
Increase the value of the
COMPATIBLEinitialization parameter on the primary database, as follows:
On one instance of the primary database, execute the following SQL statement:
ALTER SYSTEM SET COMPATIBLE=<value> SCOPE=SPFILE;
Restart all instances of the primary database.
Oracle Database Upgrade Guide for more information about compatibility settings
Downgrading Oracle Database with No Logical Standby in Place
Perform these steps to downgrade Oracle Database in an Oracle Data Guard configuration that does not contain a logical standby database.
- Ensure that all physical standby databases are mounted, but not open. Do not open the standby database(s) until all redo generated by the downgrade of the primary database has been applied.
- Start Redo Apply, in real-time apply mode, on the physical standby database(s).
- Downgrade the primary database using the procedure described in Oracle Database Upgrade Guide, keeping the following in mind:
At each step of the downgrade procedure where a script is executed, execute the script only at the primary database. Do not perform the next downgrade step until all redo generated by the execution of the script at the primary database has been applied to each physical standby database.
At each step of the downgrade procedure where an action other than running a script is performed, perform the step at the primary database first and then at each physical standby database. Do not perform the next downgrade step at the primary database until the action has been performed at each physical standby database.
- If it becomes necessary to perform a failover during a downgrade, perform the failover and then continue with the downgrade procedure at the new primary database.
Downgrading Oracle Database with a Logical Standby in Place
Perform these steps to downgrade Oracle Database in an Oracle Data Guard configuration that contains a logical standby database or a mixture of logical and physical standby databases.
- Issue the following command at the primary database (database P, for the sake of this discussion) before you downgrade it:
SQL> ALTER DATABASE COMMIT TO SWITCHOVER TO LOGICAL STANDBY;
Database P is no longer in the primary database role.
- Wait for all standby databases in the configuration to finish applying all available redo. To determine whether each standby database has finished applying all available redo, run the following query at each standby database:
SQL> SELECT SWITCHOVER_STATUS FROM V$DATABASE; SWITCHOVER_STATUS ----------------- TO PRIMARY
Do not continue on to step 3 until the query returns a value of
TO PRIMARYfor all standby databases in the configuration.
- Downgrade the logical standby databases using the procedures described in Oracle Database Upgrade Guide, keeping the following in mind:
At each step of the downgrade procedure where a script is executed, execute the script only at the logical standby databases. Do not perform the next downgrade step until all redo generated by executing the script at the logical standby database that was most recently in the primary role (database P) has been applied to each physical standby database.
At each step of the downgrade procedure where an action other than running a script is performed, first perform the step at the logical standby database that was most recently in the primary role (database P), and then perform the step at each physical standby database. Do not perform the next downgrade step at the logical standby database that was most recently in the primary role (database P) until the action has been performed at each physical standby database.
- After the logical standby that was most recently in the primary role (database P) has been successfully downgraded, open it, and issue the following command:
SQL> ALTER DATABASE ACTIVATE LOGICAL STANDBY DATABASE;
Database P is now back in the primary role.
- At each of the logical standby databases in the configuration, issue the following command (note that the command requires that a database link back to the primary exist in all of the logical standby databases):
SQL> ALTER DATABASE START LOGICAL STANDBY APPLY IMMEDIATE NEW PRIMARY prim_db_link;