【DATAGUARD 學習】測試standby應用REDO

楊奇龍發表於2010-09-21


環境:資料庫版本11g!主庫 ORCL,備庫 TESTDG

-- 檢視主庫的最大歸檔序列號
ORCL>select max(sequence#) from v$archived_log;
MAX(SEQUENCE#)                                                                 
--------------                                                                 
            32                                                                 
ORCL>ALTER SYSTEM SWITCH LOGFILE;
系統已更改。
ORCL>select max(sequence#) from v$archived_log;
MAX(SEQUENCE#)                                                                 
--------------                                                                 
            33 
--檢視備庫是否接收redo
TESTDG>select sequence# from v$archived_log;
 SEQUENCE#                                                                     
----------                                                                     
        33                                                                     
        31                                                                     
        32    
                                                               
ORCL>ALTER SYSTEM SWITCH LOGFILE;
系統已更改。
ORCL>select max(sequence#) from v$archived_log;
MAX(SEQUENCE#)                    
--------------                                                                 
            34
--檢視備庫是否接收redo
TESTDG>select sequence# from v$archived_log;
 SEQUENCE# 
----------
        33 
        31        
        32      
        34 --接收了序列號為34的redo
ORCL>---主庫與備庫的同步測試
ORCL>create table dataguard  as select object_id,object_name from dba_objects
  2  where rownum <11;
表已建立。
ORCL>col object_name for a40
ORCL>select * from dataguard;
 OBJECT_ID OBJECT_NAME                                                         
---------- -------------------------------                         
        20 ICOL$              
        46 I_USER1   
        28 CON$  
        15 UNDO$ 
        29 C_COBJ# 
         3 I_OBJ#     
        25 PROXY_ROLE_DATA$  
        41 I_IND1                                    
        54 I_CDEF2
        40 I_OBJ5  
       
已選擇10行。

--standby庫上檢視
TESTDG>conn yang/yang
已連線。
TESTDG>col object_name for a40
TESTDG>select * from dataguard;
select * from dataguard
              *
第 1 行出現錯誤:
ORA-00942: 表或檢視不存在 ---  主機未切換日誌,備庫還未應用重做日誌
--主庫切換日誌
ORCL>alter system switch logfile;
系統已更改。
ORCL>select max(sequence#) from v$archived_log;
MAX(SEQUENCE#)                                                                 
--------------
       35    
TESTDG>select sequence# from v$archived_log;
 SEQUENCE#                                                                     
----------                       
        33    
        31                                                                     
        32      
        34           
        35  ---已經接收並應用了序列號為35的redo     

TESTDG>select * from dataguard;--結果正確。
 OBJECT_ID OBJECT_NAME                                                         
---------- ----------------------------------------                            
        20 ICOL$                                                               
        46 I_USER1                                                             
        28 CON$                                                                
        15 UNDO$                                                               
        29 C_COBJ#                                                             
         3 I_OBJ#                                                              
        25 PROXY_ROLE_DATA$                                                    
        41 I_IND1                                                              
        54 I_CDEF2                                                             
        40 I_OBJ5                                                              
                                                                
已選擇10行。
                        

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/22664653/viewspace-674632/,如需轉載,請註明出處,否則將追究法律責任。

相關文章