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
 Transact-SQL (2000)
 Restoring database using .mdf and .ldf files..

Author  Topic 

challapavan
Starting Member

8 Posts

Posted - 2008-01-16 : 16:21:43
I have .mdf and .ldf files and i want to restore them as a database how do i do that...please help me in this..

Thanks a lot in advance....

pavan

sodeep
Master Smack Fu Yak Hacker

7174 Posts

Posted - 2008-01-16 : 16:42:06
You have to use Detach\attach method to restore.

Attach the files then.
Go to Top of Page

cyberpd
Yak Posting Veteran

60 Posts

Posted - 2008-01-17 : 00:48:51
1. first stop the database from service manager.

2. copy the files in the place where you want to keep them. i keep them in c:/ program files/ms sql server/mssql/data

3. start the database from service manager.

4. right click on the "database" -> all tasks -> attach database
find out the mdf file in the path you kept it and attach it.
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2008-01-17 : 01:00:29
or do it using sp_attach_db

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

eyechart
Master Smack Fu Yak Hacker

3575 Posts

Posted - 2008-01-17 : 01:05:29
no need to stop the database to attach the database. just copy the files to the data directory you are using for this sql instance and use sp_attach_db commands. check BOL for syntax.

use copies of the original LDF and MDF files in case something goes wrong.



-ec
Go to Top of Page
   

- Advertisement -