Consultor Eletrônico



Kbase P6372: Process automation using a batch file
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   03/11/2005
Status: Unverified

GOAL:

Stopping and Restarting a Webspeed broker connected to a database from a batch file

GOAL:

Stopping and Restarting database server from a batch file

GOAL:

How to use a batch file to automate a back up using probkup

GOAL:

How to use a batch file to automate restoring a database using prorest

GOAL:

How to test if a database has been stopped or started in a batch file

FACT(s) (Environment):

Windows 32 Intel

FIX:

This is a sample batch file:

rem Establish the environmental variables
set dlc=C:\program files\progress
set path=%dlc%\bin;%path%

echo stop the WSbroker
call wtbman -name WSbroker1 -stop

pause

echo Stop the DB server -by performs an unconditional batch shutdown
call proshut sports -by

pause

echo Test it to see if it has stopped
echo 64 means that it is starting
echo 6 means it is Running
echo 0 means it has stopped

:busytest
call proutil sports -C BUSY
echo %errorlevel%
echo end of first busy test
if (%errorlevel%) == 64 goto err64
if (%errorlevel%) == 6 goto err6
goto err0

:err64
echo err64
goto busytest

:err6
echo err6
goto busytest

:err0
echo err0
echo do backup
call probkup sports sports.bak
pause

echo do restore
call prorest sports sports.bak < yes.txt
pause

echo Restarting the database
pause
call proserve sports -H localhost -S portnumber -N TCP
pause

echo Verify that it has started
:starttest
_proutil sports -C BUSY
echo %errorlevel%
pause
echo %errorlevel%
if (%errorlevel%) == 0 then goto grr02
if (%errorlevel%) == 6 goto grr00
if (%errorlevel%) == 64 goto grr642
goto grr00

:grr642
echo err642
goto starttest

:grr02
echo grr02
goto starttest

:grr00
echo Restart WSbroker
pause
call wtbman -name WSbroker1 -start