ITPub博客

首页 > Linux操作系统 > Linux操作系统 > 搭建rac+DataGuard的测试环境

搭建rac+DataGuard的测试环境

原创 Linux操作系统 作者:suifeng2316 时间:2013-07-05 16:24:52 0 删除 编辑
搭建rac+DataGuard的测试环境
--1.配置网络
主备库的监听,修改tnsnames.ora 和 listener.ora  文件
--主备库的tnsnames.ora 文件是一致的。 修改成如下:
racdb2=
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = rac2-vip)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = racdb)
      (INSTANCE_NAME = racdb2)
    )
  ) 
racdb1=
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = rac1-vip)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = racdb)
      (INSTANCE_NAME = racdb1)
    )
  ) 
orcl_st =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST =192.168.13.4)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SID = dgrac)
    )
  )
--备库配置监听
SID_LIST_LISTENER_RAC2 =
  (SID_LIST =
    (SID_DESC =
      (SID_NAME = PLSExtProc)
      (ORACLE_HOME = /u01/app/oracle/product/10.2.0/db_1)
      (PROGRAM = extproc)
    )
   (SID_DESC =
      (SID_NAME = orcl)
      (ORACLE_HOME = /u01/app/oracle/product/10.2.0/db_1)
    )
  ) 
LISTENER =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.13.4)(PORT = 1521))
  )
--拷贝密码文件到备库或者使用orapwd生成密码文件,一定要保持主备密码一致
缺省情况下,win下口令文件的格式是pwdsid.ora,unix下的格式是orapwSID(大小写敏感)
--生成standby控制文件
alter database create standby controlfile as '/oracle/backup/control01.ctl';
--修改主库参数文件
create pfile='/oracle/backup/pfile.txt' from spfile;
*.log_archive_config='dg_config=(racdb,dgrac)'
*.log_archive_dest_3='service=orcl_st VALID_FOR=(ALL_LOGFILES,ALL_ROLES) db_unique_name=dgrac'
*.db_file_name_convert='/home/oracle/oradata','+ASM_DISK/RACDB/DATAFILE','/home/oracle/tempfile','+ASM_DISK/RACDB/tempfile'
*.log_file_name_convert='/home/oracle/oradata', '+ASM_DISK/RACDB/DATAFILE'
*.standby_file_management=auto
*.fal_server='orcl_st'
orcl1.fal_client='racdb1'
orcl2.fal_client='racdb2'
对应命令如下:
alter system set log_archive_config='dg_config=(racdb,dgrac)' scope=both sid='*';      
alter system set log_archive_dest_3='service=orcl_st lgwr async valid_for=(online_logfiles,primary_role) db_unique_name=dgrac' scope=both sid='*';
alter system set db_file_name_convert='/home/oracle/oradata','+ASM_DISK/RACDB/DATAFILE','/home/oracle/tempfile','+ASM_DISK/RACDB/tempfile' scope=spfile sid='*';
alter system set log_file_name_convert='/home/oracle/oradata', '+ASM_DISK/RACDB/DATAFILE' scope=spfile sid='*';
alter system set standby_file_management=auto scope=both sid='*';
alter system set fal_server='orcl_st' scope=both sid='*';
alter system set fal_client='racdb1' scope=both sid='racdb1';
alter system set fal_client='racdb2' scope=both sid='racdb2';
--备库的参数文件
*.db_unique_name=dgrac  
-- 注意,这个值要和主库参log_archive_dest_n里设置的一致,不然会报错误:
ORA-16047: DGID mismatch between destination
*.log_archive_config='dg_config=(racdb,dgrac)'
*.log_archive_dest_2='service=racdb1 valid_for=(online_logfiles,primary_role) db_unique_name=racdb'
*.db_file_name_convert='+ASM_DISK/RACDB/DATAFILE','/home/oracle/oradata/','+ASM_DISK/RACDB/tempfile','/home/oracle/tempfile'
*.log_file_name_convert='+ASM_DISK/RACDB/onlinelog','/home/oracle/oradata'
*.standby_file_management=auto
*.fal_server='racdb1','racdb2'
*.fal_client='orcl_st'
--将主库备份的目录挂载到本地备库
mount -t nfs -o rw,hard,nointr,tcp,noac,vers=3,timeo=600,rsize=32768,wsize=32768 192.168.13.201:/oracle/backup  /oracle/backup 
--备库节点上
startup pfile='/home/oracle/node1.pfile' nomount;
rman target sys/zhong@racdb1 auxiliary /
duplicate target database for standby;
alter database add standby logfile group 10 '/home/oracle/oradata/standby10_a.log' size 50m;
alter database add standby logfile group 11 '/home/oracle/oradata/standby11_a.log' size 50m;
alter database add standby logfile group 12 '/home/oracle/oradata/standby12_a.log' size 50m;
alter database add standby logfile group 13 '/home/oracle/oradata/standby13_a.log' size 50m;
--开启日志应用
alter database recover managed standby database disconnect from session;
搭建Oracle DataGuard还是相对比较简单,主要要注意在于
1,网络通畅
2,参数设置

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/23073818/viewspace-765609/,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2011-09-14

  • 博文量
    48
  • 访问量
    178811