RMAN异机复制数据库(相同路径)

有完整的备份,新的数据库datafile、controfile、logfile所在目录结构和原数据库一样。

创建好adump、bdump、cdump、udump等目录。

 

 

1、恢复参数文件。

设置环境变量:

export ORACLE_SID=HNCDFHQ

 

登录RMAN:

rman target /

 

在RMAN里把数据库起到nomount状态:

RMAN>  startup nomount;

 

设置DBID:

RMAN>  set dbid=3931082997

 

恢复spfile:

RMAN>  restore spfile from '/backup/test/c-3931082997-20131204-02';

 

关闭数据库:

RMAN>  shutdown immediate;

 

把数据库起到nomount状态:

RMAN>  startup nomount;

 

 

2、恢复控制文件。

RMAN>  restore controlfile from '/backup/test/ctl_HNCDFHQ_20131204_21_1';

 

把数据库启动到mount状态:

RMAN>  alter database mount;

 

 

3、恢复数据文件:

如果备份不在备份时所在的目录,在新的目录。

可以用此命令注册到控制文件。

 

 

RMAN>  catalog start with '/oradata1/backup';

 

 

 

restore数据库:

RMAN>  

run

{

allocate channel c1 type disk;

allocate channel c2 type disk;

allocate channel c3 type disk;

allocate channel c4 type disk;

restore database ;

}

 

recover 数据库:

RMAN>  recover database;

 

 

SQL>  recover database until cancel using backup controlfile ;

--选择redo的绝对路径,一个一个试,有多少组redo,就试多少次

 

SQL>  alter database open resetlogs;

 

 

原文地址:https://www.cnblogs.com/liang545621/p/9405901.html