Successfully reported this slideshow.
Your SlideShare is downloading. ×

How to upgrade your application with no downtime (using edition-based redefinition)

Ad
Ad
Ad
Ad
Ad
Ad
Ad
Ad
Ad
Ad
Ad
Loading in …3
×

Check these out next

1 of 52 Ad

How to upgrade your application with no downtime (using edition-based redefinition)

Download to read offline

Edition-Based Redefinition (EBR) is a powerful and fascinating feature of Oracle (added in version 11.2), that enables application upgrades with zero downtime, while the application is actively used and operational.
Join this presentation to learn how to use EBR, see many live examples, and get tips from real-life experience in a production site using EBR extensively.

Edition-Based Redefinition (EBR) is a powerful and fascinating feature of Oracle (added in version 11.2), that enables application upgrades with zero downtime, while the application is actively used and operational.
Join this presentation to learn how to use EBR, see many live examples, and get tips from real-life experience in a production site using EBR extensively.

Advertisement
Advertisement

More Related Content

Slideshows for you (20)

Viewers also liked (20)

Advertisement

Similar to How to upgrade your application with no downtime (using edition-based redefinition) (20)

Advertisement

Recently uploaded (20)

How to upgrade your application with no downtime (using edition-based redefinition)

  1. 1. How to Upgrade Your Application with no Downtime (and no Additional Costs!) Oren Nakdimon www.db-oriented.com  oren@db-oriented.com  +972-54-4393763 @DBoriented
  2. 2. This presentation is available in http://db-oriented.com/presentations ©OrenNakdimon WHO AM I? A CHRONOLOGY BY “ORACLE YEARS” Where: IAF When: Oracle 6/7 [1991-1997] What: Developer Where: Golden Screens When: Oracle 8 [1997-1998] What: Server Group Manager Where: TELEknowledge When: Oracle 8i/9i [1998-2003] What: DBA Group Manager Where: Olista When: Oracle 10g/11g [2004-2011] What: VP R&D + Israel Site Manager
  3. 3. This presentation is available in http://db-oriented.com/presentations ©OrenNakdimon WHO AM I? A CHRONOLOGY BY “ORACLE YEARS” Database Architect / Developer / DBA
  4. 4. This presentation is available in http://db-oriented.com/presentations ©OrenNakdimon @DBORIENTED
  5. 5. This presentation is available in http://db-oriented.com/presentations ©OrenNakdimon HTTP://DB-ORIENTED.COM
  6. 6. This presentation is available in http://db-oriented.com/presentations ©OrenNakdimon SHARING EXPERIENCE FROM…  A 24x7 system  Millions of end-users  Thousands of concurrent end-users  All around the world  Lots of PL/SQL code  Frequent upgrades  Intensive use of EBR
  7. 7. This presentation is available in http://db-oriented.com/presentations ©OrenNakdimon THE BOTTOM LINE  I think EBR is great!  It is quite a big and complex feature, but…  It is very easy to start using it  It may take some time to know all the details and nuances  Warning: as with any other feature, make sure to test it thoroughly before you decide to apply it in production
  8. 8. This presentation is available in http://db-oriented.com/presentations ©OrenNakdimon AGENDA  Application upgrades  Scenarios  Methods  EBR introduction  Upgrade use cases  Requirements  Challenges with online upgrade  Solving with EBR  Tips
  9. 9. APPLICATION UPGRADES Scenarios
  10. 10. This presentation is available in http://db-oriented.com/presentations ©OrenNakdimon APPLICATION UPGRADES Application X Application X + some change(s)
  11. 11. This presentation is available in http://db-oriented.com/presentations ©OrenNakdimon APPLICATION UPGRADES
  12. 12. This presentation is available in http://db-oriented.com/presentations ©OrenNakdimon APPLICATION UPGRADES  Upgrades are inherent to every application lifecycle  They may be:  Small or big  Frequent or rare  Simple or complex  With or without schema changes  Introducing new functionality, changing existing functionality, or removing functionality
  13. 13. APPLICATION UPGRADES Methods
  14. 14. EDITION-BASED REDEFINITION Introduction
  15. 15. This presentation is available in http://db-oriented.com/presentations ©OrenNakdimon EDITION BASED REDEFINITION  EBR is a feature set that lets you upgrade the database component of an application while it is in use, thereby minimizing or eliminating downtime  Introduced in 11gR2  EBR is supported in all editions, and requires no special license
  16. 16. This presentation is available in http://db-oriented.com/presentations ©OrenNakdimon  The fundamental ability is that different copies of the same object may coexist  Not all objects are editionable EDITION BASED REDEFINITION Edition1 Edition2 PKG_A JERRYTOM PKG_A PKG_A MY_VIEW MY_VIEW MY_OBJ MY_OBJ TABLE_X TABLE_Y
  17. 17. This presentation is available in http://db-oriented.com/presentations ©OrenNakdimon EDITIONS  Edition is a non-schema object  There must be at least one edition in the database  The initial edition is ORA$BASE  There is always one database-level default edition
  18. 18. This presentation is available in http://db-oriented.com/presentations ©OrenNakdimon EDITIONS – CONT.  Every new edition is created as a child of an existing edition  Currently (11.2, 12.*), each edition may have at most one child edition Edition1 Edition2 Edition3Edition3b
  19. 19. UPGRADE USE CASES
  20. 20. This presentation is available in http://db-oriented.com/presentations ©OrenNakdimon PEOPLE (table) PEOPLE_DL (package) add | remove APP_MGR (package) do_something
  21. 21. This presentation is available in http://db-oriented.com/presentations ©OrenNakdimon S B S B Table APP_MGR PEOPLE_DL @people_setup
  22. 22. This presentation is available in http://db-oriented.com/presentations ©OrenNakdimon USE CASE 1 – THE REQUIREMENTS  A package body should be changed  No change in package spec  No change in table structure
  23. 23. This presentation is available in http://db-oriented.com/presentations ©OrenNakdimon USE CASE 1 – THE CHALLENGES  Blocking  Compilation is blocked by active clients  Clients are blocked during compilation begin p; end; / alter procedure p compile; begin p; end; / begin p; end; / begin p; end; / begin p; end; / begin p; end; / begin p; end; / begin p; end; / begin p; end; / Session 1 Session 2 Session 3
  24. 24. This presentation is available in http://db-oriented.com/presentations ©OrenNakdimon Tip
  25. 25. This presentation is available in http://db-oriented.com/presentations ©OrenNakdimon EDITIONS AND USERS  To be able to own editioned objects  Editioning must be enabled for the user ALTER USER user ENABLE EDITIONS [FOR type…];  This is an irreversible operation  This is a retroactive operation @enable
  26. 26. This presentation is available in http://db-oriented.com/presentations ©OrenNakdimon EDITIONS AND USERS – CONT.  To be able to use a specific edition  Users must be granted the USE privilege on the edition GRANT USE ON EDITION edition TO user;  PUBLIC is always granted the database default edition @grant
  27. 27. This presentation is available in http://db-oriented.com/presentations ©OrenNakdimon SESSION EDITION  Each session uses one edition at a time  The current session edition:  SHOW EDITION (SQL*Plus)  SYS_CONTEXT('userenv', 'session_edition_name')  To change the session edition: ALTER SESSION SET EDITION = edition;  Must be the first statement of a transaction
  28. 28. This presentation is available in http://db-oriented.com/presentations ©OrenNakdimon EDITIONED OBJECTS  An editioned object in an edition is either:  Inherited or  Actual  Note: actualization is irreversible! @end_user_session @use_case_1 p edition1 edition2 edition3p
  29. 29. This presentation is available in http://db-oriented.com/presentations ©OrenNakdimon S B S B Table ora$base APP_MGR PEOPLE_DL V1 B
  30. 30. This presentation is available in http://db-oriented.com/presentations ©OrenNakdimon USE CASE 2 – THE REQUIREMENTS  A package spec should be changed  No change in table structure S B S B Table ora$base APP_MGR PEOPLE_DL V1 B
  31. 31. This presentation is available in http://db-oriented.com/presentations ©OrenNakdimon USE CASE 2 – THE CHALLENGES  Invalidation  Compilation errors (hopefully not…)  Object dependency  Revalidation occurs automatically when an object is referenced  Multiple interrelated objects need to be changed S B S B Table APP_MGR PEOPLE_DL
  32. 32. This presentation is available in http://db-oriented.com/presentations ©OrenNakdimon USE CASE 2  A package spec should be changed  No change in table structure S B S Bora$base APP_MGR PEOPLE_DL V1 B V2 S Table
  33. 33. This presentation is available in http://db-oriented.com/presentations ©OrenNakdimon USE CASE 2  A package spec should be changed  No change in table structure @use_case_2 S B S Bora$base APP_MGR PEOPLE_DL V1 B V2 S Table B B
  34. 34. This presentation is available in http://db-oriented.com/presentations ©OrenNakdimon A VERY IMPORTANT FOOTNOTE  Source: http://www.oracle.com/technetwork/database/features/availabilit y/ebr-455513.html
  35. 35. This presentation is available in http://db-oriented.com/presentations ©OrenNakdimon Tip
  36. 36. This presentation is available in http://db-oriented.com/presentations ©OrenNakdimon USE CASE 3 – THE REQUIREMENTS  A new column should be added  It represents a new logic  An existing package should be changed accordingly
  37. 37. This presentation is available in http://db-oriented.com/presentations ©OrenNakdimon USE CASE 3 – THE CHALLENGES  Invalidation  Code dependent on the table is invalidated (!) S B S B Table ora$base APP_MGR PEOPLE_DL V1 B V2 SB B
  38. 38. This presentation is available in http://db-oriented.com/presentations ©OrenNakdimon ViewProgram Unit ELIMINATING INVALIDATION Table
  39. 39. This presentation is available in http://db-oriented.com/presentations ©OrenNakdimon EDITIONING VIEWS  Editioning Views are:  Views (hence editionable)  Deliberately limited:  One per table  May contain only the SELECT and FROM clauses  The FROM clause refers to a single table  The SELECT list may contain only columns and aliases (no expressions), and each column may appear only once  Or in short: the view subquery may only project columns of its base table and aliasing the projected columns  DML triggers can be defined on them
  40. 40. This presentation is available in http://db-oriented.com/presentations ©OrenNakdimon Editioning Views are the Interface between the Application and the Tables
  41. 41. This presentation is available in http://db-oriented.com/presentations ©OrenNakdimon @use_case_3 Tip
  42. 42. This presentation is available in http://db-oriented.com/presentations ©OrenNakdimon Tip
  43. 43. This presentation is available in http://db-oriented.com/presentations ©OrenNakdimon USE CASE 4 – THE REQUIREMENTS  A new column should be added  It replaces an existing column  Cutover @use_case_4
  44. 44. This presentation is available in http://db-oriented.com/presentations ©OrenNakdimon USE CASE 4 – THE CHALLENGES  Keeping the old representation and new representation in sync until the cutover
  45. 45. This presentation is available in http://db-oriented.com/presentations ©OrenNakdimon CROSSEDITION TRIGGERS  A crossedition trigger is a “bridge” for moving data between editions  Temporary in nature  Forward crossedition triggers transform pre- upgrade representation to post-upgrade representation @fce_trigger
  46. 46. This presentation is available in http://db-oriented.com/presentations ©OrenNakdimon Tip
  47. 47. This presentation is available in http://db-oriented.com/presentations ©OrenNakdimon Tip
  48. 48. This presentation is available in http://db-oriented.com/presentations ©OrenNakdimon USE CASE 5  A new column should be added  It replaces an existing column  Rollover
  49. 49. This presentation is available in http://db-oriented.com/presentations ©OrenNakdimon REVERSE CROSSEDITION TRIGGERS  Reverse crossedition triggers transform post- upgrade representation to pre-upgrade representation @rce_trigger
  50. 50. This presentation is available in http://db-oriented.com/presentations ©OrenNakdimon Tip
  51. 51. This presentation is available in http://db-oriented.com/presentations ©OrenNakdimon EXPOSING THE NEW VERSION  Database-level: ALTER DATABASE DEFAULT EDITION = edition;  Session level  Statement level – using DBMS_SQL.PARSE  Service level
  52. 52. THANK YOU Oren Nakdimon www.db-oriented.com  oren@db-oriented.com  +972-54-4393763 @DBoriented

×