Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Archive Log Deletion

Status
Not open for further replies.

NuWood

Programmer
Mar 14, 2002
44
GB
Hi

I have my database 8.1.7 in Archivelog mode and all works well. What I want to do under Windows 2000 is remove old archivelog files from the destination directory after about a week. This means that the directory always contains the archivelogs for the last week and this rolls on daya on day. I could of course trash the lot after backup but I would like to leave a few days worth.

This is easy in UNIX but how can I construct a deletion mechanism in Windows 2000. I leave some logs around in case a recovery situation arises so I don't have to pull the tape etc....

Regards
Andrew Wood
nuwoodlogo.jpg
 
I am sure there is probably a better way, but I have a batch file that does something like this for my exports. Before I run my latest export, I take the one that is a week old and delete it, take the one that is six days old and rename it to the name of a week old, etc. finally, after I do all the renames, I do the export. The following is the batch file that does all the deletes and renames and then finally calls the batch file that does the new export:

DEL /Q F:\Exports\SATR\DATA\export_SATR-7.dmp
REN F:\Exports\SATR\DATA\export_SATR-6.dmp export_SATR-7.dmp
DEL /Q F:\Exports\SATR\DATA\export_SATR-6.dmp
REN F:\Exports\SATR\DATA\export_SATR-5.dmp export_SATR-6.dmp
DEL /Q F:\Exports\SATR\DATA\export_SATR-5.dmp
REN F:\Exports\SATR\DATA\export_SATR-4.dmp export_SATR-5.dmp
DEL /Q F:\Exports\SATR\DATA\export_SATR-4.dmp
REN F:\Exports\SATR\DATA\export_SATR-3.dmp export_SATR-4.dmp
DEL /Q F:\Exports\SATR\DATA\export_SATR-3.dmp
REN F:\Exports\SATR\DATA\export_SATR-2.dmp export_SATR-3.dmp
DEL /Q F:\Exports\SATR\DATA\export_SATR-2.dmp
REN F:\Exports\SATR\DATA\export_SATR-1.dmp export_SATR-2.dmp
DEL /Q F:\Exports\SATR\DATA\export_SATR-1.dmp
REN F:\Exports\SATR\DATA\export_SATR.dmp export_SATR-1.dmp
CALL F:\Exports\SATR\manual_exp_SATR.bat

I have this batch file called from the servers AT command. Works well, maybe it will help you... Terry
**************************
* General Disclaimor - Please read *
**************************
Please make sure your post is in the CORRECT forum, has a descriptive title, gives as much detail to the problem as possible, and has examples of expected results. This will enable me and others to help you faster...
 
If you are using Rman for your backups, I think you could manage the deletes with a script similar to this:

run {
execute script alloc_1_tape;
backup
filesperset 20
format 'al_t%t_s%s_p%p'
archivelog from time 'sysdate-999' until time 'sysdate-3'
delete input;
execute script rel_1_tape;
}
 
I told you there would probably be a better way... Terry
**************************
* General Disclaimor - Please read *
**************************
Please make sure your post is in the CORRECT forum, has a descriptive title, gives as much detail to the problem as possible, and has examples of expected results. This will enable me and others to help you faster...
 
Thanks for both these suggestions. I can now sort out the archivelogs
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top