Where do you want to backup today? TSM? Ok! Let's do this using LiteSpeed!

Today we start with two questions:

Scully:    Does LiteSpeed support TSM?
Answer: Yes!

Skinner: Is there any special requirement for TSM?
Answer: According the System Requirements at the Release Notes: "If using Tivoli Storage Manager (TSM), the TSM API and Backup/Archive Client version 5.3 or later should be installed."

So first that all you need to install the TSM backup-archive client version 5.3 or later on the server where LiteSpeed will be executing the backup/restore commands.
For instructions, please refer to the IBM Tivoli Storage Manager Implementation guide. Just ensure that you do a complete install of the backup-archive client and that the bitness of LiteSpeed console and TSM client matches!

Once the TSM client is installed, we should have a dsm.opt file in our computer. In my environment that file is in C:\Program Files\Tivoli\baclient.
Make sure this file contains the information needed to connect to the server(communication method and the IP address and TCP port of the TSM server to initiate a session):

Now let's going to add the following line there:

errorlogname "C:\ProgramData\Quest Software\LiteSpeed\SQL Server\Logs\dsierror.log"   

This will generate a log that will help us in case of problems! Logs files are our friends!

LiteSpeed is now ready to conduct backups directly to TSM using the console, the LiteSpeed T-SQL commands or the LiteSpeed command-line utility!
What are we waiting for? Let's start:

As always we can just select the database in the Backup Manager, r-click and select Backup

 In this example we will run a full backup:

As you can see below, you can select to store a backup to TSM as an archive or as the usual backup.
In our example we will select TSM Backup:

Note: TSM backups conducted through LiteSpeed are transferred to and then stored in and/or managed by the Tivoli Storage Manager. The TSM handles the LiteSpeed backup file from then on, managing expiration date, storage location, etc. The functions of the TSM are not discussed here, please refer to the product documentation for further details.

In the Backup Destination section, we need to select the dsm.opt file we configured before. We also need to enter the other TSM information as Client Node and Password:

When you select Select TSM Object in the windows above, the next one opens:

The explanation of these options is out of the scope of this post. Please refer to TSM documentation. Litespeed will help you to select the correct TSM Object with the Read TSM Filespaces hyperlink and the Query TSM button.
Just bear in mind that the format for TSM objects is Filespace\High Level\Low Level.

Let's fast forward the following sections:

In the Execute Script section let's click on the Preview Script hyperlink to see the script generated by LiteSpeed. Remember that we can copy this script and execute it in SQL Query Analyzer, Toad for SQL Server or any other SQL scripting tool.

 The script in this case would be as follows:

exec master.dbo.xp_backup_database
@database = N'JoeyDb',
@backupname = N'JoeyDb - Full Database Backup',
@desc = N'Full Backup of JoeyDb on %Y-%m-%d %I:%M:%S %p',
@compressionlevel = 2,
@tsmobject = N'test\test\test',
@tsmconfigfile = N'C:\Program Files\Tivoli\TSM\baclient\dsm.opt',
@tsmclientnode = N'ZVILLANO',
@tsmclientownerpwd = N'*****',
@tsmmanagementclass = N'STANDARD',
@init = 1,
@with = N'STATS = 10'

And here it is! Our backup has been created directly to TSM!

Let's see if we can see this backup in the Backup History tab....yes! here it is:

Thanks for reading and I hope that...oh!Another question!

Mulder : You have mention before that this can also be done using the command-line utility. Is that true? I need to see it to believe it.
Answer: Yes, let's see how to do the same backup as before but with the command-line:

First that all you need to change the directory until you are in the directory containing the LiteSpeed command-line utility (Usually, C:\Program Files\Quest Software\LiteSpeed\SQL Server\Engine).
In this case, since we are doing a backup task we need the sqllitespeed.exe utility.
For information about this please refer to the online User Guide or to LiteSpeed help (F1) :

There you will see the syntax, the arguments and examples and you will be able to create the command that fits your needs.
In this case this is the one we need (do not get frustrated if you need to rewrite the command a few times in order to make it work...I needed a few attempts!):

sqllitespeed.exe -Bdatabase -D"JoeyDb" -C2 -I -n"JoeyDb - Full Database Backup with command line" -d"Full Backup of model on %Y-%m-%d %I:%M:%S %p" -i"test\test\test" -j"C:\Program Files\Tivoli\TSM\baclient\dsm.opt" -c"ZVILLANO" -k"P****" --TSMarchive -S"z2AVW2K12SS2012" -U"sa" -P"***"

Let's run it:

And here it is! our first TSM backup created trough command line!

Hope this helps!