[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1300
  • Last Modified:

Recover Data From MDF and LDF

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
barisdur76
Asked:
barisdur76
  • 8
  • 3
  • 2
  • +3
1 Solution
 
pinaldaveCommented:
You can restore the Source DB with different database name and use that further.
0
 
barisdur76Author Commented:
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
 
barisdur76Author Commented:
And one more thing.
There is no backup. Just the MDF and LDF.
0
NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

 
HillwaaaCommented:
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
 
barisdur76Author Commented:
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
 
DireOrbAntCommented:
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
 
barisdur76Author Commented:
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
 
barisdur76Author Commented:
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
 
DireOrbAntCommented:
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
 
barisdur76Author Commented:
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
 
barisdur76Author Commented:
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
 
Scott PletcherSenior DBACommented:
>>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
 
barisdur76Author Commented:
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
 
Scott PletcherSenior DBACommented:
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
 
Scott PletcherSenior DBACommented:
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
 
pinaldaveCommented:
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
 
Computer101Commented:
PAQed with points refunded (500)

Computer101
EE Admin
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 8
  • 3
  • 2
  • +3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now