Re: AW: Oracle Agent
2015-10-04 17:28:41
Here is a script I've found in another Newsgroup. It helps to automatically
delete your old backups.
Timo Kilchenmann schrieb:
There is no logic in RMAN for
> automatically deleting old backups. So you must write your own scripts
which
> do this (by RMAN commands).
>
Subject: A SQL script to delete old backup with rman
RDBMS Version: 8.1.5
Operating System and Version: Sun Solaris 2.6 , AIX 4.3
A SQL script to delete old backup with rman
Normally, if You have to delete old backup from rman catalog, You have to
issue the rman-command 'list backup' in order to find the backuppiece and
the
command 'change backuppiece xxxx delete'.
In order to avoid to manually extract a lot of backuppiece and delete it,
you
can use this simple script.
This SQL script must be executed with sqlplus connected to rman database:
col handle for a30
set echo off
set verify off
set feedback off
set heading off
set pagesize 0
spo delete_backup.cmd;
select 'connect target;' from dual;
select 'allocate channel for delete type ''SBT_TAPE'';' from dual;
select 'change backuppiece '''||handle||''' delete;'
from rc_backup_piece a, rc_database b
where a.db_key=b.db_key and
status ='A' and
completion_time < SYSDATE-20 and
b.name='MYDB';
select 'release channel;' from dual;
spool off;
exit;
As you can see, it dynamically generate another script ready to be run
with
rman. You have only to customize the date (SYSDATE-20) and the DB-name
(MYDB). After execution of rman you should execute also the script
prgrmanc.sql, but remember that in some version of this script there is a
bug.
Best regards.
Guido Vetere.
--
With Regards / Mit freundlichen Gruessen
With Regards / Mit freundlichen Gruessen
Leopold Hameder
c.a.r.u.s. InformationsSysteme AG
Borsteler Chaussee 49
22453 Hamburg
Tel.: +49 40 514 35 - 0
Fax: +49 40 514 35 - 111
E-Mail: mailto:Leopold.Hameder AT carus DOT de
WWW: http://www.carus.de
|
|
|