Link to home
Start Free TrialLog in
Avatar of tradeline

asked on

sqlserver 2005 corrupt ldf file

I have a corrupt ldf file but a valid mdf file for a db.  Is it still possible to restore this database, and sacrifice the transactions that were in progress, or do I need both files?

Avatar of Raja Jegan R
Raja Jegan R
Flag of India image

Link to home
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
You can attempt to attach your MDF file alone, but you may find that the database is rendered Suspect without a valid ldf.
    Its possible to attach your mdf file alone..
Have you ever done it?  If not check out some of the sad stories on this site.
  I have done that one multiple times.

And one more thing to be noted, If you dont have ldf file then you will lose your uncomitted transactions for sure.
All the committed transactions will be successfully restored / attached to the server.

As you are using SQL Server 2005, try the below steps:
1. Right click Databases in SSMS,
2. Choose Attach Database
3. Locate the path where you have your mdf file.
4. By Default, it will locate the location of ldf file as the same path.
5. Click on that ldf file and click Remove.

By this way, you will be able to attach only mdf file.

This is the procedure which I have done several times.

Note: As I said earlier, uncommitted transactions will be lost, since that will be stored in ldf files.
You have been lucky.
    Might be though but haven't obtained any error during my process...
I would have followed this approach for nearly 20-25 times..
But I haven't got any errors till now..

Any how, if you explain me the error you have obtained, I would be able to help you.
Fair enough...  Now whatever happened to the author?