How to recover deleted rows
am 06.09.2006 08:31:20 von senthiltsj
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
Re: How to recover deleted rows
am 06.09.2006 10:35:41 von Mark Papadakis
senthiltsj@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.
Re: How to recover deleted rows
am 06.09.2006 14:40:08 von jerry gitomer
senthiltsj@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