- 配置好主库参数文件:
添加:
*.log_archive_config=‘DG_CONFIG=(CWFOL,CWFOLB)‘
*.log_archive_dest_1=‘LOCATION=USE_DB_RECOVERY_FILE_DEST VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=CWFOL‘
*.log_archive_dest_2=‘SERVICE=CWFOLB LGWR SYNC AFFIRM VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=CWFOLB‘
重启每个节点:
2.为主库添加standby log:
alter database add standby logfile thread 1(‘+DATA‘,‘+FRA‘) size 200M;
alter database add standby logfile thread 1(‘+DATA‘,‘+FRA‘) size 200M;
alter database add standby logfile thread 1(‘+DATA‘,‘+FRA‘) size 200M;
alter database add standby logfile thread 1(‘+DATA‘,‘+FRA‘) size 200M;
alter database add standby logfile thread 1(‘+DATA‘,‘+FRA‘) size 200M;
alter database add standby logfile thread 2(‘+DATA‘,‘+FRA‘) size 200M;
alter database add standby logfile thread 2(‘+DATA‘,‘+FRA‘) size 200M;
alter database add standby logfile thread 2(‘+DATA‘,‘+FRA‘) size 200M;
alter database add standby logfile thread 2(‘+DATA‘,‘+FRA‘) size 200M;
alter database add standby logfile thread 2(‘+DATA‘,‘+FRA‘) size 200M;
3.配置静态监听,,主库和备库,各节点,,,
4.主库开启闪回和强制日志:
5.生成密码文件:
orapwd file=‘$ORACLE_HOME/dbs/orapwCWFOL1‘ password=oracle entries=5 force=y ignorecase=y;
orapwd file=‘$ORACLE_HOME/dbs/orapwCWFOL2‘ password=oracle entries=5 force=y ignorecase=y;
orapwd file=‘$ORACLE_HOME/dbs/orapwCWFOLB‘ password=oracle entries=5 force=y ignorecase=y;
或者在一个节点生成后,然后拷贝到别的节点,重新命名。
6.备库编辑一个文件,只需要db_name:
[[email protected] dbs]$ cat initCWFOLB.ora
db_name=CWFOLB
7.编辑duplicate.sql
[[email protected] ~]$ cat duplicate.sql
duplicate target database
for standby
from active database
DORECOVER
spfile
set service_names=‘CWFOLB‘
set db_unique_name=‘CWFOLB‘
set log_archive_dest_1=‘location=+FRA VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=CWFOLB‘
set log_archive_dest_2=‘SERVICE=COWELLORC LGWR SYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=CWFOL‘
set standby_file_management=‘AUTO‘
set fal_server=‘CWFOL‘
set fal_client=‘CWFOLB‘
set control_files=‘+DATA‘
set cluster_database=‘false‘;
出现的错误:
1.
MAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of Duplicate Db command at 01/28/2016 13:03:45
RMAN-05501: aborting duplication of target database
RMAN-03015: error occurred in stored script Memory Script
RMAN-04014: startup failed: ORA-00119: invalid specification for system parameter REMOTE_LISTENER
ORA-00132: syntax error or unresolved network name ‘foldb-cluster-scan:1521‘
RMAN> **end-of-file**
*.remote_listener=‘foldb-cluster-scan:1521‘
解决办法:再主库上去掉这个参数,复制完成后,修改回来。
2.主库和备库无法进行实时同步, 状态为wait_for_log.需要alter system switch logfile才行.
原因是在备库上没有针对节点2的standby log,添加:
alter database add standby logfile thread 2(‘+DATA‘,‘+FRA‘) size 200M;
alter database add standby logfile thread 2(‘+DATA‘,‘+FRA‘) size 200M;
alter database add standby logfile thread 2(‘+DATA‘,‘+FRA‘) size 200M;
alter database add standby logfile thread 2(‘+DATA‘,‘+FRA‘) size 200M;
alter database add standby logfile thread 2(‘+DATA‘,‘+FRA‘) size 200M;
正常结果如下:
SQL> select status from v$managed_standby;
STATUS
------------
CLOSING
CLOSING
CLOSING
CONNECTED
IDLE
IDLE
APPLYING_LOG
IDLE
IDLE
IDLE
IDLE
11 rows selected.