This is what I was looking for but I got foll. errors.
rmandel.rcv
--------------
run {
allocate channel d1 for delete type disk;
change archivelog until time 'SYSDATE-1' delete;
release channel d1;
resync catalog;
}
RMAN-00558: error encountered while parsing input commands
RMAN-01005: syntax error: found "for": expecting one of: "name, type"
RMAN-01007: at line 2 column 21 file: rmandel.rcv
Also, can I call rmandel.rcv from another RMAN .rcv file?
Thanks,
Sam
------------------------
To handle yourself, use your head. To handle others, use your heart
allocate channel for maintenance type disk;
crosscheck backup of archivedlogs completed between 'sysdate - 30' and 'sysdate - 7';
delete expired backup;
release channel;
exit;
In 8i, that still has be run from RMAN> command prompt. In 9i, you can do it from script.
Have you actually tried? I did, and it's the way as Oracle says:
Purpose
To determine whether backups stored on disk or tape exist. Backups are either backup sets or media-managed proxy copies.
The crosscheck command checks only backup sets marked AVAILABLE or EXPIRED, either by examining the backup pieces on disk when the channel is type disk, or by querying the media manager when the channel is type 'sbt_tape'. It only processes backups created on the specified channel.
RMAN does not delete any backup pieces that it is unable to find, but updates their repository records to EXPIRED status. If some backup pieces were erroneously marked as EXPIRED, for example, because the media manager was misconfigured, then after ensuring that the files really do exist in the media manager, run the crosscheck backup command again to restore those files to AVAILABLE status.
See Also:
"Maintaining the RMAN Repository".
Requirements
Execute crosscheck backup only at the RMAN prompt.
Allocate a maintenance channel before issuing crosscheck backup.
You don't have to put "d1" after allocate channel, just do the following:
run {
allocate channel for delete type disk;
change archivelog until time 'SYSDATE-7' delete;
release channel;
}
I get foll. error if I do not give channel id.
RMANN> run {
allocate channel for delete type disk;
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-00558: error encountered while parsing input commands
RMAN-01005: syntax error: found "for": expecting one of: "channel_id, double-quoted-string, identifier, single-quoted-string"
RMAN-01007: at line 2 column 18 file: standard input
Thanks,
Sam
------------------------
To handle yourself, use your head. To handle others, use your heart
$ cat /u01/scripts/cleanup_rman_arch_test2.rcv
allocate channel for delete type disk;
change archivelog until time 'SYSDATE-7' delete;
release channel;
run {
allocate channel d1 type disk;
sql 'alter system archive log current';
backup
format 'e:\backup\%d_%s_%p_%t.1al'
archivelog all;
release channel d1;
resync catalog;
}
allocate channel for maintenance type disk;
change archivelog until time 'sysdate-1' delete;
Thanks everybody.
Sam
------------------------
To handle yourself, use your head. To handle others, use your heart
Bookmarks