Solved

Recover Data From MDF and LDF

Posted on 2006-11-25
19
1,278 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
 
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
Backup Your Microsoft Windows Server®

Backup all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

 
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:ScottPletcher
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:ScottPletcher
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:ScottPletcher
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

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Dynamics crm 2011 8 43
Problem with SqlConnection 5 109
SignalR - getting new data from sql DB 5 64
Change part of a string 2 14
Introduction SQL Server Integration Services can read XML files, that’s known by every BI developer.  (If you didn’t, don’t worry, I’m aiming this article at newcomers as well.) But how far can you go?  When does the XML Source component become …
This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
Via a live example, show how to set up a backup for SQL Server using a Maintenance Plan and how to schedule the job into SQL Server Agent.
Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables. Make a table: Update a specific column given a specific row using the UPDATE statement: Remove a set of values using the DELETE s…

708 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now