FAILOVER
The FAILOVER
function can be used to perform a database
failover.
FAILOVER
Function
DBMS_DG.FAILOVER (
db_name IN VARCHAR2,
failover_type, IN VARCHAR2,
severity OUT BINARY_INTEGER)
RETURN BINARY_INTEGER;
Parameters
Parameter | Description |
---|---|
db_name |
The DB_UNIQUE_NAME initialization
parameter value of the standby database to be fail over to.
|
failover_type |
The type of failover to perform. Accepted keywords
are:
|
severity |
The severity associated with the status returned by
this function. Severity will be one of the following Oracle error
numbers:
|
Usage Notes
-
This function returns a binary integer.
- Always try to perform a complete failover first unless Redo Apply
has stopped at the failover target due to an
ORA-752
orORA-600 [3020]
error. If one of these errors has occurred, then before proceeding follow the guidelines in "ResolvingORA-752
orORA-600 [3020]
During Standby Recovery" in My Oracle Support Note 1265884.1 at http://support.oracle.com. An immediate failover should only be performed when a complete failover is unsuccessful or in the error case just noted. - The specified standby database must be enabled before the primary database fails. However, an enabled standby database that was shut down can be a candidate for the failover operation. In this case, restart the standby database, then retry this call.
- Before you call this function, verify that you are connected to the
standby database that will become the new primary database. If necessary, issue
a
CONNECT
command to connect to the standby database to which you want to failover. - If the broker configuration is operating in maximum protection mode,
a manual failover operation will force the protection mode to be maximum
performance. The redo transport service settings are unaffected. You need to
restore the desired protection mode for the resulting configuration after the
failover operation.
Note:
With fast-start failover, the broker preserves the protection mode that was in effect prior to the failover. - If this function is called with the failover_type keyword of
IMMEDIATE
, no attempt is made to apply any unapplied redo that has been received. This option more likely results in lost application data even when standby redo log files are configured on the standby database. Additionally, any remaining standby databases in the configuration cannot function as such until they are reinstated or re-created. See Reenabling Disabled Databases After a Role Change for more information.Once you have enabled fast-start failover, you must comply with the restrictions described in Restrictions When Fast-Start Failover is Enabled. - You can perform a manual failover or set up the broker to perform a fast-start
failover. See the
ENABLE FAST_START FAILOVER
command for information about allowing the broker to automatically invoke failover, when conditions warrant a failover. - If fast-start failover is enabled, you can perform a complete manual failover
only to the fast-start failover target standby database and only if the
fast-start failover target standby database is synchronized with, or within the
lag limit of, the primary database, and only when the observer is started. You
cannot perform an immediate manual failover when fast-start failover is enabled.
If Flashback Database was enabled on the former (failed) primary database prior
to the failover, the former primary database can be reinstated using the
broker's
REINSTATE
command. If failover was performed to a physical standby database, any other physical standby databases that were disabled by the failover can be reinstated if Flashback Database was enabled on the standby database and there are sufficient flashback logs available. - The original primary database can only participate in the configuration as a standby database after it is reinstated or re-created. Caution: You should shut down the original primary database if it still has any active instances running prior to failing over.
Error | Description |
---|---|
ORA-00000: normal, successful
completion |
The failover completed successfully. |
Other |
The Data Guard broker was unable to complete the failover operation and the return value will indicate the reason for this failure. |