Wednesday, 12 August 2015

Restore a Database in Sql Server 2008 R2

 Hello everyone First of all thanks for visit and my blog and thanks for giving   a wonderful comments on my post , here is i come with my another post for  How to Restore a Database in Sql Server 2008 R2 Using Back Up file (.bak), so let's start with introduction



How to Restore a Database in Sql Server

     First open the sql server Management studio and login with specific user and password, after login go to the left pen and expand the instance, after expand the instance view the list of folder are there expand the database folder and select the database you want to restore and Right click on it.

Right click on database >> Tasks >> Restore >> Database...


Open a new window called "Restore Database" window , here is to tab on left pan is "General" "Options" i explain it here with image, first you can select source you want to get backup database file, here i select the Options  "From Device" and click on Browse button Right side on text box to display the select backup file window other is by default is set.


Here is open a new window called "Specify Backup", hew you can select the "backup Media to file" because you can backup task is done using backup file and click on "Add" button to add the Backup file with Extension (.bak).


Open new window called "Locate Backup File" to locate your (.bak) file in your system location and select it and click on "OK" Button


Display the Selected file with full location path, make sure the path and file name and the click on "OK" Button to confirm.


Return to main window


Here is display the selected location with file description, Right side of the list is display the Restore check box you can select check to this check box and go to options tab.


options tab list of option with check box display on right pan, configure all the Restore  options and Recovery State as per your requirement, here i configure Restore  options is first options is check true the option name is "Overwrite the existing database (With Replace)"  and  Recovery State is first one is "Leave the database Ready to use by Rolling back uncommitted transactions. additional transaction logs cannot be restored.(RESTORE WITH RECOVERY)" , after complete all the step and then click on "OK" button to start Restore data process....



After process completed 100% successfully (Display left bottom corner status is 100%) one message box is display "The Restore of Databasees "DBName" completed successfully" click on "Ok" to close the message and confirm the database table and make sure the changes is restore done.  

                                                          OR

the second option is to Restore the database using SQL Query

Right click on database >> new query ....

here is the synatax and example of the Restore query

Syntax

RESTORE DATABASE DatabaseName
   FROM DISK = 'file path of Backup file is locate' ;
  
Example


RESTORE DATABASE EMPDB
   FROM DISK = 'E:\krunal\data\empdb.bak' ;
   
after write query successfully execute the query to restore database is 
started and complete the process to display the message on Output window
is "Query Completed Successfully"

now i complete the my blog for how to restore the database in 
sql server 2008 R2, i wish this is helpful for everyone, you can query 
regarding this post plesase comment me or send email..

Thanks 
Krunal patel
(Software Developer)

My Popular post click on Link to view

6 comments: