' --------------------------------------------------------------------- ' Filename: archbackup.vbs ' Usage: C:> archbackup.vbs (schedule via Control-M or other scheduler) ' Purpose: Backup Oracle archive logs if the archive directory has less ' than X MB free space, and more than Y files to backup. ' Date: 09-Jul-2004 ' --------------------------------------------------------------------- Const ARCHLOGDIR = "C:\\ORACLE\\ARCH" ' Oracle Archlog Directory Const FREESPACE = 5120 ' Backup if less than X Meg free space on disk Const MAXFILES = 2 ' Backup if we have more than Y archived logs ' Don't change anything below this line dim FileSystemObj set FileSystemObj = CreateObject("Scripting.FileSystemObject") ' Check disk free space... dim drive, space set drive = FileSystemObj.GetDrive( left(ARCHLOGDIR, 1) ) space = drive.FreeSpace / 1024 / 1024 if space > FREESPACE then ' Wscript.echo space & " Meg Free Space on disk - no backup required" Wscript.Quit 0 end if ' Check number of archive files in directory... dim folder, files, numFiles set folder = FileSystemObj.GetFolder(ARCHLOGDIR) set files = folder.Files numFiles = files.Count if numFiles < MAXFILES then ' Wscript.echo numFiles & " files in archlog directory - no backup required" Wscript.Quit 0 end if ' Run ARCHLOG Backup Script... dim WshShell set WshShell = WScript.CreateObject("WScript.Shell") ' Wscript.echo "About to run the backup..." rc = WshShell.Run("rman cmdfile archlog.rcv", 1, true) ' Return backup status to Control-M... Wscript.Quit rc