oracle11gr2 active data guard,oracle 11gR2 搭建dataguard

本文详细介绍了如何配置Oracle 11g R2主备库,包括环境搭建、静态监听配置、密码文件生成、备用日志设置、数据库参数调整以及使用RMAN进行数据库复制。通过这些步骤,实现了主备库之间的实时数据同步,确保了数据的安全性和高可用性。
摘要由CSDN通过智能技术生成

1、搭建环境

主库   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;(实时应用日志模式)

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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值