Edition-Based Redefinition (EBR): Zero-Downtime Oracle Application Upgrades

Learn how Oracle Edition-Based Redefinition (EBR) enables zero-downtime application upgrades by allowing multiple versions of database objects to coexist simultaneously.

Edition-Based Redefinition (EBR) is one of Oracle's most powerful yet underutilized features. It enables you to upgrade database application components — PL/SQL packages, views, synonyms, and triggers — while users continue working without interruption. No downtime, no maintenance windows, no disruption.

What is Edition-Based Redefinition?

EBR allows multiple versions (editions) of the same database objects to exist simultaneously in the same database. Users connected to the old edition continue working normally while developers deploy and test the new edition. Once validated, users are seamlessly transitioned to the new edition.

Think of it like having two parallel versions of your application code running side by side in the database, with the ability to switch users from one to the other instantly.

The Problem EBR Solves

Traditional database upgrades face a painful dilemma:

Without EBR

  1. Schedule a maintenance window
  2. Take the application offline
  3. Deploy schema changes, new PL/SQL code, and data migrations
  4. Test everything
  5. Bring the application back online
  6. Hope nothing breaks

This approach means:

  • Downtime: Users cannot access the application
  • Risk: If something fails, rolling back is complex and time-consuming
  • Pressure: Everything must work perfectly in a limited window
  • Business impact: Lost revenue, productivity, and user trust

With EBR

  1. Create a new edition
  2. Deploy all changes to the new edition while users work on the current one
  3. Test thoroughly in the new edition
  4. Switch users to the new edition — instantly
  5. If issues arise, switch back just as quickly

Core Concepts

Editions

An edition is a container for a version of your database objects. Every Oracle database has a default edition called ORA$BASE.

-- Create a new edition
CREATE EDITION release_2_0;

-- See all editions
SELECT edition_name, parent_edition_name
FROM dba_editions
ORDER BY edition_name;

Editionable vs Non-Editionable Objects

Not all database objects can be editioned. Here is the breakdown:

EditionableNon-Editionable
PL/SQL PackagesTables
PL/SQL Package BodiesIndexes
FunctionsSequences
ProceduresMaterialized Views
ViewsConstraints
SynonymsDatabase Links
TriggersGrants
TypesTablespaces

Key insight: Tables are NOT editionable. This is by design — EBR uses editioning views and crossedition triggers to handle table structure changes.

Editioning Views

Since tables cannot be editioned, editioning views act as a layer between your application code and the underlying tables. Your PL/SQL code and application interact with editioning views instead of base tables directly.

-- Create an editioning view over a table
CREATE OR REPLACE EDITIONING VIEW employees_ev AS
SELECT employee_id, first_name, last_name, email, salary, department_id
FROM employees;

Crossedition Triggers

When table structures change between editions, crossedition triggers keep data synchronized between the old and new representations:

  • Forward crossedition triggers: Transform data from old format to new format
  • Reverse crossedition triggers: Transform data from new format back to old format (for rollback safety)

Step-by-Step EBR Implementation

Step 1: Enable Editions for Your Schema

ALTER USER app_schema ENABLE EDITIONS;

Step 2: Create Editioning Views for Existing Tables

CREATE OR REPLACE EDITIONING VIEW employees_ev AS
SELECT employee_id, first_name, last_name, email,
       salary, department_id
FROM employees;

Step 3: Update Application Code

Modify all PL/SQL code to reference editioning views instead of base tables.

Step 4: Create a New Edition for Your Upgrade

CREATE EDITION release_2_0 AS CHILD OF ora$base;

Step 5: Deploy Changes in the New Edition

ALTER SESSION SET EDITION = release_2_0;

-- Add a column to the base table
ALTER TABLE employees ADD (middle_name VARCHAR2(50));

-- Update the editioning view in the new edition
CREATE OR REPLACE EDITIONING VIEW employees_ev AS
SELECT employee_id, first_name, middle_name, last_name,
       email, salary, department_id
FROM employees;

Step 6: Create Crossedition Triggers (if needed)

CREATE OR REPLACE TRIGGER employees_fwd_xed
BEFORE INSERT OR UPDATE ON employees
FOR EACH ROW
FORWARD CROSSEDITION
BEGIN
  IF :NEW.middle_name IS NULL THEN
    :NEW.middle_name := '';
  END IF;
END;

Step 7: Test in the New Edition

ALTER SESSION SET EDITION = release_2_0;
-- Run your test suite and verify all functionality

Step 8: Switch Users to the New Edition

ALTER DATABASE DEFAULT EDITION = release_2_0;

All new connections now use the new edition. Existing connections continue on the old edition until they reconnect.

Step 9: Cleanup (After Validation Period)

DROP TRIGGER employees_fwd_xed;
DROP TRIGGER employees_rev_xed;
-- Optionally retire the old edition
DROP EDITION ora$base CASCADE;

Real-World EBR Patterns

Pattern 1: Adding a Column

  1. Add column to base table
  2. Update editioning view in new edition to expose it
  3. Create forward crossedition trigger to populate it
  4. Apply trigger to existing data
  5. Switch edition

Pattern 2: Splitting a Column

Example: Split 'full_name' into 'first_name' and 'last_name'

  1. Add new columns to base table
  2. Update editioning view in new edition
  3. Forward trigger: parse full_name into first/last
  4. Reverse trigger: concatenate first/last into full_name
  5. Apply and switch

Pattern 3: Changing Business Logic Only

When only PL/SQL changes are needed (no schema changes):

  1. Create new edition
  2. Recompile packages in new edition with new logic
  3. Test
  4. Switch — no crossedition triggers needed

Best Practices

Design for EBR from the Start

  • Always use editioning views between application code and tables
  • Never reference base tables directly in PL/SQL
  • Keep your edition hierarchy simple and linear

Testing

  • Always test both editions simultaneously before switching
  • Verify crossedition triggers handle all edge cases
  • Test rollback scenarios

Naming Conventions

  • Use consistent edition naming: release_1_0, release_2_0, etc.
  • Suffix editioning views with _ev: employees_ev, orders_ev
  • Clearly name crossedition triggers: tablename_fwd_xed, tablename_rev_xed

Performance

  • Crossedition triggers add overhead — keep them simple
  • Apply data transformations in batches for large tables
  • Remove crossedition triggers promptly after successful transition

EBR vs Other Approaches

ApproachDowntimeComplexityRollbackOracle-Specific
EBRZeroMediumInstantYes
Blue-Green DBNear-zeroHighFastNo
Rolling UpgradeMinutesLowSlowNo
Maintenance WindowHoursLowSlowNo

Who Should Use EBR?

EBR is ideal for:

  • Enterprise applications with 24/7 availability requirements
  • Organizations with frequent release cycles
  • Systems where downtime directly impacts revenue
  • Teams managing complex Oracle-based applications

Conclusion

Edition-Based Redefinition transforms database deployments from high-risk, downtime-requiring events into smooth, zero-downtime transitions. While it requires upfront investment in architecture (editioning views, crossedition triggers), the payoff is enormous: fearless deployments, instant rollback capability, and uninterrupted service for your users.

Start by edition-enabling your schemas, introducing editioning views, and practicing with simple PL/SQL-only upgrades before tackling schema changes. EBR is a game-changer for any organization serious about continuous delivery with Oracle databases.

More articles from WoCiUp