OraMatt: YABAOracle

Yet Another Blog About Oracle

Git-Like Branching for Data in Oracle Database

Modern developers take branching for granted. We branch code, test ideas safely, roll back mistakes, and merge changes deliberately. Git made this workflow so natural that it’s hard to imagine software development without it.

What’s far less common, but arguably just as important, is applying the same discipline to data.

Surprisingly, Oracle has supported this idea for decades.

Oracle Workspace Manager, introduced in the late 1990s (Oracle8i / early Oracle9i), enables Git-like branching for data: isolated workspaces, row-level versioning, savepoints, and governed merges, all inside the Oracle Database engine itself. This predates Git by several years and addresses a class of problems that most databases still struggle with today.

This post takes an in-depth look at:

  • What Workspace Manager actually is (and is not)
  • How “branching data” works at a technical level
  • Why this enables powerful what-if analysis and controlled data promotion
  • Where Workspace Manager fits alongside modern Oracle features like Flashback, DBMS_REDEFINITION, and Edition-Based Redefinition

Why Branching Data Is Hard

Most databases historically treat data changes as destructive:

  • An UPDATE overwrites a value
  • A DELETE removes a row
  • Rolling back often means restoring from backup or replaying logs

When teams want to “try something,” they usually:

  • Clone schemas
  • Copy tables
  • Spin up separate environments
  • Write fragile undo scripts

These approaches don’t scale well, don’t work on production-sized data, and often break down under regulatory or audit requirements.

Workspace Manager attacks this problem directly by changing one assumption:

Data does not have to be overwritten to be changed.


What Is Oracle Workspace Manager?

At its core, Oracle Workspace Manager provides:

  • Row-level versioning
  • Logical workspaces (think branches)
  • Savepoints within those workspaces
  • Conflict-aware merges back to a parent workspace

The default workspace is LIVE, which you can think of as main or trunk. From there, you create child workspaces that inherit the same data view—until you change it.

Critically:

  • No tables are copied
  • No schemas are cloned
  • No environments are duplicated

Everything happens inside the database using views and metadata.


Step 1: Making a Table “Branchable”

Before you can branch data, the table must support versioning.

CREATE TABLE personnel
(
  p_id           INT GENERATED ALWAYS AS IDENTITY PRIMARY KEY,
  fname          VARCHAR2(100),
  lname          VARCHAR2(100),
  primary_email  VARCHAR2(100),
  indate         TIMESTAMP DEFAULT systimestamp
);

INSERT INTO personnel (fname, lname, primary_email)
VALUES ('Matt', 'D', 'oramatt@oramatt.com');
COMMIT;

EXEC DBMS_WM.ENABLEVERSIONING(
  table_name => 'personnel',
  hist       => 'VIEW_WO_OVERWRITE'
);

This is effectively the “git init” moment for data.

From this point forward:

  • Updates do not overwrite existing row versions
  • History is preserved automatically
  • Oracle manages row visibility per workspace

Step 2: Creating a Data Branch (Workspace)

A workspace is a logical branch of your data.

EXEC DBMS_WM.CREATEWORKSPACE('personnel_updates');
EXEC DBMS_WM.GOTOWORKSPACE('personnel_updates');

SELECT DBMS_WM.GETWORKSPACE FROM dual;

You now see:

  • The same data as LIVE
  • With complete isolation for any changes you make

Nothing you do here affects production until you explicitly merge.


Step 3: Experimenting Safely in the Branch

Now comes the familiar part: experimentation.

INSERT INTO personnel (fname, lname, primary_email)
VALUES ('Bob', 'Jones', 'bob@oramatt.com');
COMMIT;

UPDATE personnel
SET primary_email = 'matt@oramatt.com'
WHERE fname = 'Matt';
COMMIT;

These changes:

  • Exist only in personnel_updates
  • Are invisible to LIVE
  • Can be validated, queried, and tested freely

This is where Workspace Manager becomes incredibly powerful for what-if analysis:

  • Data corrections
  • Policy changes
  • Reclassification
  • Scenario modeling

All against real data, at real scale.


Step 4: Savepoints = Lightweight Data Commits

Inside a workspace, you can create savepoints, logical checkpoints you can roll back to.

EXEC DBMS_WM.CREATESAVEPOINT(
  'personnel_updates',
  'before_delete_inserts'
);

You can then perform risky or exploratory changes:

DELETE FROM personnel WHERE lname = 'Jones';
COMMIT;

INSERT INTO personnel (fname, lname, primary_email)
SELECT
  dbms_random.string('a', TRUNC(dbms_random.value(5, 20))),
  dbms_random.string('a', TRUNC(dbms_random.value(5, 20))),
  dbms_random.string('a', TRUNC(dbms_random.value(5, 100)))
FROM dual
CONNECT BY LEVEL <= 10000;
COMMIT;

And roll back instantly:

EXEC DBMS_WM.ROLLBACKTOSP(
  'personnel_updates',
  'before_delete_inserts'
);

This feels very much like:

  • Local commits
  • Interactive rebases
  • Undoing experimental work

Except it’s happening inside the database, on production-scale data.


Step 5: Governed Merges Back to Production

When you’re ready to promote changes, you merge the workspace back into its parent.

EXEC DBMS_WM.GOTOWORKSPACE('LIVE');

EXEC DBMS_WM.MERGEWORKSPACE(
  'personnel_updates',
  remove_workspace => TRUE
);

This is where Workspace Manager deliberately differs from Git:

  • Merges are explicit
  • Conflicts are detected at the row level
  • Conflicts must be resolved before completion
  • The operation is auditable

This makes Workspace Manager suitable for:

  • Regulated industries
  • Financial systems
  • Healthcare and government workloads
  • Any environment where data correctness matters

What Workspace Manager Is Not

Workspace Manager is not a general-purpose schema versioning tool.

For example, this will fail:

ALTER TABLE personnel ADD secondary_email VARCHAR2(100);

That’s intentional.

Workspace Manager focuses on data versioning, not schema evolution. Oracle provides other best-in-class tools for that:

  • DBMS_REDEFINITION == Online table changes without downtime
  • Edition-Based Redefinition (EBR) == Versioned PL/SQL and application logic
  • Flashback Query == Point-in-time reads using AS OF
SELECT COUNT(*)
FROM personnel
AS OF TIMESTAMP
  TO_TIMESTAMP('2026-01-07 23:10:16', 'YYYY-MM-DD HH24:MI:SS');

Workspace Manager complements these features, it doesn’t replace them.


When Not to Use Workspace Manager

Workspace Manager is not ideal for:

  • Pure temporal databases
  • Simple audit logging
  • Lightweight historical queries

For those, Flashback or Slowly Changing Dimensions (SCDs) may be a better fit. Workspace Manager shines when you need:

  • Isolation
  • Collaboration
  • Controlled promotion of changes

Why This Matters Today

As organizations modernize:

  • Data changes continuously
  • Multiple teams touch the same datasets
  • “Just test it in prod” is no longer acceptable

Workspace Manager offers a middle ground:

  • Faster than cloning
  • Safer than direct edits
  • More disciplined than ad-hoc scripts

It turns the database into a collaborative system, not just a passive storage engine.


Final Thought

Git taught us that:

  • Branching enables freedom
  • Merging demands responsibility

Oracle Workspace Manager applies that same philosophy to data, quietly, efficiently, and at enterprise scale.

If you’ve never thought about branching data, it may be time to start.


This post may be the first in a series called “Oh, Oracle does that…”
If you’d like to see more deep dives into under-appreciated Oracle features, let me know in the comments.

Leave a comment

Navigation

About

I’m Matt and I do Oracle things.