Oracle Data Guard Commands

Important SQL commands for Data Guard:

–Mount a standby database:
SQL>alter database mount standby database;

–Perform recovery on standby:
SQL>ALTER DATABASE RECOVER MANAGED STANDBY DATABASE DISCONNECT FROM SESSION;


–Check whether Managed Recovery Process (MRP) is running on the standby and delay for the target standby :
SQL> SELECT PROCESS, CLIENT_PROCESS, SEQUENCE#, STATUS,DELAY_MINS FROM V$MANAGED_STANDBY;


–To remove a delay from a standby
SQL>alter database recover managed standby database cancel;
SQL>alter database recover managed standby database nodelay disconnect;


–Cancel managed recovery
SQL>alter database recover managed standby database cancel;


–Register a missing log file
SQL>alter database register physical logfile ‘‘;


–Turn on FAL tracing on the primary db
SQL>alter system set LOG_ARCHIVE_TRACE = 128;


–To check whether archive logs are getting applied on standby or not, using following commands on both sites:
SQL> select SEQUENCE#, ARCHIVED, APPLIED, FIRST_TIME, NEXT_TIME from V$ARCHIVED_LOG order by SEQUENCE#;


— Get current sequence numbers on standby:
SQL>select thread#, max(sequence#) from v$archived_log a, v$database b where a.resetlogs_change#=b.resetlogs_change# group by thread#;


–Get switch over status of primary and standby:
SQL> SELECT SWITCHOVER_STATUS FROM V$DATABASE;

–To check whether standby is open mode or not:
SQL> SELECT VALUE FROM V$DATAGUARD_STATS WHERE NAME=’standby has been open’;

You can skip to the end and leave a response. Pinging is currently not allowed.

Leave a Reply