Networker oracle备份恢复

Oracle

备份恢复文档

(V1.0)

 

 

 

 

 

 

 

 

 

 

  1. 安装networker客户端

    在需要进行恢复的机器上,安装networker客户端,且在netwoker服务端添加client。

    详情参照https://www.cnblogs.com/muzisanshi/p/14921431.html  6.2章节。

  2. 恢复参数文件

    建一个简化版的spfile,名为initjxdsjkp.ora (init+实例名)

     

    将数据库启动到nomount状态

     

    从备份集中还原参数文件

    设置dbid:

    set dbid=1774519710;

     

    恢复spfile脚本:

    run

    {

    allocate channel t1 type 'SBT_TAPE';

    send 'NSR_ENV=( NSR_CLIENT=jxdsjkdbp02,NSR_SERVER=networker,NSR_DATA_VOLUME_POOL=orapool)';

    restore spfile to '/u01/app/oracle/product/11.2.0/db/dbs/spfilejxdsjkp.ora' from autobackup;

    release channel t1;

    }

     

    NSR_CLIENT需要指定你要恢复的数据库networker的client名。

     

    还原参数文件后,重启一下实例,启动到nomount;

    3.恢复控制文件

    Networker查看spfile所在的备份集(参数文件和控制文件都在同一个备份集c-打头)

    恢复脚本:

    set dbid=1774519710;

    run

    {

    allocate channel t1 type 'SBT_TAPE';

    send channel t1 'NSR_ENV=( NSR_CLIENT=jxdsjkdbp02,NSR_SERVER=networker,NSR_DATA_VOLUME_POOL=orapool)';

    restore controlfile from 'c-1774519710-20210617-00';

    release channel t1;

    }

     

  3. 恢复数据文件

    数据库启动到mount

     

    恢复脚本:

    因为是异机恢复,路径不一致所以需要SET NEWNAME FOR和SWITCH 等操作。

    RUN

    {

    allocate channel t1 type 'SBT_TAPE';

    allocate channel t2 type 'SBT_TAPE';

    allocate channel t3 type 'SBT_TAPE';

    allocate channel t4 type 'SBT_TAPE';

    send 'NSR_ENV=( NSR_CLIENT=jxdsjkdbp02,NSR_SERVER=networker,NSR_DATA_VOLUME_POOL=orapool)';

    SET NEWNAME FOR DATAFILE 4 to '/oradata/jxdsjkp/users01.dbf';

    SET NEWNAME FOR DATAFILE 3 to '/oradata/jxdsjkp/undotbs01.dbf';

    SET NEWNAME FOR DATAFILE 2 to '/oradata/jxdsjkp/sysaux01.dbf';

    SET NEWNAME FOR DATAFILE 1 to '/oradata/jxdsjkp/system01.dbf';

    SET NEWNAME FOR DATAFILE 5 to '/oradata/jxdsjkp/datahup01.dbf';

    SET NEWNAME FOR DATAFILE 6 to '/oradata/jxdsjkp/datahup02.dbf';

    SET NEWNAME FOR DATAFILE 7 to '/oradata/jxdsjkp/datahup03.dbf';

    SET NEWNAME FOR DATAFILE 8 to '/oradata/jxdsjkp/datahup04.dbf';

    SET NEWNAME FOR DATAFILE 9 to '/oradata/jxdsjkp/datahup05.dbf';

    SET NEWNAME FOR DATAFILE 10 to '/oradata/jxdsjkp/datahup06.dbf';

    set newname for tempfile 1 to '/oradata/jxdsjkp/temp01.dbf';

    RESTORE DATABASE;

    SWITCH DATAFILE ALL;

    SWITCH TEMPFILE ALL;

    RECOVER DATABASE;

    release channel t1;

    release channel t2;

    release channel t3;

    release channel t4;

    }

     

    本机恢复脚本:

    Run{

    allocate channel t1 type 'SBT_TAPE';

    allocate channel t2 type 'SBT_TAPE';

    allocate channel t3 type 'SBT_TAPE';

    allocate channel t4 type 'SBT_TAPE';

    send 'NSR_ENV=( NSR_CLIENT=jxdsjkdbp02,NSR_SERVER=networker,NSR_DATA_VOLUME_POOL=orapool)';

    RESTORE DATABASE;

    RECOVER DATABASE;

    release channel t1;

    release channel t2;

    release channel t3;

    release channel t4;

    }

  4. 修改redo文件位置

    异机恢复(路径不同):

    alter database rename file '/oracle/database/oradata/jxdsjkp/redo01.log' to '/oradata/jxdsjkp/redo01.log';

    alter database rename file '/oracle/database/oradata/jxdsjkp/redo02.log' to '/oradata/jxdsjkp/redo02.log';

    alter database rename file '/oracle/database/oradata/jxdsjkp/redo03.log' to '/oradata/jxdsjkp/redo03.log';

     

    原机恢复不需要上述操作。

  5. 启动数据库

    Alter database open resetlogs;

posted @ 2021-06-23 09:54  阿西吧li  阅读(710)  评论(0编辑  收藏  举报