Presentation is loading. Please wait.

Presentation is loading. Please wait.

The powerhouse PL/SQL upgrade option: Edition-Based Redefinition (EBR)

Similar presentations


Presentation on theme: "The powerhouse PL/SQL upgrade option: Edition-Based Redefinition (EBR)"— Presentation transcript:

1 The powerhouse PL/SQL upgrade option: Edition-Based Redefinition (EBR)
Tim Hall Oracle ACE Director Oracle ACE of the Year 2006 OakTable Network OCP DBA (7, 8, 8i, 9i, 10g, 11g) OCP Advanced PL/SQL Developer Oracle Database: SQL Certified Expert Books Oracle PL/SQL Tuning Oracle Job Scheduling

2 Why should we care about EBR?
Application upgrades with no downtime. Run multiple versions of apps simultaneously. Gradual ramp-up.

3 Editions Version label (sort-of) for some objects in schema.
Only apply to: PL/SQL Objects: Functions, Libraries, Packages, Procedures, Triggers, Types Also: Synonyms, Views Objects identified by: owner object_name object_type edition

4 New and Amended Dictionary Views
*_EDITIONS *_EDITION_COMMENTS *_OBJECTS *_OBJECTS_AE *_ERRORS *_ERRORS_AE *_USERS *_VIEWS *_EDITIONING_VIEWS *_EDITIONING_VIEWS_AE *_EDITIONING_VIEW_COLS *_EDITIONING_VIEW_COLS_AE * = DBA / ALL / USER

5 What about tables? Tables NOT editionable.
Use “Editioning Views” to see subsets and rename columns. CREATE OR REPLACE EDITIONING VIEW view-name AS SELECT col1, col2, col4 AS new_name FROM table-name; Apps access EViews, not tables.

6 Editioning Views Schema Edition: release_v1 Edition: release_v2

7 Performance Oracle guarantee execution plan will match for same query against editioning view and table. No performance impact.

8 Do base tables have missing data?
Yes, but there is a solution. Use Cross-Edition Triggers to keep base table consistent. Similar to regular triggers. Transient.

9 Demo setup.sql

10 Managing Editions Editions are created using CREATE EDITION. CREATE EDITION ed-name; CREATE EDITION ed-name AS CHILD OF ed-name; Currently only 1 child per parent. Attempt to branch results in error. ORA-38807: Implementation restriction: an edition can have only one child v1 v2 v3 v1.5

11 Managing Editions (continued)
Unreferenced leaf editions removed using DROP EDITION. Attempt to drop non-leaf edition results in error ORA-38810: Implementation restriction: cannot drop edition that has a parent and a child Query DBA_EDITIONS. manage_editions.sql v1 v2 v3

12 User Setup Editioning must be turned on for a user. ALTER USER username ENABLE EDITIONS; No off switch! Specific editions must be associated with users. GRANT USE ON EDITION ed-name TO username; user_setup.sql

13 Switching between editions
Any Session: (switch_editions.sql) ALTER SESSION SET EDITION = ed-name; ALTER DATABASE DEFAULT EDITION = ed-name; SQL*Plus: $ export ORA_EDITION=ed-name C:> set ORA_EDITION=ed-name $ sqlplus edition=ed-name SQL> CONNECT EDITION=ed-name

14 Switching between editions (continued)
Services: Editions associated with services ( ) BEGIN DBMS_SERVICE.modify_service( service_name => 'DB11G.WORLD', edition => 'RELEASE_V1', modify_edition => TRUE); END; / When you switch to a new edition, all editionable objects in schema are automatically inherited from the previous edition. Altering or dropping an object breaks inheritance for that object.

15 Preparing existing app for editions.
Rename base tables. Create editioning views matching original table structures and names. PL/SQL objects will recompile against editioning view. Drop any triggers and compile them against editioning views, rather than base tables. If necessary, apply VPD policies against editioning views, rather than base tables. Revoke all privileges against tables and recreate them against the editioning views.

16 Create new application
Build editioning views over tables. Code references editioning views, not tables. Triggers and VPD policies reference editioning views. (create_app.sql)

17 Upgrade application Amend base tables. Switch edition.
Build new editioning views and new app. Build cross edition triggers and update missing data. (upgrade_app.sql)

18 Summary Application upgrades with no downtime.
Run multiple versions of apps simultaneously. Gradual ramp-up. Not just a PL/SQL feature. Java apps use tables too.

19 The End… Download slides at: http://www.oracle-base.com/workshops
Article:


Download ppt "The powerhouse PL/SQL upgrade option: Edition-Based Redefinition (EBR)"

Similar presentations


Ads by Google