VERITAS NBU异机恢复演练Oracle Database(Sun SPARC)

VERITAS NBU异机恢复演练-Oracle Database(Sun SPARC)

 (2012-04-19 17:12:44)

标签: 

it

分类: Veritas-NBU

VERITAS NBU恢复演练

                              

IXS6.0数据库异机恢复

2012年04月

文档信息

负责人:

许德军

作者:

许德军

创建日期:

04/18/2011

最后更新日期:

04/18/2012

最后更新人:

许德军

审核人:

审核日期:

是否执行:

已执行

一.     硬件配置:

1.   备份服务器操作系统环境

主机名

操作系统

内存

NBU版本

备份介质

IXSNBU

Windows2003

4GB

7.0.1

磁带(SL48)

rman nocatalog方式备份

2.   源数据库服务器操作系统环境

主机名

操作系统

处理器&内存

实例名

分配内存

数据量大小

Dbha01

SunOS 5.10

SPARC64 VII: 2.53GHz *4(8核)

内存:32G

newpay

SGA=7G

PGA=2G

16348MB

3.   目标数据库服务器操作系统环境

主机名

操作系统

处理器&内存

实例名

分配内存

可用空间

NBU

SunOS 5.10

UltraSPARC-T2 1.2GHz(8核8线程)

内存:16G

newpay

SGA=3G

PGA=1G

98G     /arch

89G     /u02

266G        /u03

266G        /u04

266G        /u05

985G   total

 

 

二.     恢复的前提条件:

1.    日常备份都是成功的。至少有一次全备份及全备份以来的增量备份和Archivelog.

2.    原主机的OS及ORACLE版本与目标主机的OS及ORACLE版本保持一致.

3.      需要原数据库的下列信息:
  1) IP Address, Hostname, Nbu server/client

IP Address

Hostname

NBU server/client

192.xxx.100.167

DBha01

IXSNBU/DBha01


  2) Oracle DB version, SID,DBID,Datafile Path,Controlfile Path,Archivelog Path

DB version

SID

DBID

10.2.0.5.0

newpay

2727758532

Datafile Path

TABLESPACE_NAME

FILE_NAME

USERS

/u03/oradata/newpay/users01.dbf

SYSAUX

/u03/oradata/newpay/sysaux01.dbf

UNDOTBS1

/u03/oradata/newpay/undotbs01.dbf

SYSTEM

/u03/oradata/newpay/system01.dbf

DBLINK

/u05/oradata/newpay/dblink01.dbf

SYSBASE

/u05/oradata/newpay/sysbase01.dbf

CORPUB

/u05/oradata/newpay/corpub01.dbf

CORRISK

/u05/oradata/newpay/corrisk01.dbf

CORIO

/u05/oradata/newpay/corio01.dbf

APPBANK

/u05/oradata/newpay/appbank01.dbf

APPOPER

/u05/oradata/newpay/appoper.dbf

APPAFS

/u05/oradata/newpay/appafs01.dbf

APPAFS

/u03/oradata/newpay/appafs02.dbf

CORIO

/u04/oradata/newpay/corio02.dbf

GGS

/u04/oradata/newpay/ggs.dbf

 

Controlfile Path

/u02/oradata/newpay/control01.ctl

/u03/oradata/newpay/control02.ctl

/u04/oradata/newpay/control03.ctl

Archivelog Path

/arch/newpay


  3. )在目标主机上安装与原数据库版本相同的oracle软件 (Install type :Software only),然后创建Oracle 相关目录:

###创建数据库数据文件存放目录###

mkdir –p /u02/oradata/newpay/

mkdir –p /u03/oradata/newpay/

mkdir –p /u04/oradata/newpay/

mkdir –p /u05/oradata/newpay/

mkdir –p /arch/paidit/

mkdir –p /oracle/admin/newpay/adump

mkdir –p /oracle/admin/newpay/bdump

mkdir –p /oracle/admin/newpay/cdump

mkdir –p /oracle/admin/newpay/ddump

mkdir –p /oracle/admin/newpay/udump

mkdir –p /oracle/admin/newpay/pfile

###创建密码文件###

orapwd file=<fname> password=<password> entries=<users>

orapwd file=/oracle/product/10.2.0/dbs/orapwnewpay password=***** entries=1


  4. )在目标主机上安装Veritas 软件,安装类型与原主机一致 (media server or client)

  

三.     NBU异机恢复配置:

1.     Master Server配置:

★在master服务器上面创建C:\Program Files\VERITAS\NetBackup\db\altnames\No.Restrictions

★在master服务器上配置hosts文件

192.xxx.100.167     DBha01

192.xxx.100.145     IXSNBU   

192.xxx.100.112     NBU

★配置介质服务器恢复重定向

注:因生产环境使用的是LAN-Free方式的备份,此次恢复演练环境中的源主机与目标机间无法进行通信,所以在做异机恢复测试前需要做media-server的恢复重定向,恢复走MASTER-server

2.     Client/Media Server 配置:

★ 配置bp.conf文件                      

#vi /usr/openv/netbackup/bp.conf

SERVER = IXSNBU

MEDIA_SERVER = IXSNBU

CLIENT_NAME = DBha01

$vi $ORACLE_HOME/bp.conf

SERVER = IXSNBU

CLIENT_NAME = DBha01

CLINET_READ_TIMEOUT = 1800

★    重启nbu服务

bash-3.2# bpps -x

NB Processes

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

   root 2397    1   0 09:20:23 ?          0:00 /usr/openv/netbackup/bin/vnetd -standalone

root 2402    1   0 09:20:23 ?          0:00 /usr/openv/netbackup/bin/bpcd –standalone

bash-3.2# netbackup stop

stopping the NetBackup client daemon

stopping the NetBackup network daemon

bash-3.2# netbackup start

NetBackup network daemon started.

NetBackup client daemon started.

NetBackup SAN Client Fibre Transport daemon started.

NetBackup Bare Metal Restore Boot Server daemon started.

bash-3.2# bpps -x

NB Processes

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

   root 2931    1   0 10:07:17 ?          0:00 /usr/openv/netbackup/bin/vnetd -standalone

   root 2934    1   0 10:07:17 ?          0:00 /usr/openv/netbackup/bin/bpcd -standalone

Shared Symantec Processes

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

   root 2271    1   0 09:19:31 ?          0:00 /opt/VRTSpbx/bin/pbx_exchange

 

 

 

 

 

四.       NBU恢复步骤:

 

本次恢复目的是将利用备份将数据库恢复到一个指定时间点,并不限于恢复到最接近当前时间点。

当前NBU备份策略:每周一 00:00全备(包括归档日志),其它周天00:00差异备份(不包括归档日志)

 

本次恢复时间目标为:  2012-04-17 08:30:00

 

 

1.     NBU恢复spfile:

对于spfile,我们可以从源数据库拷贝过来,也可以先将pfile从源数据库拷贝过来(或者手工编辑一份),让数据库从pfile启动,然后从NBU上面直接恢复:

oracle@NBU$rman target / nocatalog

Recovery Manager: Release 10.2.0.5.0 - Production on Wed Apr 18 14:52:52 2012

Copyright (c) 1982, 2007, Oracle.  All rights reserved.

connected to target database (not started)

RMAN> startup nomount

Oracle instance started

Total System Global Area   7516192768 bytes

Fixed Size                    2063688 bytes

Variable Size              1224737464 bytes

Database Buffers           6241124352 bytes

Redo Buffers                 48267264 bytes

RMAN> set dbid=2727758532

executing command: SET DBID

RMAN> run {

2> ALLOCATE CHANNEL ch00 TYPE 'SBT_TAPE';

3> send 'NB_ORA_SERV=IXSNBU, NB_ORA_CLIENT=DBha01';

4> restore spfile from 'bk_1941_1_780710954';

5> release channel ch00; 

6> }

allocated channel: ch00

channel ch00: sid=644 devtype=SBT_TAPE

channel ch00: Veritas NetBackup for Oracle - Release 7.0 (2010010418)

sent command to channel: ch00

Starting restore at 18-APR-12

channel ch00: autobackup found: bk_1941_1_780710954

channel ch00: SPFILE restore from autobackup complete

Finished restore at 18-APR-12

released channel: ch00

RMAN> exit

 

 

 

 

2.     NBU恢复controlfile

Controlfile可以从磁盘备份处恢复,也可以从NBU恢复:

a)      第一次恢复全备(Apr 16)备份的controlfile

SQL> startup nomount

ORACLE instance started.

Total System Global Area 7516192768 bytes

Fixed Size                 2063688 bytes

Variable Size           1224737464 bytes

Database Buffers        6241124352 bytes

Redo Buffers              48267264 bytes

SQL> exit

Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bit Production

With the Partitioning, OLAP, Data Mining and Real Application Testing options

oracle@NBU$

oracle@NBU$rman target / nocatalog

Recovery Manager: Release 10.2.0.5.0 - Production on Wed Apr 18 14:13:19 2012

Copyright (c) 1982, 2007, Oracle.  All rights reserved.

connected to target database: newpay (not mounted)

using target database control file instead of recovery catalog

RMAN> set dbid=2727758532

executing command: SET DBID

RMAN> run {

2> ALLOCATE CHANNEL ch00 TYPE 'SBT_TAPE';

3> send 'NB_ORA_SERV=IXSNBU, NB_ORA_CLIENT=DBha01';

4> restore controlfile from 'cntrl_1944_1_780711196';

5> release channel ch00; 

6> }

allocated channel: ch00

channel ch00: sid=644 devtype=SBT_TAPE

channel ch00: Veritas NetBackup for Oracle - Release 7.0 (2010010418)

sent command to channel: ch00

Starting restore at 18-APR-12

channel ch00: restoring control file

channel ch00: restore complete, elapsed time: 00:04:26

output filename=/u02/oradata/newpay/control01.ctl

output filename=/u03/oradata/newpay/control02.ctl

output filename=/u04/oradata/newpay/control03.ctl

Finished restore at 18-APR-12

released channel: ch00

RMAN> startup mount

database is already started

database mounted

 

 

b)     第二次恢复差备(Apr 18)备份的controlfile

RMAN> set dbid=2727758532

RMAN> startup nomount

Oracle instance started

Total System Global Area   7516192768 bytes

Fixed Size                    2063688 bytes

Variable Size              1224737464 bytes

Database Buffers           6241124352 bytes

Redo Buffers                 48267264 bytes

RMAN> run {

2> ALLOCATE CHANNEL ch00 TYPE 'SBT_TAPE';

3> send 'NB_ORA_SERV=IXSNBU, NB_ORA_CLIENT=DBha01';

4> restore controlfile from 'cntrl_1958_1_780883819';

5> release channel ch00; 

6> }

allocated channel: ch00

channel ch00: sid=644 devtype=SBT_TAPE

channel ch00: Veritas NetBackup for Oracle - Release 7.0 (2010010418)

sent command to channel: ch00

Starting restore at 18-APR-12

channel ch00: restoring control file

channel ch00: restore complete, elapsed time: 00:02:48

output filename=/u02/oradata/newpay/control01.ctl

output filename=/u03/oradata/newpay/control02.ctl

output filename=/u04/oradata/newpay/control03.ctl

Finished restore at 18-APR-12

released channel: ch00

RMAN> startup mount

database is already started

database mounted

 

 

 

 

3.     NBU恢复数据库:

a)      第一次使用全备controlfile进行恢复:

RMAN> run {

2> ALLOCATE CHANNEL ch00 TYPE 'SBT_TAPE';

3> send 'NB_ORA_SERV=IXSNBU, NB_ORA_CLIENT=DBha01';

4> set until time "to_date('2012-04-17 08:30:00','YYYY-MM-DD hh24:mi:ss')";

5> restore database;

6> recover database;

7> release channel ch00; 

8> }

allocated channel: ch00

channel ch00: sid=644 devtype=SBT_TAPE

channel ch00: Veritas NetBackup for Oracle - Release 7.0 (2010010418)

sent command to channel: ch00

executing command: SET until clause

Starting restore at 18-APR-12

Starting implicit crosscheck backup at 18-APR-12

Finished implicit crosscheck backup at 18-APR-12

Starting implicit crosscheck copy at 18-APR-12

Crosschecked 2 objects

Finished implicit crosscheck copy at 18-APR-12

searching for all files in the recovery area

cataloging files...

no files cataloged

channel ch00: starting datafile backupset restore

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

restoring datafile 00002 to /u03/oradata/newpay/undotbs01.dbf

restoring datafile 00007 to /u05/oradata/newpay/corpub01.dbf

restoring datafile 00014 to /u04/oradata/newpay/corio02.dbf

channel ch00: reading from backup piece bk_1937_1_780710413

channel ch00: restored backup piece 1

piece handle=bk_1937_1_780710413 tag=HOT_DB_BK_LEVEL0

channel ch00: restore complete, elapsed time: 00:09:16

channel ch00: starting datafile backupset restore

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

restoring datafile 00001 to /u03/oradata/newpay/system01.dbf

restoring datafile 00003 to /u03/oradata/newpay/sysaux01.dbf

restoring datafile 00009 to /u05/oradata/newpay/corio01.dbf

restoring datafile 00015 to /u04/oradata/newpay/ggs.dbf

channel ch00: reading from backup piece bk_1938_1_780710668

channel ch00: restored backup piece 1

piece handle=bk_1938_1_780710668 tag=HOT_DB_BK_LEVEL0

channel ch00: restore complete, elapsed time: 00:06:26

channel ch00: starting datafile backupset restore

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

restoring datafile 00004 to /u03/oradata/newpay/users01.dbf

restoring datafile 00005 to /u05/oradata/newpay/dblink01.dbf

restoring datafile 00010 to /u05/oradata/newpay/appbank01.dbf

restoring datafile 00012 to /u05/oradata/newpay/appafs01.dbf

restoring datafile 00013 to /u03/oradata/newpay/appafs02.dbf

channel ch00: reading from backup piece bk_1939_1_780710783

channel ch00: restored backup piece 1

piece handle=bk_1939_1_780710783 tag=HOT_DB_BK_LEVEL0

channel ch00: restore complete, elapsed time: 00:02:26

channel ch00: starting datafile backupset restore

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

restoring datafile 00006 to /u05/oradata/newpay/sysbase01.dbf

restoring datafile 00008 to /u05/oradata/newpay/corrisk01.dbf

restoring datafile 00011 to /u05/oradata/newpay/appoper.dbf

restoring datafile 00016 to /u04/oradata/newpay/corio03.dbf

channel ch00: reading from backup piece bk_1940_1_780710868

channel ch00: restored backup piece 1

piece handle=bk_1940_1_780710868 tag=HOT_DB_BK_LEVEL0

channel ch00: restore complete, elapsed time: 00:02:16

Finished restore at 18-APR-12

Starting recover at 18-APR-12

starting media recovery

channel ch00: starting archive log restore to default destination

channel ch00: restoring archive log

archive log thread=1 sequence=1320

channel ch00: restoring archive log

archive log thread=1 sequence=1321

channel ch00: reading from backup piece al_1943_1_780711108

channel ch00: restored backup piece 1

piece handle=al_1943_1_780711108 tag=TAG20120416T001022

channel ch00: restore complete, elapsed time: 00:02:16

archive log filename=/arch/newpay/1_1320_745172102.arc thread=1 sequence=1320

archive log filename=/arch/newpay/1_1321_745172102.arc thread=1 sequence=1321

unable to find archive log

archive log thread=1 sequence=1322

released channel: ch00

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

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

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

RMAN-03002: failure of recover command at 04/18/2012 14:49:02

RMAN-06054: media recovery requesting unknown log: thread 1 seq 1322 lowscn 88530792

RMAN> run {

2> ALLOCATE CHANNEL ch00 TYPE 'SBT_TAPE';

3> send 'NB_ORA_SERV=IXSNBU, NB_ORA_CLIENT=DBha01';

4> RESTORE ARCHIVELOG FROM SEQUENCE 1322;

5> release channel ch00; 

6> }

allocated channel: ch00

channel ch00: sid=644 devtype=SBT_TAPE

channel ch00: Veritas NetBackup for Oracle - Release 7.0 (2010010418)

sent command to channel: ch00

Starting restore at 18-APR-12

released channel: ch00

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

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

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

RMAN-03002: failure of restore command at 04/18/2012 14:52:15

RMAN-20242: specification does not match any archive log in the recovery catalog

RMAN> shutdown immediate

database dismounted

Oracle instance shut down

以上,说明恢复的过程中需要的归档日志的备份信息不在当前的controlfile。

b)     第二次使用差备controlfile进行恢复:

RMAN> run {

2> ALLOCATE CHANNEL ch00 TYPE 'SBT_TAPE';

3> send 'NB_ORA_SERV=IXSNBU, NB_ORA_CLIENT=DBha01';

4> set until time "to_date('2012-04-17 08:30:00','YYYY-MM-DD hh24:mi:ss')";

5> recover database;

6> release channel ch00; 

7> }

allocated channel: ch00

channel ch00: sid=642 devtype=SBT_TAPE

channel ch00: Veritas NetBackup for Oracle - Release 7.0 (2010010418)

sent command to channel: ch00

executing command: SET until clause

Starting recover at 18-APR-12

Starting implicit crosscheck backup at 18-APR-12

Finished implicit crosscheck backup at 18-APR-12

Starting implicit crosscheck copy at 18-APR-12

Crosschecked 2 objects

Finished implicit crosscheck copy at 18-APR-12

searching for all files in the recovery area

cataloging files...

no files cataloged

channel ch00: starting incremental datafile backupset restore

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

destination for restore of datafile 00002: /u03/oradata/newpay/undotbs01.dbf

destination for restore of datafile 00007: /u05/oradata/newpay/corpub01.dbf

destination for restore of datafile 00014: /u04/oradata/newpay/corio02.dbf

channel ch00: reading from backup piece bk_1946_1_780796809

channel ch00: restored backup piece 1

piece handle=bk_1946_1_780796809 tag=HOT_DB_BK_LEVEL0

channel ch00: restore complete, elapsed time: 00:06:26

channel ch00: starting incremental datafile backupset restore

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

destination for restore of datafile 00001: /u03/oradata/newpay/system01.dbf

destination for restore of datafile 00003: /u03/oradata/newpay/sysaux01.dbf

destination for restore of datafile 00009: /u05/oradata/newpay/corio01.dbf

destination for restore of datafile 00015: /u04/oradata/newpay/ggs.dbf

channel ch00: reading from backup piece bk_1947_1_780797074

channel ch00: restored backup piece 1

piece handle=bk_1947_1_780797074 tag=HOT_DB_BK_LEVEL0

channel ch00: restore complete, elapsed time: 00:02:16

channel ch00: starting incremental datafile backupset restore

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

destination for restore of datafile 00004: /u03/oradata/newpay/users01.dbf

destination for restore of datafile 00005: /u05/oradata/newpay/dblink01.dbf

destination for restore of datafile 00010: /u05/oradata/newpay/appbank01.dbf

destination for restore of datafile 00012: /u05/oradata/newpay/appafs01.dbf

destination for restore of datafile 00013: /u03/oradata/newpay/appafs02.dbf

channel ch00: reading from backup piece bk_1948_1_780797179

channel ch00: restored backup piece 1

piece handle=bk_1948_1_780797179 tag=HOT_DB_BK_LEVEL0

channel ch00: restore complete, elapsed time: 00:00:46

channel ch00: starting incremental datafile backupset restore

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

destination for restore of datafile 00006: /u05/oradata/newpay/sysbase01.dbf

destination for restore of datafile 00008: /u05/oradata/newpay/corrisk01.dbf

destination for restore of datafile 00011: /u05/oradata/newpay/appoper.dbf

destination for restore of datafile 00016: /u04/oradata/newpay/corio03.dbf

channel ch00: reading from backup piece bk_1949_1_780797264

channel ch00: restored backup piece 1

piece handle=bk_1949_1_780797264 tag=HOT_DB_BK_LEVEL0

channel ch00: restore complete, elapsed time: 00:01:06

starting media recovery

Oracle Error:

ORA-01547: warning: RECOVER succeeded but OPEN RESETLOGS would get error below

ORA-01152: file 1 was not restored from a sufficiently old backup

ORA-01110: data file 1: '/u03/oradata/newpay/system01.dbf'

released channel: ch00

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

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

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

RMAN-03002: failure of recover command at 04/18/2012 15:13:04

RMAN-06053: unable to perform media recovery because of missing log

RMAN-06025: no backup of log thread 1 seq 1327 lowscn 88783893 found to restore

RMAN-06025: no backup of log thread 1 seq 1326 lowscn 88760124 found to restore

RMAN>

查询生产库查找以上两个归档日志时间信息:

oracle@DBha01$ls -lt

total 1813666

-rw-r-----   1 oracle   oinstall 93231616 Apr 18 13:00 1_1332_745172102.arc

-rw-r-----   1 oracle   oinstall 3266048 Apr 18 00:10 1_1331_745172102.arc

-rw-r-----   1 oracle   oinstall 93447680 Apr 18 00:00 1_1330_745172102.arc

-rw-r-----   1 oracle   oinstall 93556224 Apr 17 22:00 1_1329_745172102.arc

-rw-r-----   1 oracle   oinstall 93231616 Apr 17 21:05 1_1328_745172102.arc

-rw-r-----   1 oracle   oinstall 93231616 Apr 17 12:26 1_1327_745172102.arc

-rw-r-----   1 oracle   oinstall 85093888 Apr 17 00:10 1_1326_745172102.arc

-rw-r-----   1 oracle   oinstall 93231616 Apr 16 22:03 1_1325_745172102.arc

-rw-r-----   1 oracle   oinstall 93231616 Apr 16 21:36 1_1324_745172102.arc

-rw-r-----   1 oracle   oinstall 93231616 Apr 16 19:27 1_1323_745172102.arc

-rw-r-----   1 oracle   oinstall 93231616 Apr 16 12:33 1_1322_745172102.arc

drwxr-x---   4 oracle  oinstall    512 Nov 21 14:01 NEWPAY

oracle@DBha01$

由于Apr 18差备备份不包含归档日志,故恢复到Apr 17  08:30时需要以上归档日志,此时手工将以上需要的归档日志从生产库或者备份中拷贝到目标库的归档目录,继续:

RMAN> run {

2> ALLOCATE CHANNEL ch00 TYPE 'SBT_TAPE';

3> send 'NB_ORA_SERV=IXSNBU, NB_ORA_CLIENT=DBha01';

4> set until time "to_date('2012-04-17 08:30:00','YYYY-MM-DD hh24:mi:ss')";

5> recover database;

6> release channel ch00; 

7> }

allocated channel: ch00

channel ch00: sid=642 devtype=SBT_TAPE

channel ch00: Veritas NetBackup for Oracle - Release 7.0 (2010010418)

sent command to channel: ch00

executing command: SET until clause

Starting recover at 18-APR-12

starting media recovery

archive log thread 1 sequence 1326 is already on disk as file /arch/newpay/1_1326_745172102.arc

archive log thread 1 sequence 1327 is already on disk as file /arch/newpay/1_1327_745172102.arc

archive log filename=/arch/newpay/1_1326_745172102.arc thread=1 sequence=1326

archive log filename=/arch/newpay/1_1327_745172102.arc thread=1 sequence=1327

media recovery complete, elapsed time: 00:00:41

Finished recover at 18-APR-12

released channel: ch00

RMAN> alter database open resetlogs;

database opened

RMAN> exit

至此,本次恢复完毕。整个恢复过程中调用NBU job如下:

从以上恢复,我们可以知晓如果恢复到某个时间点,请使用这个时间点以后备份的controlfile进行RMAN恢复,否则会提示找不到相关的归档日志,无法恢复到指定时间点,这与RMAN备份的catalog储存在controlfile相关。

另外,虽然使用使用时间点以后备份的controlfile,仍然会出现找不到相关的归档日志,这是由于当前的差异备份没有备份归档所致。

原文地址:https://www.cnblogs.com/yaoyangding/p/15814082.html