469,898 Members | 2,013 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,898 developers. It's quick & easy.

How to recover deleted rows

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
2 12318

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
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.

Similar topics

5 posts views Thread by Grant | last post: by
1 post views Thread by Roberto La Forgia | last post: by
reply views Thread by mike_dba | last post: by
4 posts views Thread by =?Utf-8?B?cmFuZHkxMjAw?= | last post: by
1 post views Thread by Waqarahmed | last post: by
reply views Thread by Salome Sato | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.