重庆思庄Oracle、Redhat认证学习论坛

标题: ORACLE 11G 数据库异机恢复到另外的目录 [打印本页]

作者: 郑全    时间: 2022-6-15 22:59
标题: ORACLE 11G 数据库异机恢复到另外的目录
比如生产库位置在 :/u01/app/oracle/oradata/emr/
       恢复库的文件位置:/oradata/emr/

步骤:
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;

5.打开数据库
  sql>alter database open resetlogs;








欢迎光临 重庆思庄Oracle、Redhat认证学习论坛 (http://bbs.cqsztech.com/) Powered by Discuz! X3.2