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)
 I lost .ldf file and having only .mdf file -- need working database

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2005-01-05 : 08:11:45
Siva Prasad writes "Hi,
This is Siva Prasad.
I lost .ldf file of my database and having only .mdf file.
i would like to create/restore the database with the existing .mdf file only.
Is it possible to do? if so please give me the details to restore it.

Thanks & Regards,
Siva Prasad"

Wanderer
Master Smack Fu Yak Hacker

1168 Posts

Posted - 2005-01-05 : 08:27:44
Do you have a backup strategy? If not, it's time to start working on one NOW! If you do, then you should be recovering from backup.

Otherwise, you can TRY and use sp_attach_sigle_file_db - check out BOL for more details. Example below from BOL.

Examples
This example detaches pubs and then attaches one file from pubs to the current server.

EXEC sp_detach_db @dbname = 'pubs'
EXEC sp_attach_single_file_db @dbname = 'pubs',
@physname = 'c:\Program Files\Microsoft SQL Server\MSSQL\Data\pubs.mdf'

Test to make sure you need to do this - all transaction are lost, since you'ev lost you .LDF

*##* *##* *##* *##*

Chaos, Disorder and Panic ... my work is done here!
Go to Top of Page

CanadaDBA

583 Posts

Posted - 2005-01-05 : 08:45:27
If you see the database in EM but it is marked as suspected, then detach it and reattach it. EM will ask your permission for creating LDF file.

If you don't have it in your EM, just attach the database.

To attach a database, in EM right click on the databases and in ALL Task choose Attach database.

Canada DBA
Go to Top of Page

nr
SQLTeam MVY

12543 Posts

Posted - 2005-01-05 : 08:45:45
If that doesn't work try
http://www.mindsdoor.net/SQLAdmin/RecoverCorruptDatabase.html

==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page
   

- Advertisement -