One of my prime responsibilities is developing the Packaged Applications which are included in APEX (since version 4.2). For those who don’t know, these are applications which are intended to serve two purposes: First, they are examples of how to do some pretty cool stuff with APEX; Second, they are intended to be actual useful programs that solve real-world issues. (We have some straight-up sample applications as well, distinguished by having the term “Sample” in their title. I normally refer to the non-sample apps as “Productivity” apps to help distinguish the two.)
When you install a Productivity Packaged App, it is set to a “Locked” state. While in this state, you can change the Authentication Scheme, but you cannot edit the application or any of its components, which also means that you can’t examine how it works (to use as a sample app). The reason for this is so that when we release a new version of the application, it can be upgraded smoothly–we don’t have to check to see if the application has been modified, and definitely don’t have to implement any sort of logic to try to migrate arbitrary customizations from one version into the next. Oh, and as long as the packaged app is locked, it is supported by Oracle Support; once you break the seal, though, it’s yours.
However, one question that comes up surprisingly regularly runs along the lines of “I unlocked a packaged app to see how it works, but didn’t make any changes. Can I re-lock it so that I can get the next upgrade?” The answer is yes, but you need to follow a specific process to do so.
- Edit the Application, and start the Delete wizard. Don’t rush into deleting it, though–you need to make sure you get this right.
- On the Deinstall Application page, set the Deinstallation Options to Remove Application Definition, but not to Deinstall Supporting Objects. This will ensure that the underlying tables remain after the application is dropped, so you won’t lose your data.
- Once the Application has been removed, re-install the Packaged App. Since the supporting objects already exist, APEX will merely check to see if any of the supporting objects upgrade scripts need to be run, rather than trying to run the installation scripts for them. We’re very careful to ensure that the upgrade scripts can be run multiple times without errors, so this should happen without any issues.
And that will leave you with a properly locked (and supported!) copy of the Packaged App, without losing any data.