Home > Ask the SQL Server Experts > Archive: Backup and Recovery Questions & Answers > Restoring a database with only the .mfd file
Ask The SQL Server Expert: Questions & Answers
EMAIL THIS

Restoring a database with only the .mfd file

Greg Robidoux EXPERT RESPONSE FROM: Greg Robidoux

Pose a Question
Other SQL Server Categories
Meet all SQL Server Experts
Become an Expert for this site


Expert advice on database administration
Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us    Add to Google


>
QUESTION POSED ON: 25 August 2005
I only have the .mdf file backup and no SQL Server database backups. Is it possible to get my database back into SQL Server?

>
Referencing a similar question posted on March 28 2005

You can use the attach database function of SQL Server to attach the MDF file and create the database.

This can be done one of two ways:

1. Using Enterprise Manager

  1. Expand the Databases tree
  2. Right click and select All Tasks
  3. Select Attach Database
  4. Find and select the MDF file
  5. The GUI will display the name of the MDF and LDF files and there should be an X on the LDF file name
  6. Change the name of the database and owner as needed and select OK
  7. An error message will appear that says "Filename specified for log is incorrect. Do you want to continue", click on Yes
  8. The database should now be attached to your server. If the database came from another server you will probably need to take care of user and login mismatches.
2. Using T-SQL
EXEC sp_attach_single_file_db @dbname = 'pubs', @physname = 'c:\Program Files\Microsoft SQL Server\MSSQL\Data\pubs.mdf'

Click here for a similar tip posted March 28 2005.


Do you have comments on this Ask the Expert Q&A? Let us know.


Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us    Add to Google



RELATED CONTENT
Archive: Backup and Recovery
Synchronize databases on two separate active servers
Back up tables from SQL Server 2005 database to a file
Restore SQL Server 2000 backups in SQL Server 2005
Restoring a SQL Server database with a corrupt data file
SQL Server error message: "Server out of memory"
Configure log shipping between SQL Server 2000 and 2005
Restoring from msdb with only .mdf and .ldf files
Extended stored procedure to back up databases
Change tempdb from 'C' drive
Back up stored procedure only

SQL Server Backup and Recovery
SQL Server Mailbag: Data restoration and DB property management
Achieving high availability and disaster recovery with SharePoint databases
How to 'do' SQL Server disaster recovery
The keys to database backup protection for SQL Server
Choosing a SQL Server disaster recovery solution
Licensing a standby server for SQL Server replication
Can I encrypt and restore a database backup in SQL Server 2005?
SQL Server errors, failures and other problems fixed from the trenches
Get SQL Server log shipping functionality without Enterprise Edition
SQL Server 2008 backup compression pros and cons
SQL Server Backup and Recovery Research

RELATED GLOSSARY TERMS
Terms from Whatis.com − the technology online dictionary
rollback  (SearchSQLServer.com)

RELATED RESOURCES
2020software.com, trial software downloads for accounting software, ERP software, CRM software and business software systems
Search Bitpipe.com for the latest white papers and business webcasts
Whatis.com, the online computer dictionary



Search and Browse the Expert Answer Center
Search and browse more than 25,000 question and answer pairs from more than 250 TechTarget industry experts.
Browse our Expert Advice



SQL Solutions - SQL Database Design
HomeNewsTopicsITKnowledge ExchangeTipsAsk the ExpertsMultimediaWhite PapersIT Downloads
About Us  |  Contact Us  |  For Advertisers  |  For Business Partners  |  Site Index  |  RSS
SEARCH 
TechTarget provides technology professionals with the information they need to perform their jobs - from developing strategy, to making cost-effective purchase decisions and managing their organizations' technology projects - with its network of technology-specific websites, events and online magazines.

TechTarget Corporate Web Site  |  Media Kits  |  Site Map




All Rights Reserved, Copyright 2005 - 2009, TechTarget | Read our Privacy Policy
  TechTarget - The IT Media ROI Experts