STANDBY_FILE_MANAGEMENT=AUTO
五:在备库上 把修改过后的pfile 创建成spfile,然后 改名 ,并把备库实例启动到nomount状态 SYS@JLPROJCT3> create pfile from spfile;
File created.
六:在主库上添加standby 日志组 添加的个数为:(主库原来有的个数n+1)*线程数 ,这里所说的线程数可以理解为实例的个数,这里有10个日志组,所以要添加(10+1)*2=22组。大小和路径最好和原来的保持一致,
DG有两种传递日志的方式,一种是常见的archivr log,由ARCH的后台进程控制传递到standby数据库,还有一种是和redo log一样的传递方式,由产生redo log的后台进程LGWR控制,后者就需要standby log
在最大可用和最大保护模式,因为是采用LGWR SYNC进行redo的传送,一定要用standby logfile,但是建议在最大性能模式也添加standby logfile,据说在失败切换时可以恢复更多的数据
添加命令如下:
alter database add standby logfile group 15 ('+DATA/jlprojct/onlinelog/group_15') size 2000M;
六:在主库进行测试 成功后继续进行 ,打开主备库的监听,关闭防火墙,
[oracle@rac1 ~]$ tnsping JLPROJCT3
TNS Ping Utility for Linux: Version 11.2.0.3.0 - Production on 05-MAR-2015 17:45:23
Copyright (c) 1997, 2011, Oracle. All rights reserved.
Used parameter files:
Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.15.9)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = JLPROJCT3) (INSTANCE_NAME = JLPROJCT3)))
OK (0 msec)
[oracle@rac1 ~]$ tnsping db26
TNS Ping Utility for Linux: Version 11.2.0.3.0 - Production on 05-MAR-2015 17:46:43
Copyright (c) 1997, 2011, Oracle. All rights reserved.
Used parameter files:
Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.15.26)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = JLPROJCT)))
OK (10 msec)
七:在主库用rman 同时连接主备库。
[oracle@rac1 ~]$ rman target sys/xxxxx@db26 auxiliary sys/xxxxx@JLPROJCT3
Recovery Manager: Release 11.2.0.3.0 - Production on Thu Mar 5 17:51:23 2015
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
connected to target database: JLPROJCT (DBID=2115662724)
connected to auxiliary database: JLPROJCT (not mounted )
八:在主库执行duplicate命令,最关键的一步,备份主库的控制文件,数据文件,日志文件,然后传给备库,并在备库recover ,如果没有报错的话,备库就会Open了。
RMAN> duplicate target database for standby from active database nofilenamecheck;
九:read only 的方式,打开备库数据库实例。
SYS@JLPROJCT3> alter database open read only;
Database altered.
十:在备库打开MRP进程 ,应用日志,重演变化。注意:一定要保证备库实例是在 read only 的方式下打开的,否则不能同步。
SYS@JLPROJCT3> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE DISCONNECT FROM SESSION;
Database altered.
十一:测试结果:在主库随便建立一个用户,并在这个用户下建立一个表,发现备库也会有,证明DG搭建成功。