Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

RMAN: Delete obsolete backups but not obsolete archivelogs

1,590 views
Skip to first unread message

hea...@googlemail.com

unread,
May 6, 2009, 3:44:58 PM5/6/09
to
Hi all,

I want to delete only obsolete backups and not archivelogs due to the
fact that we have a 2 stage backup process, first to disk, then to
tape and I have 2 archive log locations, 1 on SAN and another on local
disk, so I wouldn't want to put all my eggs in one basket and keep my
backed up archive logs on the local disk in case there is a failure
before they get off to tape and in the case the tape backup fails,
because my RMAN disk backup area is on local disk.

I dont want to set recovery window to +7 days because I cant keep this
many backups on disk due to the size, although I can keep the logs.

I want to handle the archived logs myself by using something like:
delete archivelog all until 'sysdate-7'

Here is my backup script:

run
{
crosscheck archivelog all;
crosscheck backup;
crosscheck copy;
backup database;
backup archivelog all not backed up 2 times keep until time 'SYSDATE
+7';
restore database validate;
delete noprompt archivelog until time 'SYSDATE-7';
delete noprompt obsolete;
sql "create pfile from spfile";
sql "alter database backup controlfile to trace";
}

If anyone knows any way of doing this just using RMAN please let me
know.

Thanks

Vinni

joel garry

unread,
May 6, 2009, 7:51:30 PM5/6/09
to
On May 6, 12:44 pm, hea...@googlemail.com wrote:

> If anyone knows any way of doing this just using RMAN please let me
> know.
>
> Thanks
>
> Vinni

Version? Catalog?

jg
--
@home.com is bogus.
Oops, they did it again:
http://www3.signonsandiego.com/stories/2009/may/06/1n6ucsd002342-ucsd-makes-admissions-error-8211-aga/?uniontrib

Message has been deleted

hea...@googlemail.com

unread,
May 7, 2009, 6:01:40 PM5/7/09
to

> Version?  Catalog?


9.2.0.8, no catalog, and 11g nocatalog. The above rman script is not
9i specific due to this line:

backup archivelog all not backed up 2 times keep until time 'SYSDATE

+7'; which on my 9i database I have as:

backup archivelog all not backed up 2 times; because 9i doesn't allow
keep to be set for archive logs nor does it understand the until time
statement its needs 'completed before' instead.

I know in 11g there are some special archive conditions that can be
set in the rman configure options however my production and test
databases are all 9i, I only use 11 when testing some script etc on my
laptop.

regards
Vin

Message has been deleted

johnb...@sbcglobal.net

unread,
May 7, 2009, 6:45:39 PM5/7/09
to

I have a similar setup where I want to keep around on disk archivelogs
more than the delete obsolete wants to give you.

Many people handle this ( as I do ) outside of rman by hiding away on
disk in a different directory the archivelogs that rman would
otherwise whack.

hea...@googlemail.com

unread,
May 8, 2009, 12:31:26 PM5/8/09
to
Thanks John, ill better put myself a shell script together then.
I'll get this posted on metalink as a product enhancement request
after I've read what later rman versions do.

Regards
Vin

johnb...@sbcglobal.net

unread,
May 8, 2009, 6:42:06 PM5/8/09
to
On May 8, 12:31 pm, "hea...@googlemail.com" <hea...@googlemail.com>
wrote:

snip

> Thanks John,  ill better put myself a shell script together then.
> I'll get this posted on metalink as a product enhancement request
> after I've read what later rman versions do.

My script does the pretty basic invoking of sqlplus and spooling a
file ... then another step to move the archivelogs elsewhere ...
aka ... stuff like this ...

export ORACLE_SID=???
rm -f /tmp/spool_obsolete_archivelogs.txt
sqlplus / as sysdba << EOF
@spool_???_obsolete_archivelogs.sql
exit;
EOF
cp spool_obsolete_archivelogs.txt /tmp/spool_obsolete_archivelogs.txt
echo " List is ..."
cat /tmp/spool_obsolete_archivelogs.txt

$ more spool_????_obsolete_archivelogs.sql
set ECHO OFF
set TERMOUT OFF
set FEEDBACK OFF
set VERIFY OFF
set PAGESIZE 0
set HEADDING OFF
spool spool_obsolete_archivelogs.txt
select fname from v$backup_files where file_type='ARCHIVED LOG' and
status='AVAI
LABLE' and obsolete='YES';
spool off


0 new messages