11gアーカイブ・バックアップの作成
1. アーカイブ・バックアップの目的

BACKUP … KEEPを使用すると、バックアップの保存方針から除外される包括的なバックアップを作成できる。
※RMANカタログを利用していなければ、BACKUP…KEEPを使えないみたい。

2. 長期用のアーカイブ・バックアップを作成

BACKUP … KEEP FOREVER

[work oracle(PROD)] rman target / catalog rman/oracle@omr

Recovery Manager: Release 11.1.0.7.0 - Production on Wed Jan 27 23:45:57 2010

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

connected to target database: PROD (DBID=113838107)
connected to recovery catalog database

RMAN> backup database tag FOREVERBAK keep forever restore point FB001;

Starting backup at 27-JAN-10
current log archived

allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=64 device type=DISK
backup will never be obsolete
archived logs required to recover from this backup will be backed up
... ...
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 27-JAN-10

RMAN>

バックアップのサマリーを確認
RMAN> list backup summary;

List of Backups
===============
Key     TY LV S Device Type Completion Time #Pieces #Copies Compressed Tag
------- -- -- - ----------- --------------- ------- ------- ---------- ---
484     B  0  A DISK        27-JAN-10       1       1       YES        TAG20100127T234352
500     B  A  A DISK        27-JAN-10       1       1       YES        TAG20100127T234542
513     B  F  A DISK        27-JAN-10       1       1       NO         TAG20100127T234543
561     B  F  A DISK        27-JAN-10       1       1       YES        FOREVERBAK
562     B  F  A DISK        27-JAN-10       1       1       YES        FOREVERBAK
579     B  A  A DISK        27-JAN-10       1       1       YES        FOREVERBAK
580     B  F  A DISK        27-JAN-10       1       1       YES        FOREVERBAK

RMAN>

保存方針から除外されたことを検証
RMAN> SHOW RETENTION POLICY;  << 保存ポリシーを確認。冗長設定は「1」になる。

RMAN configuration parameters for database with db_unique_name PROD are:
CONFIGURE RETENTION POLICY TO REDUNDANCY 1;

RMAN> list backup summary;

List of Backups
===============
Key     TY LV S Device Type Completion Time #Pieces #Copies Compressed Tag
------- -- -- - ----------- --------------- ------- ------- ---------- ---
561     B  F  A DISK        27-JAN-10       1       1       YES        FOREVERBAK
562     B  F  A DISK        27-JAN-10       1       1       YES        FOREVERBAK
579     B  A  A DISK        27-JAN-10       1       1       YES        FOREVERBAK
580     B  F  A DISK        27-JAN-10       1       1       YES        FOREVERBAK
743     B  F  A DISK        27-JAN-10       1       1       YES        TEST01
773     B  A  A DISK        27-JAN-10       1       1       YES        TAG20100127T235951
800     B  F  A DISK        27-JAN-10       1       1       NO         TAG20100127T235953
872     B  F  A DISK        28-JAN-10       1       1       YES        TEST02
905     B  F  A DISK        28-JAN-10       1       1       NO         TAG20100128T000501

RMAN>RMAN> list backup summary;  << バックアップサマリーを確認

List of Backups
===============
Key     TY LV S Device Type Completion Time #Pieces #Copies Compressed Tag
------- -- -- - ----------- --------------- ------- ------- ---------- ---
561     B  F  A DISK        27-JAN-10       1       1       YES        FOREVERBAK
562     B  F  A DISK        27-JAN-10       1       1       YES        FOREVERBAK
579     B  A  A DISK        27-JAN-10       1       1       YES        FOREVERBAK
580     B  F  A DISK        27-JAN-10       1       1       YES        FOREVERBAK
743     B  F  A DISK        27-JAN-10       1       1       YES        TEST01
773     B  A  A DISK        27-JAN-10       1       1       YES        TAG20100127T235951
800     B  F  A DISK        27-JAN-10       1       1       NO         TAG20100127T235953
872     B  F  A DISK        28-JAN-10       1       1       YES        TEST02
905     B  F  A DISK        28-JAN-10       1       1       NO         TAG20100128T000501

RMAN> delete noprompt obsolete;  << 保存方針によって不要バックアップを削除

RMAN retention policy will be applied to the command
RMAN retention policy is set to redundancy 1
using channel ORA_DISK_1
Deleting the following obsolete backups and copies:
Type                 Key    Completion Time    Filename/Handle
-------------------- ------ ------------------ --------------------
Backup Set           743    27-JAN-10
  Backup Piece       747    27-JAN-10          /u01/app/oracle/bak/PROD/rman/PROD_55l4i336_1_1_20100127
Backup Set           773    27-JAN-10
  Backup Piece       778    27-JAN-10          /u01/app/oracle/bak/PROD/rman/PROD_56l4i33n_1_1_20100127
Backup Set           800    27-JAN-10
  Backup Piece       802    27-JAN-10          /u01/app/oracle/bak/PROD/rman/ctl_c-113838107-20100127-04
deleted backup piece
backup piece handle=/u01/app/oracle/bak/PROD/rman/PROD_55l4i336_1_1_20100127 RECID=163 STAMP=709430374
deleted backup piece
backup piece handle=/u01/app/oracle/bak/PROD/rman/PROD_56l4i33n_1_1_20100127 RECID=164 STAMP=709430391
deleted backup piece
backup piece handle=/u01/app/oracle/bak/PROD/rman/ctl_c-113838107-20100127-04 RECID=165 STAMP=709430394
Deleted 3 objects

RMAN> list backup summary;  << 再度バックアップサマリーを確認し、TAG=FOREVERBAKのバックアップが方針から除外されたことを確認できる。

List of Backups
===============
Key     TY LV S Device Type Completion Time #Pieces #Copies Compressed Tag
------- -- -- - ----------- --------------- ------- ------- ---------- ---
561     B  F  A DISK        27-JAN-10       1       1       YES        FOREVERBAK
562     B  F  A DISK        27-JAN-10       1       1       YES        FOREVERBAK
579     B  A  A DISK        27-JAN-10       1       1       YES        FOREVERBAK
580     B  F  A DISK        27-JAN-10       1       1       YES        FOREVERBAK
872     B  F  A DISK        28-JAN-10       1       1       YES        TEST02
905     B  F  A DISK        28-JAN-10       1       1       NO         TAG20100128T000501

RMAN>
3. 長期用のアーカイブ・バックアップを解除

CHANGE … NOKEEP

RMAN> list backup summary;

List of Backups
===============
Key     TY LV S Device Type Completion Time #Pieces #Copies Compressed Tag
------- -- -- - ----------- --------------- ------- ------- ---------- ---
561     B  F  A DISK        27-JAN-10       1       1       YES        FOREVERBAK
562     B  F  A DISK        27-JAN-10       1       1       YES        FOREVERBAK
579     B  A  A DISK        27-JAN-10       1       1       YES        FOREVERBAK
580     B  F  A DISK        27-JAN-10       1       1       YES        FOREVERBAK
872     B  F  A DISK        28-JAN-10       1       1       YES        TEST02
905     B  F  A DISK        28-JAN-10       1       1       NO         TAG20100128T000501

RMAN> change backup tag 'FOREVERBAK' nokeep;  << 長期保存を解除

using channel ORA_DISK_1
keep attributes for the backup are deleted
backup set key=561 RECID=154 STAMP=709429696
keep attributes for the backup are deleted
backup set key=562 RECID=155 STAMP=709429696
keep attributes for the backup are deleted
backup set key=579 RECID=156 STAMP=709429699
keep attributes for the backup are deleted
backup set key=580 RECID=157 STAMP=709429701

RMAN> delete noprompt obsolete;  << 保存ポリシーによって不要のバックアップを削除

RMAN retention policy will be applied to the command
RMAN retention policy is set to redundancy 1
using channel ORA_DISK_1
Deleting the following obsolete backups and copies:
Type                 Key    Completion Time    Filename/Handle
-------------------- ------ ------------------ --------------------
Backup Set           561    27-JAN-10
  Backup Piece       565    27-JAN-10          /u01/app/oracle/bak/PROD/rman/PROD_4sl4i2dh_1_1_20100127
Backup Set           562    27-JAN-10
  Backup Piece       566    27-JAN-10          /u01/app/oracle/bak/PROD/rman/PROD_4tl4i2e0_1_1_20100127
Backup Set           579    27-JAN-10
  Backup Piece       582    27-JAN-10          /u01/app/oracle/bak/PROD/rman/PROD_4ul4i2e3_1_1_20100127
Backup Set           580    27-JAN-10
  Backup Piece       583    27-JAN-10          /u01/app/oracle/bak/PROD/rman/PROD_4vl4i2e4_1_1_20100127
deleted backup piece
backup piece handle=/u01/app/oracle/bak/PROD/rman/PROD_4sl4i2dh_1_1_20100127 RECID=154 STAMP=709429681
deleted backup piece
backup piece handle=/u01/app/oracle/bak/PROD/rman/PROD_4tl4i2e0_1_1_20100127 RECID=155 STAMP=709429696
deleted backup piece
backup piece handle=/u01/app/oracle/bak/PROD/rman/PROD_4ul4i2e3_1_1_20100127 RECID=156 STAMP=709429699
deleted backup piece
backup piece handle=/u01/app/oracle/bak/PROD/rman/PROD_4vl4i2e4_1_1_20100127 RECID=157 STAMP=709429701
Deleted 4 objects

RMAN> list backup summary;

List of Backups
===============
Key     TY LV S Device Type Completion Time #Pieces #Copies Compressed Tag
------- -- -- - ----------- --------------- ------- ------- ---------- ---
872     B  F  A DISK        28-JAN-10       1       1       YES        TEST02
905     B  F  A DISK        28-JAN-10       1       1       NO         TAG20100128T000501

RMAN>
4. 一時的なアーカイブ・バックアップの作成

BACKUP … KEEP UNTIL …

RMAN> backup database tag 'TMPBAK' keep until time 'sysdate+3' restore point TMPBAK;

Starting backup at 28-JAN-10
current log archived

using channel ORA_DISK_1
backup will be obsolete on date 31-JAN-10  << 保存期間が三日間になった
archived logs required to recover from this backup will be backed up
channel ORA_DISK_1: starting compressed full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
... ...
piece handle=/u01/app/oracle/bak/PROD/rman/PROD_5dl4i4bi_1_1_20100128 tag=TMPBAK comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 28-JAN-10

RMAN> list backup summary;

List of Backups
===============
Key     TY LV S Device Type Completion Time #Pieces #Copies Compressed Tag
------- -- -- - ----------- --------------- ------- ------- ---------- ---
872     B  F  A DISK        28-JAN-10       1       1       YES        TEST02
905     B  F  A DISK        28-JAN-10       1       1       NO         TAG20100128T000501
1100    B  F  A DISK        28-JAN-10       1       1       YES        TMPBAK
1101    B  F  A DISK        28-JAN-10       1       1       YES        TMPBAK
1148    B  A  A DISK        28-JAN-10       1       1       YES        TMPBAK
1149    B  F  A DISK        28-JAN-10       1       1       YES        TMPBAK

RMAN>
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License