Wednesday, September 17, 2008

Query TSM Archive to check file exits

@echo off
set script_dir=c:\progra~1\tivoli\tsm\scripts
echo dsmc query archive %1 -su=yes -fromdate="%2" -todate="%2"
dsmc query archive %1 -optfile="c:\progra~1\tivoli\tsm\baclient\dsm_swift.opt" -fromdate="%2" -fromtime=00:00 -todate="%2" -totime=23:00

echo.%ERRORLEVEL%

IF ERRORLEVEL 12 GOTO LABEL12
IF ERRORLEVEL 0 GOTO LABEL0

:LABEL12
echo ####################### FAILED #########################################
echo #
echo # The files you are searching for are not there . Check your syntax
echo # Date range has to be MM/DD/YYYY
echo # Directory must exist , put an asterisk on the end e.g
echo # h:\extend\*
echo # or h:\extend\Orbis_1\OFAS_CN_PRD.001
echo # Archive are kept for 14 days as per Todd Rd setup
echo #
echo ########################################################################
GOTO end

:LABEL0
echo ###################### SUCCESS #########################################
echo #
echo # This is the list of available archives within the date range you specified
echo # Use this list in the DSMC RETRIEVE command
echo #
echo # dsmc query archive %1 -optfile="c:\progra~1\tivoli\tsm\baclient\dsm_swift.opt" -fromdate="%2" -fromtime=00:00 -todate="%2" -totime=07:00
echo #
echo #
echo #
echo ########################################################################

:end


-------------------------------------------
To retrieve the data from Remote Server
-------------------------------------------
@echo off
set script_dir=c:\progra~1\tivoli\tsm\scripts
dsmc set access archive %1 %3 -optfile="c:\progra~1\tivoli\tsm\baclient\dsm_swift.opt"
dsmc query archive \\%3\%1 -optfile="c:\progra~1\tivoli\tsm\baclient\dsm_swift.opt" -fromnode=%3 -fromdate="%2" -fromtime=00:00 -todate="%2" -totime=23:00

1 comment:

.:: D@ny ::. said...

Hi,

Thanks for informations. How can I do the same thing using SQL on dsmadm?

Thanks