My Favorite Blogs

Sunday, January 24, 2010

On MS SQL how to restore a table or an object from backup file


On MS SQL how to restore a table or an object from backup file, the answer for this question is big NO from Microsoft, there is no direct option or feature to restore a table from MS SQL native backup, I’m not sure why still Microsoft is not adding this feature, but third party tools are providing this feature. Quest LiteSpeed is one of the third party tools providing this feature and also widely using backup tool for MS SQL. In this article I’m going to walk you through step by step how to restore a table from Quest LiteSpeed backup file.
I used Quest LiteSpeed version 5.0 for my test. To perform this recovery you need to open LiteSpeed console.
Go to Start/All Programs/Quest Software/LiteSpeed/LiteSpeed Console.
The below screen shot is the LiteSpeed console where you can manage the MS SQL backup, restore and other features like Log shipping as well. You can find the menu bar on top of the screen also on the side pan. On the side pan menu you can find the Object Level Recovery wizard button, click on it.





The below screen will open up, on middle of this screen you can find 2 steps 1st is Read a Backup File and 2nd is Object Recovery Actions. In order to recover an object you have to perform both the steps. Step 1 is reading the backup file to select specific object to recover. So click on the “Start the LiteSpeed Read Backup Wizard” (See below screen shot)





Start the LiteSpeed Read Backup Wizard will take you to the below screen where you can select the backup file from where your tables reside. Click Next button on the below screen


In the below screen you’ve to select the Backup source instance and backup files path. From the drop box you can select the source instance name and Click on the Add button on the right side and add the backup file path as below.

Then click Next button and the next window will list the backup file details, then click Next button.


The next window will show the preview restore script then Click Next button then click Finish.


Now you will come back to Backup Recovery Manager Window again and you can see list of objects on the backup, in the below screen you see the table with Type and Name columns and can see values Table and dbo.Table1 (Apologies for using just single object for this example), if you’ve views, stored procedures, functions and triggers in the database then all will be listed in the below table. You can select any of them which you need to be restored.


Right click on the table name [dbo.Table1] then you will get a sub menu where you can see all the actions to do next. Here you are going to click on the “Recover Table”


Another window will be popped up there you have to specify the SQL instance name, Database name and the table name which you are going to recover from the backup. You can choose either the existing instance & db name or a different, both will work. For the table name specify a new name for safer side as below.


On the above window there is an Advanced button if you click on it will show up the options for specifying the Temporary Directory, Ship Directory and Filegroup names, this will help if you want to keep this table in a separate File group on a specific file path.
Once you entered all the details then click OK button on the above window. Now LiteSpeed will restore the table on the specified database which you selected.
Now you can see the recovered table on the specific database on SSMS (see below screen shot). The ObjectReovery is the database which I used on this article and Dbo.Table1 is the table got backed up and Table_recovered is the table which recovered from the backup using Quest LiteSpeed tool.


Conclusion
Object level recovery can be done on MS SQL litespeed backup file but not from the MS SQL native backup files. Hope this article will help DBAs who are using Quest LiteSpeed for backup.

This http://support.microsoft.com/kb/321836 Kb link will explain how to recover a table from MS SQL native backup file.

1 comment:

  1. You're best bet is probably to restore the entire backup as a temporary database, and then copy the data you need over to the main database. See here: http://www.c-sharpcorner.com/blogs/perform-sql-server-object-level-recovery-with-easy-methods

    ReplyDelete