Blog Stats
  • Posts - 12
  • Articles - 0
  • Comments - 115
  • Trackbacks - 0

 

Restore DB with mdf file alone - SQL Server

Basically, we need two files to restore the database. They are .mdf and .ldf files. There is another way to restore the database, if we have the database backup file(.bak). But we can restore using one file(.mdf file) as well. Here's how it will be restored using .mdf file.

 

-- Restore Database using MDF File alone
EXEC sp_attach_single_file_db @dbname = 'testerDB',
@physname = 'c:\testDB.mdf'

Hope this might help.


Feedback

# re: Restore DB with mdf file alone - SQL Server

Gravatar Thanks so much, this worked perfectly and I didn't have to ask the client to send the .ldf. 6/9/2010 11:46 AM | Jean Johnson

Post A Comment
Title:
Name:
Email:
Website:
Comment:
Verification:
 
 

 

 

Copyright © nagendraprasad