How to upgrade your application with no downtime (using edition-based redefinition)
-
Upload
oren-nakdimon -
Category
Technology
-
view
248 -
download
2
Transcript of How to upgrade your application with no downtime (using edition-based redefinition)
![Page 1: How to upgrade your application with no downtime (using edition-based redefinition)](https://reader030.fdocuments.in/reader030/viewer/2022021420/58ac40231a28ab99028b47a5/html5/thumbnails/1.jpg)
How to Upgrade Your Application with no Downtime(and no Additional Costs!)
Oren Nakdimon
www.db-oriented.com
+972-54-4393763
@DBoriented
![Page 2: How to upgrade your application with no downtime (using edition-based redefinition)](https://reader030.fdocuments.in/reader030/viewer/2022021420/58ac40231a28ab99028b47a5/html5/thumbnails/2.jpg)
This presentation is available in http://db-oriented.com/presentations © O
ren N
akdim
on
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 ManagerWhere: 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
![Page 3: How to upgrade your application with no downtime (using edition-based redefinition)](https://reader030.fdocuments.in/reader030/viewer/2022021420/58ac40231a28ab99028b47a5/html5/thumbnails/3.jpg)
This presentation is available in http://db-oriented.com/presentations © O
ren N
akdim
on
WHO AM I?A CHRONOLOGY BY “ORACLE YEARS”
Database Architect /
Developer / DBA
![Page 4: How to upgrade your application with no downtime (using edition-based redefinition)](https://reader030.fdocuments.in/reader030/viewer/2022021420/58ac40231a28ab99028b47a5/html5/thumbnails/4.jpg)
This presentation is available in http://db-oriented.com/presentations © O
ren N
akdim
on
@DBORIENTED
![Page 5: How to upgrade your application with no downtime (using edition-based redefinition)](https://reader030.fdocuments.in/reader030/viewer/2022021420/58ac40231a28ab99028b47a5/html5/thumbnails/5.jpg)
This presentation is available in http://db-oriented.com/presentations © O
ren N
akdim
on
HTTP://DB-ORIENTED.COM
![Page 6: How to upgrade your application with no downtime (using edition-based redefinition)](https://reader030.fdocuments.in/reader030/viewer/2022021420/58ac40231a28ab99028b47a5/html5/thumbnails/6.jpg)
This presentation is available in http://db-oriented.com/presentations © O
ren N
akdim
on
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
![Page 7: How to upgrade your application with no downtime (using edition-based redefinition)](https://reader030.fdocuments.in/reader030/viewer/2022021420/58ac40231a28ab99028b47a5/html5/thumbnails/7.jpg)
This presentation is available in http://db-oriented.com/presentations © O
ren N
akdim
on
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
![Page 8: How to upgrade your application with no downtime (using edition-based redefinition)](https://reader030.fdocuments.in/reader030/viewer/2022021420/58ac40231a28ab99028b47a5/html5/thumbnails/8.jpg)
This presentation is available in http://db-oriented.com/presentations © O
ren N
akdim
on
AGENDA
Application upgrades
Scenarios
Methods
EBR introduction
Upgrade use cases
Requirements
Challenges with online upgrade
Solving with EBR
Tips
![Page 9: How to upgrade your application with no downtime (using edition-based redefinition)](https://reader030.fdocuments.in/reader030/viewer/2022021420/58ac40231a28ab99028b47a5/html5/thumbnails/9.jpg)
APPLICATION UPGRADES
Scenarios
![Page 10: How to upgrade your application with no downtime (using edition-based redefinition)](https://reader030.fdocuments.in/reader030/viewer/2022021420/58ac40231a28ab99028b47a5/html5/thumbnails/10.jpg)
This presentation is available in http://db-oriented.com/presentations © O
ren N
akdim
on
APPLICATION UPGRADES
Application XApplication X
+ some change(s)
![Page 11: How to upgrade your application with no downtime (using edition-based redefinition)](https://reader030.fdocuments.in/reader030/viewer/2022021420/58ac40231a28ab99028b47a5/html5/thumbnails/11.jpg)
This presentation is available in http://db-oriented.com/presentations © O
ren N
akdim
on
APPLICATION UPGRADES
![Page 12: How to upgrade your application with no downtime (using edition-based redefinition)](https://reader030.fdocuments.in/reader030/viewer/2022021420/58ac40231a28ab99028b47a5/html5/thumbnails/12.jpg)
This presentation is available in http://db-oriented.com/presentations © O
ren N
akdim
on
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
![Page 13: How to upgrade your application with no downtime (using edition-based redefinition)](https://reader030.fdocuments.in/reader030/viewer/2022021420/58ac40231a28ab99028b47a5/html5/thumbnails/13.jpg)
APPLICATION UPGRADES
Methods
![Page 14: How to upgrade your application with no downtime (using edition-based redefinition)](https://reader030.fdocuments.in/reader030/viewer/2022021420/58ac40231a28ab99028b47a5/html5/thumbnails/14.jpg)
EDITION-BASED REDEFINITION
Introduction
![Page 15: How to upgrade your application with no downtime (using edition-based redefinition)](https://reader030.fdocuments.in/reader030/viewer/2022021420/58ac40231a28ab99028b47a5/html5/thumbnails/15.jpg)
This presentation is available in http://db-oriented.com/presentations © O
ren N
akdim
on
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
![Page 16: How to upgrade your application with no downtime (using edition-based redefinition)](https://reader030.fdocuments.in/reader030/viewer/2022021420/58ac40231a28ab99028b47a5/html5/thumbnails/16.jpg)
This presentation is available in http://db-oriented.com/presentations © O
ren N
akdim
on
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
![Page 17: How to upgrade your application with no downtime (using edition-based redefinition)](https://reader030.fdocuments.in/reader030/viewer/2022021420/58ac40231a28ab99028b47a5/html5/thumbnails/17.jpg)
This presentation is available in http://db-oriented.com/presentations © O
ren N
akdim
on
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
![Page 18: How to upgrade your application with no downtime (using edition-based redefinition)](https://reader030.fdocuments.in/reader030/viewer/2022021420/58ac40231a28ab99028b47a5/html5/thumbnails/18.jpg)
This presentation is available in http://db-oriented.com/presentations © O
ren N
akdim
on
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
![Page 19: How to upgrade your application with no downtime (using edition-based redefinition)](https://reader030.fdocuments.in/reader030/viewer/2022021420/58ac40231a28ab99028b47a5/html5/thumbnails/19.jpg)
UPGRADE USE CASES
![Page 20: How to upgrade your application with no downtime (using edition-based redefinition)](https://reader030.fdocuments.in/reader030/viewer/2022021420/58ac40231a28ab99028b47a5/html5/thumbnails/20.jpg)
This presentation is available in http://db-oriented.com/presentations © O
ren N
akdim
on
PEOPLE
(table)
PEOPLE_DL
(package)
add | remove
APP_MGR
(package)
do_something
![Page 21: How to upgrade your application with no downtime (using edition-based redefinition)](https://reader030.fdocuments.in/reader030/viewer/2022021420/58ac40231a28ab99028b47a5/html5/thumbnails/21.jpg)
This presentation is available in http://db-oriented.com/presentations © O
ren N
akdim
on
S B S B Table
APP_MGR PEOPLE_DL
@people_setup
![Page 22: How to upgrade your application with no downtime (using edition-based redefinition)](https://reader030.fdocuments.in/reader030/viewer/2022021420/58ac40231a28ab99028b47a5/html5/thumbnails/22.jpg)
This presentation is available in http://db-oriented.com/presentations © O
ren N
akdim
on
USE CASE 1 – THE REQUIREMENTS
A package body should be changed
No change in package spec
No change in table structure
![Page 23: How to upgrade your application with no downtime (using edition-based redefinition)](https://reader030.fdocuments.in/reader030/viewer/2022021420/58ac40231a28ab99028b47a5/html5/thumbnails/23.jpg)
This presentation is available in http://db-oriented.com/presentations © O
ren N
akdim
on
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
![Page 24: How to upgrade your application with no downtime (using edition-based redefinition)](https://reader030.fdocuments.in/reader030/viewer/2022021420/58ac40231a28ab99028b47a5/html5/thumbnails/24.jpg)
This presentation is available in http://db-oriented.com/presentations © O
ren N
akdim
onTip
![Page 25: How to upgrade your application with no downtime (using edition-based redefinition)](https://reader030.fdocuments.in/reader030/viewer/2022021420/58ac40231a28ab99028b47a5/html5/thumbnails/25.jpg)
This presentation is available in http://db-oriented.com/presentations © O
ren N
akdim
on
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
![Page 26: How to upgrade your application with no downtime (using edition-based redefinition)](https://reader030.fdocuments.in/reader030/viewer/2022021420/58ac40231a28ab99028b47a5/html5/thumbnails/26.jpg)
This presentation is available in http://db-oriented.com/presentations © O
ren N
akdim
on
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
![Page 27: How to upgrade your application with no downtime (using edition-based redefinition)](https://reader030.fdocuments.in/reader030/viewer/2022021420/58ac40231a28ab99028b47a5/html5/thumbnails/27.jpg)
This presentation is available in http://db-oriented.com/presentations © O
ren N
akdim
on
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
![Page 28: How to upgrade your application with no downtime (using edition-based redefinition)](https://reader030.fdocuments.in/reader030/viewer/2022021420/58ac40231a28ab99028b47a5/html5/thumbnails/28.jpg)
This presentation is available in http://db-oriented.com/presentations © O
ren N
akdim
on
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
![Page 29: How to upgrade your application with no downtime (using edition-based redefinition)](https://reader030.fdocuments.in/reader030/viewer/2022021420/58ac40231a28ab99028b47a5/html5/thumbnails/29.jpg)
This presentation is available in http://db-oriented.com/presentations © O
ren N
akdim
on
S B S B
Table
ora$base
APP_MGR PEOPLE_DL
V1 B
![Page 30: How to upgrade your application with no downtime (using edition-based redefinition)](https://reader030.fdocuments.in/reader030/viewer/2022021420/58ac40231a28ab99028b47a5/html5/thumbnails/30.jpg)
This presentation is available in http://db-oriented.com/presentations © O
ren N
akdim
on
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
![Page 31: How to upgrade your application with no downtime (using edition-based redefinition)](https://reader030.fdocuments.in/reader030/viewer/2022021420/58ac40231a28ab99028b47a5/html5/thumbnails/31.jpg)
This presentation is available in http://db-oriented.com/presentations © O
ren N
akdim
on
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
![Page 32: How to upgrade your application with no downtime (using edition-based redefinition)](https://reader030.fdocuments.in/reader030/viewer/2022021420/58ac40231a28ab99028b47a5/html5/thumbnails/32.jpg)
This presentation is available in http://db-oriented.com/presentations © O
ren N
akdim
on
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
![Page 33: How to upgrade your application with no downtime (using edition-based redefinition)](https://reader030.fdocuments.in/reader030/viewer/2022021420/58ac40231a28ab99028b47a5/html5/thumbnails/33.jpg)
This presentation is available in http://db-oriented.com/presentations © O
ren N
akdim
on
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
![Page 34: How to upgrade your application with no downtime (using edition-based redefinition)](https://reader030.fdocuments.in/reader030/viewer/2022021420/58ac40231a28ab99028b47a5/html5/thumbnails/34.jpg)
This presentation is available in http://db-oriented.com/presentations © O
ren N
akdim
on
A VERY IMPORTANT FOOTNOTE
Source: http://www.oracle.com/technetwork/database/features/availability/ebr-455513.html
![Page 35: How to upgrade your application with no downtime (using edition-based redefinition)](https://reader030.fdocuments.in/reader030/viewer/2022021420/58ac40231a28ab99028b47a5/html5/thumbnails/35.jpg)
This presentation is available in http://db-oriented.com/presentations © O
ren N
akdim
onTip
![Page 36: How to upgrade your application with no downtime (using edition-based redefinition)](https://reader030.fdocuments.in/reader030/viewer/2022021420/58ac40231a28ab99028b47a5/html5/thumbnails/36.jpg)
This presentation is available in http://db-oriented.com/presentations © O
ren N
akdim
on
USE CASE 3 – THE REQUIREMENTS
A new column should be added
It represents a new logic
An existing package should be changed accordingly
![Page 37: How to upgrade your application with no downtime (using edition-based redefinition)](https://reader030.fdocuments.in/reader030/viewer/2022021420/58ac40231a28ab99028b47a5/html5/thumbnails/37.jpg)
This presentation is available in http://db-oriented.com/presentations © O
ren N
akdim
on
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
![Page 38: How to upgrade your application with no downtime (using edition-based redefinition)](https://reader030.fdocuments.in/reader030/viewer/2022021420/58ac40231a28ab99028b47a5/html5/thumbnails/38.jpg)
This presentation is available in http://db-oriented.com/presentations © O
ren N
akdim
on
ViewProgram
Unit
ELIMINATING INVALIDATION
Table
![Page 39: How to upgrade your application with no downtime (using edition-based redefinition)](https://reader030.fdocuments.in/reader030/viewer/2022021420/58ac40231a28ab99028b47a5/html5/thumbnails/39.jpg)
This presentation is available in http://db-oriented.com/presentations © O
ren N
akdim
on
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
![Page 40: How to upgrade your application with no downtime (using edition-based redefinition)](https://reader030.fdocuments.in/reader030/viewer/2022021420/58ac40231a28ab99028b47a5/html5/thumbnails/40.jpg)
This presentation is available in http://db-oriented.com/presentations © O
ren N
akdim
on
Editioning Views are
the Interface
between the
Application and the
Tables
![Page 41: How to upgrade your application with no downtime (using edition-based redefinition)](https://reader030.fdocuments.in/reader030/viewer/2022021420/58ac40231a28ab99028b47a5/html5/thumbnails/41.jpg)
This presentation is available in http://db-oriented.com/presentations © O
ren N
akdim
on
@use_case_3
Tip
![Page 42: How to upgrade your application with no downtime (using edition-based redefinition)](https://reader030.fdocuments.in/reader030/viewer/2022021420/58ac40231a28ab99028b47a5/html5/thumbnails/42.jpg)
This presentation is available in http://db-oriented.com/presentations © O
ren N
akdim
onTip
![Page 43: How to upgrade your application with no downtime (using edition-based redefinition)](https://reader030.fdocuments.in/reader030/viewer/2022021420/58ac40231a28ab99028b47a5/html5/thumbnails/43.jpg)
This presentation is available in http://db-oriented.com/presentations © O
ren N
akdim
on
USE CASE 4 – THE REQUIREMENTS
A new column should be added
It replaces an existing column
Cutover
@use_case_4
![Page 44: How to upgrade your application with no downtime (using edition-based redefinition)](https://reader030.fdocuments.in/reader030/viewer/2022021420/58ac40231a28ab99028b47a5/html5/thumbnails/44.jpg)
This presentation is available in http://db-oriented.com/presentations © O
ren N
akdim
on
USE CASE 4 – THE CHALLENGES
Keeping the old representation and new representation in sync until the cutover
![Page 45: How to upgrade your application with no downtime (using edition-based redefinition)](https://reader030.fdocuments.in/reader030/viewer/2022021420/58ac40231a28ab99028b47a5/html5/thumbnails/45.jpg)
This presentation is available in http://db-oriented.com/presentations © O
ren N
akdim
on
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
![Page 46: How to upgrade your application with no downtime (using edition-based redefinition)](https://reader030.fdocuments.in/reader030/viewer/2022021420/58ac40231a28ab99028b47a5/html5/thumbnails/46.jpg)
This presentation is available in http://db-oriented.com/presentations © O
ren N
akdim
onTip
![Page 47: How to upgrade your application with no downtime (using edition-based redefinition)](https://reader030.fdocuments.in/reader030/viewer/2022021420/58ac40231a28ab99028b47a5/html5/thumbnails/47.jpg)
This presentation is available in http://db-oriented.com/presentations © O
ren N
akdim
onTip
![Page 48: How to upgrade your application with no downtime (using edition-based redefinition)](https://reader030.fdocuments.in/reader030/viewer/2022021420/58ac40231a28ab99028b47a5/html5/thumbnails/48.jpg)
This presentation is available in http://db-oriented.com/presentations © O
ren N
akdim
on
USE CASE 5
A new column should be added
It replaces an existing column
Rollover
![Page 49: How to upgrade your application with no downtime (using edition-based redefinition)](https://reader030.fdocuments.in/reader030/viewer/2022021420/58ac40231a28ab99028b47a5/html5/thumbnails/49.jpg)
This presentation is available in http://db-oriented.com/presentations © O
ren N
akdim
on
REVERSE CROSSEDITION TRIGGERS
Reverse crossedition triggers transform post-upgrade representation to pre-upgrade representation
@rce_trigger
![Page 50: How to upgrade your application with no downtime (using edition-based redefinition)](https://reader030.fdocuments.in/reader030/viewer/2022021420/58ac40231a28ab99028b47a5/html5/thumbnails/50.jpg)
This presentation is available in http://db-oriented.com/presentations © O
ren N
akdim
onTip
![Page 51: How to upgrade your application with no downtime (using edition-based redefinition)](https://reader030.fdocuments.in/reader030/viewer/2022021420/58ac40231a28ab99028b47a5/html5/thumbnails/51.jpg)
This presentation is available in http://db-oriented.com/presentations © O
ren N
akdim
on
EXPOSING THE NEW VERSION
Database-level:
ALTER DATABASE DEFAULT EDITION = edition;
Session level
Statement level – using DBMS_SQL.PARSE
Service level