Sample script for validating full virtual machine backups

Before you back up Microsoft SQL Server logs, verify that you have a valid full virtual machine backup. One procedure for checking for the existence of a full virtual machine backup is to schedule the usage of a script.

This sample script checks for the instance of a full backup and then runs the Microsoft SQL Server log backups if a full virtual machine backup exists. This script can be used with a scheduler service such as the Tivoli® Storage Manager scheduler.
@echo off
dsmc q vm sql01_SQL -detail -asnode=datacenter01 | find /c 
	"database-level recovery" > c:\temp.txt
SET /p VAR=<c:\temp.txt

if %VAR% == "1" (
tdpsqlc back * log
) ELSE (
echo "There is no full backup"
set ERRORLEVEL=1
)
This script produces the following output:
IBM Tivoli Storage Manager for Databases:
Data Protection for Microsoft SQL Server
Version 7, Release 1, Level 3.0
(C) Copyright IBM Corporation 1997, 2015. All rights reserved.
Connecting to SQL Server, please wait...
Starting SQL database backup...
Connecting to TSM Server as node 'SQL01_SQL'...
Using backup node 'SQL01_SQL...
ACO5458W The TSM Server 'backup delete' setting for node (SQL01_SQL) is set to
NO. It should be set to YES for proper operation. Processing will continue.
Beginning log backup for database model, 1 of 2.
Full: 0 Read: 87808 Written: 87808 Rate: 32.54 Kb/Sec
Database Object Name: 20140303011509\000007CC
Backup of model completed successfully.
Beginning log backup for database sqldb test2, 2 of 2.
Full: 0 Read: 88832 Written: 88832 Rate: 132.44 Kb/Sec
Database Object Name: 20140303011511\000007CC
Backup of sqldb test2 completed successfully.
Total SQL backups selected: 4
Total SQL backups attempted: 2
Total SQL backups completed: 2
Total SQL backups excluded: 2
Total SQL backups deduplicated: 0
Throughput rate: 51.85 Kb/Sec
Total bytes inspected: 176,640
Total bytes transferred: 176,640
Total LanFree bytes transferred: 0
Total bytes before deduplication: 0
Total bytes after deduplication: 0
Data compressed by: 0%
Deduplication reduction: 0.00%
Total data reduction ratio: 0.00%
Elapsed processing time: 3.33 Secs
The operation completed successfully. (rc = 0)

You can also use the Tivoli Storage Manager activity log and extended summary table to determine whether virtual machine backups are successful.