记:对duplicate不熟悉遇到一些坑,给大家标注以下
环境如下:
类别 TNS IP db_name
source RAC1:192.168.50.31 prod
duplicate PROD:192.168.50.21 prod
duplicate 创建初始化参数文件,只需要2个即可
vi '/home/oracle/initprod.ora';
DB_NAME=PROD
COMPATIBLE= 11.2.0.4.0
duplicate 创建响应的目录
mkdir -p /u01/app/oracle
mkdir -p /u01/app/oracle/admin/prod/adump
mkdir -p /u01/app/oracle/oradata/prod
dumplicate 配置静态监听 vi listener.ora
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = prod)
(ORACLE_HOME = /u01/app/oracle/product/11.2.0/dbhome_1)
(SID_NAME = prod)
)
)
LISTENER =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.50.21)(PORT = 1521))
)
dumplicate 启动监听
启动监听
lsnrctl start
duplicate和target配置tnsnames.ora
##For the Auxiliary database prod
prod =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.50.21)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = prod)
)
)
## For the target database rac1
rac1 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.50.31)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.50.33)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = prod)
)
)
测试监听是否正常
tnsping prod
tnsping rac1
duplicate 执行rman恢复
rman TARGET sys/oracle@rac1 AUXILIARY sys/oracle@prod
DUPLICATE TARGET DATABASE
TO prod
FROM ACTIVE DATABASE nofilenamecheck
DB_FILE_NAME_CONVERT '+RACDG/prod/datafile/', '/u01/app/oracle/oradata/prod/'
spfile
SET LOG_FILE_NAME_CONVERT '+RACDG/prod/onlinelog/','/u01/app/oracle/oradata/prod/'
set control_files='/u01/app/oracle/oradata/prod/control01.ctl'
set cluster_database='FALSE'
set REMOTE_LISTENER='';
注意:指定spfile后,后面的set xxx是对启动后的spfile参数进行调整。调整目录和cluster_database,remote_lister参数是必须的