判斷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/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 透過日誌判斷 Uno Platform 是否在 X11 使用 OpenGL 渲染加速的方法Platform
- DATAGUARD手記(PRIMARY+2STANDBY)(一)
- DATAGUARD手記(PRIMARY+2STANDBY)(二)
- 判斷字串是否為空字串
- python 判斷是否為中文Python
- 判斷字串是否唯一字串
- 判斷URL字串是否合法字串
- python判斷是否為listPython
- 判斷一個物件是否為空物件,判斷一個物件中是否有空值物件
- node.js 多個非同步過程判斷執行是否完成Node.js非同步
- JavaScript判斷字串是否為空JavaScript字串
- js判斷物件是否為空JS物件
- js判斷checkbox是否選中JS
- jQuery 判斷元素是否隱藏jQuery
- JavaScript 判斷是否是陣列JavaScript陣列
- 判斷網路是否連線
- JavaScript 判斷函式是否存在JavaScript函式
- golang判斷檔案是否存在Golang
- MySQL判斷表名是否存在MySql
- QJsonObject判斷欄位是否存在JSONObject
- java判斷物件是否為空Java物件
- Delphi Variant 判斷是否為空
- 判斷協議是否出網協議
- mysql如何判斷是否為空MySql
- postgresql如何判斷表是否存在SQL
- js判斷字串是否為空JS字串
- Activiti判斷流程是否結束
- python 判斷檔案是否存在Python
- java判斷字串是否為空Java字串
- golang中判斷兩個slice是否相等與判斷值下的 陣列是否相等Golang陣列
- nginx判斷路徑是否含有某個引數做判斷Nginx
- java 如何判斷一天是否為工作日?節假日?Java
- Laravel 5 判斷條件是否存在Laravel
- 如何判斷 JavaScript 物件是否為空?JavaScript物件
- C++判斷是否為閏年C++
- 判斷是否遵守某個協議協議
- 判斷objectStore物件倉庫是否存在Object物件
- jQuery 判斷使用者是否存在jQuery