Removing ARC files Automatically
DBAsupport.com Forums - Powered by vBulletin
Results 1 to 7 of 7

Thread: Removing ARC files Automatically

  1. #1
    Join Date
    Jan 2001
    Posts
    61

    Post

    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

  2. #2
    Join Date
    Jan 2001
    Posts
    61
    thhsths

  3. #3
    Join Date
    Oct 2000
    Location
    Saskatoon, SK, Canada
    Posts
    3,925
    Thanx
    Sam



    Life is a journey, not a destination!


  4. #4
    Join Date
    Jan 2001
    Posts
    61
    What about in WinNT Environment????

  5. #5
    Join Date
    Oct 2000
    Location
    Dallas:TX:USA
    Posts
    407
    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

  6. #6
    Join Date
    Jan 2001
    Posts
    61
    bjkhiuiyhui

  7. #7
    Join Date
    May 2001
    Posts
    13
    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
  •  



Click Here to Expand Forum to Full Width