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

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.

主站蜘蛛池模板: 屏南县| 丰城市| 毕节市| 应城市| 白河县| 朔州市| 景谷| 邵武市| 大余县| 武安市| 榕江县| 翁牛特旗| 特克斯县| 当涂县| 确山县| 封丘县| 黄梅县| 仪征市| 土默特左旗| 巴里| 泗水县| 上栗县| 刚察县| 麻栗坡县| 萨嘎县| 德钦县| 苍山县| 高要市| 河北区| 鹰潭市| 丰原市| 胶南市| 西贡区| 白水县| 房山区| 盐源县| 安远县| 涿鹿县| 巴中市| 化州市| 武穴市|