Edition based redefinition joords

27
WWW.TRANSFER-SOLUTIONS.COM Spreker(s) : Datum : E-mail : Edition Based Redefinition The key to online application upgrade Jos van den Oord 14 februari 2013 [email protected] Cafe

Transcript of Edition based redefinition joords

Page 1: Edition based redefinition joords

WWW.TRANSFER-SOLUTIONS.COM

Spreker(s) :

Datum :

E-mail :

Edition Based RedefinitionThe key to online application upgrade

Jos van den Oord

14 februari 2013

[email protected] Cafe

Page 2: Edition based redefinition joords

© COPYRIGHT TRANSFER SOLUTIONS B.V. 2

Overview

Oracle High availability components

The traditional application upgrade scenario

Edition Based Redefinition

Components of Edition Based Redefinition

New schema design

Overview using Edition Based Redefinition

Demos

Summary

Page 3: Edition based redefinition joords

© COPYRIGHT TRANSFER SOLUTIONS B.V.

High availability

3

Resource Solution

Data Center Data Guard

Server RAC

Storage ASM, RAID, Resumable Transactions

Network VLANs, Multiplexing, Bonding

Corruption RMAN

Software Rolling Patches

Tables & Indexes Online Redefinition/Create/Alter/Rebuild/Move

Parameters Changing of most Oracle parameters(only 90 of the 350 are not online to change)

PL/SQL – view Objects

Not Possible

Page 4: Edition based redefinition joords

© COPYRIGHT TRANSFER SOLUTIONS B.V.

Application Upgrade

Creation of new objects

Changing existing objects (alter and create or replace)

Add, Modify or Drop columns or constraints

Change packages and stored procedures

Recompile

Drop redundant objects

Convert or migrate data

Resume normal operations

4A

pplication D

own

Page 5: Edition based redefinition joords

© COPYRIGHT TRANSFER SOLUTIONS B.V.

What do we want for Application Upgrades

Elimination downtime during application roll out

System continue without interrupting for users

Upgrade system code and immediately operational

Easy roll forward and backward scenario for the application

5

Page 6: Edition based redefinition joords

© COPYRIGHT TRANSFER SOLUTIONS B.V.

Edition Based Redefinition (EBR)

A single technology that provides high availability during Upgrades

No disturbing users

No corrupt data

Is safe

Is secure

Is fully supported by Oracle

Is free (no extra licensing cost)

Operational on SE and EE

6

Page 7: Edition based redefinition joords

© COPYRIGHT TRANSFER SOLUTIONS B.V.

Edition

Introduced in release 11.2

Set compatibility 11.2

Version control system inside the database

New dimensions or worlds for an Application

7

Page 8: Edition based redefinition joords

© COPYRIGHT TRANSFER SOLUTIONS B.V.

Important Oracle RDBMS 11gR2 Changes

New Oracle Objects

Fine Grained Dependency Tracking

Editions – Oracle versioning

Solving exclusive lock on table by creating online indexes

Cost-Based optimalisations

8

Page 9: Edition based redefinition joords

© COPYRIGHT TRANSFER SOLUTIONS B.V.

Editionable objects

Editionable

• PL/SQL Objects• Packages• Procedures• Functions• Triggers

• Views• Private Synonyms• Types

Not Editionable

• Tables• Materialized Views• DB Links• Public Synonyms

9

Page 10: Edition based redefinition joords

© COPYRIGHT TRANSFER SOLUTIONS B.V.

The Three New Object Types

10

• Editions are isolated environments.• A single schema can have two or more versions

of stored PL / SQL objects, types and views. [edition:owner:object => unique]

Edition

• Oracle New Tables• A shield around the existing table.• References to the table are replaced by

references to the edition view. Edition View

• Propagates data changes made by the parent edition into the child edition’s columns, or (in hot-rollover) vice-versa

Crossedition Trigger

Page 11: Edition based redefinition joords

© COPYRIGHT TRANSFER SOLUTIONS B.V.

Edition views - The New Oracle Tables

The from list is only a single table

The select list is column named

Logical projection of a table structure

Edition view and table in same schema

One edition view for a table in given database edition

An edition view can NEVER be complex

11

Page 12: Edition based redefinition joords

© COPYRIGHT TRANSFER SOLUTIONS B.V.

Cross Edition Trigger

Propagating changes back and forward between two versions

Forward Crossedition Triggers

Reverse Crossedition Triggers

Crossedition Trigger Interaction with EditionsFiring Order

Follows and Precedes Clauses

Not visible to end-users

Temporary Solution

12

Page 13: Edition based redefinition joords

© COPYRIGHT TRANSFER SOLUTIONS B.V.

EBR - Parallel Universes - Summary

A revolutionary new capabilityCode changes are installed in the privacy of an edition

Editionable object typesPL/SQL objects of all kinds

Synonyms

Views

Three new object typesEdition

Editioning View

Crossedition Trigger

Mandatory for all Oracle databases [new|upgrade] 11gR2 editioning

13

Page 14: Edition based redefinition joords

© COPYRIGHT TRANSFER SOLUTIONS B.V.

Schema design – NOT EBR

14

Table

IDX_1 IDX_2

Public synonyms

Views

Grants, Roles, Privs

VPD policies

VPD policies

Materialized views

Constraints

Triggers

AQ interfaces

Page 15: Edition based redefinition joords

© COPYRIGHT TRANSFER SOLUTIONS B.V.

Source Table

EditionViews

Schema design – EBR

15

IDX_1 IDX_2

Views

Grants, Roles, PrivsVPD policiesSynonyms

Materialized views

Triggers

AQ interfaces

Cross-edition triggers

Auditing

Contraints

Page 16: Edition based redefinition joords

© COPYRIGHT TRANSFER SOLUTIONS B.V.

EBR Implementation

16

Application Servers Network

PL/SQL Objects

Tables

Triggers

ORA$BASE EBR version 1

PL/SQL Objects

Triggers Triggers

PL/SQL Objects

Edition Views

Crossedition Triggers

Application Servers Network

Tables

Triggers

Page 17: Edition based redefinition joords

© COPYRIGHT TRANSFER SOLUTIONS B.V.

Edition Enabled Data Dictionary Views*_EDITIONS

*_EDITION_COMMENTS

*_EDITIONING_VIEWS_AE

*_EDITIONING_VIEW_COLS_AE

AUD$ (obj$edition)

FGA_LOG$ (obj$edition)

DBA_OBJECTS (edition_name)

DBA_USERS (edition enabled)

V$SESSION (session_edition_id)

*_VIEWS_AE

*_SOURCE_AE

*_OBJECTS_AE

*_ERRORS_AEAE = All Editions

17

Page 18: Edition based redefinition joords

© COPYRIGHT TRANSFER SOLUTIONS B.V.

Edition Enabled Packages

DBMS_EDITIONS_UTILITIES.SET_EDITIONING_VIEWS_READ_ONLY

DBMS_SESSION.SET_EDITION_DEFERRED(<EDITION_NAME> )

DBMS_METADATA_UTIL.GET_EDITIONID

DBMS_PARALLEL_EXECUTE.CREATE_TASK

DBMS_PARALLEL_EXECUTE.RESUME_TASK

DBMS_PARALLEL_EXECUTE.RUN_TASK

DBMS_SQL.PARSE

DBMS_UTILITY.WAIT_ON_PENDING_DML

DBMS_UTILITY.VALIDATE

18

Page 19: Edition based redefinition joords

© COPYRIGHT TRANSFER SOLUTIONS B.V.

Considerations by activating Editions

SCN and commitsSwitching/activating of editions

Inserts/updates/deletes full table LocksBulk inserts,updates,deletes on table columns

Change column sizeImpact on other objects

19

Page 20: Edition based redefinition joords

© COPYRIGHT TRANSFER SOLUTIONS B.V.

APEX and EBR (1)

20

Wrong Options:Alter session set edition

DBMS_SESSION.set edition_deferred

Apex 4.0dads.conf : PlsqlDatabaseEdition

apex_util.set_edition()

dbms_epg.set_dad_attribute( dad_name => 'APEX', attr_name =>'database-edition', attr_value => 'HR_RELEASE2');

Page 21: Edition based redefinition joords

© COPYRIGHT TRANSFER SOLUTIONS B.V.

APEX and EBR (2)

21

Build on – views on - Edition Views

Four (!) -tier architecture

Edition your Views or PL/SQL Functions

Use Authorization Schemes

Table

Editioning View

(Regular) View or PL/SQL

UI / APEX

Page 22: Edition based redefinition joords

© COPYRIGHT TRANSFER SOLUTIONS B.V.

SQLDeveloper support

22

Page 23: Edition based redefinition joords

© COPYRIGHT TRANSFER SOLUTIONS B.V.

Demos

Play with editions

Add column

Split column name into first- last name

User with grants to objects to editionable objects

23

Page 24: Edition based redefinition joords

© COPYRIGHT TRANSFER SOLUTIONS B.V.

Schema design – NOT EBR

24

Table

IDX_1 IDX_2

Public synonyms

Views

Grants, Roles, Privs

VPD policies

VPD policies

Materialized views

Constraints

Triggers

AQ interfaces

Page 25: Edition based redefinition joords

© COPYRIGHT TRANSFER SOLUTIONS B.V.

Source Table

EditionViews

Schema design – EBR

25

IDX_1 IDX_2

Views

Grants, Roles, PrivsVPD policiesSynonyms

Materialized views

Triggers

AQ interfaces

Cross-edition triggers

Auditing

Contraints

Page 26: Edition based redefinition joords

© COPYRIGHT TRANSFER SOLUTIONS B.V.

EBR exercise/planning

Application Upgrade

Editions

Editions views

Forward crossedition trigger

Reverse crossedition trigger

Change only editioned objects

Change the structure of transaction tables

Support hot rollover

26

Page 27: Edition based redefinition joords

© COPYRIGHT TRANSFER SOLUTIONS B.V. 27

&QuestionsAnswers

CONSULTING | MANAGED SERVICES | EDUCATION

WWW.TRANSFER-SOLUTIONS.COM