Rman异机恢复

联系:手机/微信(+86 17813235971) QQ(107644445)QQ咨询惜分飞

标题:Rman异机恢复

作者:惜分飞©版权所有[未经本人同意,不得以任何形式转载,否则有进一步追究法律责任的权利.]

一、查看数据库的dbid
select dbid from v$database;

二、修改参数文件
create pfile=’/tmp/pfile’ from spfile;
直接恢复spfile

三、rman操作
1.rman target /
2.startup nomount pfile=’xxxxxx’
3.set DBID=XXXXXXX

4.恢复控制文件

run{
allocate channel c1 type disk;
restore controlfile from '控制文件rman备份路径';
release channel c1;
}

5.加载控制文件
alter database mount;

6.恢复

run{
allocate channel c1 type disk;
[Set newname for datafile 1 to '新数据文件路径';]
restore database;
[switch datafile all;]
--rman中修改控制文件中datafile path
--sql "alter database rename file ''/opt/oracle/oradata/test/xff_02.dbf'' to ''/opt/oracle/oradata/test/xifenfei02.dbf''"
recover database;
release channel c1;
}
此条目发表在 Oracle备份恢复 分类目录。将固定链接加入收藏夹。

Rman异机恢复》有 4 条评论

  1. 惜分飞 说:

    shumu,

    恩,我测试过在9i及其以上版本中不需要了

  2. shumu 说:

    第三步骤中的 set DBID=XXXXXXX 好像不需要吧。

  3. 惜 分飞 说:

    如果使用了
    Set newname for datafile 1 to ‘新数据文件路径’;修改数据文件路径
    在recover前,需要使用switch datafile all;修改控制文件中关于数据文件的路径

    run
    {
    allocate channel c1 type disk;
    allocate channel c2 type disk;
    set newname for datafile 'G:\ORACLE\PRODUCT\10.2.0\ORADATA\NTSY\SYSTEM01.DBF' to  'W:\oracle\oradata\ntsy\ntsy\SYSTEM01.DBF';
    set newname for datafile 'G:\ORACLE\PRODUCT\10.2.0\ORADATA\NTSY\UNDOTBS01.DBF' to  'W:\oracle\oradata\ntsy\ntsy\UNDOTBS01.DBF';
    set newname for datafile 'G:\ORACLE\PRODUCT\10.2.0\ORADATA\NTSY\SYSAUX01.DBF' to  'W:\oracle\oradata\ntsy\ntsy\SYSAUX01.DBF';
    set newname for datafile 'G:\ORACLE\PRODUCT\10.2.0\ORADATA\NTSY\USERS01.DBF' to  'W:\oracle\oradata\ntsy\ntsy\USERS01.DBF';
    set newname for datafile 'G:\ORACLE\PRODUCT\10.2.0\ORADATA\NTSY\EXAMPLE01.DBF' to  'W:\oracle\oradata\ntsy\ntsy\EXAMPLE01.DBF';
    set newname for datafile 'G:\MY_SPACE.DBF' to  'W:\oracle\oradata\ntsy\ntsy\MY_SPACE.DBF';
    set newname for datafile 'G:\MY_SPACE1.DBF' to  'W:\oracle\oradata\ntsy\ntsy\MY_SPACE1.DBF';
    set newname for datafile 'G:\MY_SPACE2.DBF' to  'W:\oracle\oradata\ntsy\ntsy\MY_SPACE2.DBF';
    set newname for datafile 'F:\MY_SPACE4.DBF' to  'W:\oracle\oradata\ntsy\ntsy\MY_SPACE4.DBF';
    switch datafile all;
    restore database;
    release channel c1;
    release channel c2;
    }
    
  4. 惜 分飞 说:

    catalog start with ‘/opt/ORBS/data’ 将备份集信息重新导入到当前控制文件中
    CONFIGURE DEVICE TYPE DISK PARALLELISM 4; 指定并发数
    set until time “to_date(’2011-06-03:00:00:00′, ‘YYYY-MM-DD:HH24:MI:SS’)”;
    recover database; 指定时间点恢复