RMAN异机恢复
rman 异机恢复
一、创建恢复需要的目录
mkdir -p /u01/app/oracle/admin/hk/{adump,bdump,cdump,dpdump,udump,pfile}
mkdir -p /u01/app/oracle/oradata/hk
mkdir -p /u01/app/oracle/fast_recovery_area/hk
二、设置init和sid
echo 'db_name=hk' > $ORACLE_HOME/dbs/inithk.ora
more $ORACLE_HOME/dbs/inithk.ora
export ORACLE_SID=hk
rman target /
set dbid 3515046639 --原始数据库dbid
三、开始恢复
startup nomount; --启动到nomount
-----恢复spfile文件
restore spfile from '/u01/app/oracle/oradata/hk/hk_spfile_81t2a2gm_1_1.bak';
startup nomount force;-----重启实例到nomount状态
查看spfile文件中控制文件路径,并创建或者如下
restore controlfile from '/u01/app/oracle/oradata/hk/hk_Controlfile_c-3278571708-20180506-01';
ORA-19870: error while restoring backup piece /u01/app/oracle/oradata/hk/hk_Controlfile_c-3278571708-20180506-01
ORA-19504: failed to create file "/oradata/hk/control01.ctl"
ORA-27040: file create error, unable to create file
Linux-x86_64 Error: 2: No such file or directory
mkdir -p /oradata/hk
restore controlfile from '/u01/app/oracle/oradata/hk/hk_Controlfile_c-3278571708-20180506-01';
alter database mount;启动实例到mount状态
restore database; //还原数据文件
channel ORA_DISK_1: ORA-19870: error while restoring backup piece /backup/database/hk_full_6mt1jcvt_1_1
ORA-19505: failed to identify file "/backup/database/hk_full_6mt1jcvt_1_1"
ORA-27037: unable to obtain file status
-------检查/backup/database权限和路径,
restore database;
recover database;
archived log thread=1 sequence=1735
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of recover command at 05/07/2018 01:02:08
RMAN-06054: media recovery requesting unknown archived log for thread 1 with sequence 1735 and starting SCN of 34275591
recover database until scn 34275591;
alter database open resetlogs;------至此恢复完毕
RMAN> quit
验证:
sqlplus / as sysdba
select name,OPEN_MODE from v$database;