Upload
jasonclark03
View
285
Download
0
Embed Size (px)
Citation preview
RESTORING DATABASE FROM MDF FILE
Index View Of Topics
Introduction Methods to Restore SQL Database Attach Database using Management
Studio Open Management Studio Go to Attach option Attaching Database Locating .mdf File Attach Database using T-SQL Conclusion
Introduction
The SQL Server provides the facility to restore your database by attaching your .mdf file to the database.
You can directly Attach your existing .mdf file to an SQL instance by using SQL Server Management Studio or T-SQL.
Methods to Restore SQL Database
SQL Server provides two different methods for attaching your .mdf file with your database
1. Attach Database using Management Studio
2. Attach Database using T-SQL
Attach Database using Management Studio Choose a server from your network. Set the
Authentication mode to “Windows Authentication” and click on “Connect” button.
Open Management Studio Once logged in, In Object Explorer, Double
click on the ‘Databases’ to see the existing databases within the SQL instance.
Go to Attach option Right click on the ‘Databases‘ and click on
‘Attach‘
Attaching Database In Attach Databases dialog box Click on ‘Add…‘ button
Locating .mdf File Now, locate the .mdf file, which is to be add
and click on “OK”.
Attach Database using T-SQL
Take a New Query window using Management Studio and write the below code and click on “Execute”
CREATE DATABASE fixed_data ON (FILENAME = 'c:\data files\fixed_data.mdf'), (FILENAME = ' c:\data files\fixed_data.ldf') FOR ATTACH;
Conclusion
Both the procedures helps in attaching .mdf file to the database or restore an existing database from MDF file.
If you are still facing problem in restoring database from MDF file you can go through this:
http://www.systoolsgroup.com/sql-recovery/how-it- works.html