Matías Fidemraizer
Matías Fidemraizer

Reputation: 64923

How do I restore a SQL Server DB only having the transaction log?

Some ASP.NET app has removed my data in some SQL Server 2005 DB.

I've the transaction log which has a size of 18MB aprox, but the MDF file is of 4MB.

Do you know if there's any chance of recovering a full DB by using the transaction log?

Currently I don't have any DB backup, so I can't use the MSDN guidelines to do this operation.

Thank you in advance.

Upvotes: 1

Views: 227

Answers (3)

Jonathan Leffler
Jonathan Leffler

Reputation: 753695

The transaction log is a record of changes made to the database. To replay the transaction log, you need a starting point against which all the changes were made. Without the starting point, the changes are meaningless. Hence, as already noted by others, you cannot recover with just the transaction log.

Upvotes: 1

gbn
gbn

Reputation: 432261

No.

There is not enough information in the LDF by itself.

You may be able to rewind using a 3rd party log explorer tool, say from Red Gate but I've never known anyone succeed: they aren't designed for this task

Upvotes: 1

marc_s
marc_s

Reputation: 754468

You cannot. The transaction log alone won't be sufficient to restore your database.

You need to be able to restore your MDF database file, and then you can re-run transactions from the transaction log. But the log alone doesn't contain the whole database.

Upvotes: 2

Related Questions