RMAN指定備份組恢複

來源:互聯網
上載者:User

今天在做資料庫恢複的時候遇到一個問題,就是有兩個目錄下面的備份組,想指定備份組來恢複,回來查了下資料,下面做個簡單的實驗記錄:

RMAN> run{
2> allocate channel a1 type disk;
3> allocate channel a2 type disk;
4> backup database format='/home/Oracle/backup/db_arch_%U';
5> release channel a1;
6> release channel a2;
7> }

released channel: ORA_DISK_1
allocated channel: a1
channel a1: sid=144 devtype=DISK

allocated channel: a2
channel a2: sid=148 devtype=DISK

Starting backup at 02-JUL-11
channel a1: starting full datafile backupset
channel a1: specifying datafile(s) in backupset
input datafile fno=00001 name=/home/oracle/app/oracle/oradata/zwh/system01.dbf
input datafile fno=00003 name=/home/oracle/app/oracle/oradata/zwh/sysaux01.dbf
channel a1: starting piece 1 at 02-JUL-11
channel a2: starting full datafile backupset
channel a2: specifying datafile(s) in backupset
input datafile fno=00002 name=/home/oracle/app/oracle/oradata/zwh/undotbs01.dbf
input datafile fno=00004 name=/home/oracle/app/oracle/oradata/zwh/users01.dbf
channel a2: starting piece 1 at 02-JUL-11
channel a2: finished piece 1 at 02-JUL-11
piece handle=/home/oracle/backup/db_arch_6kmgfc5a_1_1 tag=TAG20110702T231137 comment=NONE
channel a2: backup set complete, elapsed time: 00:00:07
channel a2: starting full datafile backupset
channel a2: specifying datafile(s) in backupset
including current control file in backupset
channel a2: starting piece 1 at 02-JUL-11
channel a2: finished piece 1 at 02-JUL-11
piece handle=/home/oracle/backup/db_arch_6lmgfc5i_1_1 tag=TAG20110702T231137 comment=NONE
channel a2: backup set complete, elapsed time: 00:00:07
channel a2: starting full datafile backupset
channel a2: specifying datafile(s) in backupset
including current SPFILE in backupset
channel a2: starting piece 1 at 02-JUL-11
channel a2: finished piece 1 at 02-JUL-11
piece handle=/home/oracle/backup/db_arch_6mmgfc5q_1_1 tag=TAG20110702T231137 comment=NONE
channel a2: backup set complete, elapsed time: 00:00:08
channel a1: finished piece 1 at 02-JUL-11
piece handle=/home/oracle/backup/db_arch_6jmgfc5a_1_1 tag=TAG20110702T231137 comment=NONE
channel a1: backup set complete, elapsed time: 00:00:59
Finished backup at 02-JUL-11

released channel: a1

released channel: a2

 

在這個時候我在scott使用者下刪除了2條記錄,資料表空間是users,用於恢複比較用~

RMAN> run{
2>   allocate channel a1 type disk;
3>   allocate channel a2 type disk;
4>   backup database format='/home/oracle/backup2/db2_arch_%U';
5>   release channel a1;
6>   release channel a2;
7>   }

using target database control file instead of recovery catalog
allocated channel: a1
channel a1: sid=141 devtype=DISK

allocated channel: a2
channel a2: sid=143 devtype=DISK

Starting backup at 02-JUL-11
channel a1: starting full datafile backupset
channel a1: specifying datafile(s) in backupset
input datafile fno=00001 name=/home/oracle/app/oracle/oradata/zwh/system01.dbf
input datafile fno=00003 name=/home/oracle/app/oracle/oradata/zwh/sysaux01.dbf
channel a1: starting piece 1 at 02-JUL-11
channel a2: starting full datafile backupset
channel a2: specifying datafile(s) in backupset
input datafile fno=00002 name=/home/oracle/app/oracle/oradata/zwh/undotbs01.dbf
input datafile fno=00004 name=/home/oracle/app/oracle/oradata/zwh/users01.dbf
channel a2: starting piece 1 at 02-JUL-11
channel a2: finished piece 1 at 02-JUL-11
piece handle=/home/oracle/backup2/db2_arch_6omgfciq_1_1 tag=TAG20110702T231850 comment=NONE
channel a2: backup set complete, elapsed time: 00:00:07
channel a2: starting full datafile backupset
channel a2: specifying datafile(s) in backupset
including current control file in backupset
channel a2: starting piece 1 at 02-JUL-11
channel a2: finished piece 1 at 02-JUL-11
piece handle=/home/oracle/backup2/db2_arch_6pmgfcj3_1_1 tag=TAG20110702T231850 comment=NONE
channel a2: backup set complete, elapsed time: 00:00:13
channel a2: starting full datafile backupset
channel a2: specifying datafile(s) in backupset
including current SPFILE in backupset
channel a2: starting piece 1 at 02-JUL-11
channel a2: finished piece 1 at 02-JUL-11
piece handle=/home/oracle/backup2/db2_arch_6qmgfcjj_1_1 tag=TAG20110702T231850 comment=NONE
channel a2: backup set complete, elapsed time: 00:00:04
channel a1: finished piece 1 at 02-JUL-11
piece handle=/home/oracle/backup2/db2_arch_6nmgfciq_1_1 tag=TAG20110702T231850 comment=NONE
channel a1: backup set complete, elapsed time: 00:00:54
Finished backup at 02-JUL-11

released channel: a1

released channel: a2


RMAN> list backup of database;

using target database control file instead of recovery catalog

List of Backup Sets
===================

BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
201     Full    24.06M     DISK        00:00:05     02-JUL-11     
        BP Key: 201   Status: AVAILABLE  Compressed: NO  Tag: TAG20110702T231137
        Piece Name: /home/oracle/backup/db_arch_6kmgfc5a_1_1  --第一次備份組的目錄
  List of Datafiles in backup set 201
  File LV Type Ckp SCN    Ckp Time  Name
  ---- -- ---- ---------- --------- ----
  2       Full 1645604    02-JUL-11 /home/oracle/app/oracle/oradata/zwh/undotbs01.dbf
  4       Full 1645604    02-JUL-11 /home/oracle/app/oracle/oradata/zwh/users01.dbf

BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
204     Full    568.33M    DISK        00:00:52     02-JUL-11     
        BP Key: 204   Status: AVAILABLE  Compressed: NO  Tag: TAG20110702T231137
        Piece Name: /home/oracle/backup/db_arch_6jmgfc5a_1_1
  List of Datafiles in backup set 204
  File LV Type Ckp SCN    Ckp Time  Name
  ---- -- ---- ---------- --------- ----
  1       Full 1645603    02-JUL-11 /home/oracle/app/oracle/oradata/zwh/system01.dbf
  3       Full 1645603    02-JUL-11 /home/oracle/app/oracle/oradata/zwh/sysaux01.dbf

BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
205     Full    24.06M     DISK        00:00:03     02-JUL-11     
        BP Key: 205   Status: AVAILABLE  Compressed: NO  Tag: TAG20110702T231850
        Piece Name: /home/oracle/backup2/db2_arch_6omgfciq_1_1      --第二次備份組的目錄
  List of Datafiles in backup set 205
  File LV Type Ckp SCN    Ckp Time  Name
  ---- -- ---- ---------- --------- ----
  2       Full 1645939    02-JUL-11 /home/oracle/app/oracle/oradata/zwh/undotbs01.dbf
  4       Full 1645939    02-JUL-11 /home/oracle/app/oracle/oradata/zwh/users01.dbf

BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
208     Full    568.33M    DISK        00:00:53     02-JUL-11     
        BP Key: 208   Status: AVAILABLE  Compressed: NO  Tag: TAG20110702T231850
        Piece Name: /home/oracle/backup2/db2_arch_6nmgfciq_1_1
  List of Datafiles in backup set 208
  File LV Type Ckp SCN    Ckp Time  Name
  ---- -- ---- ---------- --------- ----
  1       Full 1645938    02-JUL-11 /home/oracle/app/oracle/oradata/zwh/system01.dbf
  3       Full 1645938    02-JUL-11 /home/oracle/app/oracle/oradata/zwh/sysaux01.dbf

RMAN> run{
2>   set until scn=1645604;  --執行不完全恢複
3>   restore database from tag='TAG20110702T231137';   --指定備份組的tag值,在list backup of database中可以查到
4>   recover database;
5>   sql 'alter database open resetlogs';
6>   }

Starting restore at 03-JUL-11
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=157 devtype=DISK

channel ORA_DISK_1: starting datafile backupset restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
restoring datafile 00002 to /home/oracle/app/oracle/oradata/zwh/undotbs01.dbf
restoring datafile 00004 to /home/oracle/app/oracle/oradata/zwh/users01.dbf
channel ORA_DISK_1: reading from backup piece /home/oracle/backup/db_arch_6kmgfc5a_1_1   --第一次的備份組中讀取
channel ORA_DISK_1: restored backup piece 1
piece handle=/home/oracle/backup/db_arch_6kmgfc5a_1_1 tag=TAG20110702T231137
channel ORA_DISK_1: restore complete, elapsed time: 00:00:15
channel ORA_DISK_1: starting datafile backupset restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
restoring datafile 00001 to /home/oracle/app/oracle/oradata/zwh/system01.dbf
restoring datafile 00003 to /home/oracle/app/oracle/oradata/zwh/sysaux01.dbf
channel ORA_DISK_1: reading from backup piece /home/oracle/backup/db_arch_6jmgfc5a_1_1
channel ORA_DISK_1: restored backup piece 1
piece handle=/home/oracle/backup/db_arch_6jmgfc5a_1_1 tag=TAG20110702T231137
channel ORA_DISK_1: restore complete, elapsed time: 00:00:55
Finished restore at 03-JUL-11

Starting recover at 03-JUL-11
using channel ORA_DISK_1

starting media recovery

archive log thread 1 sequence 96 is already on disk as file /home/oracle/app/oracle/flash_recovery_area/ZWH/archivelog/2011_07_02/o1_mf_1_96_70ygz9cv_.arc
archive log filename=/home/oracle/app/oracle/flash_recovery_area/ZWH/archivelog/2011_07_02/o1_mf_1_96_70ygz9cv_.arc thread=1 sequence=96
media recovery complete, elapsed time: 00:00:04
Finished recover at 03-JUL-11

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.