1 主库设置为 force loging 模式
5:48:54 sys@felix SQL>alter database force logging;
-- 验证 :
16:10:00 sys@felix SQL>selectforce_logging from v$database;
FORCE_
------
YES
查看主备库监听配置问题:
[oracle@felix ~]$ tnsping felix_st
TNS Ping Utility for Linux: Version11.2.0.3.0 - Production on 26-MAR-2014 16:12:49
Copyright (c) 1997, 2011, Oracle. All rights reserved.
Used parameter files:
Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS_LIST = (ADDRESS =(PROTOCOL = TCP)(HOST = 192.168.10.14)(PORT = 1521))) (CONNECT_DATA =(SERVICE_NAME = felix_st)))
OK (110 msec)
******************************************************************************************************************************************
[oracle@standby ~]$ tnsping felix_pd
TNS Ping Utility for Linux: Version11.2.0.3.0 - Production on 26-MAR-2014 16:12:37
Copyright (c) 1997, 2011, Oracle. All rights reserved.
Used parameter files:
Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS_LIST = (ADDRESS =(PROTOCOL = TCP)(HOST = 192.168.10.13)(PORT = 1521))) (CONNECT_DATA = (SERVICE_NAME= felix_pd)))
OK (50 msec)
用spfile将备库处于nomount状态下:
开始进行duplicate:
这个操作主备库都可以,只要RMAN连接时没有写错就行了。
rman targetsys/oracle@felix_st auxiliary sys/oracle@felix_pd
duplicate target database for standby fromactive database;
如果路径相同,使用这个:
duplicate target database for standby fromactive database nofilenamecheck;
以下是输出日志:
RMAN> duplicate target database for standby fromactive database nofilenamecheck;
(注意观察日志内容)
Starting Duplicate Db at 26-MAR-14
using target database control file insteadof recovery catalog
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: SID=21 devicetype=DISK
contents of Memory Script:
{
backup as copy reuse
targetfile '/u01/app/oracle/product/11.2.0/db_1/dbs/orapwfelix' auxiliary format
'/u01/app/oracle/product/11.2.0/db_1/dbs/orapwfelix' ;
}
----这个是目录格式转换
executing Memory Script
Starting backup at 26-MAR-14
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=44 device type=DISK
Finished backup at 26-MAR-14
contents of Memory Script:
{
backup as copy current controlfile for standbyauxiliary format '/u01/app/oracle/oradata/felix/control01.ctl';
restore clone controlfile to '/u01/app/oracle/fast_recovery_area/felix/control02.ctl'from
'/u01/app/oracle/oradata/felix/control01.ctl';
}
executing Memory Script
Starting backup at 26-MAR-14
using channel ORA_DISK_1
channel ORA_DISK_1: starting datafile copy
copying standby control file
output filename=/u01/app/oracle/product/11.2.0/db_1/dbs/snapcf_felix.ftag=TAG20140326T162408 RECID=2 STAMP=843236650
channel ORA_DISK_1: datafile copy complete,elapsed time: 00:00:07
Finished backup at 26-MAR-14
Starting restore at 26-MAR-14
using channel ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: copied control filecopy
Finished restore at 26-MAR-14
contents of Memory Script:
{
sql clone 'alter database mount standby database';
}
executing Memory Script
sql statement: alter database mount standbydatabase
contents of Memory Script:
{
set newname for tempfile 1 to
"/u01/app/oracle/oradata/felix/temp01.dbf";
switch clone tempfile all;
set newname for datafile 1 to
"/u01/app/oracle/oradata/felix/system01.dbf";
set newname for datafile 2 to
"/u01/app/oracle/oradata/felix/sysaux01.d