【DATAGUARD 学习】测试standby应用REDO


环境:数据库版本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 表已创建。
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行。
                        

上一篇:动态应用加固(DAR)技术破局登录信息泄露难题


下一篇:《机器人爱好者(第2辑)》——机器人乐队会招待你