I promised in the last post I would tell you how to keep stable editions without bloating the data dictionary. As you probably surmised from the title, the answer is to make only 2 editions and “flip flop” between them. They must, by Oracle rules, be parent and child, but you will treat them as sibling editions, always performing the same changes to both (but not at the same time).
Pick names that don’t imply a parent-child hierarchy or sequence, 2 unordered equals. Colors or animal names for example. You will explicitly avoid any inheritance between these editions. Instantiate all objects in the child edition, including synonyms. Even make explicit grants to the objects in the child edition. “Shared nothing” is the goal.
There is one flaw in this, if you deploy new code to the parent edition first, any new editioned objects will appear in the child edition before you deploy code explicitly in that edition. In most cases, the new objects will be ignored by the old code, but there is one type of editioned object that executes without being called — triggers. If the new trigger is valid in the child edition, it will execute, which may be ok. But, if the new trigger is not valid, DML that calls that trigger will begin to fail. It is best to assume that you need to avoid the new trigger being visible in the child edition, and there are 2 ways to do that:
1) Always do the first deploy to the child edition – then, when you are running in that edition and do the “catch up” deploy to the parent, the triggers already exist in the child edition and so the trigger in the parent edition is no longer new.
2) Pre-create a “dummy” trigger in the child edition – Make a trigger with the same name, but a body of “null;”, and install it into the child edition, before you start the real deploy. You can even drop that trigger immediately, once a object has been created in an edition an object with that name will always exist. Even if you drop the trigger, the parent trigger of the same name will never bleed through. If you don’t drop it, make sure the real trigger in the real deploy is installed with “create or replace” to overwrite the dummy trigger.
Personally, I recommend the second option as the one that can never fail due to confusion about the edition you are deploying to. It can be done far in advance if desired to ensure that it is done. If you can setup a process that allows you to switch all connections to the parent easily, by all means do that. Nothing says you can’t do both.
