Copy Archive Log Files to Another Directory 

Question:
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.

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

Have a Oracle Question
Do you have an Oracle Question?

Oracle Books
Oracle Certification, Database Administration, SQL, Application, Programming Reference Books

Oracle Home
Oracle Database, SQL, Application, Programming Tips

All the site contents are Copyright © www.erpgreat.com and the content authors. All rights reserved.
All product names are trademarks of their respective companies.
The site www.erpgreat.com is not affiliated with or endorsed by any company listed at this site.
Every effort is made to ensure the content integrity.  Information used on this site is at your own risk.
 The content on this site may not be reproduced or redistributed without the express written permission of
www.erpgreat.com or the content authors.