I’ve just read a thread on the OTN forums in which someone accidentally deleted his or her APEX application. The first and sole possible solution that comes to my mind in a situation like this is to apply the latest back-up (if you are lucky to have one). However, Application Express offers – in an indirect way – a pretty impressive alternative. I am talking about the flashback functionality when exporting a page or application. This means you can perform an export of your page or app as if it was x minutes ago, even if your page or app is deleted.
After I finished reading the thread on OTN, I had a look on Google to find out more on this matter. I came across a great article of P. Raganitsch that demonstrates how easy it is to recover a deleted page. This article however does not apply to the recovery of deleted applications. Submitting the application export page, after adding an extra <option> element, results in being redirected to the workspace login page or an error (Error processing condition. ORA-01427: single-row subquery returns more than one row).
Nevertheless, the steps required to recover a deleted application are very similar to P. Raganitsch’s method. Here is a quick how-to overview:
- let’s say I accidentally deleted an application with ID 100
- create a new APEX application with the same ID of the deleted application, in this case ID 100
- export the application you just created, and fill in the As of field with the appropriate number of minutes
- import the generated .sql export file
Credits go to “Kofi”, the person who suggested this technique in the OTN thread.
Some other interesting blog posts regarding this topic: