This is the overall plan for implementing editioning in a database.
- Planning steps
- Create Editions
- Replace Public Synonyms
- Enable schemas for editioning
- Save all triggers on the tables to be editioned
- Converting tables to Editioning Views
- Moving Triggers
- Stabilizes all editioned objects across editions
- Switch the default to one of the new edtions
- Implement no-downtime code deploys
Planning steps
How many editions ?
What schemas will contain editioned objects ?
Naming conventions
- editions
- tables vs editioning views – example would be to append an underscore to each table name
Will you use cross edition triggers ?
Handling DML changes to live systems
Cleanup tasks
- drop any invalid objects (or make them valid if you need to keep them)
- (optional) find code dependencies on synonyms and make the reference explicit if possible
Create Editions
Script this and test it thoroughly in your dev database
Be certain to build them in the same order and with the same names in all your databases
Don’t worry about instantiating anything, no users are enabled for editions yet, so nothing will edition
Replace Public Synonyms
Only need to drop the public synonyms that point to objects that belong to the schemas to be editioned (as determined in the planning step above)
Script a method of creating private synonyms for all schemas that can access these objects. Create those private synonyms before dropping the public ones.
Recompile any invalid objects – these go invalid when you create the private synonyms that override the publicones
Finally, drop the public synonyms and recheck for invalid objects
Enable schemas for editioning
Using the list from your planning, alter the users to turn on their editioned flag
You can query dba_users to confirm they are all enabled for editioning
Recompile everything. Here is where having no invalid objects to start makes this faster and cleaner. If something won’t recompile, fix it now.
Save all triggers on the tables to be editioned
Make sure you can recreate the trigger exactly as they are now, before you rename any tables.
After the table rename, the triggers will point to the new names, that is why you must grab the source now, or ensure it is otherwise available for creating the triggers from scratch
Converting tables to Editioning Views
You will need to rename each table where you wish to use editioning views. This is normally all the tables owned by the editioned schemas.
If the existing table name is the max number of characters, you need to modify it in some way if you wish to append an underscore
Script this also (seeing a theme here?), where for each table you rename it and create an EV as select * from the (changed) tablename
Again recompile everything – doing the recompiles in between help you debug issues with this, once you have the scripts proven, you might skip the interim compiles to save time on your production implementation, Depending on how good you feel about it
Moving Triggers
First, you must drop all the triggers on the underlying tables
Run the trigger create SQL you saved or otherwise made available, before the renames
Verify the triggers all match what they were before. They will still point to the same “table”, though that is now an editioning view
Stabilizes all editioned objects across editions
Starting in the lowest child edition, compile each editioned object into that edition, checking for invalid objects and fixing as needed
Repeat for the other editions
Run queries to compare counts of the various editions
Switch the default to one of the new edtions
Alter the default edition and any cluster ready services to point to one of the new editoins
Test with new connections to the DB
Implement no-downtime code deploys
Script this for safety and convenience
It is critical that you check the current edition and ensure you never deploy to the default edition
Want more details for these tasks? I am composing detailed instructions and some actual code for future posts.
I also reserve the right to come back to edit and add to this as I go through my next implementation. This was all written from memory and nothing jogs ones memory like repeating the process a second time.