Home SQLSQL Server interview questions: - Two Methods that explains to back-up SQL Server Database and Restore Database?
There are basically two ways (methods) in order to back-up SQL Server Database and Restore database.
The following are the two methods to do the same.
1. By simple Detach and Attach Methods.
2. By creating a .bak file of the Database.
Let’s see a simple example on both the above methods for creating back-up and restoring database.
Method1: -By simple Detach and Attach.
Let us assume that we have a Customer Database on which we have to perform the Back-up and Restore action.
In order to perform simple Detach and Attach method just right click on the database name > go to Tasks > Select Detach. A new window will pop-up from the check box of drop box just select the drop box and clicks ok.
As soon as you click on ok you find that now the Customer database is detach from the Databases.
Now, just browse to the location of “Customer.mdf” database and copy the both “Customer.mdf” and “Customer_log.ldf” and save both the file to your specified location.
Now, let’s see how we can restore the database back to the Databases.
In order to restore “Customer” database right click on Databases > Select Attach a new will pop-up like below diagram from that click on Add then again a new window will open of locate database file from that select “Customer.mdf” and click ok again you will be revert back to the Attach database window from that click ok.
Now, you will see that “Customer” database is again attached to the Databases.
Method2: -By creating a .bak file of the Database.
In order to create a .bak file right click on “Customer” database > go to Tasks > Select back up.
As soon as you select back up a new window like below diagram.
Now click on ok, a message will be displayed like below diagram.
Now, just browse to the destination, you will see a backup file (.bakformat) file is created.
Now, let’s see how to restore back the database.
As soon as you click on Restore Database a new window will appear like below diagram from that select from device and click [----] then again a new window will appear of specify back-up from that click on add.
As soon as you click on add then again a new window will appear like below diagram of Locate back-up file from that select the Database on which you have created the back-up and then click ok.
Now just click on ok.
Similarly, when you click on ok you will revert back to the restore database window from that select the database name and check the restore box as marked and later click on ok.
If everything goes right you will see the message as completed like below diagram.
See the following SQL Server interview questions video on difference between unique key and primary key
By a click you can avail more tutorial onSQL Server interview questions
Regards,
Visit for more author’s blog onSQL Server interview questions




Write a Comment
All fields marked with * are mandatory
ASP.NET interview questions: - Can you explain Method of Sorting GridViewcontrol in ASP.NET?
Sorting allow you to sort the GridViewcontrol data in Ascending or Descending order.... Read More
By : Shiv Prasad Koirala | Aug 4th, 2011 | ASP.NET
WCF Interview questions:- Which binding do we need to use for WCF REST?
In this article we will show Binding used for WCF REST. For more articles and videos visit us on www.questpond.com... Read More
By : Shiv Prasad Koirala | Nov 16th, 2011 | WCF
.NET interview questions: - Can you elaborate project life cycle?
In this article we will explain about project life cycle. For more articles and videos visit us on http://www.questpond.com/... Read More
By : Shiv Prasad Koirala | Jan 17th, 2012 | .Net
.NET interview questions: - How will you distinguish between ForeGround and BackGround Threading?
threading is a parallel processing unit and helps you to access multiple tasks at a one moment of time.... Read More
By : Shiv Prasad Koirala | Sep 27th, 2011 | ASP.NET
C# interview questions: - Explain anonymous methods in .NET?
n simple words Anonymous Methods means method which are coded inline or methods without method name.... Read More
By : Shiv Prasad Koirala | Aug 5th, 2011 | C#
ASP.NET interview questions: - Can you explain Method of Sorting GridViewcontrol in ASP.NET?
Sorting allow you to sort the GridViewcontrol data in Ascending or Descending order.... Read More
By : Shiv Prasad Koirala | Aug 4th, 2011 | ASP.NET
WCF Interview questions:- Which binding do we need to use for WCF REST?
In this article we will show Binding used for WCF REST. For more articles and videos visit us on www.questpond.com... Read More
By : Shiv Prasad Koirala | Nov 16th, 2011 | WCF
.NET interview questions: - Can you elaborate project life cycle?
In this article we will explain about project life cycle. For more articles and videos visit us on http://www.questpond.com/... Read More
By : Shiv Prasad Koirala | Jan 17th, 2012 | .Net
.NET interview questions: - How will you distinguish between ForeGround and BackGround Threading?
threading is a parallel processing unit and helps you to access multiple tasks at a one moment of time.... Read More
By : Shiv Prasad Koirala | Sep 27th, 2011 | ASP.NET
C# interview questions: - Explain anonymous methods in .NET?
n simple words Anonymous Methods means method which are coded inline or methods without method name.... Read More
By : Shiv Prasad Koirala | Aug 5th, 2011 | C#
Article Categories
YouTube Videos