TSM TDP Backup > Automation for missing fullbackups

Shpshftr

Newcomer
Joined
Mar 30, 2020
Messages
1
Reaction score
0
Points
0
Hello there,
I am struggling to get TSM TDP to work properly with adjusted scripts. I want to implement an automatism to the schedule-scripts for diff- and logbackups, meaning there should be a check beforehand if fullbackup is missing (and if yes, do it).
The schedules within TSM (which I am not working on as this is maintained from a different provider of my customer) are pointing directly to the respective scripts. Each instance has its own specific disk where config, scripts and dsm.opt files are located
As an example, here is my approach for logbackups. These are based on the general plane scripts from IBM.

set TSMERROR=0
set sql_dir=c:\Progra~1\Tivoli\TSM\TDPSql
set config_dir=E:\TSM_SQL
set sql_instance=Server\Instance


cd %sql_dir%

date /t < NUL >> %config_dir%\sqlsched.log
time /t < NUL >> %config_dir%\sqlsched.log


REM Output databases with missing fullbackup
sqlcmd -E -S %sql_instance% -d master -Q "SET NOCOUNT ON SELECT master.dbo.sysdatabases.NAME AS database_name, NULL AS [Last Data Backup Date], 9999 AS [Backup Age (Hours)] FROM master.dbo.sysdatabases LEFT JOIN msdb.dbo.backupset ON master.dbo.sysdatabases.name = msdb.dbo.backupset.database_name WHERE msdb.dbo.backupset.database_name IS NULL AND master.dbo.sysdatabases.name <> 'tempdb' ORDER BY msdb.dbo.backupset.database_name" -y0 >%config_dir%\check_before_log.txt
REM Fullbackup for databases with missing fullbackup
for /f "tokens=1" %%i in ('type %config_dir%\check_before_log.txt') do %sql_dir%\tdpsqlc backup %%i FULL /tsmoptfile=%config_dir%\dsm.opt /config=%config_dir%\tdpsql.cfg /logfile=%config_dir%\sqlfull.log >> %config_dir%\sqlsched.log
REM Logbackup of all databases
%sql_dir%\tdpsqlc backup * log /tsmoptfile=%config_dir%\dsm.opt /config=%config_dir%\tdpsql.cfg /logfile=%config_dir%\sql_tx.log >> config_dir%\sqlsched.log


The actual part for the missing fullbackup is working as intended - but it is ignoring the part after it, its just not performing a logbackup after it at all. I want to avoid to cut this logic as this would prevent unnecessary tickets for newly created databases (where fullbackup is missing since never created) in the future.
General schedule is sunday evening fullbackup, every other evening diffbackup and a logback every hour.

My biggest problem is that I am a MSSQL dba - no expert for TSM. But due to circumstances within the contract of my company and my customer, the actual backup team itself is not supporting the creation of the scripts.

Did anyone worked around such a topic before and has an idea to help me here? I would gladly appreciate any kind of help.

Thanks in advance and greetings from Germany
Stefan
 
Stab in the dark, but my suspicion is that the script is trying to run the log backup while the full backup is running and is unable to do so. There should be logs somewhere to that nature if that's the case.

I don't see any supporting lines to call pslist or tasklist and seeing if tdpsqlc is finished. Also, if more than one tdpsqlc process is running you may need to get a list of all tdpsqlc's and do some filtering to make sure you are watching the right process.
Another way that may work is using the windows 'START' with /w option, or the CALL command to fire up tdp.

My batch scripting is worse than my KSH scripting, and don't really have a quick way to test any of these idea's on, so I could be way off here. So just a few random thoughts.
 
Back
Top