[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

Recover Data From MDF and LDF

Posted on 2006-11-25
19
Medium Priority
?
1,297 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Moving data to the cloud? Find out if you’re ready

Before moving to the cloud, it is important to carefully define your db needs, plan for the migration & understand prod. environment. This wp explains how to define what you need from a cloud provider, plan for the migration & what putting a cloud solution into practice entails.

 
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 70

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 70

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 70

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

Survive A High-Traffic Event with Percona

Your application or website rely on your database to deliver information about products and services to your customers. You can’t afford to have your database lose performance, lose availability or become unresponsive – even for just a few minutes.

Question has a verified solution.

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

For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
In part one, we reviewed the prerequisites required for installing SQL Server vNext. In this part we will explore how to install Microsoft's SQL Server on Ubuntu 16.04.
Via a live example combined with referencing Books Online, show some of the information that can be extracted from the Catalog Views in SQL Server.
Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.

656 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