backup database keep forever logs
April 13th, 2007
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:
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