I'm trying to put together a script that will run once a week at remote sites to keep the DB in shape, can anyone recommend the correct order to run the DB utilities?
Here's what I've written so far:
@echo off
del c:\arcdb*.previous
rename c:\arcdb*.prev *.older
rename c:\arcdb*.txt *.previous
REM The following 3 lines will set the %DATE% and %TIME% variables to the current date/time
for /f "tokens=6-11 delims=/:. " %%a in ('net time \\%computername%') do ((set month=%%a) & (set day=%%b) & (set year=%%c) & (set hh=%%d) & (set min=%%e) & (set AMorPM=%%f) )
set TIME=%hh%:%min%%AMorPM%
set DATE=%month%/%day%/%year%
ECHO **
ECHO **Arcserve DB Check began at %TIME% on %DATE%. >> c:\arcdbmaint.txt
ECHO **Arcserve DB Check began at %TIME% on %DATE%. >> c:\arcdbstatus_%COMPUTERNAME%.txt
ECHO **
cd C:\Program Files\CA\BrightStor ARCserve Backup
REM DB Engine needs to be running for these utils to work.
call cstart.bat
REM STDIN piped to c:\arcdbmaint.txt
REM STDERR piped to c:\arcdbstatus_%COMPUTERNAME%.txt
Echo Running DBCHECK on ASJOB database
dbcheck -a -L casdb;admin;secret asjob 1>> c:\arcdbmaint.txt 2>> c:\arcdbstatus_%COMPUTERNAME%.txt
Echo Running DBCHECK on ASMEDIA database
dbcheck -a -L casdb;admin;secret asmedia 1>> c:\arcdbmaint.txt 2>> c:\arcdbstatus_%COMPUTERNAME%.txt
Echo Running DBCHECK on ASOBJECT database
dbcheck -a -L casdb;admin;secret asobject 1>> c:\arcdbmaint.txt 2>> c:\arcdbstatus_%COMPUTERNAME%.txt
Echo Running DBCHECK on ASRHOST database
dbcheck -a -L casdb;admin;secret asrhost 1>> c:\arcdbmaint.txt 2>> c:\arcdbstatus_%COMPUTERNAME%.txt
Echo Running DBCHECK on ASTAPE database
dbcheck -a -L casdb;admin;secret astape 1>> c:\arcdbmaint.txt 2>> c:\arcdbstatus_%COMPUTERNAME%.txt
Echo Running DBCHECK on ASTPDRV database
dbcheck -a -L casdb;admin;secret astpdrv 1>> c:\arcdbmaint.txt 2>> c:\arcdbstatus_%COMPUTERNAME%.txt
Echo Running DBCHECK on ASTPSDAT database
dbcheck -a -L casdb;admin;secret astpsdat 1>> c:\arcdbmaint.txt 2>> c:\arcdbstatus_%COMPUTERNAME%.txt
REM The following 3 lines will set the %DATE% and %TIME% variables to the current date/time
for /f "tokens=6-11 delims=/:. " %%a in ('net time \\%computername%') do ((set month=%%a) & (set day=%%b) & (set year=%%c) & (set hh=%%d) & (set min=%%e) & (set AMorPM=%%f) )
set TIME=%hh%:%min%%AMorPM%
set DATE=%month%/%day%/%year%
ECHO **
ECHO **Arcserve DB Check finished at %TIME% on %DATE%. >> c:\arcdbmaint.txt
ECHO **Arcserve DB Check finished at %TIME% on %DATE%. >> c:\arcdbstatus_%COMPUTERNAME%.txt
ECHO **
Here's what I've written so far:
@echo off
del c:\arcdb*.previous
rename c:\arcdb*.prev *.older
rename c:\arcdb*.txt *.previous
REM The following 3 lines will set the %DATE% and %TIME% variables to the current date/time
for /f "tokens=6-11 delims=/:. " %%a in ('net time \\%computername%') do ((set month=%%a) & (set day=%%b) & (set year=%%c) & (set hh=%%d) & (set min=%%e) & (set AMorPM=%%f) )
set TIME=%hh%:%min%%AMorPM%
set DATE=%month%/%day%/%year%
ECHO **
ECHO **Arcserve DB Check began at %TIME% on %DATE%. >> c:\arcdbmaint.txt
ECHO **Arcserve DB Check began at %TIME% on %DATE%. >> c:\arcdbstatus_%COMPUTERNAME%.txt
ECHO **
cd C:\Program Files\CA\BrightStor ARCserve Backup
REM DB Engine needs to be running for these utils to work.
call cstart.bat
REM STDIN piped to c:\arcdbmaint.txt
REM STDERR piped to c:\arcdbstatus_%COMPUTERNAME%.txt
Echo Running DBCHECK on ASJOB database
dbcheck -a -L casdb;admin;secret asjob 1>> c:\arcdbmaint.txt 2>> c:\arcdbstatus_%COMPUTERNAME%.txt
Echo Running DBCHECK on ASMEDIA database
dbcheck -a -L casdb;admin;secret asmedia 1>> c:\arcdbmaint.txt 2>> c:\arcdbstatus_%COMPUTERNAME%.txt
Echo Running DBCHECK on ASOBJECT database
dbcheck -a -L casdb;admin;secret asobject 1>> c:\arcdbmaint.txt 2>> c:\arcdbstatus_%COMPUTERNAME%.txt
Echo Running DBCHECK on ASRHOST database
dbcheck -a -L casdb;admin;secret asrhost 1>> c:\arcdbmaint.txt 2>> c:\arcdbstatus_%COMPUTERNAME%.txt
Echo Running DBCHECK on ASTAPE database
dbcheck -a -L casdb;admin;secret astape 1>> c:\arcdbmaint.txt 2>> c:\arcdbstatus_%COMPUTERNAME%.txt
Echo Running DBCHECK on ASTPDRV database
dbcheck -a -L casdb;admin;secret astpdrv 1>> c:\arcdbmaint.txt 2>> c:\arcdbstatus_%COMPUTERNAME%.txt
Echo Running DBCHECK on ASTPSDAT database
dbcheck -a -L casdb;admin;secret astpsdat 1>> c:\arcdbmaint.txt 2>> c:\arcdbstatus_%COMPUTERNAME%.txt
REM The following 3 lines will set the %DATE% and %TIME% variables to the current date/time
for /f "tokens=6-11 delims=/:. " %%a in ('net time \\%computername%') do ((set month=%%a) & (set day=%%b) & (set year=%%c) & (set hh=%%d) & (set min=%%e) & (set AMorPM=%%f) )
set TIME=%hh%:%min%%AMorPM%
set DATE=%month%/%day%/%year%
ECHO **
ECHO **Arcserve DB Check finished at %TIME% on %DATE%. >> c:\arcdbmaint.txt
ECHO **Arcserve DB Check finished at %TIME% on %DATE%. >> c:\arcdbstatus_%COMPUTERNAME%.txt
ECHO **