Saturday, May 14, 2016

Why EXPDP/IMPDP flashback_time is awesome?

So, I fucked up. I accidentally removed table which had the application users and their rights (true story).

What to do now? I had taken RMAN restore point before deleting the users (i though that I was doing the delete in database where flashback feature was on..), but flashback to restore point won't of course work if you haven't said "alter database flashback on".

What are my options? RMAN restore to timestamp? Yes. That's possible. I have the archive logs. But it's only couple of tables. Do I really, utterly need to this? Wait, expdp has flashback_time option nowadays. I can take export of the tables before I deleted them, do impdp and act like nothing happened (assuming that you know your ways handling possible triggers and constraints)

So, assuming that you have enough UNDO -tablespace space, you can do following:

flashback_time=”to_timestamp(’14-05-2016 12:00:00′, ‘DD-MM-YYYY HH24:MI:SS’)”

When the time is 13:00. Neat? I think so.