Thinking Out Loud

January 27, 2016

Why use KEEP backup?

Filed under: 11g,RMAN — mdinh @ 1:30 am

Question which may have been asked.

For 1 time backup to migrate/clone database, KEEP backup does not affect retention policy and not backed up 1 times clause.

Imagine the consequences for deleting 1 off backup which has archivelog backup and the main scripts use not backed up 1-2 times clause which could mean no archivelog for subsequent backups.

RMAN> list archivelog all;

using target database control file instead of recovery catalog
List of Archived Log Copies for database with db_unique_name HAWKLAS
=====================================================================

Key     Thrd Seq     S Low Time
------- ---- ------- - --------------------
5067    1    806     A 2016-JAN-21 07:45:48
        Name: /oradata/fra/HAWKLAS/archivelog/2016_01_21/o1_mf_1_806_cb1zcp8y_.arc

5068    1    807     A 2016-JAN-21 07:47:01
        Name: /oradata/fra/HAWKLAS/archivelog/2016_01_21/o1_mf_1_807_cb1zd4ns_.arc

5070    1    808     A 2016-JAN-21 07:47:16
        Name: /oradata/fra/HAWKLAS/archivelog/2016_01_22/o1_mf_1_808_cb4tyo1y_.arc

5071    1    809     A 2016-JAN-22 09:50:11
        Name: /oradata/fra/HAWKLAS/archivelog/2016_01_22/o1_mf_1_809_cb4tytsp_.arc

5073    1    810     A 2016-JAN-22 09:50:18
        Name: /oradata/fra/HAWKLAS/archivelog/2016_01_26/o1_mf_1_810_cbh5st68_.arc

5072    1    811     A 2016-JAN-26 07:56:40
        Name: /oradata/fra/HAWKLAS/archivelog/2016_01_26/o1_mf_1_811_cbh5sz08_.arc

5074    1    812     A 2016-JAN-26 07:56:45
        Name: /oradata/fra/HAWKLAS/archivelog/2016_01_26/o1_mf_1_812_cbh7mc9h_.arc


RMAN> backup archivelog sequence 806 KEEP UNTIL TIME 'ADD_MONTHS(SYSDATE,1)' tag ARC_KEEP
2> ;

Starting backup at 2016-JAN-26 17:19:57
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=148 device type=DISK
backup will be obsolete on date 2016-FEB-26 17:19:57
archived logs required to recover from this backup will be backed up
channel ORA_DISK_1: starting archived log backup set
channel ORA_DISK_1: specifying archived log(s) in backup set
input archived log thread=1 sequence=806 RECID=5067 STAMP=901698422
channel ORA_DISK_1: starting piece 1 at 2016-JAN-26 17:19:58
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03009: failure of backup command on ORA_DISK_1 channel at 01/26/2016 17:19:59
ORA-19811: cannot have files in DB_RECOVERY_FILE_DEST with keep attributes

RMAN> backup archivelog sequence 806 format '/tmp/U%' KEEP UNTIL TIME 'ADD_MONTHS(SYSDATE,1)' tag ARC_KEEP;

Starting backup at 2016-JAN-26 17:20:26
using channel ORA_DISK_1
backup will be obsolete on date 2016-FEB-26 17:20:26
archived logs required to recover from this backup will be backed up
channel ORA_DISK_1: starting archived log backup set
channel ORA_DISK_1: specifying archived log(s) in backup set
input archived log thread=1 sequence=806 RECID=5067 STAMP=901698422
channel ORA_DISK_1: starting piece 1 at 2016-JAN-26 17:20:26
channel ORA_DISK_1: finished piece 1 at 2016-JAN-26 17:20:27
piece handle=/tmp/U% tag=ARC_KEEP comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 2016-JAN-26 17:20:27

RMAN> backup archivelog sequence 806 not backed up 1 times tag ARC_BKUP;

Starting backup at 2016-JAN-26 17:21:02
using channel ORA_DISK_1
channel ORA_DISK_1: starting archived log backup set
channel ORA_DISK_1: specifying archived log(s) in backup set
input archived log thread=1 sequence=806 RECID=5067 STAMP=901698422
channel ORA_DISK_1: starting piece 1 at 2016-JAN-26 17:21:02
channel ORA_DISK_1: finished piece 1 at 2016-JAN-26 17:21:03
piece handle=/oradata/fra/HAWKLAS/backupset/2016_01_26/o1_mf_annnn_ARC_BKUP_cbj6vyl7_.bkp tag=ARC_BKUP comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 2016-JAN-26 17:21:03

Starting Control File and SPFILE Autobackup at 2016-JAN-26 17:21:04
piece handle=/u01/app/oracle/product/11.2.0/dbhome_1/dbs/HAWK_c-3130551611-20160126-02 comment=NONE
Finished Control File and SPFILE Autobackup at 2016-JAN-26 17:21:07

RMAN> backup archivelog sequence 807 tag ARC_BACKUP;

Starting backup at 2016-JAN-26 17:21:30
using channel ORA_DISK_1
channel ORA_DISK_1: starting archived log backup set
channel ORA_DISK_1: specifying archived log(s) in backup set
input archived log thread=1 sequence=807 RECID=5068 STAMP=901698436
channel ORA_DISK_1: starting piece 1 at 2016-JAN-26 17:21:30
channel ORA_DISK_1: finished piece 1 at 2016-JAN-26 17:21:31
piece handle=/oradata/fra/HAWKLAS/backupset/2016_01_26/o1_mf_annnn_ARC_BACKUP_cbj6wt9y_.bkp tag=ARC_BACKUP comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 2016-JAN-26 17:21:31

Starting Control File and SPFILE Autobackup at 2016-JAN-26 17:21:31
piece handle=/u01/app/oracle/product/11.2.0/dbhome_1/dbs/HAWK_c-3130551611-20160126-03 comment=NONE
Finished Control File and SPFILE Autobackup at 2016-JAN-26 17:21:34

RMAN> backup archivelog sequence 807 not backed up 1 times;

Starting backup at 2016-JAN-26 17:21:43
using channel ORA_DISK_1
skipping archived log of thread 1 with sequence 807; already backed up
Finished backup at 2016-JAN-26 17:21:43

RMAN> list backup of archivelog all summary;


List of Backups
===============
Key     TY LV S Device Type Completion Time      #Pieces #Copies Compressed Tag
------- -- -- - ----------- -------------------- ------- ------- ---------- ---
1360    B  A  A DISK        2016-JAN-26 17:20:27 1       1       NO         ARC_KEEP
1361    B  A  A DISK        2016-JAN-26 17:21:02 1       1       NO         ARC_BKUP
1363    B  A  A DISK        2016-JAN-26 17:21:30 1       1       NO         ARC_BACKUP

RMAN> list backup of archivelog sequence 806;


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


BS Key  Size       Device Type Elapsed Time Completion Time
------- ---------- ----------- ------------ --------------------
1360    27.00K     DISK        00:00:01     2016-JAN-26 17:20:27
        BP Key: 1505   Status: AVAILABLE  Compressed: NO  Tag: ARC_KEEP
        Piece Name: /tmp/U%

  List of Archived Logs in backup set 1360
  Thrd Seq     Low SCN    Low Time             Next SCN   Next Time
  ---- ------- ---------- -------------------- ---------- ---------
  1    806     6645495    2016-JAN-21 07:45:48 6645595    2016-JAN-21 07:47:01

BS Key  Size       Device Type Elapsed Time Completion Time
------- ---------- ----------- ------------ --------------------
1361    27.00K     DISK        00:00:00     2016-JAN-26 17:21:02
        BP Key: 1506   Status: AVAILABLE  Compressed: NO  Tag: ARC_BKUP
        Piece Name: /oradata/fra/HAWKLAS/backupset/2016_01_26/o1_mf_annnn_ARC_BKUP_cbj6vyl7_.bkp

  List of Archived Logs in backup set 1361
  Thrd Seq     Low SCN    Low Time             Next SCN   Next Time
  ---- ------- ---------- -------------------- ---------- ---------
  1    806     6645495    2016-JAN-21 07:45:48 6645595    2016-JAN-21 07:47:01

RMAN> list backup of archivelog sequence 806 summary;


List of Backups
===============
Key     TY LV S Device Type Completion Time      #Pieces #Copies Compressed Tag
------- -- -- - ----------- -------------------- ------- ------- ---------- ---
1360    B  A  A DISK        2016-JAN-26 17:20:27 1       1       NO         ARC_KEEP
1361    B  A  A DISK        2016-JAN-26 17:21:02 1       1       NO         ARC_BKUP

RMAN>

OOPS! Did you see my errors?

Advertisements

Leave a Comment »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Create a free website or blog at WordPress.com.

%d bloggers like this: