Restoring data by using the command-line interface

If you prefer, you can use the command-line interface to start a full Microsoft SQL Server database recovery from a virtual machine.

Procedure

  1. Issue the query command to find the full and log database backups. The following example finds all backups for the Microsoft SQL Server database called sql_db10.
    tdpsqlc q tsm sql_db10  
    IBM Tivoli Storage Manager for Databases: 
    Data Protection for Microsoft SQL Server 
    Version 7, Release 1, Level 3.0  
    ...  
    Querying TSM Server for Backups ....
    Backup Object Information ------------------------- 
    SQL Server Name ........................ SQL10 
    SQL Database Name ........................ sql_db10 
    Backup Method ........................ VMVSS 
    ... 
    Backup Creation Date / Time .............. 11/14/2014 13:41:18 
    ... 
    Backup Object Information 
    ------------------------- 
    SQL Server Name ........................ 
    SQL10 SQL Database Name ........................sql_db10 
    Backup Method ........................ Lgcy 
    ... 
    Backup on Secondary Replica .............. 
    No Backup Object State ...................... 
    Active Backup Creation Date / Time .............. 11/14/2014 15:46:07 
    ... 
    The operation completed successfully. (rc = 0)
  2. To restore the database without applying transaction logs, issue the database restore command as shown in the following example:
     tdpsqlc restore databaseName /backupMethod=vmvss 

    The following examples show the output of the command when you specify the Microsoft SQL Server database called sql_db10.

    tdpsqlc restore sql_db10 /backupmethod=vmvss /sqlserver=sql10  	
    /fromsqlserver=sql10 /recovery=no  
    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...  
    Querying TSM Server for Backups ....  
    Connecting to TSM Server as node "SQL10_SQL"...
    Connecting to Local DSM Agent "SQL10"...
    Using backup node "SQL10_SQL"...
    Starting Sql database restore...
    
    Beginning VSS restore of "sql_db10"...
    
    Restoring "sql_db10" via file-level copy from snapshot(s). This 
    	process may take some time. Please wait
    
    Files Examined/Completed/Failed: [ 2 / 2 / 0 ] Total Bytes: 3146070
    
    VSS Restore operation completed with rc = 0
    	Files Examined : 2
    	Files Completed : 2
    	Files Failed : 0
    	Total Bytes : 3146070
    	Total LanFree Bytes : 0
    
    The operation completed successfully. (rc = 0)
  3. After the full database restore operation is completed successfully, issue the command to restore the logs. For example, to restore all logs based on the restored Microsoft SQL database sql_db10, issue the following command.
     tdpsqlc restore databaseName /backupMethod=vmvss 
    /recovery=no
    You can also use the /stopat option to specify a more granular point in time.
    tdpsqlc restore sql_db10 log=* /sqlserver=sql10  	
    /fromsqlserver=sql10 /recovery=yes  
    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 restore...  
    Connecting to TSM Server as node "SQL10_SQL"... 
    Querying Tivoli Storage Manager server for a list  	
    of database backups, please wait...  
    
    Beginning log restore of backup object sql_db10\20131114154607\00000DB0,  	
    1 of 3, to database sql_db10 ...  
    
    Beginning log restore of backup object sql_db10\20131114155130\00000DB0,  	
    2 of 3, to database sql_db10 .... 
     
    Total database backups inspected: 3 
    Total database backups requested for restore: 3 
    Total database backups restored: 3 
    Total database skipped: 0 
    Throughput rate: 134.32 Kb/Sec 
    Total bytes transferred: 385,536 
    Total LanFree bytes transferred: 0 
    Elapsed processing time: 2.80 Secs  
    The operation completed successfully. (rc = 0)

What to do next

You can restore inactive backups by using the Data Protection for Microsoft SQL Server command-line interface, TDPSQLC. When you issue the restore command, specify the database object name for the specific backup.
To obtain the database object name, issue the following command:
tdpsqlc q tsm dbname full /all
After you have the database object name value, specify the database object name on the /OBJect=objectname parameter of the TDPSQLC restore command, where objectname is the database object name. For example:
tdpsqlc restore db44 /object=20140311131051 /backupdestination=tsm
 /backupmethod=vmvss
Restriction: You cannot recover a Microsoft SQL database to an alternative location on the virtual machine.