Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Administration (2000)
 Recovering data from MDF File

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2004-02-25 : 07:37:14
behij trabelsi writes "Can I recover data from .MDF file or from backup of .MDF file ?"

ballabhoks
Starting Member

18 Posts

Posted - 2004-02-25 : 07:57:49
Yes, You can recover your complete data from MDF file.

Please tell me yr situation in details
Go to Top of Page

kish
Starting Member

45 Posts

Posted - 2004-02-25 : 08:05:09
Hi,

.mdf file is your data file. It is not a backup file.
But however, if you have a mdf file alone, you can still have your database working as sql server creates a new .ldf file if it does not exist.


Go to Top of Page

raymondpeacock
Constraint Violating Yak Guru

367 Posts

Posted - 2004-02-25 : 08:10:32
Thats correct Kish, but you neglected to mention that you need to use the sp_attach_single_file_db stored procedure.


Raymond
Go to Top of Page

kish
Starting Member

45 Posts

Posted - 2004-02-25 : 08:20:18
yeah..thats right..

You will need to use sp_attach_single_file_db stored procedure to attach it back to the server with a new .ldf(log file) created.

Syntax --

EXEC sp_attach_single_file_db @dbname = <database_name>,
@physname = '<physical location of .mdf file>'

Example :
EXEC sp_attach_single_file_db @dbname = mydb,
@physname = 'C:\mssql\data\mydb.mdf'


Go to Top of Page
   

- Advertisement -