Chinaunix首页 | 论坛 | 博客
  • 博客访问: 149767
  • 博文数量: 20
  • 博客积分: 1550
  • 博客等级: 上尉
  • 技术积分: 320
  • 用 户 组: 普通用户
  • 注册时间: 2005-07-19 17:08
文章分类

全部博文(20)

文章存档

2011年(2)

2010年(2)

2009年(1)

2008年(15)

我的朋友

分类: Oracle

2008-07-23 21:47:09

===================================================
如何从磁带中恢复 备份是制定了格式的控制文件??????????
备份时候采用
CONFIGURE CONTROLFILE AUTOBACKUP ON;
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE 'SBT_TAPE' TO 'contr_%F.bk';

在恢复的时候 不知道该如何恢复

====================================================

一次基于时间的oracle不完全恢复(一)
今天,用户让我去解决TSM管理员密码过期的问题,结果过去后,又说他们的oracle数据库的一个表在上周被开发删除了,现在又想要找回来。本来以为很简单的事情,结果搞了一天,直到晚上23点才弄完。

一、方法

由于没有做exp逻辑备份,而且不能停客户的应用;所有只有靠RMAN备份的基于时间点的不完全恢复来做,大体方法如下:找一台和当前环境差不多的主机,做全库恢复,然后recover到想要的时间点,再从这个临时恢复出来的库中exp出用户想要的表,再imp到当前的生产库中去。环境是两台570用HACMP做互为备份的集群,安装AIX5.3,oracle9206,采用TSM5.3做备份。刚好可以使用另外一台主机来做恢复。

       顺便说一句,TSM的node在mannger上注册的时候与主机名和IP都没有关系的,所以可以很轻松的实现异机恢复,我想这应该算是TSM最大的优点吧:)。

二、过程

用户的两台570的主机名分别是p570a和p570b,目前oracle跑在p570a上,数据库使用的是裸设备。为了简单起见,在p570b上恢复成文件系统方式。以下是详细的恢复过程:

1、  准备环境:

在p570a上,copy出最新的contorlfile和pfile:

p570a&oracle> rman target / catalog rman/rman@rman

 

Recovery Manager: Release 9.2.0.6.0 - 64bit Production

 

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

 

connected to target database: ORACLE9I (DBID=3231295384)

connected to recovery catalog database

 

RMAN> run{

2> ALLOCATE CHANNEL ch00 TYPE DISK;

3> copy current controlfile to '/oracle/ctlbk.ctl';

4> RELEASE CHANNEL ch00;

5> }

 

allocated channel: ch00

channel ch00: sid=133 devtype=DISK

 

Starting copy at 2006-06-20:10:46:26

channel ch00: copied current controlfile

output filename=/oracle/ctlbk.ctl

Finished copy at 2006-06-20:10:46:27

 

Starting Control File and SPFILE Autobackup at 2006-06-20:10:46:27

piece handle=/oracle/app/oracle/product/9.2.0.6/dbs/c-3231295384-20060620-04 comment=NONE

Finished Control File and SPFILE Autobackup at 2006-06-20:10:46:30

 

released channel: ch00

 

RMAN> quit

 

 

Recovery Manager complete.

通过spfile创建pfile:

p570a&oracle> sqlplus "/as sysdba"

 

SQL*Plus: Release 9.2.0.6.0 - Production on Tue Jun 20 10:46:39 2006

 

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 and OLAP options

JServer Release 9.2.0.6.0 - Production

 

SQL> show parameter spfile;

 

NAME                                 TYPE        VALUE

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

spfile                               string      /dev/rspfile_rw

SQL> create pfile='/oracle/ora9ipfile.ora' from spfile='/dev/rspfile_rw';

 

File created.

 

SQL> quit

在p570b上,本来需要安装和a机相同的oracle代码(当前是安装在共享盘上,随HACMP切换使用的,现在也觉得oracle装在internal disk上还是有好处的:)),不过在这个项目做完的时候我做过类似的测试,找找看还在不在:

p570b# varyonvg data04vg

p570b# lsvg -l  data04vg

data04vg:

LV NAME             TYPE       LPs   PPs   PVs  LV STATE      MOUNT POINT

test_lv             jfs2       1280  1280  1    closed/syncd  /test

loglv02             jfs2log    1     1     1    closed/syncd  N/A

还好还在:),这个部分的oracle代码是直接从a机复制过来的,所以应该一致:

p570b# mount /test

p570b# cd /test

p570b# ls -l

总计 184

drwxr-xr-x   2 root     system         4096  8月23 2005   TT_DB

drwxr-xr-x   3 oracle   dba             256  8月23 2005   app

drwxr-xr-x   2 oracle   dba            4096  9月27 2005   arch

drwxr-xr-x   2 oracle   dba             256  8月22 2005   lost+found

drwxr-xr-x   4 oracle   dba             256  9月01 2005   tsm

-rw-r--r--   1 root     system        85797  9月07 2005   tsmconf.tar.Z

呵呵,还在,直接拿过来使用就可以了,不用再倒腾oracle代码了。注意为了不破坏系统的正常状态,所以我把oracle代码放在了test文件系统下,但是oracle的home是在/oracle下面的,于是需要做一个link:

p570b&oracle> cd /oracle

p570b&oracle> ls -l

总计 0

lrwxrwxrwx   1 root     system            9  9月27 2005   app -> /test/app

lrwxrwxrwx   1 root     system            9  9月27 2005   tsm -> /test/tsm

ok,可以把controlfile和spfile复制过来了:

p570b&oracle> rcp p570a:/oracle/ctlbk.ctl ./

p570b&oracle> ls -l

总计 4568

-rw-r-----   1 oracle   dba         2334720  6月20 10时47 ctlbk.ctl

p570b&oracle> rcp p570a:/oracle/ora9ipfile.ora ./

p570b&oracle> ls

ctlbk.ctl       ora9ipfile.ora

把pfile复制到oracle的默认位置:

p570b&oracle> cp /oracle/app/oracle/oradata/ora9i/*.ora /oracle/app/oracle/product/9.2.0.6/dbs/

修改pfile参数,主要是controlfile、arch dest和sort_area_size:

p570b&oracle> more  initora9i.ora

*.aq_tm_processes=1

*.background_dump_dest='/oracle/app/oracle/admin/oracle9i/bdump'

*.compatible='9.2.0.0.0'

*.control_files='/oracle/app/oracle/oradata/oracle9i/contorl1.ctl'

*.core_dump_dest='/oracle/app/oracle/admin/oracle9i/cdump'

*.db_block_size=8192

*.db_cache_size=209715200

*.db_domain=''

*.db_file_multiblock_read_count=16

*.db_name='oracle9i'

*.dispatchers='(PROTOCOL=TCP)'

*.fast_start_mttr_target=300

*.hash_join_enabled=TRUE

*.instance_name='ora9i'

*.java_pool_size=1048576000

*.job_queue_processes=10

*.large_pool_size=83886080

*.log_archive_dest='/test/arch'

*.log_archive_format='arch%S.arc'

*.log_archive_max_processes=2

*.log_archive_start=true

*.open_cursors=300

*.pga_aggregate_target=209715200

*.processes=150

*.query_rewrite_enabled='FALSE'

*.remote_login_passwordfile='EXCLUSIVE'

*.shared_pool_size=1048576000

*.sort_area_size=20000000

*.star_transformation_enabled='FALSE'

*.timed_statistics=TRUE

*.undo_management='AUTO'

*.undo_retention=10800

*.undo_tablespace='UNDOTBS1'

*.user_dump_dest='/oracle/app/oracle/admin/oracle9i/udump'

p570b&oracle> mv ora9ipfile.ora  initora9i.ora

p570b&oracle> sqlplus "/as sysdba"

好,启动oracle到mount状态,开始干活:

SQL*Plus: Release 9.2.0.6.0 - Production on Tue Jun 20 10:53:05 2006

 

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

 

Connected to an idle instance.

 

SQL> startup mount;

ORACLE instance started.

 

Total System Global Area 2451542600 bytes

Fixed Size                   746056 bytes

Variable Size            2231369728 bytes

Database Buffers          218103808 bytes

Redo Buffers                1323008 bytes

ORA-00205: error in identifying controlfile, check alert log for more info

 

 

SQL> show parameter controlfile;

SQL> show parameter cont;

 

NAME                                 TYPE

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

VALUE

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

control_file_record_keep_time        integer

7

control_files                        string

/oracle/app/oracle/oradata/ora

9i/control01.dbf

global_context_pool_size             string

 

SQL> quit

Disconnected from Oracle9i Enterprise Edition Release 9.2.0.6.0 - 64bit Production

With the Partitioning and OLAP options

JServer Release 9.2.0.6.0 - Production

p570b&oracle> ls -l /test/app/oracle/oradata/ora9i      

总计 4576

-rw-r-----   1 oracle   dba         2334720  6月20 10时47 crontrol01.dbf

-rw-r--r--   1 oracle   dba            1057  6月20 10时49 ora9ipfile.ora

先查以下file#和file_name的对应关系,等下会用到:

SQL> select file#,name from v$datafile;

 

     FILE#

----------

NAME

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

         1

/dev/rsystem_rw

 

         2

/dev/rundo1_rw

 

         3

/dev/rcwmlite_rw

 

 

     FILE#

----------

NAME

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

         4

/dev/rdrsys_rw

 

         5

/dev/rdata4_1_01_rw

 

         6

/dev/rtools_rw

 

 

     FILE#

----------

NAME

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

         7

/dev/rusers_rw

 

         8

/dev/rxdb_rw

 

         9

/dev/rdata10_1_01_rw

 

 

     FILE#

----------

NAME

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

        10

/dev/rdata10_1_02_rw

 

        11

/oracle/app/oracle/product/9.2.0.6/dbs/spaces.dbf

 

        12

/dev/rdata1_1_01_rw

SQL> quit

2、从磁带库中取出需要的备份文件及archivelog

OK,先resotre database,注意,只是restore数据文件,使用until time方法来做,oracle会根据catalog的信息找到离我们需要恢复的时间点最近的上一个全备份,除了time,还有基于SCN、logseq等的方法,后面我们会用到:

p570b&oracle> rman target / catalog rman/rman@rman

 

Recovery Manager: Release 9.2.0.6.0 - 64bit Production

 

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

 

connected to target database: ORACLE9I (DBID=3231295384)

connected to recovery catalog database

 

RMAN> run {

2> set archivelog destination to '/test/arch/';

3> set until time "to_date('06/13/06 13:00:00','MM/DD/YY HH24:MI:SS')" ;

4> allocate channel t1 type 'sbt_tape' parms 'ENV=(TDPO_OPTFILE=/oracle/tsm/client/oracle/bin/tdpo.opt)';

5> set newname for datafile 1 to '/oracle/app/oracle/oradata/ora9i/system.dbf';

6> set newname for datafile 2 to '/oracle/app/oracle/oradata/ora9i/undo1.dbf';

7> set newname for datafile 3 to '/oracle/app/oracle/oradata/ora9i/cwmlite.dbf';

8> set newname for datafile 4 to '/oracle/app/oracle/oradata/ora9i/drsys.dbf';

9> set newname for datafile 5 to '/oracle/app/oracle/oradata/ora9i/data4_1_01.dbf';

10> set newname for datafile 6 to '/oracle/app/oracle/oradata/ora9i/tools.dbf';

11> set newname for datafile 7 to '/oracle/app/oracle/oradata/ora9i/users.dbf';

12> set newname for datafile 8 to '/oracle/app/oracle/oradata/ora9i/xdb.dbf';

13> set newname for datafile 9 to '/oracle/app/oracle/oradata/ora9i/data10_1_01.dbf';

14> set newname for datafile 10 to '/oracle/app/oracle/oradata/ora9i/data10_1_02.dbf';

15> set newname for datafile 11 to '/oracle/app/oracle/oradata/ora9i/spaces.dbf';

16> set newname for datafile 12 to '/oracle/app/oracle/oradata/ora9i/data1_1_01.dbf';

17> restore database;

18> switch datafile all;

19> release channel t1;

20> }

 

executing command: SET ARCHIVELOG DESTINATION

 

executing command: SET until clause

 

ANS0101E NLInit: Unable to open message repository '/usr/tivoli/tsm/client/oracle/bin64/zh_CN/tdpo.cat'.

allocated channel: t1

channel t1: sid=14 devtype=SBT_TAPE

channel t1: Tivoli Data Protection for Oracle: version 5.2.0.0

 

executing command: SET NEWNAME

 

executing command: SET NEWNAME

 

executing command: SET NEWNAME

 

executing command: SET NEWNAME

 

executing command: SET NEWNAME

 

executing command: SET NEWNAME

 

executing command: SET NEWNAME

 

executing command: SET NEWNAME

 

executing command: SET NEWNAME

 

executing command: SET NEWNAME

 

executing command: SET NEWNAME

 

executing command: SET NEWNAME

 

Starting restore at 20-JUN-06

 

channel t1: starting datafile backupset restore

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

restoring datafile 00001 to /oracle/app/oracle/oradata/ora9i/system.dbf

restoring datafile 00002 to /oracle/app/oracle/oradata/ora9i/undo1.dbf

restoring datafile 00004 to /oracle/app/oracle/oradata/ora9i/drsys.dbf

restoring datafile 00007 to /oracle/app/oracle/oradata/ora9i/users.dbf

restoring datafile 00010 to /oracle/app/oracle/oradata/ora9i/data10_1_02.dbf

restoring datafile 00012 to /oracle/app/oracle/oradata/ora9i/data1_1_01.dbf

channel t1: restored backup piece 1

piece handle=bk_ora_3152_1_591497170 tag=DB_LEVEL0 params=NULL

channel t1: restored backup piece 2

piece handle=bk_ora_3152_2_591497170 tag=DB_LEVEL0 params=NULL

channel t1: restore complete

channel t1: starting datafile backupset restore

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

restoring datafile 00003 to /oracle/app/oracle/oradata/ora9i/cwmlite.dbf

restoring datafile 00005 to /oracle/app/oracle/oradata/ora9i/data4_1_01.dbf

restoring datafile 00006 to /oracle/app/oracle/oradata/ora9i/tools.dbf

restoring datafile 00008 to /oracle/app/oracle/oradata/ora9i/xdb.dbf

restoring datafile 00009 to /oracle/app/oracle/oradata/ora9i/data10_1_01.dbf

restoring datafile 00011 to /oracle/app/oracle/oradata/ora9i/spaces.dbf

channel t1: restored backup piece 1

piece handle=bk_ora_3153_1_591497170 tag=DB_LEVEL0 params=NULL

channel t1: restored backup piece 2

piece handle=bk_ora_3153_2_591497170 tag=DB_LEVEL0 params=NULL

channel t1: restore complete

Finished restore at 20-JUN-06

 

datafile 1 switched to datafile copy

input datafilecopy recid=13 stamp=593610382 filename=/oracle/app/oracle/oradata/ora9i/system.dbf

datafile 2 switched to datafile copy

input datafilecopy recid=14 stamp=593610382 filename=/oracle/app/oracle/oradata/ora9i/undo1.dbf

datafile 3 switched to datafile copy

input datafilecopy recid=15 stamp=593610382 filename=/oracle/app/oracle/oradata/ora9i/cwmlite.dbf

datafile 4 switched to datafile copy

input datafilecopy recid=16 stamp=593610382 filename=/oracle/app/oracle/oradata/ora9i/drsys.dbf

datafile 5 switched to datafile copy

input datafilecopy recid=17 stamp=593610382 filename=/oracle/app/oracle/oradata/ora9i/data4_1_01.dbf

datafile 6 switched to datafile copy

input datafilecopy recid=18 stamp=593610382 filename=/oracle/app/oracle/oradata/ora9i/tools.dbf

datafile 7 switched to datafile copy

input datafilecopy recid=19 stamp=593610382 filename=/oracle/app/oracle/oradata/ora9i/users.dbf

datafile 8 switched to datafile copy

input datafilecopy recid=20 stamp=593610382 filename=/oracle/app/oracle/oradata/ora9i/xdb.dbf

datafile 9 switched to datafile copy

input datafilecopy recid=21 stamp=593610382 filename=/oracle/app/oracle/oradata/ora9i/data10_1_01.dbf

datafile 10 switched to datafile copy

input datafilecopy recid=22 stamp=593610382 filename=/oracle/app/oracle/oradata/ora9i/data10_1_02.dbf

datafile 11 switched to datafile copy

input datafilecopy recid=23 stamp=593610382 filename=/oracle/app/oracle/oradata/ora9i/spaces.dbf

datafile 12 switched to datafile copy

input datafilecopy recid=24 stamp=593610382 filename=/oracle/app/oracle/oradata/ora9i/data1_1_01.dbf

 

RMAN>

本来archivelog文件也一样可以使用until time来找的,但是不知道为什么,我采用这样的语句始终报错,只好转换成logseq来做了:

RMAN> run {

2> set archivelog destination to '/test/arch/';

3> set until time "to_date('06/13/06 13:00:00','MM/DD/YY HH24:MI:SS')" ;

4> allocate channel t1 type 'sbt_tape' parms 'ENV=(TDPO_OPTFILE=/oracle/tsm/client/oracle/bin/tdpo.opt)';

5> restore archivelog until time "to_date('06/13/06 13:00:00','MM/DD/YY HH24:MI:SS')" ;

6> release channel t1;

7> }

 

executing command: SET ARCHIVELOG DESTINATION

 

executing command: SET until clause

 

ANS0101E NLInit: Unable to open message repository '/usr/tivoli/tsm/client/oracle/bin64/zh_CN/tdpo.cat'.

allocated channel: t1

channel t1: sid=11 devtype=SBT_TAPE

channel t1: Tivoli Data Protection for Oracle: version 5.2.0.0

 

Starting restore at 20-JUN-06

 

archive log thread 1 sequence 1 is already on disk as file /test/arch/arch0000000001.arc

archive log thread 1 sequence 2 is already on disk as file /test/arch/arch0000000002.arc

archive log thread 1 sequence 3 is already on disk as file /test/arch/arch0000000003.arc

archive log thread 1 sequence 4 is already on disk as file /test/arch/arch0000000004.arc

archive log thread 1 sequence 5 is already on disk as file /test/arch/arch0000000005.arc

archive log thread 1 sequence 6 is already on disk as file /test/arch/arch0000000006.arc

当然,这里没有使用from time限定,但是后来我使用了from time还是一样报错。

使用RMAN查询对应日期的logseq号:

RMAN> list backup of archivelog all;

 

 

List of Backup Sets

===================

 

BS Key  Size       Device Type Elapsed Time Completion Time  

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

41      643K       SBT_TAPE    00:02:58     2005-09-26:18:55:50

        BP Key: 42   Status: AVAILABLE   Tag: TAG20050926T185252

        Piece Name: al_ora_t570048772_s2_p1

 

  List of Archived Logs in backup set 41

  Thrd Seq     Low SCN    Low Time            Next SCN   Next Time

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

  1    1       3224721    2005-09-26:18:18:24 3225856    2005-09-26:18:37:36

  1    2       3225856    2005-09-26:18:37:36 3226284    2005-09-26:18:52:52

………(省略若干)…..

BS Key  Size       Device Type Elapsed Time Completion Time  

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

22094   1M         SBT_TAPE    00:03:07     2006-05-26:21:41:16

        BP Key: 22095   Status: AVAILABLE   Tag: TAG20060526T213809

        Piece Name: al_ora_t591485889_s3148_p1

 

  List of Archived Logs in backup set 22094

  Thrd Seq     Low SCN    Low Time            Next SCN   Next Time

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

  1    1953    117583452  2006-05-26:18:38:09 117590956  2006-05-26:21:38:09

 

BS Key  Size       Device Type Elapsed Time Completion Time  

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

22107   1M         SBT_TAPE    00:03:11     2006-05-27:00:41:20

        BP Key: 22108   Status: AVAILABLE   Tag: TAG20060527T003809

        Piece Name: al_ora_t591496689_s3150_p1

 

  List of Archived Logs in backup set 22107

  Thrd Seq     Low SCN    Low Time            Next SCN   Next Time

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

  1    1954    117590956  2006-05-26:21:38:09 117598466  2006-05-27:00:38:09

………(省略若干)…..

 

BS Key  Size       Device Type Elapsed Time Completion Time  

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

22864   1M         SBT_TAPE    00:02:55     2006-06-13:21:40:21

        BP Key: 22865   Status: AVAILABLE   Tag: TAG20060613T213725

        Piece Name: al_ora_t593041046_s3263_p1

 

  List of Archived Logs in backup set 22864

  Thrd Seq     Low SCN    Low Time            Next SCN   Next Time

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

  1    2014    119214265  2006-06-13:18:37:26 119221819  2006-06-13:21:37:25

………(省略若干)…..

由上面可见,我们需要的archivelog,从5月27~6月13晚上,logseq号是1954~2014,SCN号是117590956~119214265,奇怪为什么是从5月27~6月13晚上?6月13晚上是用户告诉我删数据前的一个时间点,而5月27则是查出来离6月13最近的一个全备份(注意oracle恢复的时候不能往后回滚,只能向前提交archivelog来恢复):

RMAN> list backup of database;

 

 

List of Backup Sets

===================

………(省略若干)…..

BS Key  Type LV Size       Device Type Elapsed Time Completion Time  

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

22117   Incr 0  12G        SBT_TAPE    00:13:27     2006-05-27:00:59:37

  List of Datafiles in backup set 22117

  File LV Type Ckp SCN    Ckp Time            Name

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

  1    0  Incr 117598811  2006-05-27:00:46:10 /dev/rsystem_rw

  2    0  Incr 117598811  2006-05-27:00:46:10 /dev/rundo1_rw

  4    0  Incr 117598811  2006-05-27:00:46:10 /dev/rdrsys_rw

  7    0  Incr 117598811  2006-05-27:00:46:10 /dev/rusers_rw

  10   0  Incr 117598811  2006-05-27:00:46:10 /dev/rdata10_1_02_rw

  12   0  Incr 117598811  2006-05-27:00:46:10 /dev/rdata1_1_01_rw

 

  Backup Set Copy #1 of backup set 22117

  Device Type Elapsed Time Completion Time     Tag

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

  SBT_TAPE    00:13:27     2006-05-27:00:59:37 DB_LEVEL0

 

    List of Backup Pieces for backup set 22117 Copy #1

    BP Key  Pc# Status      Piece Name

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

    22119   1   AVAILABLE   bk_ora_3152_1_591497170

    22120   2   AVAILABLE   bk_ora_3152_2_591497170

 

BS Key  Type LV Size       Device Type Elapsed Time Completion Time  

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

22118   Incr 0  10G        SBT_TAPE    00:13:43     2006-05-27:00:59:53

  List of Datafiles in backup set 22118

  File LV Type Ckp SCN    Ckp Time            Name

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

  3    0  Incr 117598812  2006-05-27:00:46:10 /dev/rcwmlite_rw

  5    0  Incr 117598812  2006-05-27:00:46:10 /dev/rdata4_1_01_rw

  6    0  Incr 117598812  2006-05-27:00:46:10 /dev/rtools_rw

  8    0  Incr 117598812  2006-05-27:00:46:10 /dev/rxdb_rw

  9    0  Incr 117598812  2006-05-27:00:46:10 /dev/rdata10_1_01_rw

  11   0  Incr 117598812  2006-05-27:00:46:10 /oracle/app/oracle/product/9.2.0.6/dbs/spaces.dbf

 

  Backup Set Copy #1 of backup set 22118

  Device Type Elapsed Time Completion Time     Tag

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

  SBT_TAPE    00:13:43     2006-05-27:00:59:53 DB_LEVEL0

 

    List of Backup Pieces for backup set 22118 Copy #1

    BP Key  Pc# Status      Piece Name

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

    22121   1   AVAILABLE   bk_ora_3153_1_591497170

    22122   2   AVAILABLE   bk_ora_3153_2_591497170

 

BS Key  Type LV Size       Device Type Elapsed Time Completion Time  

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

23199   Incr 0  12G        SBT_TAPE    00:11:26     2006-06-17:00:57:02

  List of Datafiles in backup set 23199

  File LV Type Ckp SCN    Ckp Time            Name

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

  1    0  Incr 119504058  2006-06-17:00:45:36 /dev/rsystem_rw

  2    0  Incr 119504058  2006-06-17:00:45:36 /dev/rundo1_rw

  4    0  Incr 119504058  2006-06-17:00:45:36 /dev/rdrsys_rw

  7    0  Incr 119504058  2006-06-17:00:45:36 /dev/rusers_rw

  10   0  Incr 119504058  2006-06-17:00:45:36 /dev/rdata10_1_02_rw

  12   0  Incr 119504058  2006-06-17:00:45:36 /dev/rdata1_1_01_rw

 

  Backup Set Copy #1 of backup set 23199

  Device Type Elapsed Time Completion Time     Tag

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

  SBT_TAPE    00:11:26     2006-06-17:00:57:02 DB_LEVEL0

………(省略若干)…..

有了这个logseq,就好办事了:

p570b&oracle> rman target / catalog rman/rman@rman

 

Recovery Manager: Release 9.2.0.6.0 - 64bit Production

 

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

 

connected to target database: ORACLE9I (DBID=3231295384)

connected to recovery catalog database

 

RMAN> run {

2> set archivelog destination to '/test/arch/';

3> allocate channel t1 type 'sbt_tape' parms 'ENV=(TDPO_OPTFILE=/oracle/tsm/client/oracle/bin/tdpo.opt)';

4> restore archivelog from  logseq=1966 until logseq=2015;

5> release channel t1;

6> }

 

executing command: SET ARCHIVELOG DESTINATION

 

ANS0101E NLInit: Unable to open message repository '/usr/tivoli/tsm/client/oracle/bin64/zh_CN/tdpo.cat'.

allocated channel: t1

channel t1: sid=13 devtype=SBT_TAPE

channel t1: Tivoli Data Protection for Oracle: version 5.2.0.0

 

Starting restore at 2006-06-20:13:30:36

 

channel t1: starting archive log restore to user-specified destination

archive log destination=/test/arch/

channel t1: restoring archive log

archive log thread=1 sequence=1966

channel t1: restored backup piece 1

piece handle=al_ora_t591615479_s3175_p1 tag=TAG20060528T093759 params=NULL

channel t1: restore complete

channel t1: starting archive log restore to user-specified destination

archive log destination=/test/arch/

channel t1: restoring archive log

archive log thread=1 sequence=1967

channel t1: restored backup piece 1

piece handle=al_ora_t591626280_s3177_p1 tag=TAG20060528T123759 params=NULL

channel t1: restore complete

channel t1: starting archive log restore to user-specified destination

archive log destination=/test/arch/

channel t1: restoring archive log

archive log thread=1 sequence=1968

于是敲完这些命令就去吃中午饭了,心想吃完回来应该restore完了吧,也就60个logseq!

没想到过了2个小时才restore了10几个logseq,观察发现,每恢复一个logseq,3582都要dismount以下volume,然后再mount,location……但是这些logseq都是在同一个volume上的!按照常理,应该是一次restore完一个volume上的所有log才会dismount一个volume的,猜想是不是TSM的node的keep mount point属性影响?该属性是让一个node备份完后并不马上dismount当前volume,而是等待一段时间,当一下个备份node不是刚才的node的时候,才dismount该volume,于是中断恢复,修改该属性,问题依然。。。。


没办法,打电话给IBMer,他解释说要用SCN做条件来恢复才快,于是,改成SCN:

RMAN> run {

2> set archivelog destination to '/test/arch/';

3> allocate channel t1 type 'sbt_tape' parms 'ENV=(TDPO_OPTFILE=/oracle/tsm/client/oracle/bin/tdpo.opt)';

4> restore archivelog from  scn=117841982 until scn=119229249;

5> release channel t1;

6> }

 

executing command: SET ARCHIVELOG DESTINATION

 

ANS0101E NLInit: Unable to open message repository '/usr/tivoli/tsm/client/oracle/bin64/zh_CN/tdpo.cat'.

allocated channel: t1

channel t1: sid=13 devtype=SBT_TAPE

channel t1: Tivoli Data Protection for Oracle: version 5.2.0.0

 

Starting restore at 2006-06-20:14:37:59

 

channel t1: starting archive log restore to user-specified destination

archive log destination=/test/arch/

channel t1: restoring archive log

archive log thread=1 sequence=1979

channel t1: restored backup piece 1

piece handle=al_ora_t591755880_s3201_p1 tag=TAG20060530T003800 params=NULL

还是一样的问题,再打电话问IBMer,他肯定的说是sta(TSM的存储代理,相当于veritas的media server)的TCP配置有问题,我也没高清楚是什么问题,半信半疑的禁用了STA,也就是禁用了SAN恢复,采用网络方式,然而,问题没有解决,更大的问题却来了(不过,后来的操作证明IBMer说的是对的):

RMAN> run {

2> set archivelog destination to '/test/arch/';

3> allocate channel t1 type 'sbt_tape' parms 'ENV=(TDPO_OPTFILE=/oracle/tsm/client/oracle/bin/tdpo.opt)';

4> restore archivelog from  scn=117864624 until scn=119229249;

5> release channel t1;

6> }

 

executing command: SET ARCHIVELOG DESTINATION

 

ANS0101E NLInit: Unable to open message repository '/usr/tivoli/tsm/client/oracle/bin64/zh_CN/tdpo.cat'.

allocated channel: t1

channel t1: sid=13 devtype=SBT_TAPE

channel t1: Tivoli Data Protection for Oracle: version 5.2.0.0

 

Starting restore at 2006-06-20:15:05:39

 

archive log thread 1 sequence 1982 is already on disk as file /test/arch/arch0000001982.arc

channel t1: starting archive log restore to user-specified destination

archive log destination=/test/arch/

channel t1: restoring archive log

archive log thread=1 sequence=1983

released channel: t1

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

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

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

RMAN-03002: failure of restore command at 06/20/2006 15:06:07

ORA-19501: read error on file "al_ora_t591799080_s3209_p1", blockno 1 (blocksize=512)

ORA-27190: skgfrd: sbtread2 returned error

ORA-19511: Error received from media manager layer, error text:

   ANS1314E (RC14)   File data currently unavailable on server

 

RMAN> quit

居然一个log也不能恢复了!!!但是刚刚装的windows客户端备份恢复却是好好的!恢复sta的配置,不行,直接到p570a上restore archivelog(注:虽然不能在p570a上recover,但是restore是可以的,但是操作要千万小心,不然可能破坏生产环境了),还是不行,甚至再restore刚才能够restore的那些log都不行了!!!但是,在p570a上备份归档却可以,恢复刚备份的log也可以!

于是根据TSM的报错,在TSM上查原因:

tsm£oTSMSVR>q vol A00005L2 f=d

 

                   Volume Name: A00005L2

             Storage Pool Name: ORACLE

             Device Class Name: LTOCLASS1

            Estimated Capacity: 190,734.0

       Scaled Capacity Applied:

                      Pct Util: 15.7

                 Volume Status: Filling

                        Access: Unavailable

        Pct. Reclaimable Space: 0.0

               Scratch Volume?: No

               In Error State?: No

      Number of Writable Sides: 1

       Number of Times Mounted: 335

             Write Pass Number: 1

     Approx. Date Last Written: 06/20/2006 09:54:06

        Approx. Date Last Read: 06/20/2006 15:14:04

           Date Became Pending:

        Number of Write Errors: 0

         Number of Read Errors: 0

               Volume Location:

Volume is MVS Lanfree Capable : No

Last Update by (administrator): ADMIN

         Last Update Date/Time: 09/06/2005 11:08:08

          Begin Reclaim Period:

            End Reclaim Period:

A00005L2是就是恢复需要的volume,居然变成Unavailable了!难道是刚才疯狂mount把它弄坏了。。。

尝试手工把状态改回来:

tsm£oTSMSVR>update volume A00005L2 access=READWrite

ANR2207I Volume A00005L2 updated.

tsm£oTSMSVR>q vol A00005L2 f=d                    

 

                   Volume Name: A00005L2

             Storage Pool Name: ORACLE

             Device Class Name: LTOCLASS1

            Estimated Capacity: 190,734.0

       Scaled Capacity Applied:

                      Pct Util: 15.7

                 Volume Status: Filling

                        Access: Read/Write

        Pct. Reclaimable Space: 0.0

               Scratch Volume?: No

               In Error State?: No

      Number of Writable Sides: 1

       Number of Times Mounted: 335

             Write Pass Number: 1

     Approx. Date Last Written: 06/20/2006 09:54:06

        Approx. Date Last Read: 06/20/2006 15:14:04

           Date Became Pending:

        Number of Write Errors: 0

         Number of Read Errors: 0

               Volume Location:

Volume is MVS Lanfree Capable : No

Last Update by (administrator): ADMIN

         Last Update Date/Time: 06/20/2006 16:42:32

          Begin Reclaim Period:

            End Reclaim Period:

居然OK了,呵呵,没搞清楚是什么原因,继续往下做吧,没想到还真的可以了,而且去掉sta的参数后,log也是一下子恢复出来了,而不是象刚才一个log要mount一次volume。
阅读(1423) | 评论(1) | 转发(0) |
0

上一篇:Tivoli技术贴汇总

下一篇:ibm出版物

给主人留下些什么吧!~~

chinaunix网友2008-08-16 03:07:16

RMAN管理的备份与恢复 一、配置RMAN环境 1.配置自动通道 在9i之前,当使用RMAN执行备份、转储和恢复操作时,必须手工分配通道,并指定相应参数配置,从9i开始,DBA可以将RMAN通道配置存放到RMAN资料库,从而使得 RMAN可以自动分配通道。但是,当执行特殊RMAN作业时,DBA仍然可以使用ALLOCATE CHANNEL覆盖默认通道配置。 (1)配置通道并行度。 RMAN>CONFIGURE DEVICE TYPE DISK PARALLELISM 3 RMAN>CONFIGURE DEVICE TYPE sbt PARALLELISM 3 (2)配置所有通道的备份文件格式。默认情况下,RMAN会自动为 DISK 分配一个通道,并且没有任何选项。通过配置自动通道,可以指定所有通道的备份文件格式。示例如下: RMAN>CONFIGURE CHANNEL DEVICE TYPE DISK FORMAT 'D:\BACKUP\%d_%s_%p.ba