-
Do any one has any idea or script to remove the archive files automatically in WinNT as well as in Unix OS. I am taking backup everynight of all the archive files next morning I need to remove them manully??? If you have any tip to automate this process please do share with me.Here is the other information:
Datebase: Oracle8i R8.1.7
OS: Unix and some other databases are in WinNT
Database Size : 50GB(Approx)
Archive Log: True
-
-
Thanx
Sam
Life is a journey, not a destination!
-
What about in WinNT Environment????
-
Download Active Perl (for NT) from perl.com and write a simple script.
Here is a sample script I use. I learned a little bit of Perl just for this script purposes so this may not be the best script --
opendir(dirname, "d:/archive2/");
$count = 0;
$age = 0;
#---------------------------------------------------------------------
# Read one file at a time and delete if it is older than specified days
#---------------------------------------------------------------------
while ($file = readdir(dirname))
{
#-------------------------------------------------------------
# Prefix the file name with the directory Path otherwise
# it will not delete
#-------------------------------------------------------------
$file = "d:/archive2/" . $file;
$age = -M $file;
print "$file is $age days old\n";
#-------------------------------------------------------------
# Check if the file is at least 7 days old
#-------------------------------------------------------------
if ($age > 7)
{
#-----------------------------------------------------
# Delete the file
#-----------------------------------------------------
unlink($file);
print "Deleted file : $file\n";
$count = $count +1;
}
}
closedir dirname;
print "Total $count files were deleted. \n";
Rajeev Suri
-
-
For Windows NT, you could use the AT command. AT is the automatic task for windows. In a DOS windows type AT. (But verify in the NT Services to see if the service SCHEDULE is sarted. If not start it.
You could write a batch file to delete the archive file and then in the AT command, start the batch file every day.
Ex: batch file :
@echo off
del /q e:\oracle\oradata\(BD)\archive\*.*
ex : AT
AT 7:00 /every:su,m,t,w,th,f,s c:\delete.bat
that all for Windows NT.
Fugazi...
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|