官术网_书友最值得收藏!

Time for action – verifying synchronization between the primary and standby databases

By using the following steps, you can control whether the standby database is synchronized with primary:

  1. On the standby database, query the V$ARCHIVED_LOG view for the archived and applied sequences.

    For the last archived sequence, use the following:

    SQL> SELECT MAX(SEQUENCE#) FROM V$ARCHIVED_LOG;
    MAX(SEQUENCE#)
    --------------
     145
    

    For the last applied sequence, use the following:

    SQL> SELECT MAX(SEQUENCE#) FROM V$ARCHIVED_LOG WHERE APPLIED='YES';
    MAX(SEQUENCE#)
    --------------
     144
    

    From the preceding two queries, we see that the latest sequence, 145, is being archived or written into the standby redo logfiles. There's expected to be a lag of one sequence between archived and applied columns.

  2. Check the status of the latest log sequence.
    SQL> SELECT SEQUENCE#,APPLIED FROM V$ARCHIVED_LOG ORDER BY SEQUENCE#;
    
     SEQUENCE# APPLIED
    ---------- ---------
     140 YES
     141 YES
     142 YES
     143 YES
     144 YES
     145 IN-MEMORY
    

    The log sequence 145 is still being shipped.

  3. On the primary database query for the last archived logfile, perform a couple of log switches and then monitor if those archives are transported and applied.
    SQL> SELECT MAX(SEQUENCE#) FROM V$ARCHIVED_LOG;
    MAX(SEQUENCE#)
    --------------
     145
    

    Perform log switches several times and check.

    SQL> alter system switch logfile;
    System altered.
    
    SQL> SELECT MAX(SEQUENCE#) FROM V$ARCHIVED_LOG;
    MAX(SEQUENCE#)
    --------------
     148
    
  4. On the standby query for new archived logfiles and applied archived logfiles, query if the new archive log sequences are applied on standby.
    SQL> SELECT SEQUENCE#,APPLIED FROM V$ARCHIVED_LOG ORDER BY SEQUENCE#;
     SEQUENCE# APPLIED
    ---------- ---------
     143 YES
     144 YES
     145 YES
     146 YES
     147 YES
     148 YES
    

    The APPLIED column on standby will be very helpful to determine which sequence is generated and which sequences are applied. In the previous scenario, the archives generated on primary and archives applied on standby have the same sequence number; hence, standby is synchronized with the primary database.

    The value of the APPLIED column for the most recently received logfile will be IN-MEMORY, or YES if that logfile has been applied.

What just happened?

It's very important to know methods to verify synchronization between primary and standby databases. We've now seen one of these methods.

主站蜘蛛池模板: 南溪县| 新河县| 罗源县| 临高县| 佛山市| 永康市| 清水河县| 灵璧县| 中西区| 平南县| 汕头市| 井陉县| 长沙县| 突泉县| 哈尔滨市| 泾川县| 南召县| 丽江市| 峨眉山市| 孝义市| 建阳市| 仪陇县| 固安县| 饶河县| 延津县| 穆棱市| 沛县| 故城县| 灵川县| 洛阳市| 邢台市| 宁津县| 霍州市| 江达县| 新闻| 项城市| 桃园市| 肥西县| 莱西市| 淮北市| 龙井市|