关于使用Rman结合netbackup重定向恢复ORACLE数据库

关于使用Rman结合netbackup重定向恢复ORACLE数据库

*****实施环境*****

数据库服务器:eagle (原主机)

NBUserversol1NBU备份服务器)

异机数据库:sol2(目标主机)

[@more@]

*****恢复的前提条件*****

1、日常数据库备份成功。至少有一次全备份和Archivelog.

2、原主机的OSORACLE版本与目标主机的OSORACLE版本保持一致.

3、需要原数据库、NBUserver的下列信息:

3.1IP Address, Hostname, Nbu media server nameNBU备份服务器) /client name(原主机)

3.2Oracle DB version,SID,DBID,Datafile Path,Controlfile Path,Archivelog Path

3.3、在目标主机上安装与原数据库版本相同的oracle软件,不创建数据库。

3.4、在目标主机上安装NbuClient软件、DBagent服务,安装类型与原主机一致。

*********************************各主机软件安装情况*********************************

1、数据库服务器:eagle (原主机)

oracle9.2.0.6 Server/oracleAgent/NBUClient6.5

2NBUserversol1(NBU备份服务器)

NBUServer6.5

3、异机数据库:sol2(目标主机)

oracle9.2.0.6 Server/oracleAgent/NBUClient6.5

*********************************恢复步骤*********************************

目标主机sol2配置

1、安装NBUClient6.5

1.1、拷贝带有NBUClient65_DVD1_20070723.iso

# ls

65_DVD1_20070723.iso 65_DVD2_20070723.iso

1.2、挂载iso文件

# lofiadm

Block Device File

# pwd

/opt/nbufile

# lofiadm -a /solairs 10 iso

lofiadm: open: /solairs: No such file or directory

# lofiadm -a /opt/nbufile/65_DVD1_20070723.iso

/dev/lofi/1

#

# mkdir /mnt/iso

# mount -F hsfs /dev/lofi/1 /mnt/iso/

# cd /mnt/iso

# ls

IA64 NB_65_ICS_1.4.37.3_WIN32 X86 x64

Launch.bat NB_65_ICS_1.4.37.3_WINIA64 autorun.inf

NBClients NB_65_ICS_1.4.37.3_WINX64 install

#

1.3、开始安装NBUClient

# ./install

Symantec Installation Script

Copyright 1993 - 2007 Symantec Corporation, All Rights Reserved.

Installing NetBackup Client Software

NOTE: To install NetBackup Server software, insert the appropriate

NetBackup Server cdrom.

Do you wish to continue? [y,n] (y) y

Do you want to install the NetBackup client software for this client? [y,n] (y) y

This package will install Solaris/Solaris10 client.

This package will install NetBackup client 6.5.

--指定NBUServer端得名称:

Enter the name of the NetBackup server : sol1

--指定NBUClient端得名称:

Would you like to use "sol2" as the configured

name of the NetBackup client? [y,n] (y) y

x openv, 0 bytes, 0 tape blocks

x openv/lib, 0 bytes, 0 tape blocks

..........................

LiveUpdate is not installed, skipping registration step...

File /usr/openv/tmp/install_trace.9361 contains a trace of this install.

That file can be deleted after you are sure the install was successful.

#

2、安装NBUClient6.5

2.1、挂载iso

# ls

65_DVD1_20070723.iso 65_DVD2_20070723.iso 65_DVD4_20070723.iso

#

#

# lofiadm -a /dev/lofi/2

lofiadm: cannot use lofi on itself

# mount -F hsfs /dev/lofi/2 /mnt/iso/

# df -h

Filesystem size used avail capacity Mounted on

/dev/md/dsk/d10 111G 46G 64G 42% /

/devices 0K 0K 0K 0% /devices

ctfs 0K 0K 0K 0% /system/contract

proc 0K 0K 0K 0% /proc

mnttab 0K 0K 0K 0% /etc/mnttab

swap 34G 1.7M 34G 1% /etc/svc/volatile

objfs 0K 0K 0K 0% /system/object

sharefs 0K 0K 0K 0% /etc/dfs/sharetab

/platform/sun4u-us3/lib/libc_psr/libc_psr_hwcap2.so.1

111G 46G 64G 42% /platform/sun4u-us3/lib/libc_psr.so.1

/platform/sun4u-us3/lib/sparcv9/libc_psr/libc_psr_hwcap2.so.1

111G 46G 64G 42% /platform/sun4u-us3/lib/sparcv9/libc_psr.so.1

fd 0K 0K 0K 0% /dev/fd

swap 34G 1.1M 34G 1% /tmp

swap 34G 64K 34G 1% /var/run

/dev/lofi/2 1.4G 1.4G 0K 100% /mnt/iso

# cd /mnt/iso

# ls

Doc NB_OM NB_SM install vADD vDBA

2.2、安装NetBackup Database Agent Software

# ./install

Symantec Installation Script

Copyright 1993 - 2007 Symantec Corporation, All Rights Reserved.

Installation Options

1 NetBackup Add-On Product Software

2 NetBackup Database Agent Software

q To quit from this script

Choose an option [default: q]: 2

**********

There are two ways to install database agent software.

1. Remote Installation: Loads the software on a server with

the intent of pushing database software out to affected clients.

2. Local Installation: Loads and installs the software only to this

local machine.

**********

Do you want to do a local installation? [y,n] (n) /mnt/iso

You have entered an invalid option.

Do you want to do a local installation? [y,n] (n) y

**********

NetBackup Database Agent Installation

Choose the Database Agents you wish to install

one at a time or select Install All Database Agents.

1) NetBackup for DB2

2) NetBackup for Informix

3) NetBackup for Lotus Notes

4) NetBackup for Oracle

5) NetBackup for SAP

6) NetBackup for Sybase

7) Install All Database Agents

q) Done Selecting Agents

x) Exit from this Script

Choose an option: 4

Choose an option: q

You have chosen to install these Database Agents:

NetBackup for Oracle

Is this list correct? [y,n] (y) y

**********

Of the agents selected, the following are supported

on this platform and will be installed:

Oracle

Loading the Database Agent packages into the

/usr/openv/netbackup/dbext directory and installing.

**********

Installing NetBackup for Oracle

Installing NetBackup for Oracle...

NetBackup for Oracle installation completed.

**********

Execution of ./install_dbext is complete.

Execution of ./install is complete.

File /usr/openv/tmp/install_options_trace.10400 contains a trace of this install.

Symantec Installation Script

Copyright 1993 - 2007 Symantec Corporation, All Rights Reserved.

Installation Options

1 NetBackup Add-On Product Software

2 NetBackup Database Agent Software

q To quit from this script

Choose an option [default: q]: q

#

3、安装Oracle 9.2.0.1 升级至 9.2.0.6(此步骤略过)

3.1、将$ORACLE_HOME/dbs/pfilespfilepwdfile拷贝至目标数据库相同目录

3.2、根据参数文件中参数指向的目录创建,bdumpcumpudump及归档路径

-bash-3.00$mkdir /oracle/app/admin/china111/bdump

-bash-3.00$mkdir /oracle/app/admin/china111/cdump

-bash-3.00$mkdir /oracle/app/admin/china111/udump

-bash-3.00$mkdir /oracle/archive

4、目标主机sol2nbuClienthosts文件配置

4.1、创建$ORACLE_HOME/bp.conf file

#cd $ORACLE_HOME

#vi bp.conf

SERVER = sol1 /*master server name*/

CLIENT_NAME = eagle /*source host name*/

CLINET_READ_TIMEOUT = 1800

4.2、编辑/usr/openv/netbackup/bp.conf

#vi bp.conf

SERVER = sol1 /*master server name*/

CLIENT_NAME = eagle /*source host name*/

CLIENT_NAME = sol2 /*target host name */

VERBOSE = 5

CLIENT_READ_TIMEOUT = 1800

CLIENT_CONNECT_TIMEOUT = 1800

4.3 编辑/etc/hosts文件

#vi /etc/hosts

#

# Internet host table

#

::1 localhost

127.0.0.1 localhost

192.168.45.12 sol2 loghost sol2.company.igocctv.com.

192.168.45.11 sol1

192.168.43.180 autosvr

#AD Use

192.168.45.10 company.igocctv.com

5NBUserver主机的nbuhosts文件配置

5.1、创建文件允许进行重定向恢复主机

#cd /usr/openv/netbackup/db/altnames

#touch sol2 /*target host name */

#cd /usr/openv/netbackup/db/altnames

#touch No.Restrictions

5.2、编辑/etc/hosts文件

#vi /etc/hosts

# vi /etc/hosts

#

# Internet host table

#

::1 localhost

127.0.0.1 localhost

192.168.45.11 sol1 loghost sol1.company.igocctv.com.

192.168.45.12 sol2

192.168.43.101 swallow1

192.168.43.102 swallow2

192.168.43.151 swallow3

192.168.43.152 swallow4

192.168.43.180 autosvr

192.168.43.2 eagle

6、开始恢复数据库

6.1、使用pfilespfile在目标主机(sol2)上启动数据库到nomount 状态

# su - oracle

Sun Microsystems Inc. SunOS 5.10 Generic January 2005

-bash-3.00$ ORACLE_SID=china111

-bash-3.00$ sqlplus " / as sysdba "

SQL*Plus: Release 9.2.0.6.0 - Production on Tue Jun 14 11:30:36 2011

Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.

Connected to an idle instance.

SQL> startup nomount

ORACLE instance started.

Total System Global Area 1.7836E+10 bytes

Fixed Size 756856 bytes

Variable Size 7348420608 bytes

Database Buffers 1.0486E+10 bytes

Redo Buffers 811008 bytes

SQL>

6.2rman恢复数据库

首先在NBUserver端找到有效的备份文件,其中/cntrl_2602_1_753766268为最新的控制文件

# bplist -C eagle -S sol1 -l -t 4 -s 6/13/2011 -e 6/14/2011 -R /

-rw-rw---- oracle dba 2097152 Jun 14 03:31 /cntrl_2602_1_753766268

-rw-rw---- oracle dba 1048576000 Jun 14 03:25 /al_2600_1_753765924

-rw-rw---- oracle dba 367263744 Jun 14 03:25 /al_2601_1_753765924

-rw-rw---- oracle dba 10281216K Jun 14 03:07 /bk_2599_1_753764858

-rw-rw---- oracle dba 1051648K Jun 14 03:00 /bk_2597_1_753764402

-rw-rw---- oracle dba 2602752K Jun 14 03:00 /bk_2598_1_753764402

-rw-rw---- oracle dba 2097152 Jun 13 03:30 /cntrl_2596_1_753679828

-rw-rw---- oracle dba 1048576000 Jun 13 03:24 /al_2594_1_753679494

-rw-rw---- oracle dba 327155712 Jun 13 03:24 /al_2595_1_753679494

-rw-rw---- oracle dba 10246400K Jun 13 03:06 /bk_2593_1_753678418

-rw-rw---- oracle dba 1069285376 Jun 13 03:00 /bk_2591_1_753678002

-rw-rw---- oracle dba 2564352K Jun 13 03:00 /bk_2592_1_753678002

开始进行恢复

-bash-3.00$ rman target /

Recovery Manager: Release 9.2.0.6.0 - 64bit Production

Copyright (c) 1995, 2002, Oracle Corporation. All rights reserved.

connected to target database: china111 (not mounted)

RMAN> run{

2> ALLOCATE CHANNEL CH00 TYPE 'SBT_TAPE';

3> SEND 'NB_ORA_SERV=sol1,NB_ORA_CLIENT=eagle';

4> restore controlfile from '/cntrl_2602_1_753766268';

5> }

using target database controlfile instead of recovery catalog

RMAN-00571: ===========================================================

RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============

RMAN-00571: ===========================================================

RMAN-03009: failure of allocate command on CH00 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

google下,结合trace文件发现没有libobk.so所致

trace文件:

-bash-3.00$ cat ch*

/oracle/app/admin/china111/udump/china111_ora_12041.trc

Oracle9i Enterprise Edition Release 9.2.0.6.0 - 64bit Production

With the Partitioning, OLAP and Oracle Data Mining options

JServer Release 9.2.0.6.0 - Production

ORACLE_HOME = /oracle/app/product/9.2.0

System name: SunOS

Node name: sol2

Release: 5.10

Version: Generic_139555-08

Machine: sun4u

Instance name: china111

Redo thread mounted by this instance: 0

Oracle process number: 16

Unix process pid: 12041, image: oracle@sol2 (TNS V1-V3)

*** SESSION ID:(13.1) 2011-06-14 11:45:03.268

SKGFQ OSD: Error in function sbtinit on line 2384

SKGFQ OSD: Look for SBT Trace messages in file /oracle/app/admin/china111/udump/sbtio.log

SBT Initialize failed for oracle.static

-bash-3.00$ more ch*

/oracle/app/admin/china111/udump/china111_ora_12041.trc

Oracle9i Enterprise Edition Release 9.2.0.6.0 - 64bit Production

With the Partitioning, OLAP and Oracle Data Mining options

JServer Release 9.2.0.6.0 - Production

ORACLE_HOME = /oracle/app/product/9.2.0

System name: SunOS

Node name: sol2

Release: 5.10

Version: Generic_139555-08

Machine: sun4u

Instance name: china111

Redo thread mounted by this instance: 0

Oracle process number: 16

Unix process pid: 12041, image: oracle@sol2 (TNS V1-V3)

*** SESSION ID:(13.1) 2011-06-14 11:45:03.268

SKGFQ OSD: Error in function sbtinit on line 2384

SKGFQ OSD: Look for SBT Trace messages in file /oracle/app/admin/china111/udump/sbtio.log

SBT Initialize failed for oracle.static

-bash-3.00$ sbttest /etc/hosts

The sbt function pointers are loaded from oracle.static library.

libobk.so could not be loaded. Check that it is installed

libobk.so没有找到,所有报错了。

拷贝libobk.so/opt/oracle/product/9.2/lib/下面

oracle@dbsvr$ ls /usr/openv/netbackup/bin/libobk.so*

/usr/openv/netbackup/bin/libobk.so.1 /usr/openv/netbackup/bin/libobk.so64.1

oracle@dbsvr$cp /usr/openv/netbackup/bin/libobk.so64.1 /opt/oracle/product/9.2/lib/libobk.so

重新进行rman恢复

RMAN> run{

2> ALLOCATE CHANNEL CH00 TYPE 'SBT_TAPE';

3> SEND 'NB_ORA_SERV=sol1,NB_ORA_CLIENT=eagle';

4> restore controlfile from '/cntrl_2602_1_753766268';

5> }

allocated channel: CH00

channel CH00: sid=11 devtype=SBT_TAPE

channel CH00: Veritas NetBackup for Oracle - Release 6.5 (2007072323)

sent command to channel: CH00

Starting restore at 14-JUN-11

channel CH00: restoring controlfile

channel CH00: restore complete

replicating controlfile

input filename=/oracle/app/oradata/china111/control01.ctl

output filename=/oracle/app/oradata/china111/control02.ctl

output filename=/oracle/app/oradata/china111/control03.ctl

Finished restore at 14-JUN-11

released channel: CH00

RMAN> exit

Recovery Manager complete.

完成恢复数据库控制文件,重启数据库,加载mount状态

-bash-3.00$ sqlplus " / as sysdba "

SQL*Plus: Release 9.2.0.6.0 - Production on Tue Jun 14 16:26:23 2011

Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.

Connected to:

Oracle9i Enterprise Edition Release 9.2.0.6.0 - 64bit Production

With the Partitioning, OLAP and Oracle Data Mining options

JServer Release 9.2.0.6.0 - Production

SQL> shutdown immediate;

ORA-01507: database not mounted

ORACLE instance shut down.

SQL>

SQL> startup mount

ORACLE instance started.

Total System Global Area 1.7836E+10 bytes

Fixed Size 756856 bytes

Variable Size 7348420608 bytes

Database Buffers 1.0486E+10 bytes

Redo Buffers 811008 bytes

Database mounted.

SQL> exit

继续进行rman数据库恢复

-bash-3.00$ rman target /

Recovery Manager: Release 9.2.0.6.0 - 64bit Production

Copyright (c) 1995, 2002, Oracle Corporation. All rights reserved.

connected to target database: CHINA111 (DBID=2087198266)

RMAN> run{

2> ALLOCATE CHANNEL CH00 TYPE 'SBT_TAPE';

3> SEND 'NB_ORA_SERV=sol1,NB_ORA_CLIENT=eagle';

4> restore database;

5> }

using target database controlfile instead of recovery catalog

allocated channel: CH00

channel CH00: sid=13 devtype=SBT_TAPE

channel CH00: Veritas NetBackup for Oracle - Release 6.5 (2007072323)

sent command to channel: CH00

Starting restore at 14-JUN-11

channel CH00: starting datafile backupset restore

channel CH00: specifying datafile(s) to restore from backup set

restoring datafile 00001 to /oracle/app/oradata/china111/system01.dbf

restoring datafile 00005 to /oracle/app/oradata/china111/example01.dbf

restoring datafile 00012 to /oracle/app/oradata/china111/TBS_MIG_DATA02.dbf

channel CH00: restored backup piece 1

piece handle=bk_2597_1_753764402 tag=HOT_DB_BK_LEVEL0 params=NULL

channel CH00: restore complete

channel CH00: starting datafile backupset restore

channel CH00: specifying datafile(s) to restore from backup set

restoring datafile 00002 to /oracle/app/oradata/china111/undotbs01.dbf

restoring datafile 00003 to /oracle/app/oradata/china111/cwmlite01.dbf

restoring datafile 00006 to /oracle/app/oradata/china111/indx01.dbf

restoring datafile 00010 to /oracle/app/oradata/china111/xdb01.dbf

restoring datafile 00013 to /oracle/app/oradata/china111/perfstat.dbf

channel CH00: restored backup piece 1

piece handle=bk_2598_1_753764402 tag=HOT_DB_BK_LEVEL0 params=NULL

channel CH00: restore complete

channel CH00: starting datafile backupset restore

channel CH00: specifying datafile(s) to restore from backup set

restoring datafile 00004 to /oracle/app/oradata/china111/drsys01.dbf

restoring datafile 00007 to /oracle/app/oradata/china111/odm01.dbf

restoring datafile 00008 to /oracle/app/oradata/china111/tools01.dbf

restoring datafile 00009 to /oracle/app/oradata/china111/users01.dbf

restoring datafile 00011 to /oracle/app/oradata/china111/TBS_MIG_DATA01.dbf

channel CH00: restored backup piece 1

piece handle=bk_2599_1_753764858 tag=HOT_DB_BK_LEVEL0 params=NULL

channel CH00: restore complete

Finished restore at 14-JUN-11

完成restore数据库恢复。

由于使用了最新的controlfile备份,还需要利用之前的归档日志做数据库恢复。

执行recover并结合备份信息得到完成恢复需要的归档。

SQL> recover database until cancel using backup controlfile;

ORA-00279: change 80864517522 generated at 06/14/2011 03:00:02 needed for

thread 1

ORA-00289: suggestion : /oracle/archive/china111_t1_arc_s1709.arc

ORA-00280: change 80864517522 for thread 1 is in sequence #1709

Specify log: {=suggested | filename | AUTO | CANCEL}

需要17091710的归档

使用rman恢复归档日志:

-bash-3.00$ rman target /

Recovery Manager: Release 9.2.0.6.0 - 64bit Production

Copyright (c) 1995, 2002, Oracle Corporation. All rights reserved.

connected to target database: CHINA111 (DBID=2087198266)

RMAN> run{

2> ALLOCATE CHANNEL CH00 TYPE 'SBT_TAPE';

3> SEND 'NB_ORA_SERV=sol1,NB_ORA_CLIENT=eagle';

4> restore archivelog from logseq 1709 until logseq 1710;

5> }

using target database controlfile instead of recovery catalog

allocated channel: CH00

channel CH00: sid=11 devtype=SBT_TAPE

channel CH00: Veritas NetBackup for Oracle - Release 6.5 (2007072323)

sent command to channel: CH00

Starting restore at 14-JUN-11

channel CH00: starting archive log restore to default destination

channel CH00: restoring archive log

archive log thread=1 sequence=1709

channel CH00: restoring archive log

archive log thread=1 sequence=1710

channel CH00: restored backup piece 1

piece handle=al_2601_1_753765924 tag=TAG20110614T032524 params=NULL

channel CH00: restore complete

Finished restore at 14-JUN-11

released channel: CH00

RMAN>

有了需要的归档可以完成数据库恢复了

-bash-3.00$ ls -l

total 717372

-rw-r----- 1 oracle dba 367072256 Jun 14 18:25 china111_t1_arc_s1709.arc

-rw-r----- 1 oracle dba 30208 Jun 14 18:24 china111_t1_arc_s1710.arc

SQL> recover database until cancel using backup controlfile;

ORA-00279: change 80864517522 generated at 06/14/2011 03:00:02 needed for

thread 1

ORA-00289: suggestion : /oracle/archive/china111_t1_arc_s1709.arc

ORA-00280: change 80864517522 for thread 1 is in sequence #1709

Specify log: {=suggested | filename | AUTO | CANCEL}

ORA-00279: change 80864574826 generated at 06/14/2011 03:25:19 needed for

thread 1

ORA-00289: suggestion : /oracle/archive/china111_t1_arc_s1710.arc

ORA-00280: change 80864574826 for thread 1 is in sequence #1710

ORA-00278: log file '/oracle/archive/china111_t1_arc_s1709.arc' no longer

needed for this recovery

Specify log: {=suggested | filename | AUTO | CANCEL}

cancel

Media recovery cancelled.

SQL> alter database open resetlogs;

Database altered.

SQL> select instance_name,status from v$instance;

INSTANCE_NAME STATUS

---------------- ------------

china111 OPEN

完成Rman结合netbackup重定向异机恢复ORACLE数据库

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/7417660/viewspace-1051162/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/7417660/viewspace-1051162/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值