目的,将oracle库TESTA的数据覆盖TESTB库。
1源端和目标端重建密码文件
TESTA:
orapwd file=$ORACLE_HOME/dbs/orapw$ORACLE_SID password=test1234 force=y
TESTB:
orapwd file=$ORACLE_HOME/dbs/orapw$ORACLE_SID password=test1234 force=y
2添加tns
3目标库TESTB备份后执行drop database,然后启动到nomount状态;
注意修改以下参数
*.control_files='+DATA_TESTB_MDG'
4源端TESTA启动到mount状态,通过rman传输文件
select file#,name from v$datafile;
复脚本一:
export log_file=./restore_testb_`date '+%Y%m%d_%H%M%S'`.log
rman target sys/test1234 auxiliary sys/test1234@testb<< EOF > ${log_file} 2>&1
backup as copy current controlfile auxiliary format '+DATA_TE