Results 1 to 5 of 5
  1. #1
    Join Date
    Aug 2003
    Posts
    1

    Unanswered: copy archive log files to another directory

    Would anyone have a script that will copy the archive log files from one directory to another when the directory reaches approximately 80% full.

    I work on a unix platform and unfortunately my unix scripting skills are very limited and I haven't had much luck finding a script that would somewhat come close to what I need.

    Any help would be appreciated.

    Thanks,
    LW

  2. #2
    Join Date
    Jul 2003
    Posts
    2,296
    what about something time-based and then g-zipping everything and moving wherever?

    Like every week all files get zipped (excluding the most recent) and then moved?
    - The_Duck
    you can lead someone to something but they will never learn anything ...

  3. #3
    Join Date
    May 2003
    Location
    Dublin, Ireland
    Posts
    44
    To find out how much disk space you have (in a file system not in the directory) you can use 'df -k' the fifth column shows percentage of disk usage. Use awk to extract the value of the 5th column. Get rid of the '%'. Check the value, if it is bigger then 80 do the move.

    Something like that (korn shell) assuming that you are in the source directory:

    fsize=`df -k . | awl '{getline; print $5}' | sed 's/%//'`
    if [ $fsize > 80 ]
    then
    mv *.arc /destination
    fi


    Mind your quotes.;-)

    Hope it helps,

    Jacek
    Last edited by sjacek; 08-28-03 at 11:33.

  4. #4
    Join Date
    Aug 2003
    Location
    SW Ohio
    Posts
    198

    Smile Re: copy archive log files to another directory

    Originally posted by Lorena
    Would anyone have a script that will copy the archive log files from one directory to another when the directory reaches approximately 80% full.

    I work on a unix platform and unfortunately my unix scripting skills are very limited and I haven't had much luck finding a script that would somewhat come close to what I need.

    Any help would be appreciated.

    Thanks,
    LW
    Another thought on this......

    Is your db up 24/7? Or do you bring it down on a regular basis? Do you have that much activity that it writes that many logs? Do you really need to keep them? Just asking the question so you don't beat yourself up holding onto stuff you don't need.

    My db is on an NT server. And I can bring it down nightly for cold backups. That way I only need the archive logs for a couple of days to be retained. That is why I have an MS Access DB that writes the export parameter file and then goes through and deletes the archive logs that are older than 5 days.

    I know you are talking UNIX, but you might be able to adapt this idea if you have a WinXX client that can access the paths. I'm putting in the delete archive chunk from my Access database. This just arbatrarily deletes the files that are five days old. You can add some functionality to this so that the WinXX client fires the access DB once an hour, the Access then uses the dir and filelen functions to see the amount of space taken by the log files and then filecopy to move the files to the new path and then deletes the original.

    I know, I know....you UNIX guys hate to be beholden to MS, but it might work for you instead of trying to beat together a script.

    Dim FilesName(7000) As String
    Dim Delfile As String
    Dim I As Integer
    Dim FileCount As Integer

    I = 1
    ChDir "D:\oracle\oradata\PROD\archive\"
    FilesName(I) = Dir("D:\oracle\oradata\PROD\archive\*.*")

    Do While FilesName(I) <> ""
    'Debug.Print FileName(I)
    I = I + 1
    FilesName(I) = Dir
    Loop

    FileCount = I
    I = 1

    Do Until I >= FileCount
    Delfile = "D:\oracle\oradata\PROD\archive\" & FilesName(I)
    If FileDateTime(Delfile) < Date - 5 Then
    Kill Delfile
    'Debug.Print I & ") " & Delfile & ": " & FileDateTime(Delfile)
    End If
    I = I + 1
    Loop
    Jim P.

    Supoorting Oracle, MSSQL7, Sybase 8, & Pervasive. Confusion Reigns

  5. #5
    Join Date
    Apr 2009
    Location
    Paraguay
    Posts
    1

    Announcing Delicious Library

    Everyone at Delicious Monster has been hard at work for the past several months on Delicious Library 1.5, a free upgrade that will be made available on April 29th
    delicious
    DELICIOUS BLOG: Announcing Delicious Library 1.5

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •