Wednesday 7 March 2012

Exporting deleted Apex applications

It's very rare I lose a piece of work, but recently when removing a bunch of miscellaneous applications from my workspace, I inadvertently removed one that I think I should have kept - so I thought I better go restore it.

Update: June 2016: Turns out there's a craftier solution - just create a new blank application with the same app_id, then you can use the declarative offering.

Heading over to the application export, we can in fact export applications as of x many minutes ago. I know a few people who have used this feature to save lost work, but it's dependent on a number of factors - one of which is that your application still needs to be present in the workspace!

So I got my database to turn back time so I could export the application from the database before I nuked it.

Trouble is, in my first effort, I went a little too far.

See, in the midst of battle, I wasn't sure exactly when I removed it, and how far on my little laptop db I could create time paradoxes.

I found the magic number then grabbed a copy of my application - I could have done the same thing via the SQL Developer GUI but I just happened to have this syntax on hand.

And so that's how I saved the day, well, as it turns out I did have a copy after all.

Of course, when I try to double check information about this particular feature, I find people like Tyler wrote about this some time ago. Never hurts to have a reminder :-)

-- to assist with googlers, I thought I better add the code, instead of just the image.
exec dbms_flashback.enable_at_time(systimestamp-0.17);
select wwv_flow_utilities.export_application_to_clob(120) from dual;
select * from apex_applications;

ScottWe.

No comments: