5 Things I wish I knew about APEX when I just started (part 4)

Flashback

Ever deleted or changed something by accident in your application and wished you could get it back?

You can! The oracle database has a feature called flashback, and APEX can take advantage of this feature. (Flashback needs to be enabled on the database, if you are not sure if it is enabled on your database, you can always ask your DBA).

Today I will show you some of the different places, where you can recover lost work.

Page items

Create a new application and a blank page. On that page add a region and some items.
Now delete one and modify some.
To undo the changes that you made, you can click the export page button. You will then see the following dialog:

flashback1

In the field “As of” enter the time in minutes that you want to go back and export the page.
If you now import the page again you will notice your items are back.
This method can be used for any page component (regions, buttons, items, dynamic actions…)

Regions & Processes

For modified regions and processes there is another feature that you can use. Suppose that you have modified your process or region code, and then you notice that something is no longer working and you want to go back to what it was before… You can do this by opening your region or process.

On the right-hand side of the page in the tasks block, you will see a link “undo region/process source”, click it.

flashback2

You will now get a popup with a select list showing all the times you modified something. Select the one you want, and press the set button. Next, click the past source text, to copy it to your region.

flashback3

Pages

If you deleted the entire page by accident, there is still no reason to be worried. There is also a way to go back in time and get your page back. For this, you go to the screen where you export your application like you would usually do, and you will notice the “as of” field is also available there.

flashback4

Application

And what if I deleted the entire application? Well then it’s time to start panicking….. Then calm down again, and do the following. Download SQL Developer and open the schema where your application is in and execute the following code:

Exec dbms_flashback.enable_at_time(SYSTIMESTAMP – INTERVAL ‘10’ minute);

You should now notice your application has reappeared in the list of applications in SQL developer:

flashback5

Now export your application by right clicking it. Select “quick ddl” and then save to file. You now have an export file of your application that you should be able to import again trough SQL Developer/APEX.

Please don’t do this for fun in a production environment to scare your boss, you never know if something might still get broken🙂

But at least now you know the option is there, should you ever need it.

Also check out my previous post about build options.

One thought on “5 Things I wish I knew about APEX when I just started (part 4)

  1. Good read.
    Another alternative to recovering a deleted application is to create a new application with the same application id and then use the “Export application as of” trick to recover the previous version.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

About Bjorn Fraeys