SlideShare a Scribd company logo
1 of 166
Download to read offline
Edition-Based Redefinition
Made Easy
Oren Nakdimon
www.db-oriented.com
 oren@db-oriented.com
 +972-54-4393763
@DBoriented
How to Upgrade Your Application
with no Downtime
(and no Additional Costs)
This presentation is available in http://db-oriented.com/presentations
©OrenNakdimon©OrenNakdimon©OrenNakdimon
http://db-oriented.com
Who
Am I
?
3 Membership Tiers
• Oracle ACE Director
• Oracle ACE
• Oracle ACE Associate
bit.ly/OracleACEProgram
500+ Technical Experts
Helping Peers Globally
Connect:
Nominate yourself or someone you know: acenomination.oracle.com
@oracleace
Facebook.com/oracleaces
oracle-ace_ww@oracle.com
This presentation is available in http://db-oriented.com/presentations
©OrenNakdimon©OrenNakdimon©OrenNakdimon
Edition-Based
Redefinition
This presentation is available in http://db-oriented.com/presentations
©OrenNakdimon©OrenNakdimon©OrenNakdimon
Edition-Based
Redefinition
This presentation is available in http://db-oriented.com/presentations
©OrenNakdimon©OrenNakdimon©OrenNakdimon
Agenda
The problem EBR solves
What EBR is
DemoAdditional benefits of EBR
This presentation is available in http://db-oriented.com/presentations
©OrenNakdimon©OrenNakdimon©OrenNakdimon
What’s in Today’s Session
(and what’s not)
 
The main and major principles All the details and nuances
Step-by-Step Examples Deep philosophy
Guidelines
System with EBR from day one Converting non-EBR system
This presentation is available in http://db-oriented.com/presentations
©OrenNakdimon©OrenNakdimon©OrenNakdimon
This presentation is available in http://db-oriented.com/presentations
©OrenNakdimon©OrenNakdimon©OrenNakdimon
Make sure to test it
thoroughly before you decide
to apply it in production
This presentation is available in http://db-oriented.com/presentations
©OrenNakdimon©OrenNakdimon©OrenNakdimon
Application
Upgrades
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
This presentation is available in http://db-oriented.com/presentations
©OrenNakdimon
APPLICATION UPGRADES
Application X
Application X
+ some change(s)
This presentation is available in http://db-oriented.com/presentations
©OrenNakdimon
APPLICATION UPGRADES
This presentation is available in http://db-oriented.com/presentations
©OrenNakdimon©OrenNakdimon©OrenNakdimon
Pre-Upgrade Version
POST-UPGRADE VERSION
This presentation is available in http://db-oriented.com/presentations
©OrenNakdimon©OrenNakdimon©OrenNakdimon
Offline
Application
Upgrade
This presentation is available in http://db-oriented.com/presentations
©OrenNakdimon©OrenNakdimon©OrenNakdimon
Offline Upgrade (Cold Cutover)
This presentation is available in http://db-oriented.com/presentations
©OrenNakdimon©OrenNakdimon©OrenNakdimon
Offline Upgrade (Cold Cutover)
This presentation is available in http://db-oriented.com/presentations
©OrenNakdimon©OrenNakdimon©OrenNakdimon
Offline Upgrade (Cold Cutover)
This presentation is available in http://db-oriented.com/presentations
©OrenNakdimon©OrenNakdimon©OrenNakdimon
Offline Upgrade (Cold Cutover)
This presentation is available in http://db-oriented.com/presentations
©OrenNakdimon©OrenNakdimon©OrenNakdimon
Offline Upgrade (Cold Cutover)
This presentation is available in http://db-oriented.com/presentations
©OrenNakdimon©OrenNakdimon©OrenNakdimon
Offline Upgrade (Cold Cutover)
This presentation is available in http://db-oriented.com/presentations
©OrenNakdimon©OrenNakdimon©OrenNakdimon
Offline Upgrade (Cold Cutover)
This presentation is available in http://db-oriented.com/presentations
©OrenNakdimon©OrenNakdimon©OrenNakdimon
Offline Upgrade (Cold Cutover)
This presentation is available in http://db-oriented.com/presentations
©OrenNakdimon©OrenNakdimon©OrenNakdimon
Offline
Application
Upgrade
Downtime
This presentation is available in http://db-oriented.com/presentations
©OrenNakdimon©OrenNakdimon©OrenNakdimon
Offline
Application
Upgrade
Downtime
Bad User
Experience
Nights &
Weekends
Co-workers are
not there
Upgrades
are
Postponed
Unexpected
Problems?
Stress
This presentation is available in http://db-oriented.com/presentations
©OrenNakdimon©OrenNakdimon©OrenNakdimon
So let’s simply
upgrade while
clients are
connected
This presentation is available in http://db-oriented.com/presentations
©OrenNakdimon©OrenNakdimon©OrenNakdimon
What Could
Possibly
Go Wrong?
Invalidations
ORA-04068
Locking
and
Blocking
This presentation is available in http://db-oriented.com/presentations
©OrenNakdimon©OrenNakdimon©OrenNakdimon
This presentation is available in http://db-oriented.com/presentations
©OrenNakdimon©OrenNakdimon©OrenNakdimon
Online
Application
Upgrade
This presentation is available in http://db-oriented.com/presentations
©OrenNakdimon
ONLINE UPGRADE (HOT ROLLOVER)
This presentation is available in http://db-oriented.com/presentations
©OrenNakdimon
ONLINE UPGRADE (HOT ROLLOVER)
This presentation is available in http://db-oriented.com/presentations
©OrenNakdimon
ONLINE UPGRADE (HOT ROLLOVER)
This presentation is available in http://db-oriented.com/presentations
©OrenNakdimon
ONLINE UPGRADE (HOT ROLLOVER)
This presentation is available in http://db-oriented.com/presentations
©OrenNakdimon
ONLINE UPGRADE (HOT ROLLOVER)
This presentation is available in http://db-oriented.com/presentations
©OrenNakdimon
ONLINE UPGRADE (HOT ROLLOVER)
This presentation is available in http://db-oriented.com/presentations
©OrenNakdimon
ONLINE UPGRADE (HOT ROLLOVER)
This presentation is available in http://db-oriented.com/presentations
©OrenNakdimon
ONLINE UPGRADE (HOT ROLLOVER)
This presentation is available in http://db-oriented.com/presentations
©OrenNakdimon
ONLINE UPGRADE (HOT ROLLOVER)
This presentation is available in http://db-oriented.com/presentations
©OrenNakdimon
ONLINE UPGRADE (HOT ROLLOVER)
This presentation is available in http://db-oriented.com/presentations
©OrenNakdimon
ONLINE UPGRADE (HOT ROLLOVER)
This presentation is available in http://db-oriented.com/presentations
©OrenNakdimon
ONLINE UPGRADE (HOT ROLLOVER)
This presentation is available in http://db-oriented.com/presentations
©OrenNakdimon
ONLINE UPGRADE (HOT ROLLOVER)
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 11.2
No extra
license/option
Supported in
all editions
“The Killer Feature of
Oracle 11g Release 2”
(Tom Kyte, Oracle Magazine,
January 2010)
This presentation is available in http://db-oriented.com/presentations
©OrenNakdimon
Procedure P
Procedure P
My Schema
Edition1
Edition2
procedure p is
begin
-- do something
end p;
create or replace
procedure p as
begin
-- do something else
end p;
This presentation is available in http://db-oriented.com/presentations
©OrenNakdimon
Procedure
P
My Schema
Edition1
Edition2
Function
F
Procedure
P
View
V
This presentation is available in http://db-oriented.com/presentations
©OrenNakdimon
Procedure
P
My Schema
Edition1
Edition2
Function
F
Procedure
P
View
V
Edition3
Function
F
Package
PKG
This presentation is available in http://db-oriented.com/presentations
©OrenNakdimon
Procedure
P
My Schema
Edition1
Edition2
Function
F
Procedure
P
View
V
Edition3
Function
F
Table
T
This presentation is available in http://db-oriented.com/presentations
©OrenNakdimon
Procedure
P
My Schema
Edition1
Edition2
Function
F
Procedure
P
View
V
Edition3
Function
F
Package
PKG
Table
T
This presentation is available in http://db-oriented.com/presentations
©OrenNakdimon
Procedure
P
My Schema
Edition1
Edition2
Function
F
Procedure
P
View
V
Edition3
Function
F
Package
PKG
Table
T
This presentation is available in http://db-oriented.com/presentations
©OrenNakdimon
Procedure
P
My Schema
Edition1
Edition2
Function
F
Procedure
P
View
V
Edition3
Function
F
Package
PKG
Table
T
This presentation is available in http://db-oriented.com/presentations
©OrenNakdimon
Demo
This presentation is available in http://db-oriented.com/presentations
©OrenNakdimon
ENTITY RELATIONSHIP DIAGRAM
ALBUM
# id
* title
* release_date
SONG
# track#
* title
ARTIST
# id
* name
* type
No need to
think of EBR
This presentation is available in http://db-oriented.com/presentations
©OrenNakdimon©OrenNakdimon©OrenNakdimon
APIs
add_artist
add_album
get_albums
get_album_songs
Data
Entities
ALBUM SONG ARTIST
No need to
think of EBR
This presentation is available in http://db-oriented.com/presentations
©OrenNakdimon©OrenNakdimon©OrenNakdimon
High Level Design
add_artist
add_album
get_albums
get_album_songs
Data
Entities
ALBUM SONG ARTIST
This presentation is available in http://db-oriented.com/presentations
©OrenNakdimon©OrenNakdimon©OrenNakdimon
High Level Design
add_artist
add_album
get_albums
get_album_songs
Data
Entities
MUSIC_OWNER
ALBUM SONG ARTIST
This presentation is available in http://db-oriented.com/presentations
©OrenNakdimon©OrenNakdimon©OrenNakdimon
High Level Design
add_artist
add_album
get_albums
get_album_songs
Data
Entities
MUSIC_OWNER
ALBUM SONG ARTIST
MUSIC_USER
This presentation is available in http://db-oriented.com/presentations
©OrenNakdimon©OrenNakdimon©OrenNakdimon
High Level Design
add_artist
add_album
get_albums
get_album_songs
Data
Entities
MUSIC_OWNER
ALBUM SONG ARTIST
External
API
MUSIC_USER
This presentation is available in http://db-oriented.com/presentations
©OrenNakdimon©OrenNakdimon©OrenNakdimon
High Level Design
MUSIC_MGR
add_artist
add_album
get_albums
get_album_songs
Data
Entities
External
API
MUSIC_OWNER
ALBUM SONG ARTIST
MUSIC_USER
This presentation is available in http://db-oriented.com/presentations
©OrenNakdimon©OrenNakdimon©OrenNakdimon
High Level Design
ALBUMS_DL SONGS_DL ARTISTS_DL
MUSIC_MGR
add add add
add_artist
add_album
get_albums
get_album_songs
Data
Entities
Internal
Code
External
API
MUSIC_OWNER
ALBUM SONG ARTIST
MUSIC_USER
No need to
think of EBR
This presentation is available in http://db-oriented.com/presentations
©OrenNakdimon©OrenNakdimon©OrenNakdimon
One-Time Setup
This presentation is available in http://db-oriented.com/presentations
©OrenNakdimon©OrenNakdimon©OrenNakdimon
create user music_owner identified by pwd;
grant
create session,
create table,
create view,
create procedure,
create sequence,
create type,
create trigger,
create job,
create synonym,
unlimited tablespace
to
music_owner;
DBA
This presentation is available in http://db-oriented.com/presentations
©OrenNakdimon©OrenNakdimon©OrenNakdimon
create user music_user identified by pwd;
grant
create session
to
music_user;
DBA
This presentation is available in http://db-oriented.com/presentations
©OrenNakdimon©OrenNakdimon©OrenNakdimon
alter user music_owner enable editions;
DBA
This presentation is available in http://db-oriented.com/presentations
©OrenNakdimon©OrenNakdimon©OrenNakdimon
Version #1
This presentation is available in http://db-oriented.com/presentations
©OrenNakdimon©OrenNakdimon©OrenNakdimon
The Upgrade
Create a New Edition
Create/Alter Non-Editioned Objects
Create/Replace Editioned Objects in the New Edition
Expose the New Edition
(or initial installation)
This presentation is available in http://db-oriented.com/presentations
©OrenNakdimon©OrenNakdimon©OrenNakdimon
The Upgrade
Create a New Edition
Create/Alter Non-Editioned Objects
Create/Replace Editioned Objects in the New Edition
Expose the New Edition
This presentation is available in http://db-oriented.com/presentations
©OrenNakdimon©OrenNakdimon©OrenNakdimon
create edition v1;
DBA
This presentation is available in http://db-oriented.com/presentations
©OrenNakdimon©OrenNakdimon©OrenNakdimon
create edition v1;
DBA
grant use on edition v1 to music_owner;
This presentation is available in http://db-oriented.com/presentations
©OrenNakdimon©OrenNakdimon©OrenNakdimon
The Upgrade
Create a New Edition
Create/Alter Non-Editioned Objects
Create/Replace Editioned Objects in the New Edition
Expose the New Edition
This presentation is available in http://db-oriented.com/presentations
©OrenNakdimon©OrenNakdimon©OrenNakdimon
alter session set edition=v1;
MUSIC_OWNER
This presentation is available in http://db-oriented.com/presentations
©OrenNakdimon©OrenNakdimon©OrenNakdimon
Procedure
PEdition1
Table
T
a
b
c
This presentation is available in http://db-oriented.com/presentations
©OrenNakdimon©OrenNakdimon©OrenNakdimon
Procedure
PEdition1
Edition2
Procedure
P Table
T
a
b
c
d
This presentation is available in http://db-oriented.com/presentations
©OrenNakdimon©OrenNakdimon©OrenNakdimon
Procedure
PEdition1
Edition2
Procedure
P
Edition3
Table
T
Procedure
P
a
b
c
d
This presentation is available in http://db-oriented.com/presentations
©OrenNakdimon©OrenNakdimon©OrenNakdimon
Procedure
PEdition1
Table
T
View
V
a,b,c
a
b
c
This presentation is available in http://db-oriented.com/presentations
©OrenNakdimon©OrenNakdimon©OrenNakdimon
Procedure
PEdition1
Edition2
Procedure
P Table
T
View
V
a,b,c
View
V
a,b,c,d
a
b
c
d
This presentation is available in http://db-oriented.com/presentations
©OrenNakdimon©OrenNakdimon©OrenNakdimon
Procedure
PEdition1
Edition2
Procedure
P
Edition3
Table
T
View
V
a,b,c
View
V
a,b,c,d
View
V
b,c,d
Procedure
P
a
b
c
d
This presentation is available in http://db-oriented.com/presentations
©OrenNakdimon©OrenNakdimon©OrenNakdimon
Editioning
Views
Views
Editionable
Deliberately
limited
Project
Columns
Alias the
Projected Columns
This presentation is available in http://db-oriented.com/presentations
©OrenNakdimon©OrenNakdimon©OrenNakdimon
Editioning
Views
Prevent
Invalidations
Simulate different
table structures in
different editions
This presentation is available in http://db-oriented.com/presentations
©OrenNakdimon©OrenNakdimon©OrenNakdimon
Editioning Views are the
Interface between the
Application and the
Tables
Never refer to tables
in your code, only to
editioning views
This presentation is available in http://db-oriented.com/presentations
©OrenNakdimon©OrenNakdimon©OrenNakdimon
ALBUMS_DL SONGS_DL ARTISTS_DL
MUSIC_MGR
Internal
Code
External
API
MUSIC_OWNER
Data
Entities
ALBUM SONG ARTIST
This presentation is available in http://db-oriented.com/presentations
©OrenNakdimon©OrenNakdimon©OrenNakdimon
ALBUMS_DL SONGS_DL ARTISTS_DL
MUSIC_MGR
Tables
Internal
Code
External
API
MUSIC_OWNER
ALBUMS SONGS ARTISTS
This presentation is available in http://db-oriented.com/presentations
©OrenNakdimon©OrenNakdimon©OrenNakdimon
ALBUMS_DL SONGS_DL ARTISTS_DL
MUSIC_MGR
Tables
Internal
Code
External
API
MUSIC_OWNER
ALBUMS SONGS ARTISTS
Editioning
Views ALBUMS SONGS ARTISTS
This presentation is available in http://db-oriented.com/presentations
©OrenNakdimon©OrenNakdimon©OrenNakdimon
ALBUMS_DL SONGS_DL ARTISTS_DL
MUSIC_MGR
Tables
Internal
Code
External
API
MUSIC_OWNER
? ?
Editioning
Views ALBUMS SONGS ARTISTS
?
This presentation is available in http://db-oriented.com/presentations
©OrenNakdimon©OrenNakdimon©OrenNakdimon
Define Your
Naming
Convention
Adhere to Your
Naming
Convention
This presentation is available in http://db-oriented.com/presentations
©OrenNakdimon©OrenNakdimon©OrenNakdimon
ALBUMS_DL SONGS_DL ARTISTS_DL
MUSIC_MGR
Tables
Internal
Code
External
API
MUSIC_OWNER
ALBUMS$0 SONGS$0 ARTISTS$0
Editioning
Views ALBUMS SONGS ARTISTS
This presentation is available in http://db-oriented.com/presentations
©OrenNakdimon©OrenNakdimon©OrenNakdimon
create table artists$0 (
id
integer
generated as identity
not null
constraint artists$0_pk primary key,
name
varchar2(100)
not null,
type
varchar2(6)
not null
constraint artists$0_chk_type check (type in ('Person','Band'))
);
MUSIC_OWNER
This presentation is available in http://db-oriented.com/presentations
©OrenNakdimon©OrenNakdimon©OrenNakdimon
create editioning view artists as
select
id,
name,
type
from
artists$0;
MUSIC_OWNER
This presentation is available in http://db-oriented.com/presentations
©OrenNakdimon©OrenNakdimon©OrenNakdimon
create table albums$0 (
id
integer
generated as identity
not null
constraint albums$0_pk primary key,
title
varchar2(100)
not null,
release_date
date
not null
);
MUSIC_OWNER
This presentation is available in http://db-oriented.com/presentations
©OrenNakdimon©OrenNakdimon©OrenNakdimon
create editioning view albums as
select
id,
title,
release_date
from
albums$0;
MUSIC_OWNER
This presentation is available in http://db-oriented.com/presentations
©OrenNakdimon©OrenNakdimon©OrenNakdimon
create table songs$0 (
album_id
not null
constraint songs$0_fk_album_id references albums$0,
track#
number(2)
not null,
constraint songs$0_pk primary key (album_id,track#),
title
varchar2(100)
not null,
artist_id
not null
constraint songs$0_fk_atrist_id references artists$0
);
MUSIC_OWNER
create index songs$0_artist_id_ix on songs$0 (artist_id);
This presentation is available in http://db-oriented.com/presentations
©OrenNakdimon©OrenNakdimon©OrenNakdimon
create editioning view songs as
select
album_id,
track#,
title,
artist_id
from
songs$0;
MUSIC_OWNER
This presentation is available in http://db-oriented.com/presentations
©OrenNakdimon©OrenNakdimon©OrenNakdimon
create or replace package artists_dl
as
procedure add
(
i_name in artists.name%type,
i_type in artists.type%type,
o_id out artists.id%type
);
end artists_dl;
/
MUSIC_OWNER
create or replace package body artists_dl
as
procedure add
(
i_name in artists.name%type,
i_type in artists.type%type,
o_id out artists.id%type
) is
begin
insert into artists
(name,
type)
values
(i_name,
i_type)
returning id into o_id;
end add;
end artists_dl;
This presentation is available in http://db-oriented.com/presentations
©OrenNakdimon©OrenNakdimon©OrenNakdimon
MUSIC_OWNER
create or replace package albums_dl as
procedure add
(
i_title in albums.title%type,
i_release_date in albums.release_date%type,
o_id out albums.id%type
);
end albums_dl;
create or replace package body albums_dl as
procedure add
(
i_title in albums.title%type,
i_release_date in albums.release_date%type,
o_id out albums.id%type
) is
begin
insert into albums
(title,
release_date)
values
(i_title,
i_release_date)
returning id into o_id;
end add;
end albums_dl;
This presentation is available in http://db-oriented.com/presentations
©OrenNakdimon©OrenNakdimon©OrenNakdimon
create or replace package body songs_dl as
procedure add
(
i_album_id in songs.album_id%type,
i_songs in song_tt
) is
begin
forall i in indices of i_songs
insert into songs
(album_id,
track#,
title,
artist_id)
values
(i_album_id,
i_songs(i).track#,
i_songs(i).title,
i_songs(i).artist_id);
end add;
end songs_dl;
create type song_t as object (
track# number(2),
title varchar2(100),
artist_id integer
)
/
MUSIC_OWNER
create type song_tt as
table of song_t
/
create or replace package songs_dl as
procedure add
(
i_album_id in songs.album_id%type,
i_songs in song_tt
);
end songs_dl;
This presentation is available in http://db-oriented.com/presentations
©OrenNakdimon©OrenNakdimon©OrenNakdimon
create or replace package music_mgr as
procedure add_artist
(
i_name in artists.name%type,
i_type in artists.type%type,
o_id out artists.id%type
);
procedure add_album
(
i_title in albums.title%type,
i_release_date in albums.release_date%type,
i_songs in song_tt,
o_id out albums.id%type
);
procedure get_albums
(
o_albums out sys_refcursor
);
procedure get_album_songs
(
i_album_id in albums.id%type,
o_songs out sys_refcursor
);
end music_mgr;
MUSIC_OWNER
This presentation is available in http://db-oriented.com/presentations
©OrenNakdimon©OrenNakdimon©OrenNakdimon
create or replace package music_mgr as
procedure add_artist
(
i_name in artists.name%type,
i_type in artists.type%type,
o_id out artists.id%type
);
procedure add_album…
procedure get_albums…
procedure get_album_songs…
end music_mgr;
MUSIC_OWNER
This presentation is available in http://db-oriented.com/presentations
©OrenNakdimon©OrenNakdimon©OrenNakdimon
create or replace package body music_mgr as
procedure add_artist
(
i_name in artists.name%type,
i_type in artists.type%type,
o_id out artists.id%type
) is
begin
artists_dl.add(i_name => i_name, i_type => i_type, o_id => o_id);
commit;
end add_artist;
.
.
.
MUSIC_OWNER
This presentation is available in http://db-oriented.com/presentations
©OrenNakdimon©OrenNakdimon©OrenNakdimon
create or replace package body music_mgr as
.
.
procedure add_album
(
i_title in albums.title%type,
i_release_date in albums.release_date%type,
i_songs in song_tt,
o_id out albums.id%type
) is
begin
albums_dl.add(i_title => i_title,
i_release_date => i_release_date,
o_id => o_id);
songs_dl.add(i_album_id => o_id, i_songs => i_songs);
commit;
end add_album;
.
.
MUSIC_OWNER
This presentation is available in http://db-oriented.com/presentations
©OrenNakdimon©OrenNakdimon©OrenNakdimon
create or replace package body music_mgr as
.
.
procedure get_albums
(
o_albums out sys_refcursor
) is
begin
open o_albums for
select a.id,
a.title,
a.release_date
from albums a
order by a.title;
end get_albums;
.
.
MUSIC_OWNER
This presentation is available in http://db-oriented.com/presentations
©OrenNakdimon©OrenNakdimon©OrenNakdimon
create or replace package body music_mgr as
.
.
procedure get_album_songs
(
i_album_id in albums.id%type,
o_songs out sys_refcursor
) is
begin
open o_songs for
select s.track#,
s.title,
s.artist_id
from songs s
where s.album_id = i_album_id
order by s.track#;
end get_album_songs;
end music_mgr;
MUSIC_OWNER
This presentation is available in http://db-oriented.com/presentations
©OrenNakdimon©OrenNakdimon©OrenNakdimon
The Upgrade
Create a New Edition
Create/Alter Non-Editioned Objects
Create/Replace Editioned Objects in the New Edition
Expose the New Edition
This presentation is available in http://db-oriented.com/presentations
©OrenNakdimon©OrenNakdimon©OrenNakdimon
Exposing the Post-Upgrade Version
Validate (and actualize) necessary objects
Grant permissions on new objects to the application user
Create necessary synonyms
Grant use on the new edition to the application user
Associate the new edition with a service
This presentation is available in http://db-oriented.com/presentations
©OrenNakdimon©OrenNakdimon©OrenNakdimon
Exposing the Post-Upgrade Version
Validate (and actualize) necessary objects
Grant permissions on new objects to the application user
Create necessary synonyms
Grant use on the new edition to the application user
Associate the new edition with a service
This presentation is available in http://db-oriented.com/presentations
©OrenNakdimon©OrenNakdimon©OrenNakdimon
exec dbms_utility.compile_schema(user,compile_all=>false)
MUSIC_OWNER
This presentation is available in http://db-oriented.com/presentations
©OrenNakdimon©OrenNakdimon©OrenNakdimon
Exposing the Post-Upgrade Version
Validate (and actualize) necessary objects
Grant permissions on new objects to the application user
Create necessary synonyms
Grant use on the new edition to the application user
Associate the new edition with a service
This presentation is available in http://db-oriented.com/presentations
©OrenNakdimon©OrenNakdimon©OrenNakdimon
grant execute on music_mgr to music_user;
grant execute on song_t to music_user;
grant execute on song_tt to music_user;
MUSIC_OWNER
This presentation is available in http://db-oriented.com/presentations
©OrenNakdimon©OrenNakdimon©OrenNakdimon
Exposing the Post-Upgrade Version
Validate (and actualize) necessary objects
Grant permissions on new objects to the application user
Create necessary synonyms
Grant use on the new edition to the application user
Associate the new edition with a service
This presentation is available in http://db-oriented.com/presentations
©OrenNakdimon©OrenNakdimon©OrenNakdimon
create synonym music_user.music_mgr for music_owner.music_mgr;
create synonym music_user.song_t for music_owner.song_t;
create synonym music_user.song_tt for music_owner.song_tt;
DBA
This presentation is available in http://db-oriented.com/presentations
©OrenNakdimon©OrenNakdimon©OrenNakdimon
Exposing the Post-Upgrade Version
Validate (and actualize) necessary objects
Grant permissions on new objects to the application user
Create necessary synonyms
Grant use on the new edition to the application user
Associate the new edition with a service
This presentation is available in http://db-oriented.com/presentations
©OrenNakdimon©OrenNakdimon©OrenNakdimon
grant use on edition v1 to music_user;
DBA
This presentation is available in http://db-oriented.com/presentations
©OrenNakdimon©OrenNakdimon©OrenNakdimon
Exposing the Post-Upgrade Version
Validate (and actualize) necessary objects
Grant permissions on new objects to the application user
Create necessary synonyms
Grant use on the new edition to the application user
Associate the new edition with a service
This presentation is available in http://db-oriented.com/presentations
©OrenNakdimon©OrenNakdimon©OrenNakdimon
begin
dbms_service.create_service(
service_name => 'MUSIC_SERVICE_A',
network_name => 'MUSIC_SERVICE_A',
edition => 'V1'
);
dbms_service.start_service(
service_name => 'MUSIC_SERVICE_A‘
);
end;
DBA
@demo01
This presentation is available in http://db-oriented.com/presentations
©OrenNakdimon©OrenNakdimon©OrenNakdimon
Version #2
Change get_album_songs to
return artist_name instead
of artist_id
Code
Implementation
Changes
This presentation is available in http://db-oriented.com/presentations
©OrenNakdimon©OrenNakdimon©OrenNakdimon
The Upgrade
Create a New Edition
Create/Alter Non-Editioned Objects
Create/Replace Editioned Objects in the New Edition
Expose the New Edition
This presentation is available in http://db-oriented.com/presentations
©OrenNakdimon©OrenNakdimon©OrenNakdimon
create edition v2;
DBA
This presentation is available in http://db-oriented.com/presentations
©OrenNakdimon©OrenNakdimon©OrenNakdimon
create edition v2;
DBA
grant use on edition v2 to music_owner;
This presentation is available in http://db-oriented.com/presentations
©OrenNakdimon©OrenNakdimon©OrenNakdimon
The Upgrade
Create a New Edition
Create/Alter Non-Editioned Objects
Create/Replace Editioned Objects in the New Edition
Expose the New Edition
This presentation is available in http://db-oriented.com/presentations
©OrenNakdimon©OrenNakdimon©OrenNakdimon
alter session set edition=v2;
MUSIC_OWNER
This presentation is available in http://db-oriented.com/presentations
©OrenNakdimon©OrenNakdimon©OrenNakdimon
create or replace package body music_mgr as
.
.
procedure get_album_songs
(
i_album_id in albums.id%type,
o_songs out sys_refcursor
) is
begin
open o_songs for
select s.track#,
s.title,
a.name artist_name
from songs s,
artists a
where s.album_id = i_album_id
and a.id = s.artist_id
order by s.track#;
end get_album_songs;
end music_mgr;
MUSIC_OWNER
This presentation is available in http://db-oriented.com/presentations
©OrenNakdimon©OrenNakdimon©OrenNakdimon
The Upgrade
Create a New Edition
Create/Alter Non-Editioned Objects
Create/Replace Editioned Objects in the New Edition
Expose the New Edition
This presentation is available in http://db-oriented.com/presentations
©OrenNakdimon©OrenNakdimon©OrenNakdimon
Exposing the Post-Upgrade Version
Validate (and actualize) necessary objects
Grant permissions on new objects to the application user
Create necessary synonyms
Grant use on the new edition to the application user
Associate the new edition with a service
This presentation is available in http://db-oriented.com/presentations
©OrenNakdimon©OrenNakdimon©OrenNakdimon
exec dbms_utility.compile_schema(user,compile_all=>false)
MUSIC_OWNER
This presentation is available in http://db-oriented.com/presentations
©OrenNakdimon©OrenNakdimon©OrenNakdimon
grant use on edition v2 to music_user;
DBA
This presentation is available in http://db-oriented.com/presentations
©OrenNakdimon©OrenNakdimon©OrenNakdimon
begin
dbms_service.modify_service(
service_name => 'MUSIC_SERVICE_A',
edition => 'V2',
modify_edition => TRUE)
);
end;
DBA
@demo02
This presentation is available in http://db-oriented.com/presentations
©OrenNakdimon©OrenNakdimon©OrenNakdimon
Entity Relationship Diagram
ALBUM
# id
* title
* release_date
o genre
SONG
# track#
* title
ARTIST
# id
* name
* type
This presentation is available in http://db-oriented.com/presentations
©OrenNakdimon©OrenNakdimon©OrenNakdimon
Version #3
Add genre to albums
Data Model Changes
(New Functionality)
API Changes
Code
Implementation
Changes
This presentation is available in http://db-oriented.com/presentations
©OrenNakdimon©OrenNakdimon©OrenNakdimon
The Upgrade
Create a New Edition
Create/Alter Non-Editioned Objects
Create/Replace Editioned Objects in the New Edition
Expose the New Edition
This presentation is available in http://db-oriented.com/presentations
©OrenNakdimon©OrenNakdimon©OrenNakdimon
create edition v3;
DBA
This presentation is available in http://db-oriented.com/presentations
©OrenNakdimon©OrenNakdimon©OrenNakdimon
create edition v3;
DBA
grant use on edition v3 to music_owner;
This presentation is available in http://db-oriented.com/presentations
©OrenNakdimon©OrenNakdimon©OrenNakdimon
The Upgrade
Create a New Edition
Create/Alter Non-Editioned Objects
Create/Replace Editioned Objects in the New Edition
Expose the New Edition
This presentation is available in http://db-oriented.com/presentations
©OrenNakdimon©OrenNakdimon©OrenNakdimon
MUSIC_OWNER
alter session set edition=v3;
This presentation is available in http://db-oriented.com/presentations
©OrenNakdimon©OrenNakdimon©OrenNakdimon
alter table albums$0 add (
genre
varchar2(100)
);
MUSIC_OWNER
create or replace editioning view albums as
select
id,
title,
release_date,
genre
from
albums$0;
This presentation is available in http://db-oriented.com/presentations
©OrenNakdimon©OrenNakdimon©OrenNakdimon
create or replace package albums_dl as
procedure add
(
i_title in albums.title%type,
i_release_date in albums.release_date%type,
o_id out albums.id%type
);
procedure set_genre
(
i_id in albums.id%type,
i_genre in albums.genre%type
);
end albums_dl;
/
MUSIC_OWNER
This presentation is available in http://db-oriented.com/presentations
©OrenNakdimon©OrenNakdimon©OrenNakdimon
create or replace package body albums_dl as
.
.
procedure set_genre
(
i_id in albums.id%type,
i_genre in albums.genre%type
) is
begin
update albums a
set a.genre = i_genre
where a.id = i_id;
end set_genre;
end albums_dl;
/
MUSIC_OWNER
This presentation is available in http://db-oriented.com/presentations
©OrenNakdimon©OrenNakdimon©OrenNakdimon
create or replace package music_mgr as
.
.
procedure set_album_genre
(
i_album_id in albums.id%type,
i_genre in albums.genre%type
);
.
.
MUSIC_OWNER
This presentation is available in http://db-oriented.com/presentations
©OrenNakdimon©OrenNakdimon©OrenNakdimon
create or replace package body music_mgr as
.
.
procedure set_album_genre
(
i_album_id in albums.id%type,
i_genre in albums.genre%type
) is
begin
albums_dl.set_genre(i_id => i_album_id, i_genre => i_genre);
commit;
end set_album_genre;
.
.
MUSIC_OWNER
This presentation is available in http://db-oriented.com/presentations
©OrenNakdimon©OrenNakdimon©OrenNakdimon
create or replace package body music_mgr as
.
.
procedure get_albums
(
o_albums out sys_refcursor
) is
begin
open o_albums for
select a.id,
a.title,
a.release_date,
a.genre
from albums a
order by a.title;
end get_albums;
.
MUSIC_OWNER
This presentation is available in http://db-oriented.com/presentations
©OrenNakdimon©OrenNakdimon©OrenNakdimon
The Upgrade
Create a New Edition
Create/Alter Non-Editioned Objects
Create/Replace Editioned Objects in the New Edition
Expose the New Edition
This presentation is available in http://db-oriented.com/presentations
©OrenNakdimon©OrenNakdimon©OrenNakdimon
Exposing the Post-Upgrade Version
Validate (and actualize) necessary objects
Grant permissions on new objects to the application user
Create necessary synonyms
Grant use on the new edition to the application user
Associate the new edition with a service
This presentation is available in http://db-oriented.com/presentations
©OrenNakdimon©OrenNakdimon©OrenNakdimon
exec dbms_utility.compile_schema(user,compile_all=>false)
MUSIC_OWNER
This presentation is available in http://db-oriented.com/presentations
©OrenNakdimon©OrenNakdimon©OrenNakdimon
grant use on edition v3 to music_user;
DBA
This presentation is available in http://db-oriented.com/presentations
©OrenNakdimon©OrenNakdimon©OrenNakdimon
begin
dbms_service.modify_service(
service_name => 'MUSIC_SERVICE_A',
edition => 'V3',
modify_edition => TRUE)
);
end;
DBA
@demo03
This presentation is available in http://db-oriented.com/presentations
©OrenNakdimon©OrenNakdimon©OrenNakdimon
Entity Relationship Diagram
ALBUM
# id
* title
* release_date
o genre
SONG
# track#
* title
ARTIST
# id
* name
* type
GENRE
# id
* name
This presentation is available in http://db-oriented.com/presentations
©OrenNakdimon©OrenNakdimon©OrenNakdimon
Version #4
Replace the free text genre
column with a foreign key to
a new table
Data Model Changes
(Replacing
Functionality) API Changes
Code
Implementation
Changes
This presentation is available in http://db-oriented.com/presentations
©OrenNakdimon©OrenNakdimon©OrenNakdimon
The Upgrade
Create a New Edition
Create/Alter Non-Editioned Objects
Create/Replace Editioned Objects in the New Edition
Expose the New Edition
This presentation is available in http://db-oriented.com/presentations
©OrenNakdimon©OrenNakdimon©OrenNakdimon
create edition v4;
DBA
This presentation is available in http://db-oriented.com/presentations
©OrenNakdimon©OrenNakdimon©OrenNakdimon
create edition v4;
DBA
grant use on edition v4 to music_owner;
This presentation is available in http://db-oriented.com/presentations
©OrenNakdimon©OrenNakdimon©OrenNakdimon
The Upgrade
Create a New Edition
Create/Alter Non-Editioned Objects
Create/Replace Editioned Objects in the New Edition
Expose the New Edition
This presentation is available in http://db-oriented.com/presentations
©OrenNakdimon©OrenNakdimon©OrenNakdimon
MUSIC_OWNER
alter session set edition=v4;
This presentation is available in http://db-oriented.com/presentations
©OrenNakdimon©OrenNakdimon©OrenNakdimon
create table genres$0 (
id
number(3)
not null
constraint genres$0_pk primary key,
name
varchar2(20)
not null
);
MUSIC_OWNER
create editioning view genres as
select
id,
name
from
genres$0;
This presentation is available in http://db-oriented.com/presentations
©OrenNakdimon©OrenNakdimon©OrenNakdimon
insert into genres (id,name) values (1,'Classical');
insert into genres (id,name) values (2,'Country');
insert into genres (id,name) values (3,'Electronic');
insert into genres (id,name) values (4,'Folk');
insert into genres (id,name) values (5,'Hip-Hop');
insert into genres (id,name) values (6,'Jazz');
insert into genres (id,name) values (7,'Latin');
insert into genres (id,name) values (8,'Pop');
insert into genres (id,name) values (9,'Rock');
insert into genres (id,name) values (10,'R&B');
insert into genres (id,name) values (11,'Soul');
MUSIC_OWNER
This presentation is available in http://db-oriented.com/presentations
©OrenNakdimon©OrenNakdimon©OrenNakdimon
alter table albums$0 add (
genre_id
constraint albums$0_fk_genre_id references genres$0 (id)
);
MUSIC_OWNER
create or replace editioning view albums as
select
id,
title,
release_date,
genre_id
from
albums$0;
This presentation is available in http://db-oriented.com/presentations
©OrenNakdimon©OrenNakdimon©OrenNakdimon
create or replace package albums_dl as
procedure add
(
i_title in albums.title%type,
i_release_date in albums.release_date%type,
o_id out albums.id%type
);
procedure set_genre_id
(
i_id in albums.id%type,
i_genre_id in albums.genre_id%type
);
end albums_dl;
/
MUSIC_OWNER
This presentation is available in http://db-oriented.com/presentations
©OrenNakdimon©OrenNakdimon©OrenNakdimon
create or replace package body albums_dl as
.
.
procedure set_genre_id
(
i_id in albums.id%type,
i_genre_id in albums.genre_id%type
) is
begin
update albums a
set a.genre_id = i_genre_id
where a.id = i_id;
end set_genre_id;
end albums_dl;
/
MUSIC_OWNER
This presentation is available in http://db-oriented.com/presentations
©OrenNakdimon©OrenNakdimon©OrenNakdimon
create or replace package body music_mgr as
.
.
procedure set_album_genre_id
(
i_album_id in albums.id%type,
i_genre_id in albums.genre_id%type
) is
begin
albums_dl.set_genre_id(i_id => i_album_id,
i_genre_id => i_genre_id);
commit;
end set_album_genre_id;
.
.
MUSIC_OWNER
This presentation is available in http://db-oriented.com/presentations
©OrenNakdimon©OrenNakdimon©OrenNakdimon
create or replace package body music_mgr as
.
procedure get_albums
(
o_albums out sys_refcursor
) is
begin
open o_albums for
select a.id,
a.title,
a.release_date,
g.name genre
from albums a,
genres g
where g.id(+) = a.genre_id
order by a.title;
end get_albums;
MUSIC_OWNER
This presentation is available in http://db-oriented.com/presentations
©OrenNakdimon©OrenNakdimon©OrenNakdimon
create or replace trigger albums_fce_trig
before insert or update of genre on albums$0
for each row
forward crossedition
disable
begin
if :new.genre is null then
:new.genre_id := null;
else
select g.id
into :new.genre_id
from genres g
where upper(g.name) = upper(:new.genre);
end if;
end albums_fce_trig;
/
MUSIC_OWNER
alter trigger albums_fce_trig enable;
This presentation is available in http://db-oriented.com/presentations
©OrenNakdimon©OrenNakdimon©OrenNakdimon
merge into albums$0 a
using genres g
on (upper(a.genre) = upper(g.name))
when matched then
update set a.genre_id = g.id;
MUSIC_OWNER
This presentation is available in http://db-oriented.com/presentations
©OrenNakdimon©OrenNakdimon©OrenNakdimon
create or replace trigger albums_rce_trig
before insert or update of genre_id on albums$0
for each row
reverse crossedition
disable
begin
if :new.genre_id is null then
:new.genre := null;
else
select g.name
into :new.genre
from genres g
where g.id = :new.genre_id;
end if;
end albums_rce_trig;
/
MUSIC_OWNER
alter trigger albums_rce_trig enable;
This presentation is available in http://db-oriented.com/presentations
©OrenNakdimon©OrenNakdimon©OrenNakdimon
The Upgrade
Create a New Edition
Create/Alter Non-Editioned Objects
Create/Replace Editioned Objects in the New Edition
Expose the New Edition
This presentation is available in http://db-oriented.com/presentations
©OrenNakdimon©OrenNakdimon©OrenNakdimon
Exposing the Post-Upgrade Version
Validate (and actualize) necessary objects
Grant permissions on new objects to the application user
Create necessary synonyms
Grant use on the new edition to the application user
Associate the new edition with a service
This presentation is available in http://db-oriented.com/presentations
©OrenNakdimon©OrenNakdimon©OrenNakdimon
exec dbms_utility.compile_schema(user,compile_all=>false)
MUSIC_OWNER
This presentation is available in http://db-oriented.com/presentations
©OrenNakdimon©OrenNakdimon©OrenNakdimon
grant use on edition v4 to music_user;
DBA
This presentation is available in http://db-oriented.com/presentations
©OrenNakdimon©OrenNakdimon©OrenNakdimon
begin
dbms_service.create_service(
service_name => 'MUSIC_SERVICE_B',
network_name => 'MUSIC_SERVICE_B',
edition => 'V4'
);
dbms_service.start_service(
service_name => 'MUSIC_SERVICE_B'
);
end;
DBA
@demo04
This presentation is available in http://db-oriented.com/presentations
©OrenNakdimon©OrenNakdimon©OrenNakdimon
Beyond Online UpgradesBeyond Online Upgrades
 Upgrades can be done at any time
 Upgrades can take as long as needed
 DB-side upgrade can be done independently of App Server upgrade
readiness
 Flexible exposure of new versions
 Testing of the new version before it is exposed to the end users
 Different types of App Servers may use different editions
THANK YOU
Oren Nakdimon
www.db-oriented.com
 oren@db-oriented.com
 +972-54-4393763
@DBoriented

More Related Content

What's hot

3963066 pl-sql-notes-only
3963066 pl-sql-notes-only3963066 pl-sql-notes-only
3963066 pl-sql-notes-only
Ashwin Kumar
 
Controllers and context programming
Controllers and context programmingControllers and context programming
Controllers and context programming
Kranthi Kumar
 

What's hot (9)

2015 owb2 odi converter - white paper_owb_to_odi_migration_service_d&t
2015 owb2 odi converter - white paper_owb_to_odi_migration_service_d&t2015 owb2 odi converter - white paper_owb_to_odi_migration_service_d&t
2015 owb2 odi converter - white paper_owb_to_odi_migration_service_d&t
 
The latest features coming to Java 12
The latest features coming to Java 12The latest features coming to Java 12
The latest features coming to Java 12
 
Java 12 - New features in action
Java 12 -   New features in actionJava 12 -   New features in action
Java 12 - New features in action
 
3963066 pl-sql-notes-only
3963066 pl-sql-notes-only3963066 pl-sql-notes-only
3963066 pl-sql-notes-only
 
JAX RS and CDI bike the reactive bridge
JAX RS and CDI bike the reactive bridgeJAX RS and CDI bike the reactive bridge
JAX RS and CDI bike the reactive bridge
 
Controllers and context programming
Controllers and context programmingControllers and context programming
Controllers and context programming
 
Actors in a New "Highly Parallel" World
Actors in a New "Highly Parallel" WorldActors in a New "Highly Parallel" World
Actors in a New "Highly Parallel" World
 
Chapter8 pl sql
Chapter8 pl sqlChapter8 pl sql
Chapter8 pl sql
 
Controlling execution plans 2014
Controlling execution plans   2014Controlling execution plans   2014
Controlling execution plans 2014
 

Similar to Edition Based Redefinition Made Easy - Oren Nakdimon

4392091081755796971 emea10 zero_downtimeoperations
4392091081755796971 emea10 zero_downtimeoperations4392091081755796971 emea10 zero_downtimeoperations
4392091081755796971 emea10 zero_downtimeoperations
Locuto Riorama
 
Tecnologias Oracle em Docker Containers On-premise e na Nuvem
Tecnologias Oracle em Docker Containers On-premise e na NuvemTecnologias Oracle em Docker Containers On-premise e na Nuvem
Tecnologias Oracle em Docker Containers On-premise e na Nuvem
Bruno Borges
 
Jmorrow rtv den_auto_config_rapidclone
Jmorrow rtv den_auto_config_rapidcloneJmorrow rtv den_auto_config_rapidclone
Jmorrow rtv den_auto_config_rapidclone
Mlx Le
 
Suffering from Chronic Patching Pain? Get Relief with Fleet Maintenance [CON6...
Suffering from Chronic Patching Pain? Get Relief with Fleet Maintenance [CON6...Suffering from Chronic Patching Pain? Get Relief with Fleet Maintenance [CON6...
Suffering from Chronic Patching Pain? Get Relief with Fleet Maintenance [CON6...
Timothy Schubert
 
11158682984719608417 emea11 fallback
11158682984719608417 emea11 fallback11158682984719608417 emea11 fallback
11158682984719608417 emea11 fallback
Locuto Riorama
 
11158682984719608417 emea11 fallback
11158682984719608417 emea11 fallback11158682984719608417 emea11 fallback
11158682984719608417 emea11 fallback
Locuto Riorama
 

Similar to Edition Based Redefinition Made Easy - Oren Nakdimon (20)

4392091081755796971 emea10 zero_downtimeoperations
4392091081755796971 emea10 zero_downtimeoperations4392091081755796971 emea10 zero_downtimeoperations
4392091081755796971 emea10 zero_downtimeoperations
 
Oracle zdm Migrate Amazon RDS Oracle to Oracle Autonomous 2021 Kamalesh Ramas...
Oracle zdm Migrate Amazon RDS Oracle to Oracle Autonomous 2021 Kamalesh Ramas...Oracle zdm Migrate Amazon RDS Oracle to Oracle Autonomous 2021 Kamalesh Ramas...
Oracle zdm Migrate Amazon RDS Oracle to Oracle Autonomous 2021 Kamalesh Ramas...
 
Oracle ZDM KamaleshRamasamy Sangam2020
Oracle ZDM KamaleshRamasamy Sangam2020Oracle ZDM KamaleshRamasamy Sangam2020
Oracle ZDM KamaleshRamasamy Sangam2020
 
Ebr the key_to_online_application_upgrade at amis25
Ebr the key_to_online_application_upgrade at amis25Ebr the key_to_online_application_upgrade at amis25
Ebr the key_to_online_application_upgrade at amis25
 
(ZDM) Zero Downtime DB Migration to Oracle Cloud
(ZDM) Zero Downtime DB Migration to Oracle Cloud(ZDM) Zero Downtime DB Migration to Oracle Cloud
(ZDM) Zero Downtime DB Migration to Oracle Cloud
 
Scaling your apps with Kubernetes and Docker - TheConf 2018
Scaling your apps with Kubernetes and Docker - TheConf 2018Scaling your apps with Kubernetes and Docker - TheConf 2018
Scaling your apps with Kubernetes and Docker - TheConf 2018
 
OID Install and Config
OID Install and ConfigOID Install and Config
OID Install and Config
 
It's Not a Dream—Conquer Chaos for Your DB2® for z/OS® Optimization Nightmares
It's Not a Dream—Conquer Chaos for Your DB2® for z/OS® Optimization NightmaresIt's Not a Dream—Conquer Chaos for Your DB2® for z/OS® Optimization Nightmares
It's Not a Dream—Conquer Chaos for Your DB2® for z/OS® Optimization Nightmares
 
How do you implement Continuous Delivery?: Part 5 - Deployment Patterns
How do you implement Continuous Delivery?: Part 5 - Deployment Patterns How do you implement Continuous Delivery?: Part 5 - Deployment Patterns
How do you implement Continuous Delivery?: Part 5 - Deployment Patterns
 
How do you implement Continuous Delivery?: Part 5 - Deployment Patterns
How do you implement Continuous Delivery?: Part 5 - Deployment PatternsHow do you implement Continuous Delivery?: Part 5 - Deployment Patterns
How do you implement Continuous Delivery?: Part 5 - Deployment Patterns
 
Devoxx UK 2018 - A cloud application journey with helm and kubernetes
Devoxx UK 2018 - A cloud application journey with helm and kubernetesDevoxx UK 2018 - A cloud application journey with helm and kubernetes
Devoxx UK 2018 - A cloud application journey with helm and kubernetes
 
Tecnologias Oracle em Docker Containers On-premise e na Nuvem
Tecnologias Oracle em Docker Containers On-premise e na NuvemTecnologias Oracle em Docker Containers On-premise e na Nuvem
Tecnologias Oracle em Docker Containers On-premise e na Nuvem
 
Oracle Plug-in For Open ModelSphere
Oracle Plug-in For Open ModelSphereOracle Plug-in For Open ModelSphere
Oracle Plug-in For Open ModelSphere
 
Samuel Asher Rivello - PureMVC Hands On Part 2
Samuel Asher Rivello - PureMVC Hands On Part 2Samuel Asher Rivello - PureMVC Hands On Part 2
Samuel Asher Rivello - PureMVC Hands On Part 2
 
Upgrade Oracle Database to 12c
Upgrade Oracle Database to 12c Upgrade Oracle Database to 12c
Upgrade Oracle Database to 12c
 
Jmorrow rtv den_auto_config_rapidclone
Jmorrow rtv den_auto_config_rapidcloneJmorrow rtv den_auto_config_rapidclone
Jmorrow rtv den_auto_config_rapidclone
 
Oracle RAC 19c: Best Practices and Secret Internals
Oracle RAC 19c: Best Practices and Secret InternalsOracle RAC 19c: Best Practices and Secret Internals
Oracle RAC 19c: Best Practices and Secret Internals
 
Suffering from Chronic Patching Pain? Get Relief with Fleet Maintenance [CON6...
Suffering from Chronic Patching Pain? Get Relief with Fleet Maintenance [CON6...Suffering from Chronic Patching Pain? Get Relief with Fleet Maintenance [CON6...
Suffering from Chronic Patching Pain? Get Relief with Fleet Maintenance [CON6...
 
11158682984719608417 emea11 fallback
11158682984719608417 emea11 fallback11158682984719608417 emea11 fallback
11158682984719608417 emea11 fallback
 
11158682984719608417 emea11 fallback
11158682984719608417 emea11 fallback11158682984719608417 emea11 fallback
11158682984719608417 emea11 fallback
 

More from Oren Nakdimon

More from Oren Nakdimon (9)

Write Less (Code) With More (Features) [UKOUG 22]
Write Less (Code) With More (Features) [UKOUG 22]Write Less (Code) With More (Features) [UKOUG 22]
Write Less (Code) With More (Features) [UKOUG 22]
 
Design Patterns in PLSQL and SQL [UKOUG 22]
Design Patterns in PLSQL and SQL [UKOUG 22]Design Patterns in PLSQL and SQL [UKOUG 22]
Design Patterns in PLSQL and SQL [UKOUG 22]
 
Oren nakdimon - Write Less With More - UKOUGtogether21
Oren nakdimon - Write Less With More - UKOUGtogether21Oren nakdimon - Write Less With More - UKOUGtogether21
Oren nakdimon - Write Less With More - UKOUGtogether21
 
Oren nakdimon - Design Patterns for PL/SQL and SQL - UKOUGtogether21
Oren nakdimon - Design Patterns for PL/SQL and SQL - UKOUGtogether21Oren nakdimon - Design Patterns for PL/SQL and SQL - UKOUGtogether21
Oren nakdimon - Design Patterns for PL/SQL and SQL - UKOUGtogether21
 
Oren Nakdimon - Oracle SQL Pattern Matching Made Easy
Oren Nakdimon - Oracle SQL Pattern Matching Made EasyOren Nakdimon - Oracle SQL Pattern Matching Made Easy
Oren Nakdimon - Oracle SQL Pattern Matching Made Easy
 
Constraint Optimization
Constraint OptimizationConstraint Optimization
Constraint Optimization
 
Oren nakdimon - Oracle 12c SQL Pattern Matching Made Easy
Oren nakdimon - Oracle 12c SQL Pattern Matching Made EasyOren nakdimon - Oracle 12c SQL Pattern Matching Made Easy
Oren nakdimon - Oracle 12c SQL Pattern Matching Made Easy
 
Oren nakdimon oh really... i didn't know it is supported in standard edition
Oren nakdimon   oh really... i didn't know it is supported in standard editionOren nakdimon   oh really... i didn't know it is supported in standard edition
Oren nakdimon oh really... i didn't know it is supported in standard edition
 
The Features That (maybe) You Didn't Know About
The Features That (maybe) You Didn't Know AboutThe Features That (maybe) You Didn't Know About
The Features That (maybe) You Didn't Know About
 

Recently uploaded

Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
VictoriaMetrics
 
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Medical / Health Care (+971588192166) Mifepristone and Misoprostol tablets 200mg
 
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
chiefasafspells
 
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
masabamasaba
 
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
masabamasaba
 

Recently uploaded (20)

WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?
 
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learn
 
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
 
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
 
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
 
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
 
WSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open Source
WSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open SourceWSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open Source
WSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open Source
 
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park %in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
 
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
 
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
 
WSO2Con204 - Hard Rock Presentation - Keynote
WSO2Con204 - Hard Rock Presentation - KeynoteWSO2Con204 - Hard Rock Presentation - Keynote
WSO2Con204 - Hard Rock Presentation - Keynote
 
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park %in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
 
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
 
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
 
Artyushina_Guest lecture_YorkU CS May 2024.pptx
Artyushina_Guest lecture_YorkU CS May 2024.pptxArtyushina_Guest lecture_YorkU CS May 2024.pptx
Artyushina_Guest lecture_YorkU CS May 2024.pptx
 
%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto
 
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
 
Architecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastArchitecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the past
 
Announcing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareAnnouncing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK Software
 

Edition Based Redefinition Made Easy - Oren Nakdimon

  • 1. Edition-Based Redefinition Made Easy Oren Nakdimon www.db-oriented.com  oren@db-oriented.com  +972-54-4393763 @DBoriented How to Upgrade Your Application with no Downtime (and no Additional Costs)
  • 2. This presentation is available in http://db-oriented.com/presentations ©OrenNakdimon©OrenNakdimon©OrenNakdimon http://db-oriented.com Who Am I ?
  • 3. 3 Membership Tiers • Oracle ACE Director • Oracle ACE • Oracle ACE Associate bit.ly/OracleACEProgram 500+ Technical Experts Helping Peers Globally Connect: Nominate yourself or someone you know: acenomination.oracle.com @oracleace Facebook.com/oracleaces oracle-ace_ww@oracle.com
  • 4. This presentation is available in http://db-oriented.com/presentations ©OrenNakdimon©OrenNakdimon©OrenNakdimon Edition-Based Redefinition
  • 5. This presentation is available in http://db-oriented.com/presentations ©OrenNakdimon©OrenNakdimon©OrenNakdimon Edition-Based Redefinition
  • 6. This presentation is available in http://db-oriented.com/presentations ©OrenNakdimon©OrenNakdimon©OrenNakdimon Agenda The problem EBR solves What EBR is DemoAdditional benefits of EBR
  • 7. This presentation is available in http://db-oriented.com/presentations ©OrenNakdimon©OrenNakdimon©OrenNakdimon What’s in Today’s Session (and what’s not)   The main and major principles All the details and nuances Step-by-Step Examples Deep philosophy Guidelines System with EBR from day one Converting non-EBR system
  • 8. This presentation is available in http://db-oriented.com/presentations ©OrenNakdimon©OrenNakdimon©OrenNakdimon
  • 9. This presentation is available in http://db-oriented.com/presentations ©OrenNakdimon©OrenNakdimon©OrenNakdimon Make sure to test it thoroughly before you decide to apply it in production
  • 10. This presentation is available in http://db-oriented.com/presentations ©OrenNakdimon©OrenNakdimon©OrenNakdimon Application Upgrades
  • 11. 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
  • 12. This presentation is available in http://db-oriented.com/presentations ©OrenNakdimon APPLICATION UPGRADES Application X Application X + some change(s)
  • 13. This presentation is available in http://db-oriented.com/presentations ©OrenNakdimon APPLICATION UPGRADES
  • 14. This presentation is available in http://db-oriented.com/presentations ©OrenNakdimon©OrenNakdimon©OrenNakdimon Pre-Upgrade Version POST-UPGRADE VERSION
  • 15. This presentation is available in http://db-oriented.com/presentations ©OrenNakdimon©OrenNakdimon©OrenNakdimon Offline Application Upgrade
  • 16. This presentation is available in http://db-oriented.com/presentations ©OrenNakdimon©OrenNakdimon©OrenNakdimon Offline Upgrade (Cold Cutover)
  • 17. This presentation is available in http://db-oriented.com/presentations ©OrenNakdimon©OrenNakdimon©OrenNakdimon Offline Upgrade (Cold Cutover)
  • 18. This presentation is available in http://db-oriented.com/presentations ©OrenNakdimon©OrenNakdimon©OrenNakdimon Offline Upgrade (Cold Cutover)
  • 19. This presentation is available in http://db-oriented.com/presentations ©OrenNakdimon©OrenNakdimon©OrenNakdimon Offline Upgrade (Cold Cutover)
  • 20. This presentation is available in http://db-oriented.com/presentations ©OrenNakdimon©OrenNakdimon©OrenNakdimon Offline Upgrade (Cold Cutover)
  • 21. This presentation is available in http://db-oriented.com/presentations ©OrenNakdimon©OrenNakdimon©OrenNakdimon Offline Upgrade (Cold Cutover)
  • 22. This presentation is available in http://db-oriented.com/presentations ©OrenNakdimon©OrenNakdimon©OrenNakdimon Offline Upgrade (Cold Cutover)
  • 23. This presentation is available in http://db-oriented.com/presentations ©OrenNakdimon©OrenNakdimon©OrenNakdimon Offline Upgrade (Cold Cutover)
  • 24. This presentation is available in http://db-oriented.com/presentations ©OrenNakdimon©OrenNakdimon©OrenNakdimon Offline Application Upgrade Downtime
  • 25. This presentation is available in http://db-oriented.com/presentations ©OrenNakdimon©OrenNakdimon©OrenNakdimon Offline Application Upgrade Downtime Bad User Experience Nights & Weekends Co-workers are not there Upgrades are Postponed Unexpected Problems? Stress
  • 26. This presentation is available in http://db-oriented.com/presentations ©OrenNakdimon©OrenNakdimon©OrenNakdimon So let’s simply upgrade while clients are connected
  • 27. This presentation is available in http://db-oriented.com/presentations ©OrenNakdimon©OrenNakdimon©OrenNakdimon What Could Possibly Go Wrong? Invalidations ORA-04068 Locking and Blocking
  • 28. This presentation is available in http://db-oriented.com/presentations ©OrenNakdimon©OrenNakdimon©OrenNakdimon
  • 29. This presentation is available in http://db-oriented.com/presentations ©OrenNakdimon©OrenNakdimon©OrenNakdimon Online Application Upgrade
  • 30. This presentation is available in http://db-oriented.com/presentations ©OrenNakdimon ONLINE UPGRADE (HOT ROLLOVER)
  • 31. This presentation is available in http://db-oriented.com/presentations ©OrenNakdimon ONLINE UPGRADE (HOT ROLLOVER)
  • 32. This presentation is available in http://db-oriented.com/presentations ©OrenNakdimon ONLINE UPGRADE (HOT ROLLOVER)
  • 33. This presentation is available in http://db-oriented.com/presentations ©OrenNakdimon ONLINE UPGRADE (HOT ROLLOVER)
  • 34. This presentation is available in http://db-oriented.com/presentations ©OrenNakdimon ONLINE UPGRADE (HOT ROLLOVER)
  • 35. This presentation is available in http://db-oriented.com/presentations ©OrenNakdimon ONLINE UPGRADE (HOT ROLLOVER)
  • 36. This presentation is available in http://db-oriented.com/presentations ©OrenNakdimon ONLINE UPGRADE (HOT ROLLOVER)
  • 37. This presentation is available in http://db-oriented.com/presentations ©OrenNakdimon ONLINE UPGRADE (HOT ROLLOVER)
  • 38. This presentation is available in http://db-oriented.com/presentations ©OrenNakdimon ONLINE UPGRADE (HOT ROLLOVER)
  • 39. This presentation is available in http://db-oriented.com/presentations ©OrenNakdimon ONLINE UPGRADE (HOT ROLLOVER)
  • 40. This presentation is available in http://db-oriented.com/presentations ©OrenNakdimon ONLINE UPGRADE (HOT ROLLOVER)
  • 41. This presentation is available in http://db-oriented.com/presentations ©OrenNakdimon ONLINE UPGRADE (HOT ROLLOVER)
  • 42. This presentation is available in http://db-oriented.com/presentations ©OrenNakdimon ONLINE UPGRADE (HOT ROLLOVER)
  • 43. 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 11.2 No extra license/option Supported in all editions “The Killer Feature of Oracle 11g Release 2” (Tom Kyte, Oracle Magazine, January 2010)
  • 44. This presentation is available in http://db-oriented.com/presentations ©OrenNakdimon Procedure P Procedure P My Schema Edition1 Edition2 procedure p is begin -- do something end p; create or replace procedure p as begin -- do something else end p;
  • 45. This presentation is available in http://db-oriented.com/presentations ©OrenNakdimon Procedure P My Schema Edition1 Edition2 Function F Procedure P View V
  • 46. This presentation is available in http://db-oriented.com/presentations ©OrenNakdimon Procedure P My Schema Edition1 Edition2 Function F Procedure P View V Edition3 Function F Package PKG
  • 47. This presentation is available in http://db-oriented.com/presentations ©OrenNakdimon Procedure P My Schema Edition1 Edition2 Function F Procedure P View V Edition3 Function F Table T
  • 48. This presentation is available in http://db-oriented.com/presentations ©OrenNakdimon Procedure P My Schema Edition1 Edition2 Function F Procedure P View V Edition3 Function F Package PKG Table T
  • 49. This presentation is available in http://db-oriented.com/presentations ©OrenNakdimon Procedure P My Schema Edition1 Edition2 Function F Procedure P View V Edition3 Function F Package PKG Table T
  • 50. This presentation is available in http://db-oriented.com/presentations ©OrenNakdimon Procedure P My Schema Edition1 Edition2 Function F Procedure P View V Edition3 Function F Package PKG Table T
  • 51. This presentation is available in http://db-oriented.com/presentations ©OrenNakdimon Demo
  • 52. This presentation is available in http://db-oriented.com/presentations ©OrenNakdimon ENTITY RELATIONSHIP DIAGRAM ALBUM # id * title * release_date SONG # track# * title ARTIST # id * name * type No need to think of EBR
  • 53. This presentation is available in http://db-oriented.com/presentations ©OrenNakdimon©OrenNakdimon©OrenNakdimon APIs add_artist add_album get_albums get_album_songs Data Entities ALBUM SONG ARTIST No need to think of EBR
  • 54. This presentation is available in http://db-oriented.com/presentations ©OrenNakdimon©OrenNakdimon©OrenNakdimon High Level Design add_artist add_album get_albums get_album_songs Data Entities ALBUM SONG ARTIST
  • 55. This presentation is available in http://db-oriented.com/presentations ©OrenNakdimon©OrenNakdimon©OrenNakdimon High Level Design add_artist add_album get_albums get_album_songs Data Entities MUSIC_OWNER ALBUM SONG ARTIST
  • 56. This presentation is available in http://db-oriented.com/presentations ©OrenNakdimon©OrenNakdimon©OrenNakdimon High Level Design add_artist add_album get_albums get_album_songs Data Entities MUSIC_OWNER ALBUM SONG ARTIST MUSIC_USER
  • 57. This presentation is available in http://db-oriented.com/presentations ©OrenNakdimon©OrenNakdimon©OrenNakdimon High Level Design add_artist add_album get_albums get_album_songs Data Entities MUSIC_OWNER ALBUM SONG ARTIST External API MUSIC_USER
  • 58. This presentation is available in http://db-oriented.com/presentations ©OrenNakdimon©OrenNakdimon©OrenNakdimon High Level Design MUSIC_MGR add_artist add_album get_albums get_album_songs Data Entities External API MUSIC_OWNER ALBUM SONG ARTIST MUSIC_USER
  • 59. This presentation is available in http://db-oriented.com/presentations ©OrenNakdimon©OrenNakdimon©OrenNakdimon High Level Design ALBUMS_DL SONGS_DL ARTISTS_DL MUSIC_MGR add add add add_artist add_album get_albums get_album_songs Data Entities Internal Code External API MUSIC_OWNER ALBUM SONG ARTIST MUSIC_USER No need to think of EBR
  • 60. This presentation is available in http://db-oriented.com/presentations ©OrenNakdimon©OrenNakdimon©OrenNakdimon One-Time Setup
  • 61. This presentation is available in http://db-oriented.com/presentations ©OrenNakdimon©OrenNakdimon©OrenNakdimon create user music_owner identified by pwd; grant create session, create table, create view, create procedure, create sequence, create type, create trigger, create job, create synonym, unlimited tablespace to music_owner; DBA
  • 62. This presentation is available in http://db-oriented.com/presentations ©OrenNakdimon©OrenNakdimon©OrenNakdimon create user music_user identified by pwd; grant create session to music_user; DBA
  • 63. This presentation is available in http://db-oriented.com/presentations ©OrenNakdimon©OrenNakdimon©OrenNakdimon alter user music_owner enable editions; DBA
  • 64. This presentation is available in http://db-oriented.com/presentations ©OrenNakdimon©OrenNakdimon©OrenNakdimon Version #1
  • 65. This presentation is available in http://db-oriented.com/presentations ©OrenNakdimon©OrenNakdimon©OrenNakdimon The Upgrade Create a New Edition Create/Alter Non-Editioned Objects Create/Replace Editioned Objects in the New Edition Expose the New Edition (or initial installation)
  • 66. This presentation is available in http://db-oriented.com/presentations ©OrenNakdimon©OrenNakdimon©OrenNakdimon The Upgrade Create a New Edition Create/Alter Non-Editioned Objects Create/Replace Editioned Objects in the New Edition Expose the New Edition
  • 67. This presentation is available in http://db-oriented.com/presentations ©OrenNakdimon©OrenNakdimon©OrenNakdimon create edition v1; DBA
  • 68. This presentation is available in http://db-oriented.com/presentations ©OrenNakdimon©OrenNakdimon©OrenNakdimon create edition v1; DBA grant use on edition v1 to music_owner;
  • 69. This presentation is available in http://db-oriented.com/presentations ©OrenNakdimon©OrenNakdimon©OrenNakdimon The Upgrade Create a New Edition Create/Alter Non-Editioned Objects Create/Replace Editioned Objects in the New Edition Expose the New Edition
  • 70. This presentation is available in http://db-oriented.com/presentations ©OrenNakdimon©OrenNakdimon©OrenNakdimon alter session set edition=v1; MUSIC_OWNER
  • 71. This presentation is available in http://db-oriented.com/presentations ©OrenNakdimon©OrenNakdimon©OrenNakdimon Procedure PEdition1 Table T a b c
  • 72. This presentation is available in http://db-oriented.com/presentations ©OrenNakdimon©OrenNakdimon©OrenNakdimon Procedure PEdition1 Edition2 Procedure P Table T a b c d
  • 73. This presentation is available in http://db-oriented.com/presentations ©OrenNakdimon©OrenNakdimon©OrenNakdimon Procedure PEdition1 Edition2 Procedure P Edition3 Table T Procedure P a b c d
  • 74. This presentation is available in http://db-oriented.com/presentations ©OrenNakdimon©OrenNakdimon©OrenNakdimon Procedure PEdition1 Table T View V a,b,c a b c
  • 75. This presentation is available in http://db-oriented.com/presentations ©OrenNakdimon©OrenNakdimon©OrenNakdimon Procedure PEdition1 Edition2 Procedure P Table T View V a,b,c View V a,b,c,d a b c d
  • 76. This presentation is available in http://db-oriented.com/presentations ©OrenNakdimon©OrenNakdimon©OrenNakdimon Procedure PEdition1 Edition2 Procedure P Edition3 Table T View V a,b,c View V a,b,c,d View V b,c,d Procedure P a b c d
  • 77. This presentation is available in http://db-oriented.com/presentations ©OrenNakdimon©OrenNakdimon©OrenNakdimon Editioning Views Views Editionable Deliberately limited Project Columns Alias the Projected Columns
  • 78. This presentation is available in http://db-oriented.com/presentations ©OrenNakdimon©OrenNakdimon©OrenNakdimon Editioning Views Prevent Invalidations Simulate different table structures in different editions
  • 79. This presentation is available in http://db-oriented.com/presentations ©OrenNakdimon©OrenNakdimon©OrenNakdimon Editioning Views are the Interface between the Application and the Tables Never refer to tables in your code, only to editioning views
  • 80. This presentation is available in http://db-oriented.com/presentations ©OrenNakdimon©OrenNakdimon©OrenNakdimon ALBUMS_DL SONGS_DL ARTISTS_DL MUSIC_MGR Internal Code External API MUSIC_OWNER Data Entities ALBUM SONG ARTIST
  • 81. This presentation is available in http://db-oriented.com/presentations ©OrenNakdimon©OrenNakdimon©OrenNakdimon ALBUMS_DL SONGS_DL ARTISTS_DL MUSIC_MGR Tables Internal Code External API MUSIC_OWNER ALBUMS SONGS ARTISTS
  • 82. This presentation is available in http://db-oriented.com/presentations ©OrenNakdimon©OrenNakdimon©OrenNakdimon ALBUMS_DL SONGS_DL ARTISTS_DL MUSIC_MGR Tables Internal Code External API MUSIC_OWNER ALBUMS SONGS ARTISTS Editioning Views ALBUMS SONGS ARTISTS
  • 83. This presentation is available in http://db-oriented.com/presentations ©OrenNakdimon©OrenNakdimon©OrenNakdimon ALBUMS_DL SONGS_DL ARTISTS_DL MUSIC_MGR Tables Internal Code External API MUSIC_OWNER ? ? Editioning Views ALBUMS SONGS ARTISTS ?
  • 84. This presentation is available in http://db-oriented.com/presentations ©OrenNakdimon©OrenNakdimon©OrenNakdimon Define Your Naming Convention Adhere to Your Naming Convention
  • 85. This presentation is available in http://db-oriented.com/presentations ©OrenNakdimon©OrenNakdimon©OrenNakdimon ALBUMS_DL SONGS_DL ARTISTS_DL MUSIC_MGR Tables Internal Code External API MUSIC_OWNER ALBUMS$0 SONGS$0 ARTISTS$0 Editioning Views ALBUMS SONGS ARTISTS
  • 86. This presentation is available in http://db-oriented.com/presentations ©OrenNakdimon©OrenNakdimon©OrenNakdimon create table artists$0 ( id integer generated as identity not null constraint artists$0_pk primary key, name varchar2(100) not null, type varchar2(6) not null constraint artists$0_chk_type check (type in ('Person','Band')) ); MUSIC_OWNER
  • 87. This presentation is available in http://db-oriented.com/presentations ©OrenNakdimon©OrenNakdimon©OrenNakdimon create editioning view artists as select id, name, type from artists$0; MUSIC_OWNER
  • 88. This presentation is available in http://db-oriented.com/presentations ©OrenNakdimon©OrenNakdimon©OrenNakdimon create table albums$0 ( id integer generated as identity not null constraint albums$0_pk primary key, title varchar2(100) not null, release_date date not null ); MUSIC_OWNER
  • 89. This presentation is available in http://db-oriented.com/presentations ©OrenNakdimon©OrenNakdimon©OrenNakdimon create editioning view albums as select id, title, release_date from albums$0; MUSIC_OWNER
  • 90. This presentation is available in http://db-oriented.com/presentations ©OrenNakdimon©OrenNakdimon©OrenNakdimon create table songs$0 ( album_id not null constraint songs$0_fk_album_id references albums$0, track# number(2) not null, constraint songs$0_pk primary key (album_id,track#), title varchar2(100) not null, artist_id not null constraint songs$0_fk_atrist_id references artists$0 ); MUSIC_OWNER create index songs$0_artist_id_ix on songs$0 (artist_id);
  • 91. This presentation is available in http://db-oriented.com/presentations ©OrenNakdimon©OrenNakdimon©OrenNakdimon create editioning view songs as select album_id, track#, title, artist_id from songs$0; MUSIC_OWNER
  • 92. This presentation is available in http://db-oriented.com/presentations ©OrenNakdimon©OrenNakdimon©OrenNakdimon create or replace package artists_dl as procedure add ( i_name in artists.name%type, i_type in artists.type%type, o_id out artists.id%type ); end artists_dl; / MUSIC_OWNER create or replace package body artists_dl as procedure add ( i_name in artists.name%type, i_type in artists.type%type, o_id out artists.id%type ) is begin insert into artists (name, type) values (i_name, i_type) returning id into o_id; end add; end artists_dl;
  • 93. This presentation is available in http://db-oriented.com/presentations ©OrenNakdimon©OrenNakdimon©OrenNakdimon MUSIC_OWNER create or replace package albums_dl as procedure add ( i_title in albums.title%type, i_release_date in albums.release_date%type, o_id out albums.id%type ); end albums_dl; create or replace package body albums_dl as procedure add ( i_title in albums.title%type, i_release_date in albums.release_date%type, o_id out albums.id%type ) is begin insert into albums (title, release_date) values (i_title, i_release_date) returning id into o_id; end add; end albums_dl;
  • 94. This presentation is available in http://db-oriented.com/presentations ©OrenNakdimon©OrenNakdimon©OrenNakdimon create or replace package body songs_dl as procedure add ( i_album_id in songs.album_id%type, i_songs in song_tt ) is begin forall i in indices of i_songs insert into songs (album_id, track#, title, artist_id) values (i_album_id, i_songs(i).track#, i_songs(i).title, i_songs(i).artist_id); end add; end songs_dl; create type song_t as object ( track# number(2), title varchar2(100), artist_id integer ) / MUSIC_OWNER create type song_tt as table of song_t / create or replace package songs_dl as procedure add ( i_album_id in songs.album_id%type, i_songs in song_tt ); end songs_dl;
  • 95. This presentation is available in http://db-oriented.com/presentations ©OrenNakdimon©OrenNakdimon©OrenNakdimon create or replace package music_mgr as procedure add_artist ( i_name in artists.name%type, i_type in artists.type%type, o_id out artists.id%type ); procedure add_album ( i_title in albums.title%type, i_release_date in albums.release_date%type, i_songs in song_tt, o_id out albums.id%type ); procedure get_albums ( o_albums out sys_refcursor ); procedure get_album_songs ( i_album_id in albums.id%type, o_songs out sys_refcursor ); end music_mgr; MUSIC_OWNER
  • 96. This presentation is available in http://db-oriented.com/presentations ©OrenNakdimon©OrenNakdimon©OrenNakdimon create or replace package music_mgr as procedure add_artist ( i_name in artists.name%type, i_type in artists.type%type, o_id out artists.id%type ); procedure add_album… procedure get_albums… procedure get_album_songs… end music_mgr; MUSIC_OWNER
  • 97. This presentation is available in http://db-oriented.com/presentations ©OrenNakdimon©OrenNakdimon©OrenNakdimon create or replace package body music_mgr as procedure add_artist ( i_name in artists.name%type, i_type in artists.type%type, o_id out artists.id%type ) is begin artists_dl.add(i_name => i_name, i_type => i_type, o_id => o_id); commit; end add_artist; . . . MUSIC_OWNER
  • 98. This presentation is available in http://db-oriented.com/presentations ©OrenNakdimon©OrenNakdimon©OrenNakdimon create or replace package body music_mgr as . . procedure add_album ( i_title in albums.title%type, i_release_date in albums.release_date%type, i_songs in song_tt, o_id out albums.id%type ) is begin albums_dl.add(i_title => i_title, i_release_date => i_release_date, o_id => o_id); songs_dl.add(i_album_id => o_id, i_songs => i_songs); commit; end add_album; . . MUSIC_OWNER
  • 99. This presentation is available in http://db-oriented.com/presentations ©OrenNakdimon©OrenNakdimon©OrenNakdimon create or replace package body music_mgr as . . procedure get_albums ( o_albums out sys_refcursor ) is begin open o_albums for select a.id, a.title, a.release_date from albums a order by a.title; end get_albums; . . MUSIC_OWNER
  • 100. This presentation is available in http://db-oriented.com/presentations ©OrenNakdimon©OrenNakdimon©OrenNakdimon create or replace package body music_mgr as . . procedure get_album_songs ( i_album_id in albums.id%type, o_songs out sys_refcursor ) is begin open o_songs for select s.track#, s.title, s.artist_id from songs s where s.album_id = i_album_id order by s.track#; end get_album_songs; end music_mgr; MUSIC_OWNER
  • 101. This presentation is available in http://db-oriented.com/presentations ©OrenNakdimon©OrenNakdimon©OrenNakdimon The Upgrade Create a New Edition Create/Alter Non-Editioned Objects Create/Replace Editioned Objects in the New Edition Expose the New Edition
  • 102. This presentation is available in http://db-oriented.com/presentations ©OrenNakdimon©OrenNakdimon©OrenNakdimon Exposing the Post-Upgrade Version Validate (and actualize) necessary objects Grant permissions on new objects to the application user Create necessary synonyms Grant use on the new edition to the application user Associate the new edition with a service
  • 103. This presentation is available in http://db-oriented.com/presentations ©OrenNakdimon©OrenNakdimon©OrenNakdimon Exposing the Post-Upgrade Version Validate (and actualize) necessary objects Grant permissions on new objects to the application user Create necessary synonyms Grant use on the new edition to the application user Associate the new edition with a service
  • 104. This presentation is available in http://db-oriented.com/presentations ©OrenNakdimon©OrenNakdimon©OrenNakdimon exec dbms_utility.compile_schema(user,compile_all=>false) MUSIC_OWNER
  • 105. This presentation is available in http://db-oriented.com/presentations ©OrenNakdimon©OrenNakdimon©OrenNakdimon Exposing the Post-Upgrade Version Validate (and actualize) necessary objects Grant permissions on new objects to the application user Create necessary synonyms Grant use on the new edition to the application user Associate the new edition with a service
  • 106. This presentation is available in http://db-oriented.com/presentations ©OrenNakdimon©OrenNakdimon©OrenNakdimon grant execute on music_mgr to music_user; grant execute on song_t to music_user; grant execute on song_tt to music_user; MUSIC_OWNER
  • 107. This presentation is available in http://db-oriented.com/presentations ©OrenNakdimon©OrenNakdimon©OrenNakdimon Exposing the Post-Upgrade Version Validate (and actualize) necessary objects Grant permissions on new objects to the application user Create necessary synonyms Grant use on the new edition to the application user Associate the new edition with a service
  • 108. This presentation is available in http://db-oriented.com/presentations ©OrenNakdimon©OrenNakdimon©OrenNakdimon create synonym music_user.music_mgr for music_owner.music_mgr; create synonym music_user.song_t for music_owner.song_t; create synonym music_user.song_tt for music_owner.song_tt; DBA
  • 109. This presentation is available in http://db-oriented.com/presentations ©OrenNakdimon©OrenNakdimon©OrenNakdimon Exposing the Post-Upgrade Version Validate (and actualize) necessary objects Grant permissions on new objects to the application user Create necessary synonyms Grant use on the new edition to the application user Associate the new edition with a service
  • 110. This presentation is available in http://db-oriented.com/presentations ©OrenNakdimon©OrenNakdimon©OrenNakdimon grant use on edition v1 to music_user; DBA
  • 111. This presentation is available in http://db-oriented.com/presentations ©OrenNakdimon©OrenNakdimon©OrenNakdimon Exposing the Post-Upgrade Version Validate (and actualize) necessary objects Grant permissions on new objects to the application user Create necessary synonyms Grant use on the new edition to the application user Associate the new edition with a service
  • 112. This presentation is available in http://db-oriented.com/presentations ©OrenNakdimon©OrenNakdimon©OrenNakdimon begin dbms_service.create_service( service_name => 'MUSIC_SERVICE_A', network_name => 'MUSIC_SERVICE_A', edition => 'V1' ); dbms_service.start_service( service_name => 'MUSIC_SERVICE_A‘ ); end; DBA @demo01
  • 113. This presentation is available in http://db-oriented.com/presentations ©OrenNakdimon©OrenNakdimon©OrenNakdimon Version #2 Change get_album_songs to return artist_name instead of artist_id Code Implementation Changes
  • 114. This presentation is available in http://db-oriented.com/presentations ©OrenNakdimon©OrenNakdimon©OrenNakdimon The Upgrade Create a New Edition Create/Alter Non-Editioned Objects Create/Replace Editioned Objects in the New Edition Expose the New Edition
  • 115. This presentation is available in http://db-oriented.com/presentations ©OrenNakdimon©OrenNakdimon©OrenNakdimon create edition v2; DBA
  • 116. This presentation is available in http://db-oriented.com/presentations ©OrenNakdimon©OrenNakdimon©OrenNakdimon create edition v2; DBA grant use on edition v2 to music_owner;
  • 117. This presentation is available in http://db-oriented.com/presentations ©OrenNakdimon©OrenNakdimon©OrenNakdimon The Upgrade Create a New Edition Create/Alter Non-Editioned Objects Create/Replace Editioned Objects in the New Edition Expose the New Edition
  • 118. This presentation is available in http://db-oriented.com/presentations ©OrenNakdimon©OrenNakdimon©OrenNakdimon alter session set edition=v2; MUSIC_OWNER
  • 119. This presentation is available in http://db-oriented.com/presentations ©OrenNakdimon©OrenNakdimon©OrenNakdimon create or replace package body music_mgr as . . procedure get_album_songs ( i_album_id in albums.id%type, o_songs out sys_refcursor ) is begin open o_songs for select s.track#, s.title, a.name artist_name from songs s, artists a where s.album_id = i_album_id and a.id = s.artist_id order by s.track#; end get_album_songs; end music_mgr; MUSIC_OWNER
  • 120. This presentation is available in http://db-oriented.com/presentations ©OrenNakdimon©OrenNakdimon©OrenNakdimon The Upgrade Create a New Edition Create/Alter Non-Editioned Objects Create/Replace Editioned Objects in the New Edition Expose the New Edition
  • 121. This presentation is available in http://db-oriented.com/presentations ©OrenNakdimon©OrenNakdimon©OrenNakdimon Exposing the Post-Upgrade Version Validate (and actualize) necessary objects Grant permissions on new objects to the application user Create necessary synonyms Grant use on the new edition to the application user Associate the new edition with a service
  • 122. This presentation is available in http://db-oriented.com/presentations ©OrenNakdimon©OrenNakdimon©OrenNakdimon exec dbms_utility.compile_schema(user,compile_all=>false) MUSIC_OWNER
  • 123. This presentation is available in http://db-oriented.com/presentations ©OrenNakdimon©OrenNakdimon©OrenNakdimon grant use on edition v2 to music_user; DBA
  • 124. This presentation is available in http://db-oriented.com/presentations ©OrenNakdimon©OrenNakdimon©OrenNakdimon begin dbms_service.modify_service( service_name => 'MUSIC_SERVICE_A', edition => 'V2', modify_edition => TRUE) ); end; DBA @demo02
  • 125. This presentation is available in http://db-oriented.com/presentations ©OrenNakdimon©OrenNakdimon©OrenNakdimon Entity Relationship Diagram ALBUM # id * title * release_date o genre SONG # track# * title ARTIST # id * name * type
  • 126. This presentation is available in http://db-oriented.com/presentations ©OrenNakdimon©OrenNakdimon©OrenNakdimon Version #3 Add genre to albums Data Model Changes (New Functionality) API Changes Code Implementation Changes
  • 127. This presentation is available in http://db-oriented.com/presentations ©OrenNakdimon©OrenNakdimon©OrenNakdimon The Upgrade Create a New Edition Create/Alter Non-Editioned Objects Create/Replace Editioned Objects in the New Edition Expose the New Edition
  • 128. This presentation is available in http://db-oriented.com/presentations ©OrenNakdimon©OrenNakdimon©OrenNakdimon create edition v3; DBA
  • 129. This presentation is available in http://db-oriented.com/presentations ©OrenNakdimon©OrenNakdimon©OrenNakdimon create edition v3; DBA grant use on edition v3 to music_owner;
  • 130. This presentation is available in http://db-oriented.com/presentations ©OrenNakdimon©OrenNakdimon©OrenNakdimon The Upgrade Create a New Edition Create/Alter Non-Editioned Objects Create/Replace Editioned Objects in the New Edition Expose the New Edition
  • 131. This presentation is available in http://db-oriented.com/presentations ©OrenNakdimon©OrenNakdimon©OrenNakdimon MUSIC_OWNER alter session set edition=v3;
  • 132. This presentation is available in http://db-oriented.com/presentations ©OrenNakdimon©OrenNakdimon©OrenNakdimon alter table albums$0 add ( genre varchar2(100) ); MUSIC_OWNER create or replace editioning view albums as select id, title, release_date, genre from albums$0;
  • 133. This presentation is available in http://db-oriented.com/presentations ©OrenNakdimon©OrenNakdimon©OrenNakdimon create or replace package albums_dl as procedure add ( i_title in albums.title%type, i_release_date in albums.release_date%type, o_id out albums.id%type ); procedure set_genre ( i_id in albums.id%type, i_genre in albums.genre%type ); end albums_dl; / MUSIC_OWNER
  • 134. This presentation is available in http://db-oriented.com/presentations ©OrenNakdimon©OrenNakdimon©OrenNakdimon create or replace package body albums_dl as . . procedure set_genre ( i_id in albums.id%type, i_genre in albums.genre%type ) is begin update albums a set a.genre = i_genre where a.id = i_id; end set_genre; end albums_dl; / MUSIC_OWNER
  • 135. This presentation is available in http://db-oriented.com/presentations ©OrenNakdimon©OrenNakdimon©OrenNakdimon create or replace package music_mgr as . . procedure set_album_genre ( i_album_id in albums.id%type, i_genre in albums.genre%type ); . . MUSIC_OWNER
  • 136. This presentation is available in http://db-oriented.com/presentations ©OrenNakdimon©OrenNakdimon©OrenNakdimon create or replace package body music_mgr as . . procedure set_album_genre ( i_album_id in albums.id%type, i_genre in albums.genre%type ) is begin albums_dl.set_genre(i_id => i_album_id, i_genre => i_genre); commit; end set_album_genre; . . MUSIC_OWNER
  • 137. This presentation is available in http://db-oriented.com/presentations ©OrenNakdimon©OrenNakdimon©OrenNakdimon create or replace package body music_mgr as . . procedure get_albums ( o_albums out sys_refcursor ) is begin open o_albums for select a.id, a.title, a.release_date, a.genre from albums a order by a.title; end get_albums; . MUSIC_OWNER
  • 138. This presentation is available in http://db-oriented.com/presentations ©OrenNakdimon©OrenNakdimon©OrenNakdimon The Upgrade Create a New Edition Create/Alter Non-Editioned Objects Create/Replace Editioned Objects in the New Edition Expose the New Edition
  • 139. This presentation is available in http://db-oriented.com/presentations ©OrenNakdimon©OrenNakdimon©OrenNakdimon Exposing the Post-Upgrade Version Validate (and actualize) necessary objects Grant permissions on new objects to the application user Create necessary synonyms Grant use on the new edition to the application user Associate the new edition with a service
  • 140. This presentation is available in http://db-oriented.com/presentations ©OrenNakdimon©OrenNakdimon©OrenNakdimon exec dbms_utility.compile_schema(user,compile_all=>false) MUSIC_OWNER
  • 141. This presentation is available in http://db-oriented.com/presentations ©OrenNakdimon©OrenNakdimon©OrenNakdimon grant use on edition v3 to music_user; DBA
  • 142. This presentation is available in http://db-oriented.com/presentations ©OrenNakdimon©OrenNakdimon©OrenNakdimon begin dbms_service.modify_service( service_name => 'MUSIC_SERVICE_A', edition => 'V3', modify_edition => TRUE) ); end; DBA @demo03
  • 143. This presentation is available in http://db-oriented.com/presentations ©OrenNakdimon©OrenNakdimon©OrenNakdimon Entity Relationship Diagram ALBUM # id * title * release_date o genre SONG # track# * title ARTIST # id * name * type GENRE # id * name
  • 144. This presentation is available in http://db-oriented.com/presentations ©OrenNakdimon©OrenNakdimon©OrenNakdimon Version #4 Replace the free text genre column with a foreign key to a new table Data Model Changes (Replacing Functionality) API Changes Code Implementation Changes
  • 145. This presentation is available in http://db-oriented.com/presentations ©OrenNakdimon©OrenNakdimon©OrenNakdimon The Upgrade Create a New Edition Create/Alter Non-Editioned Objects Create/Replace Editioned Objects in the New Edition Expose the New Edition
  • 146. This presentation is available in http://db-oriented.com/presentations ©OrenNakdimon©OrenNakdimon©OrenNakdimon create edition v4; DBA
  • 147. This presentation is available in http://db-oriented.com/presentations ©OrenNakdimon©OrenNakdimon©OrenNakdimon create edition v4; DBA grant use on edition v4 to music_owner;
  • 148. This presentation is available in http://db-oriented.com/presentations ©OrenNakdimon©OrenNakdimon©OrenNakdimon The Upgrade Create a New Edition Create/Alter Non-Editioned Objects Create/Replace Editioned Objects in the New Edition Expose the New Edition
  • 149. This presentation is available in http://db-oriented.com/presentations ©OrenNakdimon©OrenNakdimon©OrenNakdimon MUSIC_OWNER alter session set edition=v4;
  • 150. This presentation is available in http://db-oriented.com/presentations ©OrenNakdimon©OrenNakdimon©OrenNakdimon create table genres$0 ( id number(3) not null constraint genres$0_pk primary key, name varchar2(20) not null ); MUSIC_OWNER create editioning view genres as select id, name from genres$0;
  • 151. This presentation is available in http://db-oriented.com/presentations ©OrenNakdimon©OrenNakdimon©OrenNakdimon insert into genres (id,name) values (1,'Classical'); insert into genres (id,name) values (2,'Country'); insert into genres (id,name) values (3,'Electronic'); insert into genres (id,name) values (4,'Folk'); insert into genres (id,name) values (5,'Hip-Hop'); insert into genres (id,name) values (6,'Jazz'); insert into genres (id,name) values (7,'Latin'); insert into genres (id,name) values (8,'Pop'); insert into genres (id,name) values (9,'Rock'); insert into genres (id,name) values (10,'R&B'); insert into genres (id,name) values (11,'Soul'); MUSIC_OWNER
  • 152. This presentation is available in http://db-oriented.com/presentations ©OrenNakdimon©OrenNakdimon©OrenNakdimon alter table albums$0 add ( genre_id constraint albums$0_fk_genre_id references genres$0 (id) ); MUSIC_OWNER create or replace editioning view albums as select id, title, release_date, genre_id from albums$0;
  • 153. This presentation is available in http://db-oriented.com/presentations ©OrenNakdimon©OrenNakdimon©OrenNakdimon create or replace package albums_dl as procedure add ( i_title in albums.title%type, i_release_date in albums.release_date%type, o_id out albums.id%type ); procedure set_genre_id ( i_id in albums.id%type, i_genre_id in albums.genre_id%type ); end albums_dl; / MUSIC_OWNER
  • 154. This presentation is available in http://db-oriented.com/presentations ©OrenNakdimon©OrenNakdimon©OrenNakdimon create or replace package body albums_dl as . . procedure set_genre_id ( i_id in albums.id%type, i_genre_id in albums.genre_id%type ) is begin update albums a set a.genre_id = i_genre_id where a.id = i_id; end set_genre_id; end albums_dl; / MUSIC_OWNER
  • 155. This presentation is available in http://db-oriented.com/presentations ©OrenNakdimon©OrenNakdimon©OrenNakdimon create or replace package body music_mgr as . . procedure set_album_genre_id ( i_album_id in albums.id%type, i_genre_id in albums.genre_id%type ) is begin albums_dl.set_genre_id(i_id => i_album_id, i_genre_id => i_genre_id); commit; end set_album_genre_id; . . MUSIC_OWNER
  • 156. This presentation is available in http://db-oriented.com/presentations ©OrenNakdimon©OrenNakdimon©OrenNakdimon create or replace package body music_mgr as . procedure get_albums ( o_albums out sys_refcursor ) is begin open o_albums for select a.id, a.title, a.release_date, g.name genre from albums a, genres g where g.id(+) = a.genre_id order by a.title; end get_albums; MUSIC_OWNER
  • 157. This presentation is available in http://db-oriented.com/presentations ©OrenNakdimon©OrenNakdimon©OrenNakdimon create or replace trigger albums_fce_trig before insert or update of genre on albums$0 for each row forward crossedition disable begin if :new.genre is null then :new.genre_id := null; else select g.id into :new.genre_id from genres g where upper(g.name) = upper(:new.genre); end if; end albums_fce_trig; / MUSIC_OWNER alter trigger albums_fce_trig enable;
  • 158. This presentation is available in http://db-oriented.com/presentations ©OrenNakdimon©OrenNakdimon©OrenNakdimon merge into albums$0 a using genres g on (upper(a.genre) = upper(g.name)) when matched then update set a.genre_id = g.id; MUSIC_OWNER
  • 159. This presentation is available in http://db-oriented.com/presentations ©OrenNakdimon©OrenNakdimon©OrenNakdimon create or replace trigger albums_rce_trig before insert or update of genre_id on albums$0 for each row reverse crossedition disable begin if :new.genre_id is null then :new.genre := null; else select g.name into :new.genre from genres g where g.id = :new.genre_id; end if; end albums_rce_trig; / MUSIC_OWNER alter trigger albums_rce_trig enable;
  • 160. This presentation is available in http://db-oriented.com/presentations ©OrenNakdimon©OrenNakdimon©OrenNakdimon The Upgrade Create a New Edition Create/Alter Non-Editioned Objects Create/Replace Editioned Objects in the New Edition Expose the New Edition
  • 161. This presentation is available in http://db-oriented.com/presentations ©OrenNakdimon©OrenNakdimon©OrenNakdimon Exposing the Post-Upgrade Version Validate (and actualize) necessary objects Grant permissions on new objects to the application user Create necessary synonyms Grant use on the new edition to the application user Associate the new edition with a service
  • 162. This presentation is available in http://db-oriented.com/presentations ©OrenNakdimon©OrenNakdimon©OrenNakdimon exec dbms_utility.compile_schema(user,compile_all=>false) MUSIC_OWNER
  • 163. This presentation is available in http://db-oriented.com/presentations ©OrenNakdimon©OrenNakdimon©OrenNakdimon grant use on edition v4 to music_user; DBA
  • 164. This presentation is available in http://db-oriented.com/presentations ©OrenNakdimon©OrenNakdimon©OrenNakdimon begin dbms_service.create_service( service_name => 'MUSIC_SERVICE_B', network_name => 'MUSIC_SERVICE_B', edition => 'V4' ); dbms_service.start_service( service_name => 'MUSIC_SERVICE_B' ); end; DBA @demo04
  • 165. This presentation is available in http://db-oriented.com/presentations ©OrenNakdimon©OrenNakdimon©OrenNakdimon Beyond Online UpgradesBeyond Online Upgrades  Upgrades can be done at any time  Upgrades can take as long as needed  DB-side upgrade can be done independently of App Server upgrade readiness  Flexible exposure of new versions  Testing of the new version before it is exposed to the end users  Different types of App Servers may use different editions
  • 166. THANK YOU Oren Nakdimon www.db-oriented.com  oren@db-oriented.com  +972-54-4393763 @DBoriented