• 10g 11g配置Logical Standby


    1.创建一个物理Standby数据库

    详细见11g Physical Standby配置

    2.Standby数据库取消managed  recovery

    ALTER DATABASE RECOVER MANAGED STANDBY DATABASE CANCEL;

    3.主库配置

    1)主库修改LOG_ARCHIVE_DEST_2参数

    ALTER SYSTEM SET log_archive_dest_2 = 'SERVICE=PRODDG VALID_FOR=(ONLINE_LOGFILES,STANDBY_ROLE) DB_UNIQUE_NAME=PRODDG'  SCOPE=SPFILE;

    2)主库建立Logminer数据字典

    EXECUTE DBMS_LOGSTDBY.BUILD;

    4.备库设置

    1)切换到逻辑备库

    ALTER DATABASE RECOVER TO LOGICAL STANDBY PRODDG;

    2)重启实例,并且reset log

    SHUTDOWN IMMEDIATE
       STARTUP  mount
       ALTER DATABASE OPEN RESETLOGS;

    3)standby开启sql apply

    ALTER DATABASE START LOGICAL STANDBY APPLY;


    5.验证

    1)主库创建一个用户

    SQL> alter system switch logfile;
    
    System altered.
    
    SQL> create user hxy identified by hxy;
    
    User created.
    
    SQL> grant dba to hxy;
    
    Grant succeeded.
    
    SQL> alter system switch logfile;
    
    System altered.
    
    SQL> conn hxy/hxy
    Connected.
    SQL> select * from tab;
    
    no rows selected
    
    SQL> create table t1 as select * from dba_users;
    
    Table created.
    
    SQL> alter system switch logfile;
    
    System altered.
    
    SQL> select count(*) from t1;
    
      COUNT(*)
    ----------
            23

    2)备库查看alert日志

    Sun Apr 27 23:25:11 2014
    LOGMINER: Begin mining logfile for session 1 thread 1 sequence 123, /dsg/oracle11/PRODDG/arch/log1_123_839354331.arc
    LOGMINER: End   mining logfile for session 1 thread 1 sequence 123, /dsg/oracle11/PRODDG/arch/log1_123_839354331.arc
    Sun Apr 27 23:25:12 2014
    RFS[2]: Opened log for thread 1 sequence 124 dbid 251192667 branch 839354331
    Sun Apr 27 23:26:19 2014
    RFS LogMiner: Registered logfile [/dsg/oracle11/PRODDG/arch/log1_124_839354331.arc] to LogMiner session id [1]
    Sun Apr 27 23:26:19 2014
    LOGMINER: Begin mining logfile for session 1 thread 1 sequence 124, /dsg/oracle11/PRODDG/arch/log1_124_839354331.arc
    LOGMINER: End   mining logfile for session 1 thread 1 sequence 124, /dsg/oracle11/PRODDG/arch/log1_124_839354331.arc
    RFS[2]: Opened log for thread 1 sequence 125 dbid 251192667 branch 839354331

    数据库中验证

    SQL> conn hxy/hxy
    Connected.
    SQL> select * from tab;
    TNAME                          TABTYPE  CLUSTERID
    ------------------------------ ------- ----------
    T1                             TABLE
    SQL> select count(*) from t1;
      COUNT(*)
    ----------
            23

    可见,主库备库数据一致!

    6.总结

           配置Logical DataGuard最主要的还是配置好Physical DataGuard,并且主备库最好使用spfile启动数据库,方便切换成Logical Standby的时候修改参数

        如果数据库是RAC,配置请参考官方文档Data Guard Concepts and Administration 11g Release 2 (11.2)之 Creating a Logical Standby Database

  • 相关阅读:
    为蓝桥杯准备
    Java里子类调用父类构造方法问题
    boost库的Singleton的实现以及static成员的初始化问题
    VS2005调试小记
    <转载>程序员每天该做的事
    vs2005, 2008 使用了未初始化的msg变量
    转载 vs2005 快捷键大全
    VS2005右键点击转到定义后出现“未定义符号”的提示及其解决
    软件工程配置规范(VC2005) 第二版(转载)
    匆忙赶路的时候别忘了适时停下来回头看看
  • 原文地址:https://www.cnblogs.com/haoxiaoyu/p/3695483.html
Copyright © 2020-2023  润新知