Answered by:
How to create DB back from .mdf and .ldf (data and log file)?

Question
-
Is that restore or some other process? forgotWednesday, April 22, 2009 11:46 AM
Answers
-
my mdf file is stored in
Copy the mdf and ldf files to the directory listed above then attach the database file to your SQL server.c:\\db\db.mdfi want to attach db and keep it here...c:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\how to do?
http://msdn.microsoft.com/en-us/library/ms190794.aspx- Marked as answer by Jinchun ChenMicrosoft employee Thursday, April 30, 2009 9:17 AM
Thursday, April 23, 2009 9:26 PM
All replies
-
You need to attach the .mdf file.
see this
http://msdn.microsoft.com/en-us/library/ms190209.aspx
Mangal Pardeshi
SQL With Mangal- Proposed as answer by h0xff Wednesday, April 22, 2009 12:20 PM
Wednesday, April 22, 2009 11:49 AM -
Hi
By Running the below query we can attach the database (Considering two files .mdf and .ldf files)
EXEC
sp_attach_db @dbname = N'DatabaseName',
@filename1 = N'c:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\DatabaseName_Data.mdf', @filename2 = N'c:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\DatabaseName_log.ldf'
The path what i have given is default path. It changes based upon where the .mdf and .ldf files are Placed.
After attaching(Restoring) the Database. We can take Backup from that
Thanks
Ramesh.M- Proposed as answer by Pinal Dave Wednesday, April 22, 2009 12:32 PM
Wednesday, April 22, 2009 12:08 PM -
my mdf file is stored inc:\\db\db.mdfi want to attach db and keep it here...c:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\how to do?Thursday, April 23, 2009 12:35 PM
-
Is this .mdf Associated Database already there in the SQL Server?
Or
We have to create Database by using this .mdf File? Can you please clarify me
Thanks
Ramesh.MThursday, April 23, 2009 12:52 PM -
my mdf file is stored in
Copy the mdf and ldf files to the directory listed above then attach the database file to your SQL server.c:\\db\db.mdfi want to attach db and keep it here...c:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\how to do?
http://msdn.microsoft.com/en-us/library/ms190794.aspx- Marked as answer by Jinchun ChenMicrosoft employee Thursday, April 30, 2009 9:17 AM
Thursday, April 23, 2009 9:26 PM