The DBMS_DG
package allows applications to notify the primary database in an Oracle Data Guard broker environment to initiate a fast-start failover when the application encounters a condition that warrants a failover.
See Also:
Oracle Data Guard Broker for more information about performing a fast-start failover in a broker configurationThis chapter contains the following topics:
There are conditions detectable by applications running outside of the Oracle database that may warrant the Oracle Data Guard broker to perform a fast-start failover. Because the range of possible conditions is virtually unlimited, it is left to the applications to determine which conditions warrant a fast-start failover.
When such conditions occur, the application calls the DBMS_DG
.INITIATE_FS_FAILOVER
procedure to alert the primary database that the application wants a fast-start failover to occur immediately. The primary database then notifies the observer, which immediately initiates a fast-start failover as long as the standby database is in a valid fast-start failover state ("observed" and either "synchronized" or "within lag") to accept a failover.If the configuration is not in a valid fast-start failover state, the INITIATE_FS_FAILOVER
subprogram returns an ORA error message (it will not signal an exception) to inform the calling application that a fast-start failover could not be performed.
Table 58-1 DBMS_DG Package Subprogram
Subprogram | Description |
---|---|
Enables an application to notify the primary database that a fast-start failover is necessary when the application encounters conditions that warrant a failover. |
Use this procedure to specify a condition string that, when encountered by an application, allows the application to request the primary database to immediately invoke a fast-start failover.
Table 58-2 INITIATE_FS_FAILOVER Procedure Parameters
Parameter | Description |
---|---|
condstr |
Specifies the condition string for which a fast-start failover should be requested. If no condition string argument is supplied, the default string of "Application Failover Requested" will be logged in the broker log file and in the database alert log of the primary database. |
This procedure returns a binary integer.
Query the V$FS_FAILOVER_STATS
view to see the time of the last fast-start failover and the reason it was performed.
Table 58-3 INITIATE_FS_FAILOVER Procedure Errors
Error | Description |
---|---|
|
The request to initiate a fast-start failover has been posted to the observer. |
|
Either a broker configuration does not exist or fast-start failover has not been enabled. |
|
|
|
|
|
|
|
|
|
|
In this example, the program attempts to initiate a fast-start failover when fast-start failover is disabled. To use this example, connect as user SYS
with SYDDBA
privileges.
set serveroutput on declare status integer; begin status := dbms_dg.initiate_fs_failover(''Failover Requested''); dbms_output.put_line(''Fast-Start Failover is disabled: Expected status = ORA-16646''); dbms_output.put_line('' Actual Status = ORA-'' || status); end; / exit;