422,023 Members | 1,005 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 422,023 IT Pros & Developers. It's quick & easy.

How to recover deleted rows

P: n/a
hi

two days before arount 20,000 rows are manuly deleted, is there any way
to recover it back.
We have backup, that is 10 days old, Is there any way to recover only
that 20,000 rows,
Plz help me out ASAP.

Regards
Senthil Kumar.T

Sep 6 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a

se********@gmail.com wrote:
hi

two days before arount 20,000 rows are manuly deleted, is there any way
to recover it back.
We have backup, that is 10 days old, Is there any way to recover only
that 20,000 rows,
Plz help me out ASAP.

Regards
Senthil Kumar.T
Provided that no other rows other than the 20,000 ones were deleted
since then, you can write a trivial program that goes through all rows
available in the backup ( dumped into memory, files whatever) comparing
them with the ones you have left.

Find the ones that exist in the original set ( provided by the backup
) but do not exist on the current set ( the ones left after the manual
removal ).

Use INSERT IGNORE VALUES (...), (...), (...), (...)
to insert them back. Providing the column data for many rows ( as
opposed to just one ) for INSERT will considerably speed up the
process.

Sep 6 '06 #2

P: n/a
se********@gmail.com wrote:
hi

two days before arount 20,000 rows are manuly deleted, is there any way
to recover it back.
We have backup, that is 10 days old, Is there any way to recover only
that 20,000 rows,
Plz help me out ASAP.

Regards
Senthil Kumar.T
Yes, It may prove tedious, but step-by-step.

1. Create a temporary table using

CREATE TABLE temp AS SELECT * FROM realtable.

2. Delete the contents of the temp table.

3. Add the same primary index to temp

4. Load temp from your backup

5. Delete from the temp table where the primary key can be
found in the real table

What is left in the temp table are the deleted records

6. Insert them into the real table.
HTH
Jerry
Sep 6 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.