I have a pretty involved script that performs Oracle data pump exports each night. It uses the Run method in the WScript.Shell object to run the oracle export command. The export runs and outputs my Oracle database to a file called FULLEXPORT.DMP.
Before the script runs the oracle export, it does two things:
1. Delete FULLEXPORT_OLD.DMP.
2. Rename yesterday's file to FULLEXPORT_OLD.DMP
This way i can always hold on to the last 2 backups (these files are zipped and uploaded to an FTP server later in the script every day for tape backup).
The problem: The creation date of FULLEXPORT.DMP and FULLEXPORT_OLD.DMP never change, but the modified date does.
How is this possible, as the file gets created one day, renamed the next, and finally deleted on the third day. here is the code i use to do my renames/deletes, followed by the export (there are some references to functions that do not pertain to my question):
Any ideas? Thanks in advance.
Thanks,
Andrew
Hard work often pays off over time, but procrastination pays off right now!
Before the script runs the oracle export, it does two things:
1. Delete FULLEXPORT_OLD.DMP.
2. Rename yesterday's file to FULLEXPORT_OLD.DMP
This way i can always hold on to the last 2 backups (these files are zipped and uploaded to an FTP server later in the script every day for tape backup).
The problem: The creation date of FULLEXPORT.DMP and FULLEXPORT_OLD.DMP never change, but the modified date does.
How is this possible, as the file gets created one day, renamed the next, and finally deleted on the third day. here is the code i use to do my renames/deletes, followed by the export (there are some references to functions that do not pertain to my question):
Code:
'clean up old export files
On Error Resume Next
objFSO.DeleteFile(exportDir & dumpFilePrefix & "-OLD" & dumpFileSuffix)
On Error GoTo 0
If objFSO.FileExists(exportDir & dumpFilePrefix & "-OLD" & dumpFileSuffix) Then
errors = 1
End If
checkForErrors "Delete of oldest dump file ", dumpFilePrefix & "-OLD" & dumpFileSuffix, errors, NonFatalError
If objFSO.FileExists(exportDir & dumpFilePrefix & dumpFileSuffix) Then
On Error Resume Next
objFSO.MoveFile exportDir & dumpFilePrefix & dumpFileSuffix, exportDir & dumpFilePrefix & "-OLD" & dumpFileSuffix
On Error GoTo 0
End If
If Not objFSO.FileExists(exportDir & dumpFilePrefix & "-OLD" & dumpFileSuffix) Then
errors = 1
End If
checkForErrors "Rename of previous dump file to '-old'",null,errors, NonFatalError
If objFSO.FileExists(exportDir & dumpFilePrefix & dumpFileSuffix) Then
errors = 1
checkForErrors dumpFilePrefix & dumpFileSuffix & " exists. Cannot perform Oracle Export.", null,errors, FatalError
End If
'perform oracle export
exportCmd = "C:\oracle\product\10.2.0\db_1\bin\expdp.exe username/password@oracleserver parfile=" & parfileDir & parFilename
logOutput = logOutput & getLogHeader & "About to start Oracle export."
errors = oShell.Run (exportCmd, 0, 1)
checkForErrors "Oracle export",null,errors, FatalError
Any ideas? Thanks in advance.
Thanks,
Andrew
Hard work often pays off over time, but procrastination pays off right now!