diff --git a/WebServer/DatabaseScripts/expdp_task.cmd b/WebServer/DatabaseScripts/expdp_task.cmd index 199ef5b..aea56c0 100644 --- a/WebServer/DatabaseScripts/expdp_task.cmd +++ b/WebServer/DatabaseScripts/expdp_task.cmd @@ -1,4 +1,4 @@ -REM $Id:$ +REM $Id$ REM REM Use Oracle data pump to export data, zip the dump file and then move it to the @@ -24,8 +24,37 @@ erase %logfile% expdp 'sys/fmdidgad@webmip as sysdba' parfile=parfile_data.expdp -cmd /c /wait "start /low zip %zipfile% %dmpfile% %logfile%" +cmd /c start "7-zip files - started %TIME%" /wait /low 7z a %zipfile% %dmpfile% %logfile% mkdir %destdir% move /Y %zipfile% %destdir% && erase %dmpfile% + + +REM +REM Remove the previous months matching backup +REM + +if %mm% LSS 10 ( +set tmpmm=%mm:~1,1% +) else ( +set tmpmm=%mm% +) + +set /a prevmm=%tmpmm% - 1 + +if %prevmm% LEQ 0 ( +set prevmm=112 +) else ( +set /a prevmm=100 + %prevmm% +) + +if %prevmm% EQU 112 ( +set /a yyyy=%yyyy% - 1 +) + +set prevmm=%prevmm:~1,2% +set prevzipfile=webmip_expdp_%yyyy%-%prevmm%-%dd%-%hr%.zip +set prevdestdir=%destbasedir%\%yyyy%-%prevmm% +echo erase %prevdestdir%\%prevzipfile% >> c:\erase_log.txt +erase %prevdestdir%\%prevzipfile%