资讯

精准传达 • 有效沟通

从品牌网站建设到网络营销策划,从策略到执行的一站式服务

oracle11gR2搭建dataguard


1、搭建环境

钢城网站制作公司哪家好,找创新互联公司!从网页设计、网站建设、微信开发、APP开发、成都响应式网站建设公司等网站项目制作,到程序开发,运营维护。创新互联公司于2013年成立到现在10年的时间,我们拥有了丰富的建站经验和运维经验,来保证我们的工作的顺利进行。专注于网站建设就选创新互联公司

 主库   oracle11gR2    备库 oracle11gR2

 db_name orcl            orcl

 db_unique_name orcl       standby239

 配置host文件

 主库:primaryHost     备库:standbyHost

 

 准备库都置于归档模式。

2、配置静态监听

 主备库都配置

 listener.ora

    SID_LIST_LISTENER =    

       (SID_LIST =    

            (SID_DESC =    

              (SID_NAME = CLRExtProc)    

              (ORACLE_HOME = /data/oracle/product/11.2.0/dbhome_1)    

              (PROGRAM = extproc)    

            )    

            (SID_DESC =    

              (GLOBAL_DBNAME = orcl)    

              (ORACLE_HOME = /data/oracle/product/11.2.0/dbhome_1)    

              (SID_NAME = orcl)       

            )       

        ) 

    SID_LIST_LISTENER =    

       (SID_LIST =    

            (SID_DESC =    

              (SID_NAME = CLRExtProc)    

              (ORACLE_HOME = /data/oracle/product/11.2.0/dbhome_1)    

              (PROGRAM = extproc)    

            )    

            (SID_DESC =    

              (GLOBAL_DBNAME = standby239)    

              (ORACLE_HOME = /data/oracle/product/11.2.0/dbhome_1)    

              (SID_NAME = orcl)       

            )       

        )

  配置tnsnames.ora

  主备库配置

    standby239 =    

      (DESCRIPTION =    

        (ADDRESS = (PROTOCOL = TCP)(HOST = standbyHost)(PORT = 1521))    

        (CONNECT_DATA =    

          (UR = A)    

          (SERVER = DEDICATED)    

          (SERVICE_NAME = standby239)    

        )    

      )    

    

    ORCL =    

      (DESCRIPTION =    

        (ADDRESS = (PROTOCOL = TCP)(HOST = primaryHost)(PORT = 1521))    

        (CONNECT_DATA =    

          (UR = A)    

          (SERVER = DEDICATED)    

          (SERVICE_NAME = orcl)    

        )    

      )  

3、主备库生成密码文件

   使用orapwd

    orapwd file=$ORACLE_HOME/dbs/orapworcl password=xxxxx ignorecase=Y  

4、生成standbylog

     alter database add standby logfile ('/data/oracle/flash_recovery_area/orcl/standby/standby07.log') size 50m;    

     alter database add standby logfile ('/data/oracle/flash_recovery_area/orcl/standby/standby05.log') size 50m;    

     alter database add standby logfile ('/data/oracle/flash_recovery_area/orcl/standby/standby04.log') size 50m;    

     alter database add standby logfile ('/data/oracle/flash_recovery_area/orcl/standby/standby06.log') size 50m;

5、修改dg参数

  主库

   alter system set db_unique_name=orcl scope=spfile;

   alter system set log_archive_config='dg_config=(orcl,standby239)' scope=both;

   alter system set log_archive_dest_1='location=/data/oracle/flash_recovery_area/ORCL valid_for=(all_logfiles,all_roles) db_unique_name=orcl' scope=both;  

   alter system set log_archive_dest_2='service=standby239 async lgwr valid_for=(online_logfiles,primary_role) db_unique_name=standby239' scope=both;  

   alter system set log_archive_dest_state_1=enable scope=both;

   alter system set log_archive_dest_state_2=enable scope=both; 

   alter system set fal_server=standby239 scope=both;

   alter system set fal_client=orcl scope=both;

   alter system set standby_file_management=AUTO;

  备库 

   alter system set db_unique_name=standby239 scope=spfile;

   alter system set log_archive_config='dg_config=(orcl,standby239)' scope=both;

   alter system set log_archive_dest_1='location=/data/oracle/flash_recovery_area/ORCL valid_for=(all_logfiles,all_roles) db_unique_name=standby239' scope=both;  

   alter system set log_archive_dest_2='service=orcl async lgwr valid_for=(online_logfiles,primary_role) db_unique_name=orcl' scope=both;  

   alter system set log_archive_dest_state_1=enable scope=both;

   alter system set log_archive_dest_state_2=enable scope=both; 

   alter system set fal_server=orcl scope=both;

   alter system set fal_client=standby239 scope=both;

   alter system set standby_file_management=AUTO;

6、使用rman duplicate主库到备库

   将备库置于未装载状态

  rman target sys/xxxx auxiliary sys/xxxx@standby239

  duplicate target database for standby nofilenamecheck from active database;

  

  如果需要重命名的话,使用set newname for

7、将备库置于active dataguard模式

  alter database mount standby database;

  alter database open read only;

  alter database recover managed standby database disconnect from session;

  或者 alter database recover managed standby database using current logfile disconnect from session;(实时应用日志模式)

这样就可以实验主库和备库的状态了。


分享文章:oracle11gR2搭建dataguard
网页地址:http://cdkjz.cn/article/gehjic.html
多年建站经验

多一份参考,总有益处

联系快上网,免费获得专属《策划方案》及报价

咨询相关问题或预约面谈,可以通过以下方式与我们联系

业务热线:400-028-6601 / 大客户专线   成都:13518219792   座机:028-86922220