NUB备份介质恢复问题记录

库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 介质服务器打通,能正常进行恢复。

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
There are a few issues with the provided code: 1. The `map` object is not initialized, which will cause a `NullPointerException` when using the `get` method. To fix this, initialize the map object before using it: ``` private static HashMap<String,Student> map = new HashMap<String,Student>(); ``` 2. The `toString` method in the `Student` class is missing some plus signs to concatenate the strings. Fix it by adding the plus signs: ``` public String toString() { return "学生信息{" + "学号='" + sno + '\'' + ", 姓名='" + name + '\'' + ", 专业='" + major + '\'' + ", 成绩='" + score + '\'' + '}'; } ``` 3. The `score` field is declared as `String`, which is not a suitable type for storing scores. Change it to a numeric type, such as `int` or `double`. 4. The `setScore` method has a typo and should be `this.score = score;` 5. It's a good practice to use `try-catch` blocks when reading from input, as the input could be incorrect and cause exceptions. For example, using `Integer.parseInt()` to get an integer from input could throw a `NumberFormatException`, and using `scanner.nextLine()` could throw a `NoSuchElementException` if there is no more input available. Here is the fixed code with these issues addressed: ``` package demo; import java.util.HashMap; import java.util.Scanner; public class Exercise333 { private static Scanner scanner; /** 学生信息集合 */ private static HashMap<String, Student> map = new HashMap<String, Student>(); public static void main(String[] args) { // TODO Auto-generated method stub select(); } private static void select() { System.out.println("请输入学号:"); Scanner sc = new Scanner(System.in); String nub = sc.nextLine(); try { Student student = map.get(nub); if (student == null) System.out.println("没有查询到该学生!"); else System.out.println(student.toString()); } catch (Exception e) { System.out.println("输入有误!"); } finally { sc.close(); } } } class Student { private String sno; /** 学号 */ private String name; /** 姓名 */ private String major; /** 专业 */ private int score; /** 成绩 */ public String toString() { return "学生信息{" + "学号='" + sno + '\'' + ", 姓名='" + name + '\'' + ", 专业='" + major + '\'' + ", 成绩='" + score + '\'' + '}'; } public String getSno() { return sno; } public void setSno(String sno) { this.sno = sno; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getMajor() { return major; } public void setMajor(String major) { this.major = major; } public int getScore() { return score; } public void setScore(int score) { this.score = score; } public Student(String sno, String name, String major, int score) { this.sno = sno; this.name = name; this.major = major; this.score = score; } } ```

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

huangliang0703

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值