Solved

Recover Data From MDF and LDF

Posted on 2006-11-25
19
1,285 Views
Last Modified: 2012-08-14
Hi,
We have a database in MSSQL 2000.
The problem is "while exporting data from this source DB to a target DB somehow the tables in the source DB gets emptied. And the target db's tables are empty either.
I don't know what's done wrong cos I was not the one that did the mistake, but I am the one who should solve the problem.
What we have in hand is
  - the MDF and LDF of the source DB.
  - the MDF and LDF of the target DB.

What can I do to bring back all the data?
A third party SW?
A command to take back everything?

Thanks,
Baris
0
Comment
Question by:barisdur76
  • 8
  • 3
  • 2
  • +3
19 Comments
 
LVL 21

Expert Comment

by:pinaldave
ID: 18013079
You can restore the Source DB with different database name and use that further.
0
 

Author Comment

by:barisdur76
ID: 18013095
Pinaldave,
Thanks for the answer. But the tables in the source DB are totally empty now(somehow). How will I restore the source DB in order to be able to access the data in it (while it seems to be empty)
0
 

Author Comment

by:barisdur76
ID: 18013140
And one more thing.
There is no backup. Just the MDF and LDF.
0
NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

 
LVL 16

Expert Comment

by:Hillwaaa
ID: 18013148
Hi barisdur76,

Without backups, you might be in a spot of bother here.  Do you have any recent backups of the source database?  

I'm certainly not aware of any way to bring back the data - assuming that the transaction that copied it all has been committed.

Cheers,
Hillwaaa
0
 

Author Comment

by:barisdur76
ID: 18013160
There are no backups.
There is the .MDF file and the .LDF file and no backups.
Well I am not experienced in databases. But if the LDF file contains all this logs and the MDF file contains the last status of the DB, somehow there should be a way to take back the transactions back. Am I wrong?
0
 
LVL 26

Expert Comment

by:DireOrbAnt
ID: 18013316
First, make sure you keep a safe backup of those files before attempting anything.
Have you tried attaching those files? Right-click server root, all tasks (I think), then attach.

It most likely won't work, but worth a try.

Another trick might be to create an empty DB with the same file names, then stop SQL Server, copy the mdf/ldf over those files and restart SQL server. With any luck that could work.
You'll probably have to run DBCC CHECKDB after that.

0
 

Author Comment

by:barisdur76
ID: 18013732
Yes,
I have created backups of those files, and attached them with a different DB name.
But unfortunately the tables are still empty.

DireOrbAnt,
What I understand is, this guy who's done this mistake somehow deleted the rows, or dropped and re-created the tables during this DTS operation (most possibly accidentally). The tables are totally empty (But has been full of rows before DTS).
0
 

Author Comment

by:barisdur76
ID: 18013765
Hey,
A new info just arrived :
We have a copy of the DB belonging to 26 days before. This is not a backup nor a physical copy of the MDF file. The data was transferred from the original DB to this target, using DTS.

So what we have in hand is
  1.) The data in a local copy DB that belongs to 26 days before.
  2.) An LDF file copy which contains transactions of more than 30 days back.
  3.) The original MDF file whose tables exist but the rows in those tables no longer exist.
0
 
LVL 26

Expert Comment

by:DireOrbAnt
ID: 18014316
Use the one you attached with empty tables, then try this product:
http://www.red-gate.com/products/SQL_Log_Rescue/index.htm

You'll be able to revert the deletes.
0
 

Author Comment

by:barisdur76
ID: 18014423
Hi DireOrbAnt,
I've downloaded and installed this SQLLogRescue.
I created a project. Since I don't have any backups the program gave me a warning message meaning "No full DB Backup specified. Can't be able to recover fully". And when I clicked "finish" it than gives "No transactions are recorded in the database log. Re-run the Project Settings wizard and ensure you have chosen the correct database and server combination."
0
 

Author Comment

by:barisdur76
ID: 18014458
I googled the error message and found two similar problems but none fits me. I think I will have to drink a glass of cold water and cool down with no solutions.
0
 
LVL 69

Expert Comment

by:Scott Pletcher
ID: 18020684
>>I have created backups of those files, and attached them with a different DB name.  But unfortunately the tables are still empty. <<

For future reference:
In situations like this, the first thing you *really* need to do, if at all possible, is to stop SQL and make a copy of the .MDF file(s) and .LDF file(s).  Keep that copy "pure" as a core backup.
Do *NOT* do a SQL backup, as this will allow the log to be truncated, which could lose your data.

That gives you the best chance of re-trying a recovery using a different method if the first (second, etc.) methods fail.
0
 

Author Comment

by:barisdur76
ID: 18021134
Is it possible that I just load an LDF, and this SQLLogRescue or another program shows the transactions in it without asking for a valid backup or an MDF.
Because what I just need is the INSERTS and UPDATES. So this shouldn't be that difficult to extract from an LDF. Isn't it?

Thanks.
0
 
LVL 69

Expert Comment

by:Scott Pletcher
ID: 18021857
Not if you have a good backup of the .LDF.

If not, and you've done a SQL db backup, the log can get truncated/overwritten.  So backup the log *now* to have the best chance of keeping those trans.
0
 
LVL 69

Expert Comment

by:Scott Pletcher
ID: 18267761
Please do *not* include me in the points, as I just added general comments, not specifically related to the current q, but possible future reoccurences.
0
 
LVL 21

Expert Comment

by:pinaldave
ID: 18354439
Hello All,

There are many great suggestions in the thread. This thread did not bring desired resolution to asker but it does have suggestion which will be very useful to other readers. I have personally bookmarked this thread for reference.

I will suggest PAQ/Refund.

Thank you,
0
 
LVL 1

Accepted Solution

by:
Computer101 earned 0 total points
ID: 18376092
PAQed with points refunded (500)

Computer101
EE Admin
0

Featured Post

Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Having an SQL database can be a big investment for a small company. Hardware, setup and of course, the price of software all add up to a big bill that some companies may not be able to absorb.  Luckily, there is a free version SQL Express, but does …
This article shows gives you an overview on SQL Server 2016 row level security. You will also get to know the usages of row-level-security and how it works
Using examples as well as descriptions, and references to Books Online, show the documentation available for datatypes, explain the available data types and show how data can be passed into and out of variables.
Viewers will learn how the fundamental information of how to create a table.

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question