Hello,
Does anyone having experience in backup script under Windows 2000 SP4. Maybe I whill have to post in the Windows forum, let me know if you think it is a dos or db2 problem.
I basicly would like to try to back all my databases using a single batch script and I have problem retrieving and interpreting the return code of the db2cmd command:
In this sample, I test the backup of 3 databaes. The two first doesn't exist but the DBPROD exist:
The result it that all databases in the loop will execute the command after the else, even the last backup is OK (return code 0).
Thanks in advance
Does anyone having experience in backup script under Windows 2000 SP4. Maybe I whill have to post in the Windows forum, let me know if you think it is a dos or db2 problem.
I basicly would like to try to back all my databases using a single batch script and I have problem retrieving and interpreting the return code of the db2cmd command:
In this sample, I test the backup of 3 databaes. The two first doesn't exist but the DBPROD exist:
Code:
for %%f in (TOTO,TRUP,DBPROD) do (
echo "--------------------------------------">>%backuplogfile%
echo "Backup start of %%f en date du %mydate%" >>%backuplogfile%
db2cmd /c /w /i db2 "BACKUP DATABASE %%f ONLINE USE TSM OPEN 1 SESSIONS WITH 2 BUFFERS BUFFER 1024 PARALLELISM 1 WITHOUT PROMPTING" >>%backuplogfile%
set retcode=%ERRORLEVEL%
if %ERRORLEVEL% GEQ 1 (
echo "ERROR: Backup Error backupDB2, RC=%retcode% " >>%backuplogfile%
echo "--------------------------------------">>%backuplogfile%
call c:\admin\blat\bckfailed.bat %%f %mydate%
set globalerror=1
else
echo "Backup of %%f en date du %mydate% OK !" >>%backuplogfile%
echo "--------------------------------------">>%backuplogfile%)
)
The result it that all databases in the loop will execute the command after the else, even the last backup is OK (return code 0).
Thanks in advance