判斷standby日誌是否同步primary
Verify standby STB_DB is in synch with Primary PROD_DB
Confirm physical standby database
STB_DB
is in sync with the primary database
PROD_DB
1. Connect to primary database
PROD_DB
and note the current log sequence.
SQL>
select max(SEQUENCE#) from v$log;
2. Connect to standby database
STB_DB
server and confirm that:
- The RFS process is currently receiving the same sequence#
- The MRP0 (managed recovery) process is also processing the same sequence#
SQL>
set lines 200 pages 40
SQL> s
elect process, status, client_process, sequence#, block# from v$managed_standby where process = 'MRP0' or client_process = 'LGWR';
以上驗證方式只表示收到了 log, 但不表示已經 apply 了 .
下面的 SQL statement 驗證是否已經 applied, 以及是否同步 .
啟動 RMP
ALTER DATABASE RECOVER MANAGED STANDBY DATABASE DISCONNECT ;
select process,status,thread#,sequence#,blocks from v$managed_standby where process like '%MRP%';
用以下查詢 check 是否還有 gap. SQL> SELECT ARCH.THREAD# "Thread", ARCH.SEQUENCE# "Last Sequence Received", APPL.SEQUENCE# "Last Sequence Applied", (ARCH.SEQUENCE# - APPL.SEQUENCE#) "Difference" FROM(SELECT THREAD# ,SEQUENCE# FROM V$ARCHIVED_LOG WHERE (THREAD#,FIRST_TIME ) IN (SELECT THREAD#,MAX(FIRST_TIME) FROM V$ARCHIVED_LOG GROUP BY THREAD#)) ARCH,(SELECT THREAD# ,SEQUENCE# FROM V$LOG_HISTORY WHERE (THREAD#,FIRST_TIME ) IN (SELECT THREAD#,MAX(FIRST_TIME) FROM V$LOG_HISTORY GROUP BY THREAD#)) APPL WHERE ARCH.THREAD# = APPL.THREAD# ; 現在沒有 gap 了 .
|
上面的查詢可以分解成以下幾個 :
SELECT ARCH.THREAD# "Thread", ARCH.SEQUENCE# "Last Sequence Received", APPL.SEQUENCE# "Last Sequence Applied", (ARCH.SEQUENCE# - APPL.SEQUENCE#) "Difference" FROM
SELECT THREAD# ,SEQUENCE# FROM V$ARCHIVED_LOG WHERE (THREAD#,FIRST_TIME ) IN (SELECT THREAD#,MAX(FIRST_TIME) FROM V$ARCHIVED_LOG GROUP BY THREAD#)) ARCH
SELECT THREAD# ,SEQUENCE# FROM V$LOG_HISTORY WHERE (THREAD#,FIRST_TIME ) IN (SELECT THREAD#,MAX(FIRST_TIME) FROM V$LOG_HISTORY GROUP BY THREAD#)) APPL
WHERE ARCH.THREAD# = APPL.THREAD# ;
從 V$LOG_HISTORY 裡查詢到的最大的 sequence 怎麼就是 applied 的最大 sequence? 是不是因為它顯示的是控制檔案的 log history? 如果 applied 了 , 才可能更新了控制檔案 ?
v$log_history displays log history information from the control file.
v$archived_log displays archived log information from the control file, including archive log names.
或者用下面的查詢 ?
Primary:
SQL> select max(sequence#) from v$archived_log;
MAX(SEQUENCE#)
--------------
70
Standby:
SQL> select max(sequence#) from v$archived_log where applied='YES';
MAX(SEQUENCE#)
--------------
70
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/14377/viewspace-2375059/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 同步快速判斷視訊是否可以播放
- standby缺失primary歸檔,手工同步恢復
- 透過日誌判斷 Uno Platform 是否在 X11 使用 OpenGL 渲染加速的方法Platform
- data guard 歸檔日誌管理 (primary)
- 判斷字串是否為空字串
- 判斷URL字串是否合法字串
- 41:判斷元素是否存在
- 判斷oracle是否啟動Oracle
- Javascript 判斷物件是否相等JavaScript物件
- 判斷SD卡是否可用SD卡
- 判斷字串是否唯一字串
- 【java web】--Ajax非同步判斷使用者名稱是否存在JavaWeb非同步
- standby database to primary database.Database
- 判斷一個物件是否為空物件,判斷一個物件中是否有空值物件
- node.js 多個非同步過程判斷執行是否完成Node.js非同步
- 判斷網路是否連線
- JavaScript 判斷是否是陣列JavaScript陣列
- JavaScript 判斷函式是否存在JavaScript函式
- python判斷是否為listPython
- js判斷字串是否為空JS字串
- mysql如何判斷是否為空MySql
- postgresql如何判斷表是否存在SQL
- python 判斷是否為中文Python
- golang判斷檔案是否存在Golang
- JavaScript判斷字串是否為空JavaScript字串
- java判斷字串是否為空Java字串
- jQuery 判斷元素是否隱藏jQuery
- Activiti判斷流程是否結束
- C 判斷字串是否是子集字串
- js判斷物件是否為空JS物件
- 判斷是否為迴文字元字元
- vc判斷檔案是否存在
- 判斷物件值是否為空物件
- jQuery如何判斷元素是否存在jQuery
- C#判斷字串是否合法C#字串
- iOS判斷是否存在網路iOS
- PHP 判斷是否包含某字串PHP字串
- 判斷是否是iPhone5iPhone