show parameter DG_BROKER_CONFIG_FILE1;
show parameter DG_BROKER_START;
select dbid,name,db_unique_name,log_mode,open_mode,database_role,activation#,switchover#,protection_mode,protection_level,checkpoint_change#,archive_change#
from v$database;
select status,DEST_ID,TYPE,ERROR,GAP_STATUS,SYNCHRONIZED,SYNCHRONIZATION_STATUS,RECOVERY_MODE from V$ARCHIVE_DEST_STATUS where STatus <> ‘INACTIVE’;
Standby:
SELECT name, value, datum_time, time_computed FROM V$DATAGUARD_STATS;
Dev:
dgmgrl sys/Ora***** as sysdba
DGMGRL> show configuration;
Prod:
dgmgrl sys/Ora*****@dbnamep_2288 as sysdba
dgmgrl sys/Ora******@dbnamep_2289 as sysdba
DGMGRL> FAILOVER TO dbnamep_2289;
Specify the optional IMMEDIATE clause to perform an immediate failover if any of the following conditions are true:
• An ORA-752 error has occurred at the standby database
• An ORA-600 [3020] error has occurred at the standby database and Oracle support has determined that it was caused by a lost write at the primary database
• A complete failover is not possible
DGMGRL> FAILOVER TO database-name IMMEDIATE;
手动操作
If the primary database can be mounted, it may be possible to flush any unsent redo data from the primary database to the target standby database using the ALTER SYSTEM FLUSH REDO;
SQL> ALTER SYSTEM FLUSH REDO TO target_db_name;
SQL> SELECT THREAD#, LOW_SEQUENCE#, HIGH_SEQUENCE# FROM V$ARCHIVE_GAP;
THREAD# LOW_SEQUENCE# HIGH_SEQUENCE#
1 90 92
SQL> ALTER DATABASE REGISTER PHYSICAL LOGFILE ‘filespec1’;
Failover:
SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE CANCEL;
SQL> ALTER DATABASE FAILOVER TO target_db_name;
SQL> ALTER DATABASE OPEN;
If Redo Apply has stopped at any of the other physical standby databases in your Data Guard configuration, then restart it
SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE DISCONNECT;
–error
error occurs, use the FORCE option
SQL> ALTER DATABASE FAILVOVER TO xxxxxx FORCE;
If the FORCE option is unsuccessful, Perform a data loss failover.
SQL> ALTER DATABASE ACTIVATE PHYSICAL STANDBY DATABASE;
SQL> ALTER DATABASE OPEN;