5 Managing the Data Guard Environment
5.2 Database Role Transitions
Table 5–1 describes four methods for changing database roles.
Table 5–1 Database Role Transitions
Method Description
Database Switchover You can switch a database role from primary to standby, as well as from standby to primary, without resetting the online redo logs of the new primary database. No data is lost even when standby redo logs are not configured. No reinstantiation of the primary and standby databases is necessary.
Database Switchback This is a database switchover, performed in reverse, that results in the original primary database resuming the primary role.
Graceful Database Failover Database failover changes one of the standby databases into the role of primary database.
A graceful failover will automatically recover some or all of the original primary database application data and therefore avoid reinstantiating other standby databases. If so, this is a graceful failover and it will be necessary to reinstantiate only the original primary database as a standby database.
Database Role Transitions
Role transition requires all instances whose roles have changed to be shut down and restarted before the new role become effective.
Figure 5–1 is a road map of the operations that are discussed in the following sections of this chapter.
Figure 5–1 Standby Database Road Map
This section contains the following topics: ■ Database Switchover
■ Database Switchback
Forced Database Failover Database failover changes one of the standby databases into the role of primary database.
A forced failover may result in lost application data even when standby redo logs are configured on the standby database. You will need to reinstantiate the original primary database and all other standby databases. Table 5–1 (Cont.) Database Role Transitions
Method Description Primary Noresetlogs Database Managed Recovery Mode Read-Only Mode Primary Instance Mounted Standby Instance Mounted Primary Resetlogs Database Graceful Failover (finish) Managed Recovery Switchover to Primary Database Switchover to Standby Database Primary Database Switchover to Primary Database Cancel Managed Recovery Forced Failover (activate) Open Read-Only Standby Database
Database Role Transitions
■ Graceful Database Failover ■ Forced Database Failover
5.2.1 Database Switchover
You can switch a database role from primary to standby, as well as from standby to primary, without resetting the online redo logs of the new primary database. This is known as a database switchover operation, instead of a failover operation, because there is no loss of application data, and there is no need to reinstantiate the standby databases, including the other standby databases not involved in the switchover operation.
On the primary database, the SQL ALTER DATABASE COMMIT TO SWITCHOVER TO STANDBY statement is used to prepare the current primary database for
switchover to the standby role. On one of the standby databases, the SQL ALTER
DATABASE COMMIT TO SWITCHOVER TO PRIMARY statement is used to prepare
the standby database for switchover to the primary role.
5.2.2 Database Switchback
This is a database switchover, performed in reverse, which results in the original primary database becoming a new primary database. There is no actual database switchback operation. Use the switchover procedure instead.
5.2.3 Graceful Database Failover
Database failover changes one of the standby databases into the role of primary database. You should perform a standby database failover only in the event of a software or system failure that results in the loss of the primary database.
One of the consequences of a graceful database failover is that the original primary database must be reinstantiated. However, the other standby databases in the configuration do not need to be reinstantiated.
Depending on the log transport services attributes, it may be possible to
automatically recover some or all of the primary database modifications. The SQL
ALTER DATABASE RECOVER MANAGED STANDBY DATABASE FINISH statement
is used to finalize the recovery of the archived logs on the standby database.
To issue the SQL ALTER DATABASE RECOVER MANAGED STANDBY DATABASE
FINISH statement, you must set compatibility to 9.0.1.0.0 in the initialization parameter file. Furthermore, when you apply the standby redo logs, compatibility
Switching Over Your Database
must remain at 9.0.1.0.0 from this point forward. Add the following line to the initialization parameter file:
compatible=9.0.1.0.0
If the SQL ALTER DATABASE RECOVER MANAGED STANDBY DATABASE FINISH
statement is canceled before the standby redo logs have been applied, you can return to an 8.0 or 8.1 release.
5.2.4 Forced Database Failover
Database failover changes one of the standby databases into the role of primary database. You should perform a standby database failover only in the event of a software or system failure that results in the loss of the primary database.
One of the consequences of a forced database failover is that the original primary database and all other standby databases must be reinstantiated. Another
consequence is that there may be lost application data unless the standby and primary databases have been configured to run in guaranteed protection mode. The SQL ALTER DATABASE ACTIVATE STANDBY DATABASE statement changes the state of a standby database to an active database and prepares it to become the primary database.