If you want to keep some backups forever, you maybe tried
RMAN> backup database keep forever logs; Starting backup at 13.04.2007 13:58:04 ... backup will never be obsolete archived logs required to recover from this backup will expire when this backup expires ... Finished backup at 13.04.2007 13:58:23
but the problem is that the archivelogs to recover this backup at any time after the backup will NEVER be obsolete.
You could well try the NOLOGS option, but this requires you to take the database in the MOUNT state.
RMAN> backup database keep forever nologs; Starting backup at 13.04.2007 14:06:36 ... backup will never be obsolete archived logs required to recover from this backup will not be kept ... Finished backup at 13.04.2007 14:07:25
This is fine if you can stop your database. But you probably wants online backup. What’s next?
Ok, here is the way to go. You do your online backup, then you mark what you want to keep !
First I backup the old archivelogs, because I do not need to keep those yet.
RMAN> backup archivelog all; Starting backup at 13.04.2007 14:10:00 ... Finished backup at 13.04.2007 14:10:08
Now I do a backup plus archivelog (with a tag for simplicity)
RMAN> backup database tag backuplsc plus archivelog tag backuplsc; Starting backup at 13.04.2007 14:10:42 ... Finished backup at 13.04.2007 14:11:00
Now I can mark my backup as keep
RMAN> change backup tag backuplsc keep forever; ... keep attributes for the backup are changed backup will never be obsolete backup set key=405 RECID=116 STAMP=619798257 keep attributes for the backup are changed backup will never be obsolete backup set key=406 RECID=117 STAMP=619798260
Now if I do a delete obsolete, it will never delete my backup.
RMAN> backup database plus archivelog Starting backup at 13.04.2007 14:16:46 ... Finished backup at 13.04.2007 14:17:10 RMAN> delete noprompt obsolete; RMAN retention policy will be applied to the command RMAN retention policy is set to redundancy 1 ... Deleting the following obsolete backups and copies: ... Deleted 7 objects RMAN> list backup summary; List of Backups =============== Key TY LV S Device Type Completion Time ------- -- -- - ----------- ------------------- #Pieces #Copies Compressed Tag ------- ------- ---------- --- ... 405 B F A DISK 13.04.2007 14:10:57 1 1 YES BACKUPLSC 406 B F A DISK 13.04.2007 14:11:00 1 1 YES BACKUPLSC ...
Or you could use the Archiving feature of the Backup prOxy Server (BOS) solution and avoid all those headaches 🙂
is it related to RMAN?
This doesn’t appear to work; RMAN won’t mark a copy that includes archive logs KEEP.
with which version did you try?
I’ve tried this in 10.2.0.3.0. It produces the following error: –
RMAN> change backup tag LNACBP01_20070430_110744 keep forever;
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-00558: error encountered while parsing input commands
RMAN-01009: syntax error: found “;”: expecting one of: “consistent, logs, nologs”
RMAN-01007: at line 1 column 56 file: standard input
RMAN> change backup tag LNACBP01_20070430_110744 keep forever nologs;
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=89 devtype=DISK
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of KEEP command at 05/01/2007 15:54:31
RMAN-06530: CHANGE … KEEP not supported for backup set which contains archive logs
RMAN>
This is a real pain, as I know that the backup set contains enough redo to make for a consistent restore which will give me my month end position.
this is strange, either I made a copy paste error or there is something magic in the site where I tried, but it seems it works with NOLOGS.
Ok, here I try again
so the KEEP FOREVER NOLOGS seems to work with backup of archivelogs
How do you restore that backup once you’ve taken other backups sometime later?
something like
restore database until sequence 14 thread 1
recover database until sequence 14 thread 1
where 13 is your highest saved redo log.
should work
Another quick question as I can’t find the answer. Anyway to change the actual tag name of the backup? I.E. change TAG20070613T000231 to something like BKUP_06132007_KEEP_30?
backup database tag BKUP_06132007_KEEP_30
?
No, I meant for a backup that is already completed. Backups run nightly, and sometimes the next day, the proj mgr wants to keep the previous nights backup and rename it.
Sorry, I do not know how to change the tag 🙁
Starting backup at 13.04.2007 13:58:04
How do you get RMAN to include the time ? (like you have)
I only get the date in “Starting backup at 13.04.2007” !…
Thank you,
NLS_DATE_FORMAT=’YYYY-MM-DD HH24:MI:SS’
either OS variable or registry entry depending on your os
There must be something magical at the site you did this, because it most definitely does not work for me on 10.2.0.3 either:
$rman target / nocatalog
Recovery Manager: Release 10.2.0.3.0 - Production on Tue Aug 5 21:37:22 2008
Copyright (c) 1982, 2005, Oracle. All rights reserved.
connected to target database: ORASID (DBID=204994610)
using target database control file instead of recovery catalog
RMAN> backup archivelog all tag KEEP_ME_PLEASE;
Starting backup at 05-AUG-08
current log archived
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=1023 devtype=DISK
allocated channel: ORA_DISK_2
channel ORA_DISK_2: sid=1064 devtype=DISK
skipping archive log file /FRA/archivelog/2008_06_18/o1_mf_1_1378_y8JAYjEt_.arc; already backed up 1 time(s)
[...snipped...]
skipping archive log file /FRA/archivelog/2008_08_05/o1_mf_1_1411_z4nRigt3_.arc; already backed up 1 time(s)
channel ORA_DISK_1: starting compressed archive log backupset
channel ORA_DISK_1: specifying archive log(s) in backup set
input archive log thread=1 sequence=1412 recid=1399 stamp=661988258
channel ORA_DISK_1: starting piece 1 at 05-AUG-08
channel ORA_DISK_1: finished piece 1 at 05-AUG-08
piece handle=/FRA/backupset/2008_08_05/o1_mf_annnn_KEEP_ME_PLEASE_z4nhfQSB_.bkp tag=KEEP_ME_PLEASE comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:02
Finished backup at 05-AUG-08
Starting Control File and SPFILE Autobackup at 05-AUG-08
piece handle=/FRA/autobackup/2008_08_05/o1_mf_s_661988261_z4nhkEYn_.bkp comment=NONE
Finished Control File and SPFILE Autobackup at 05-AUG-08
RMAN> change backup tag KEEP_ME_PLEASE keep forever nologs;
using channel ORA_DISK_1
using channel ORA_DISK_2
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of KEEP command at 08/05/2008 21:37:58
RMAN-06530: CHANGE ... KEEP not supported for backup set which contains archive logs
RMAN> delete backup tag KEEP_ME_PLEASE;
using channel ORA_DISK_1
using channel ORA_DISK_2
List of Backup Pieces
BP Key BS Key Pc# Cp# Status Device Type Piece Name
------- ------- --- --- ----------- ----------- ----------
71 71 1 1 AVAILABLE DISK /FRA/backupset/2008_08_05/o1_mf_annnn_KEEP_ME_PLEASE_z4nhfQSB_.bkp
Do you really want to delete the above objects (enter YES or NO)? yes
deleted backup piece
backup piece handle=/FRA/backupset/2008_08_05/o1_mf_annnn_KEEP_ME_PLEASE_z4nhfQSB_.bkp recid=71 stamp=661988260
Deleted 1 objects
RMAN> quit
Recovery Manager complete.
My brief trip to the Backup and Recovery Advanced User’s Guide seems to indicate that the only way to accomplish this is from the consistent mount state: Keeping a Long-Term Backup: Example
@Philip,
I am fairly certain you need to be using a recovery catalog to use KEEP FOREVER. I’ve read it in Oracle documentation, but cannot find it at the moment.
Hi
I hope somebody will visit this page again.
Oracle 10.2.0.4, standard edition. It seems it is not possible to keep backupsets that contain archived logs?
RMAN> change backup tag KEEP_ME_PLEASE keep forever nologs;
using channel ORA_DISK_1
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of KEEP command at 10/26/2008 19:21:04
RMAN-06530: CHANGE … KEEP not supported for backup set which contains archive logs
RMAN> change backup tag MonthlyARC20111206032000 keep UNTIL TIME = ‘SYSDATE+365’ NOLOGS;
using channel ORA_DISK_1
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of KEEP command at 12/06/2011 03:20:43
RMAN-06530: CHANGE … KEEP not supported for backup set which contains archive logs
Works in 11.2.0.3 (Its quite late, but it might help someone).
Taking backup to disk
——————————
RMAN> backup database plus archivelog
tag freshinstall_10182013
format ‘/home/oracle/dba/vick/tickets/%u’;
Starting backup at 10/18/2013 02:34:09 am
current log archived
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=1 RECID=1 STAMP=829090040
input archived log thread=1 sequence=2 RECID=2 STAMP=829100605
input archived log thread=1 sequence=3 RECID=3 STAMP=829100606
input archived log thread=1 sequence=4 RECID=4 STAMP=829100939
input archived log thread=1 sequence=5 RECID=5 STAMP=829100995
input archived log thread=1 sequence=6 RECID=6 STAMP=829101112
input archived log thread=1 sequence=7 RECID=7 STAMP=829101163
input archived log thread=1 sequence=8 RECID=8 STAMP=829101251
input archived log thread=1 sequence=9 RECID=9 STAMP=829101283
input archived log thread=1 sequence=10 RECID=10 STAMP=829103649
channel ORA_DISK_1: starting piece 1 at 10/18/2013 02:34:09 am
channel ORA_DISK_1: finished piece 1 at 10/18/2013 02:34:16 am
piece handle=/home/oracle/dba/vick/tickets/07omm7h1 tag=FRESHINSTALL_10182013 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:07
Finished backup at 10/18/2013 02:34:16 am
Starting backup at 10/18/2013 02:34:16 am
using channel ORA_DISK_1
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00001 name=/u01/oradata/oraguru/system01.dbf
input datafile file number=00002 name=/u02/oradata/oraguru/sysaux01.dbf
input datafile file number=00005 name=/u01/oradata/oraguru/example01.dbf
input datafile file number=00003 name=/u02/oradata/oraguru/undotbs01.dbf
input datafile file number=00004 name=/u01/oradata/oraguru/users01.dbf
channel ORA_DISK_1: starting piece 1 at 10/18/2013 02:34:17 am
channel ORA_DISK_1: finished piece 1 at 10/18/2013 02:34:32 am
piece handle=/u01/oracle/product/fast_recovery_area/ORAGURU/backupset/2013_10_18/o1_mf_nnndf_TAG20131018T023416_961om95d_.bkp tag=TAG20131018T023416 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:15
Finished backup at 10/18/2013 02:34:32 am
Starting backup at 10/18/2013 02:34:32 am
current log archived
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=11 RECID=11 STAMP=829103672
channel ORA_DISK_1: starting piece 1 at 10/18/2013 02:34:32 am
channel ORA_DISK_1: finished piece 1 at 10/18/2013 02:34:33 am
piece handle=/home/oracle/dba/vick/tickets/09omm7ho tag=FRESHINSTALL_10182013 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 10/18/2013 02:34:33 am
Starting Control File and SPFILE Autobackup at 10/18/2013 02:34:33 am
piece handle=/u01/oracle/product/fast_recovery_area/ORAGURU/autobackup/2013_10_18/o1_mf_s_829103673_961omsmn_.bkp comment=NONE
Finished Control File and SPFILE Autobackup at 10/18/2013 02:34:34 am
now Keeping it for some time
—————————————
RMAN> change backup tag freshinstall_10182013 keep until time ’10/29/2013 5:30:00 pm’;
using channel ORA_DISK_1
keep attributes for the backup are changed
backup will be obsolete on date 10/29/2013 05:30:00 pm
backup set key=5 RECID=5 STAMP=829103653
keep attributes for the backup are changed
backup will be obsolete on date 10/29/2013 05:30:00 pm
backup set key=7 RECID=7 STAMP=829103672
Question: Why did the backup-piece and the autobackup not go to /home/oracle/dba/vick/tickets ? I thought the FORMAT should have taken care of it.