Problem solve Get help with specific problems with your technologies, process and projects.

Restoring a database with only the trans.mfd file

I have only the trans.mfd file. I lost the trans.ldf file. What are the steps to restore the database?

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'

Dig Deeper on SQL Server Backup and Recovery

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.