oracledataguard
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
oracledataguard [2015/07/08 14:57] – created 131.111.27.50 | oracledataguard [2025/03/08 22:24] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 4: | Line 4: | ||
< | < | ||
ALTER DATABASE RECOVER MANAGED STANDBY DATABASE USING CURRENT LOGFILE DISCONNECT FROM SESSION; | ALTER DATABASE RECOVER MANAGED STANDBY DATABASE USING CURRENT LOGFILE DISCONNECT FROM SESSION; | ||
+ | ALTER DATABASE RECOVER MANAGED STANDBY DATABASE DELAY 240 DISCONNECT FROM SESSION; | ||
ALTER DATABASE RECOVER MANAGED STANDBY DATABASE CANCEL;</ | ALTER DATABASE RECOVER MANAGED STANDBY DATABASE CANCEL;</ | ||
Line 24: | Line 25: | ||
< | < | ||
- | Transport and Apply Lag should now always be 0 seconds. | + | Transport and Apply Lag should now always be 0 seconds. |
+ | |||
+ | ==== SQL Scripts ==== | ||
+ | Primary | ||
+ | < | ||
+ | set linesize 170 | ||
+ | col destination format a90 | ||
+ | col error format a20 | ||
+ | SELECT DESTINATION, | ||
+ | |||
+ | -- Check Standby Errors for log_archive_dest_n | ||
+ | set linesize 170 | ||
+ | col destination format a90 | ||
+ | col error format a20 | ||
+ | SELECT DEST_ID, DESTINATION, | ||
+ | |||
+ | Primary/ | ||
+ | < | ||
+ | SELECT THREAD# THREAD, MAX(SEQUENCE# | ||
+ | WHERE ARCHIVED = ' | ||
+ | AND RESETLOGS_CHANGE# | ||
+ | GROUP BY THREAD# | ||
+ | ORDER BY THREAD#;</ | ||
+ | |||
+ | Standby | ||
+ | < | ||
+ | col name format a16 | ||
+ | col value format a16 | ||
+ | col time_computed format a30 | ||
+ | SELECT name, value, time_computed FROM V$DATAGUARD_STATS WHERE name like ' | ||
+ | |||
+ | -- Media Recovery Information | ||
+ | alter session set nls_date_format = ' | ||
+ | set linesize 160 | ||
+ | col timestamp format a20 | ||
+ | col facility format a24 | ||
+ | col severity format a13 | ||
+ | col message format a100 trunc | ||
+ | select timestamp, facility, severity, message | ||
+ | from v$dataguard_status | ||
+ | order by timestamp; | ||
+ | |||
+ | -- Check if Real Time Apply is Enabled | ||
+ | col DEST_NAME format a25 | ||
+ | select DEST_ID, | ||
+ | from v$archive_dest_status | ||
+ | where status <> ' | ||
+ | |||
+ | ==== Switchover ==== | ||
+ | If the database you are using RAC and the database version is 11gR2 or less then you need to shut down all database instances apart from the first one before doing a switchover.\\ | ||
+ | This is not neccessary any more in 12c. | ||
+ | |||
+ | The example below assumes a 2 Node RAC system using 10gR2.\\ | ||
+ | Primary Database: DBPRIM\\ | ||
+ | Standby Database: DBSTBY\\ | ||
+ | |||
+ | < | ||
+ | STANDBY: alter system set log_archive_trace=8191; | ||
+ | |||
+ | PRIMARY: srvctl modify database -d DBPRIM -s mount | ||
+ | STANDBY: srvctl modify database -d DBSTBY -s open | ||
+ | |||
+ | PRIMARY: select switchover_status from v$database; (Value should say TO_STANDBY or SESSIONS_ACTIVE) | ||
+ | PRIMARY: srvctl stop instance -d DBPRIM -i DBPRIM2 | ||
+ | PRIMARY: alter system archive log current; | ||
+ | |||
+ | STANDBY: srvctl stop instance -d DBSTBY -i DBSTBY2 | ||
+ | |||
+ | PRIMARY: alter database commit to switchover to physical standby with session shutdown; | ||
+ | |||
+ | STANDBY: select switchover_status from v$database; (Value should say TO_PRIMARY or SESSIONS_ACTIVE) | ||
+ | STANDBY: alter database commit to switchover to primary; | ||
+ | STANDBY: alter database open; | ||
+ | STANDBY: srvctl start instance -d DBSTBY -i DBSTBY2 | ||
+ | |||
+ | PRIMARY: shutdown immediate; | ||
+ | PRIMARY: srvctl start database -d DBPRIM | ||
+ | PRIMARY: alter database recover managed standby database using current logfile disconnect; | ||
+ | |||
+ | STANDBY: srvctl modify database -d DBSTBY -r primary | ||
+ | PRIMARY: srvctl modify database -d DBPRIM -r physical_standby | ||
+ | |||
+ | PRIMARY: alter system set log_archive_trace=0; | ||
+ | STANDBY: alter system set log_archive_trace=0;</ | ||
+ | |||
+ | ==== Failover ==== | ||
+ | https:// | ||
+ | < | ||
+ | SELECT STATUS, INSTANCE_NAME, | ||
+ | |||
+ | ALTER DATABASE RECOVER MANAGED DATABASE CANCEL; | ||
+ | ALTER DATABASE RECOVER MANAGED DATABASE FINISH; | ||
+ | |||
+ | ALTER DATABASE COMMIT TO SWITCHOVER TO PRIMARY WITH SESSION SHUTDOWN; | ||
+ | ALTER DATABASE ACTIVATE STANDBY DATABASE; | ||
+ | ALTER DATABASE OPEN; | ||
+ | |||
+ | SELECT STATUS, INSTANCE_NAME, | ||
+ | </ | ||
+ | |||
==== Active Data Guard ==== | ==== Active Data Guard ==== |
oracledataguard.1436367423.txt.gz · Last modified: 2025/03/08 22:23 (external edit)