Avatar of tradeline
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?

Thanks.
Microsoft SQL Server

Avatar of undefined
Last Comment
Anthony Perkins

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
Raja Jegan R

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
See how we're fighting big data
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
Anthony Perkins

You can attempt to attach your MDF file alone, but you may find that the database is rendered Suspect without a valid ldf.
Raja Jegan R

acperkins,
    Its possible to attach your mdf file alone..
Anthony Perkins

Have you ever done it?  If not check out some of the sad stories on this site.
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes
Anthony Perkins

Raja Jegan R

acperkins,
  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.
Anthony Perkins

You have been lucky.
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
Raja Jegan R

acperkins,
    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.
Anthony Perkins

Fair enough...  Now whatever happened to the author?