库A 用NBU做了一个全备,现在要搭一个备库,刚好用NBU的备份做一个恢复,下面是在备库运行的恢复脚本
将数据库启动到mount 状态
#!/bin/bash
source /home/oracle/.bash_profile
$ORACLE_HOME/bin/rman << eof > /home/oracle/scripts/restore.log
connect target sys/oracle@kdedi (<span style="color:#ff0000;">主库的服务名</span>)
connect auxiliary /
RUN {
allocate auxiliary channel ch00 TYPE 'SBT_TAPE';
allocate auxiliary channel ch01 TYPE 'SBT_TAPE';
allocate auxiliary channel ch02 TYPE 'SBT_TAPE';
allocate auxiliary channel ch03 TYPE 'SBT_TAPE';
allocate auxiliary channel ch04 TYPE 'SBT_TAPE';
allocate auxiliary channel ch05 TYPE 'SBT_TAPE';
allocate auxiliary channel ch06 TYPE 'SBT_TAPE';
allocate auxiliary channel ch07 TYPE 'SBT_TAPE';
send 'NB_ORA_CLIENT=xxx.xxx.com'; (<span style="color:#ff0000;">主库的域名</span>)
send 'NB_ORA_SERV=nbuserver.xxx.com';
duplicate target database for standby nofilenamecheck;
release channel ch00;
release channel ch01;
release channel ch02;
release channel ch03;
release channel ch04;
release channel ch05;
release channel ch06;
release channel ch07;
}
eof
exit;
运行后报下面的错误:
Recovery Manager: Release 11.2.0.4.0 - Production on Mon Nov 9 15:30:14 2015
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
RMAN>
connected to target database: KDEDI (DBID=1364717330)
RMAN>
connected to auxiliary database (not started)
RMAN> 2> 3> 4> 5> 6> 7> 8> 9> 10> 11> 12> 13> 14> 15> 16> 17> 18> 19> 20> 21>
using target database control file instead of recovery catalog
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of allocate command at 11/09/2015 15:30:15
RMAN-06403: could not obtain a fully authorized session
RMAN-04006: error from auxiliary database: ORA-01034: ORACLE not available
ORA-27101: shared memory realm does not exist
Linux-x86_64 Error: 2: No such file or directory
RMAN>
报出来的错误不好定位,我们分解执行
[oracle@qs-fbfjdbadg1 ~]$ rman target sys/oracle@kdedi (<span style="color:#ff0000;">连到主库</span>)
Recovery Manager: Release 11.2.0.4.0 - Production on Mon Nov 9 15:24:48 2015
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
connected to target database: KDEDI (DBID=1364717330)
RMAN> connect auxiliary / (<span style="color:#ff0000;">备库本身</span>)
connected to auxiliary database: KDEDI (DBID=1364717330, not open)
RMAN> RUN {
2> allocate auxiliary channel ch00 TYPE 'SBT_TAPE';
3> allocate auxiliary channel ch01 TYPE 'SBT_TAPE';
4> allocate auxiliary channel ch02 TYPE 'SBT_TAPE';
5> allocate auxiliary channel ch03 TYPE 'SBT_TAPE';
6> allocate auxiliary channel ch04 TYPE 'SBT_TAPE';
7> allocate auxiliary channel ch05 TYPE 'SBT_TAPE';
8> allocate auxiliary channel ch06 TYPE 'SBT_TAPE';
9> allocate auxiliary channel ch07 TYPE 'SBT_TAPE';
10> send 'NB_ORA_CLIENT=xxx.xxx.com';
11> send 'NB_ORA_SERV=nbuserver.xxx.com';
12> duplicate target database for standby nofilenamecheck;
13> release channel ch00;
14> release channel ch01;
15> release channel ch02;
16> release channel ch03;
17> release channel ch04;
18> release channel ch05;
19> release channel ch06;
20> release channel ch07;
21> }
using target database control file instead of recovery catalog
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03009: failure of allocate command on ch00 channel at 11/09/2015 15:26:32
ORA-19554: error allocating device, device type: SBT_TAPE, device name:
ORA-27211: Failed to load Media Management Library
Additional information: 2
RMAN> exit
错误指出不能加载介质管理库,原来是没有装NBU客户端,需要执行一个oralink‘ 文件(/usr/openv/netbackup/bin 目录下)
再次执行,出现下面的错误,
RMAN-00571: ===========================================================
RMAN-03002: failure of Duplicate Db command at 11/09/2015 15:46:47
RMAN-05501: aborting duplication of target database
RMAN-05500: the auxiliary database must be not mounted when issuing a DUPLICATE command
duplicate 是一种数据复制方式,要求数据库出在 nomount ,我们更改下脚本:
RUN {
allocate channel ch00 TYPE 'SBT_TAPE';
allocate channel ch01 TYPE 'SBT_TAPE';
allocate channel ch02 TYPE 'SBT_TAPE';
allocate channel ch03 TYPE 'SBT_TAPE';
allocate channel ch04 TYPE 'SBT_TAPE';
allocate channel ch05 TYPE 'SBT_TAPE';
allocate channel ch06 TYPE 'SBT_TAPE';
allocate channel ch07 TYPE 'SBT_TAPE';
send 'NB_ORA_CLIENT=qs-xx.xxx.com';
send 'NB_ORA_SERV=nbuserver.xxx.com';
restore database;
release channel ch00;
release channel ch01;
release channel ch02;
release channel ch03;
release channel ch04;
release channel ch05;
release channel ch06;
release channel ch07;
}
这次报数据文件不能创建的错误,请NBU的工程师检查,发现时备库与nbu master 是通的,但是与nbu 介质服务器不同,
将备库与nbu 介质服务器打通,能正常进行恢复。