Restoring data by using the command-line interface

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

Before you begin

Ensure that the Microsoft iSCSI Initiator Service is running before you restore any Microsoft SQL Server database with backup type "VMVSS". If the service is not running, start it. For instructions, see Starting the Microsoft iSCSI Initiator Service.

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 Storage Protect for Databases:
    Data Protection for Microsoft SQL Server
    Version 8, Release 1, Level 6.0
    (C) Copyright IBM Corporation 1997, 2018. All rights reserved.
    
    Connecting to IBM Storage Protect Server as node 'KINGSTON40_SQL'...
    
    Querying IBM Storage Protect Server for Backups ....
    
    Backup Object Information
    -------------------------
    
    SQL Server Name   ........................ SQL40
    SQL Database Name ........................ sql_db10
    Backup Method     ........................ VMVSS
    Backup Location   ........................ Srv
    Backup Object Type ....................... Full
    Mount Points Root Directory ..............
    Backup Object State ...................... Active
    Backup Creation Date / Time .............. 07/12/2018 13:08:45
    Backup Size .............................. 17.00 MB
    Backup Compressed ........................ Yes
    Backup Encryption Type ................... None
    Backup Client-Deduplicated ............... Yes
    Backup Supports Instant Restore .......... No
    Database Object Name ..................... 20180712130845
    Assigned Management Class ................ STANDARD
    Backup Modified ..........................
    
    
    The operation completed successfully. (rc = 0)
    
  2. To restore the database without applying transaction logs, issue the following command:
    tdpsqlc restore databaseName /backupMethod=vmvss

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

    tdpsqlc restore sql_db10 /backupmethod=vmvss /sqlserver=sql40  	
    /fromsqlserver=sql40 /recovery=no  
    
    IBM Storage Protect for Databases:
    Data Protection for Microsoft SQL Server
    Version 8, Release 1, Level 6.0
    (C) Copyright IBM Corporation 1997, 2018. All rights reserved.
    
    Connecting to SQL Server, please wait...  
    
    Querying IBM Storage Protect Server for Backups ....  
    
    Connecting to IBM Storage Protect Server as node 'KINGSTON40_SQL'...
    Connecting to Local DSM Agent 'SQL40'...
    Using backup node 'KINGSTON40_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 log=* /sqlsever=sql40 /fromserver=sql40 
    /recovery=yes
    You can also use the /stopat option to specify a more granular point in time.
    tdpsqlc restore sql_db10 log=* /sqlserver=sql40  	
    /fromsqlserver=sql40 /recovery=yes  
    
    
    IBM Storage Protect for Databases:
    Data Protection for Microsoft SQL Server
    Version 8, Release 1, Level 6.0
    (C) Copyright IBM Corporation 1997, 2018. All rights reserved.
    
    Connecting to SQL Server, please wait...  
    Starting Sql database restore...  
    Connecting to IBM Storage Protect Server as node 'KINGSTON40_SQL'... 
    Querying IBM Storage Protect server for a list  	
    of database backups, please wait...  
    
    Beginning log restore of backup object sql_db10\20180712130845\00000DB0,  	
    1 of 3, to database sql_db10 ...  
    
    Beginning log restore of backup object sql_db10\20180712130845\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=20180712130845 /backupdestination=tsm
 /backupmethod=vmvss