arthur

Austin Ofor

Posted on Apr 06, 2022

How to recover deleted Data from an Oracle database Table

To recover deleted data from an Oracle database after using the delete from table command to remove the data, you have to take note of the timestamp (date and time) when the data was deleted.

The timestamp is used as a flashpoint to recover back the deleted data.

Modify the below script to see/retrieve the deleted data.

select * from MY_TABLE 
as of timestamp to_timestamp('04-MAY-2017 13:30:00', 'DD-MON-YYYY HH24:MI:SS') 
where 'some condition';

In the above script, the time specified in the to_timestamp would return the dataset is as at the specified time (before the data was deleted). You can also use the where clause to filter the result set.

The timestamp above is in 24HRS format, for a 12HRS format use the below timestamp format.

select * from MY_TABLE 
as of timestamp to_timestamp('04-MAY-2017 12:30:00', 'DD-MON-YYYY HH:MI:SS') 
where 'some condition';

Happy coding!!!

A forum to write, learn and earn.

Made with love and Next.js with a touch of tailwind.

Built by @kwadoskii

TSB © 2021 - 2026