rman结合netbackup重定向恢复oracle数据库

1.创建数据库目录

2.从原来主机复制pfile文件,并更改oracle_sid

vi .bash_profile
source .bash_profile

3.启动数据到nomount状态

$ sqlplus / as sysdba
SQL> startup nomount pfile='pfile文件绝对位置';
ORACLE instance started.
SQL> exit


4.查看备份controlfile列表

$ /usr/openv/netbackup/bin/bplist -S 备份服务器 -C 备份客户端 -t 4 -s 09/10/2000 -e  09/11/2000 -R -l /
该命令中-s参数后面接开始日期,-e参数接结束日期,表示获取该时间段内的控制文件列表


5.恢复controlfile文件

$ rman target /
RMAN>
run{
allocate channel a0 type 'sbt_tape';
allocate channel a1 type 'sbt_tape';
send 'nb_ora_serv=备份服务器  , nb_ora_client=备份客户端';
restore controlfile from ' cntrl_xxx_x_xxxxxxxxx';   #控制文件名由上一步骤中得到
release channel a0;
release channel a1;
}
RMAN> exit


注意:在这里报错

RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03009: failure of allocate command on a0 channel at 06/14/2011 11:45:03
ORA-19554: error allocating device, device type: SBT_TAPE, device name: 
ORA-27211: Failed to load Media Management Library

race文件发现没有libobk.so所致,拷贝libobk.so至oracle安装目录下的lib/下面


cp /usr/openv/netbackup/bin/libobk.so64.1 /opt/oracle/product/9.2/lib/libobk.so
或者做一个软链接
ln -s /usr/openv/netbackup/bin/libobk.so64  /opt/oracle/product/9.2/lib/libobk.so


6.启动数据库到mount状态

$ sqlplus / as sysdba
SQL> alter database mount;
Database altered.
SQL> exit


7.恢复数据库

$ rman target /
run{
allocate channel a0 type 'sbt_tape';
allocate channel a1 type 'sbt_tape';
allocate channel a2 type 'sbt_tape';
allocate channel a3 type 'sbt_tape';
send 'nb_ora_serv=备份服务器  , nb_ora_client=备份客户端';
restore database;
recover database;
release channel a0;
release channel a1;
release channel a2;
release channel a3;
}

8.Reset log 打开数据库

$ sqlplus / as sysdba
SQL> alter database open resetlogs;