步骤:
1.恢复控制文件
rman target /
rman>restore controlfile from '/bak/dbbak/ctl.bak';
2.启动到mount
rman>alter database mount;
3.恢复数据文件
数据文件可以一个个去执行位置,如果文件太多,指定太麻烦,可以使用set newname for database to '/oradata/emr/%b' 方式解决
rman>
run{
allocate channel c1 device type disk;
allocate channel c2 device type disk;
allocate channel c3 device type disk;
allocate channel c4 device type disk;
set newname for database to '/oradata/emr/%b';
restore database;
switch datafile all;
switch tempfile all;
recover database;
}
4.调整联机文件
sql>
alter database rename file '/u01/app/oracle/oradata/emr/redo01.log' to '/oradata/emr/redo01.log';
alter database rename file '/u01/app/oracle/oradata/emr/redo02.log' to '/oradata/emr/redo02.log';
alter database rename file '/u01/app/oracle/oradata/emr/redo03.log' to '/oradata/emr/redo03.log';
alter database rename file '/u01/app/oracle/oradata/emr/redo04.log' to '/oradata/emr/redo04.log';
alter database clear logfile group 1;
alter database clear logfile group 2;
alter database clear logfile group 3;
alter database clear logfile group 4;