从带库中把Oracle归档日志提取到数据库服务器中

时间:2008-10-24 09:26:03  来源:博客园  作者:蒙昭良  字号:【

描述:数据库的所在系统为AIX5.3,数据库的备份通过Tivoli Storage Manage(简称TSM)软件把数据库数据、归档日志备份到带库中。

  在备份完归档日志到带库后,即删除数据库数据库中的归档日志。现在需要查询数据库中某表的数据具体是哪些用户进行操作的,需要用到数据库的归档日志。

  从带库中把归档日志提取到数据库中的某个位置上。

  1、远程登陆或本地登陆数据库服务器系统:

  进入rman的命令界面:


  LHXXDBS01:oraoms> rman target/
  RMAN>list backup;

   (这命令把所有的备份都列出来)

  如果只提取恢复归档日志,用下面命令即可,然后记住那天归档日志的sequence 号:


  RMAN>list backupset of archivelog all; (这命令把所有的归档日志列出来)
  Handle: c-2813856949-20081020-05 Media:
  Control File Included: Ckp SCN: 224711393 Ckp time: 20-OCT-08
  SPFILE Included: Modification time: 20-OCT-08
  BS Key Size Device Type Elapsed Time Completion Time
  ------- ---------- ----------- ------------ ---------------
  3306 81.50M SBT_TAPE 00:03:02 20-OCT-08
  BP Key: 3306 Status: AVAILABLE Compressed: NO Tag: TAG20081020T16023
  6
  Handle: arch_20081020_9621_1 Media:
  List of Archived Logs in backup set 3306
  Thrd Seq Low SCN Low Time Next SCN Next Time
  ---- ------- ---------- --------- ---------- ---------
  1 3440 224711325 20-OCT-08 224779163 20-OCT-08
  1 3441 224779163 20-OCT-08 224779169 20-OCT-08
  BS Key Type LV Size Device Type Elapsed Time Completion Time
  ------- ---- -- ---------- ----------- ------------ ---------------
  3307 Full 5.75M SBT_TAPE 00:01:59 20-OCT-08
  BP Key: 3307 Status: AVAILABLE Compressed: NO Tag: TAG20081020T16054
  3
  Handle: c-2813856949-20081020-06 Media:
  Control File Included: Ckp SCN: 224779614 Ckp time: 20-OCT-08
  SPFILE Included: Modification time: 20-OCT-08
  BS Key Size Device Type Elapsed Time Completion Time
  ------- ---------- ----------- ------------ ---------------
  3308 70.25M SBT_TAPE 00:03:26 20-OCT-08
  BP Key: 3308 Status: AVAILABLE Compressed: NO Tag: TAG20081020T20052
  9
  Handle: arch_20081020_9623_1 Media:
  List of Archived Logs in backup set 3308
  Thrd Seq Low SCN Low Time Next SCN Next Time
  ---- ------- ---------- --------- ---------- ---------
  1 3442 224779169 20-OCT-08 224840954 20-OCT-08
  1 3443 224840954 20-OCT-08 224840960 20-OCT-08
  BS Key Type LV Size Device Type Elapsed Time Completion Time
  ------- ---- -- ---------- ----------- ------------ ---------------
  3309 Full 5.75M SBT_TAPE 00:02:00 20-OCT-08
  BP Key: 3309 Status: AVAILABLE Compressed: NO Tag: TAG20081020T20085
  5
  Handle: c-2813856949-20081020-07 Media:
  Control File Included: Ckp SCN: 224842089 Ckp time: 20-OCT-08
  RMAN> exit

  2、选择存放归档日志的位置,然后执行命令:


  RUN
  {
  SET ARCHIVELOG DESTINATION TO '新位置';
  RESTORE ARCHIVELOG SEQUENCE XXXX;
  }

  注意:如果不用"SET ARCHIVELOG DESTINATION TO '新位置';"该语句,归档日志会在数据库的默认的归档日志目录。

  命令如下:


  Recovery Manager complete.
  LHXXDBS01:oraoms> pwd
  /oracle/oms/oradata/temp
  LHXXDBS01:oraoms> rman target/
  Recovery Manager: Release 10.2.0.1.0 - Production on Tue Oct 21 08:52:08 2008
  Copyright (c) 1982, 2005, Oracle. All rights reserved.
  connected to target database: LHOMS (DBID=2813856949)
  RMAN> run{
  2> set archivelog destination to '/oracle/oms/oradata/temp';
  3> restore archivelog sequence 3442;
  4> }
  executing command: SET ARCHIVELOG DESTINATION
  using target database control file instead of recovery catalog
  Starting restore at 21-OCT-08
  allocated channel: ORA_SBT_TAPE_1
  channel ORA_SBT_TAPE_1: sid=465 devtype=SBT_TAPE
  channel ORA_SBT_TAPE_1: Data Protection for Oracle: version 5.3.3.0
  allocated channel: ORA_SBT_TAPE_2
  channel ORA_SBT_TAPE_2: sid=543 devtype=SBT_TAPE
  channel ORA_SBT_TAPE_2: Data Protection for Oracle: version 5.3.3.0
  allocated channel: ORA_DISK_1
  channel ORA_DISK_1: sid=480 devtype=DISK
  channel ORA_SBT_TAPE_1: starting archive log restore to user-specified destinati
  on
  archive log destination=/oracle/oms/oradata/temp
  channel ORA_SBT_TAPE_1: restoring archive log
  archive log thread=1 sequence=3442
  channel ORA_SBT_TAPE_1: reading from backup piece arch_20081020_9623_1
  channel ORA_SBT_TAPE_1: restored backup piece 1
  piece handle=arch_20081020_9623_1 tag=TAG20081020T200529
  channel ORA_SBT_TAPE_1: restore complete, elapsed time: 00:03:07
  Finished restore at 21-OCT-08

  现在已经把sequence号为3442的归档日志转存到/oracle/oms/oradata/temp目录下。

  如果需要提取几天的归档日志出来,归档日志比较大、比较多的话,则需要花费很多时间。

0

顶一下

0

埋一下

引用地址: