Oracle数据库备份与恢复-NBU恢复

  1. 本机恢复
  2. 查找备份集

找到需要恢复的备份集,在备份服务器上执行如下命令:

  1. bplist -C cy06s -S backupserver -t 4 -R -l /
  2. 恢复spfile

启动RMAN

rman target /

rman>run {

allocate channel c1 type 'sbt_tape';

send 'nb_ora_serv=backupserver,nb_ora_client=cy06s';

restore spfile from 'c-s436-p1';

release channel c1;

}

启动数据库

启动数据库到nomount 状态:

sqlplus /nolog

conn /as sysdba

sql> startup nomount

恢复控制文件

启动RMAN

rman target /

rman>run {

allocate channel c1 type 'sbt_tape';

send 'nb_ora_serv=backupserver,nb_ora_client=cy06s';

restore controlfile from 'contr-s436-p1';

release channel c1;

}

恢复数据文件

rman>run {

allocate channel c1 type 'sbt_tape';

allocate channel c2 type 'sbt_tape';

send 'nb_ora_serv=backupserver,nb_ora_client=cy06';

restore database;

release channel c1;

release channel c2;

}  

日志回滚

rman>run 

allocate channel c1 type 'sbt_tape';

allocate channel c2 type 'sbt_tape';

send 'nb_ora_serv=backupserver,nb_ora_client=cy06s';

recover database;

release channel c1;

release channel c2;

} 

启动数据库

alter database open resetlogs;

或者

recover database until cancel using backup controlfile;

OPEN数据库,并重置日志文件

  1. 异机恢复创建权限

首先在备份服务器,建立文件允许异机恢复

/usr/openv/netbackup/db/altnames/No.Restrictions

 创建参数文件

创建一个新的参数文件和原机器的配置一致,可以通过拷贝完成。

按照参数文件中的内容创建相应的目录和权限。

主要包audit文件目录

启动数据库到nomount 状态:

sqlplus /nolog

conn /as sysdba

sql> startup nomount

查找备份集

找到需要恢复的备份集,在备份服务器上执行如下命令:

bplist -C cy06s -S backupserver -t 4 -R -l /

 恢复spfile

启动RMAN

rman target /

rman>run {

allocate channel c1 type 'sbt_tape';

send 'nb_ora_serv=backupserver,nb_ora_client=cy06s';

restore spfile from 'c-s436-p1';

release channel c1;

}

 恢复控制文件

启动RMAN

rman target /

rman>run {

allocate channel c1 type 'sbt_tape';

send 'nb_ora_serv=backupserver,nb_ora_client=cy06s';

restore controlfile from 'contr-s436-p1';

release channel c1;

}

​​​​​​​mount数据库

rman>Alter database mount;

根据控制文件,建立相关目录:数据文件目录、日志文件

SQL> select file#,name from v$datafile;

可以创建数据文件的路径,也可以重定向数据文件 

无需重定向

rman>run {

allocate channel c1 type 'sbt_tape';

allocate channel c2 type 'sbt_tape';

send 'nb_ora_serv=backupserver,nb_ora_client=cy06';

restore database;

resore archivelog all;

release channel c1;

release channel c2;

}

重定向数据文件

rman>run {

allocate channel c1 type 'sbt_tape';

allocate channel c2 type 'sbt_tape';

send 'nb_ora_serv=backupserver,nb_ora_client=ycoracle9';

set newname for datafile  1 to '/home7/oracle10/oradata/ora9i/system01.dbf';

set newname for datafile  2 to '/home7/oracle10/oradata/ora9i/undotbs01.dbf';

set newname for datafile  3 to '/home7/oracle10/oradata/ora9i/sysaux01.dbf';

set newname for datafile  4 to '/home7/oracle10/oradata/ora9i/users01.dbf';

set newname for datafile  5 to '/home7/oracle10/oradata/ora9i/tools01.dbf';

set newname for datafile  6 to '/home7/oracle10/oradata/ora9i/cyrc01.dbf';

set newname for datafile  7 to '/home7/oracle10/oradata/ora9i/zyrj01.dbf';

set newname for datafile  8 to '/home7/oracle10/oradata/ora9i/super01.dbf';

set newname for datafile  9 to '/home7/oracle10/oradata/ora9i/super02.dbf';

set newname for datafile  10 to '/home7/oracle10/oradata/ora9i/gengsy01.dbf';

set newname for datafile  11 to '/home7/oracle10/oradata/ora9i/wangyy01.dbf';

set newname for datafile  12 to '/home7/oracle10/oradata/ora9i/tbs_stream01.dbf';

restore database;

switch datafile all;

release channel c1;

release channel c2;

}  

日志回滚

rman>run {

allocate channel c1 type 'sbt_tape';

allocate channel c2 type 'sbt_tape';

send 'nb_ora_serv=backupserver,nb_ora_client=cy06s';

recover database;

release channel c1;

release channel c2;

}​​​​​​​​​​​​​​

启动数据库

alter database open resetlogs;

或者

recover database until cancel using backup controlfile;

OPEN数据库,并重置日志文件

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值