SlideShare a Scribd company logo
Beyond EBR (Draft)
Quantum Columns, Spooky Joins and Virtual Integrity for ZDT Data Versioning
Jeff Jacobs, Consulting Data Architect
Jeffrey Jacobs & Associates
About Me
The Problem
• Complex Application
• 1,000s of Tables and Views
• Referential integrity constraints require enforcement
• Application code in PL/SQL, Java, etc.
• New releases/upgrades/patches require significant downtime
Partial Solution - Edition Based Redefinition
(EBR)
• Migrate to Edition Based Redefinition EBR for Zero Down Time (ZDT)
release
• Stage and test new release in same infrastructure independent of current
release
EBR Features
• EBR manages editions of an application for:
• PL/SQL changes
• DDL changes
• EBR’s edition triggers provide the ability to synch data between
editions for changes to DDL
• Edition to be used by code governed by SYS_CONTEXT variable
• Very transparent to existing code
• Each edition has an EDITION_NAME
What is Seed Data?
• Seed Data tables are (usually) reference only tables
• May be parent to multiple Non-Seed Data tables
• “Seed Data” tables contain data that is added/updated for a new release
• Data needs to be “versioned” for each release
• Data is not synched across releases
• Data changes not due to changes in DDL
• New, coordinated version of data for multiple tables for new edition
• Examples
• Field labels for application screen
• Text
• Font
• Color
• Size
• Demo/sample data
• Etc.
Solution Goals
• EBR does not provide support for managing Seed Data
• But we want independent Seed Data for each edition
• Minimal or no changes to existing DML
• Minimal or no changes to existing code
• Minimal or no affect on performance
• Avoid creation of new DB objects, i.e. VIEWS, synonyms, etc.
• Minimize rework
• Preserve referential integrity enforcement
Sample Schema
SYS_CONTEXT Variables
• What are they?
• How to create?
• <code sample>
• How to use?
• <code sample>
Quantum Column Physics POP Quiz!
(Schrodinger’s Cat + Quantum Superposition)
• Can a given row’s virtual column have multiple values at the same
instant in time with no in-flight transactions?
• Yes
• Call this a “Quantum Column” (QC)
• How?
• Virtual column is based on a SYS_CONTEXT variable
• Value of QC is determined by value of SYS_CONTEXT variables
• Can this be used to solve our Seed Data problem?
• TBD!
Never Include a Quantum Column in an Index
• QCs are inherently non-deterministic
• Value is based on session’s value of SYS_CONTEXT variable at time of query
• Virtual column value is determined at runtime
• Indexes are deterministic:
• A virtual column’s value is persisted in the index with the value at the time of
INSERT/UPDATE
“Bollocks” – Bryn Lewellyn
• Starting simple, focus on normal runtime behavior
• Seed data patching issues later
• How it’s done!
• Add a Quantum Column to child table based on EBR SYS_CONTEXT variable
• We’ll name the Quantum Column “EDITION_NAME_QC”
• Drop the FK constraint(s)
• Add a non-virtual version column to parent/Seed table
• Holds the value of EBR editions
• We’ll name this “EDITION_NAME
• Drop PK constraint
• Recreate PK constraint with prior columns plus new version column
• Add Virtual Private Database expression to parent/Seed table to use appropriate EBR edition value
• Normal runtime code uses above EBR SYS_CONTEXT variable value
• Recreate FK
• NO CHANGES TO EXISTING DML!
Demos
• Query to show original query works without new columns in join
• Add new release to Seed Data with updated/new info
• Show same query works in both editions returning appropriate data
• Show referential integrity works
Part 1 – QCs and Foreign Key Constraints
• FK columns may be based on a virtual column
• Virtual column may be based on SYS_CONTEXT variable value
• Such as EBR’s <need name>
• QC is a virtual column
• But what about the parent table’s primary key?
Part 2 – Modify Seed Table Primary Key
• Add new column, “EDITION NAME” to PK
• DEFAULT value of EBR_EDITION
• PK now consists of original PK, i.e. “FIELD_NAME”
• Patching code explicitly manages value of EDITION_NAME
• Application code INSERT addressed later
New Data Model Diagram
VPD Example (Spooky Join)
• VPD provides the additional join column between the Seed Data table
and the child table
• “Spooky” join
Spooky Join Demo
• Create and populate tables with 1 release of data
• Run Query
• Enable EBR
• Drop constraints
• Add columns, PK and VPD
Virtual Integrity Constraint Demo
• Add FK constraint
• Insert into child table with valid original PK column values
• succeeds
• Demo Spooky Join
• Attempt to INSERT with invalid original PK column values
• fails
Important Stuff!
• QC column can be added to any non-Seed table
• FK constraint need not be changed if no Seed table reference
• DO NOT ADD QC VIRTUAL COLUMN TO INDEX!
• Inherently non-deterministic value!
• Adding to index persists value
• No need to use new columns in DML
• DO NOT use EDITION_NAME (QC and parent PK columns) in DML
• VPD handles appropriate join
• For normal application runtime
• Create virtual column with SYS_CONTEXT
• Create new PK column with DEFAULT VALUE. (Double check this)
• Seed data patching process needs explicit control
Recap
• Demo’ed and explained basic technique
Life Is Never That Simple
• Distinguish between:
• Normal application code
• Code to manage Seed Data – requires explicit control of values
• Distinguish between:
• Release/upgrade – a new version of the application
• Typically requires new Seed Data
• Patch/fix
• No, or very few, changes to Seed Data
• EBR may have many editions of either type
• Need indirection for SYS_CONTEXT variables and EBR Edition values
• What if end user can update/add to Seed Data table?
More Things to Consider
• The technique described assumes a complete set of Seed Data for
ZDT EBR Rollover to a given release
• For new release, typically bulk copy/MERGE from prior release either:
• At start of release work
• Prior to rollover
• For a fix/patch requiring a only a small amount of Seed Data changes
and small downtime is acceptable
• Backward MERGE from pending release
Beyond Simple EBR – Context Variable
Management
• There may be many EBR editions
• DDL and PL/SQL changes form a single line inheritance structure
• Each EBR edition holds only “true” changes
• Not every new edition requires Seed Data changes
• Solution
• Create new set of SYS_CONTEXT variable, i.e.
• RUNTIME_EDITION holds EBR edition name for current application code release
• PATCHING_EDITION holds EBR edition name for the next release
• Create a mapping table between DEFAULT_EBR and SYS_CONTEXT variable values
• RUNTIME_EDITION <> EBR Default
• Consider not using edition names
• Morph edition name into “release” values
Sample Mapping Table
Application Code INSERT/UPDATE
• Can application code INSERT/UPDATE into Seed Data Table
• If Yes:
• INSERT/UPDATE should be controlled in application, not ad-hoc
INSERT/UPDATE
• Prior to rollover, MERGE from runtime edition into patch edition
• May need to handle sequence/identity column issues
• Potential conflict between new release values and application values
• Out of Scope
• Assumes a brief freeze of such INSERT/UPDATE before rollover
• Worst case requires AFTER INSERT/AFTER UPDATE triggers
Beyond EBR
• This technique is NOT dependent on EBR!!!
• QC, Spook Joins, Virtual Integrity Constraints
• A new technique for versioning multi-row, multi-table datasets
Beyond EBR, Quantum Columns, Spook Joins and Virtual Integrity for ZDT Data Versioning

More Related Content

PPTX
Sql parametrized queries
PPTX
How to – wrap soap web service around a database
PDF
DBAdapters
PPTX
Database Change Management
PDF
EclipseLink JPA
PDF
InterConnect 2016, OpenJPA and EclipseLink Usage Scenarios (PEJ-5303)
PPTX
Introduction to Neuron ESB 3.7
PDF
AAI 2235-OpenJPA and EclipseLink Usage Scenarios Explained
Sql parametrized queries
How to – wrap soap web service around a database
DBAdapters
Database Change Management
EclipseLink JPA
InterConnect 2016, OpenJPA and EclipseLink Usage Scenarios (PEJ-5303)
Introduction to Neuron ESB 3.7
AAI 2235-OpenJPA and EclipseLink Usage Scenarios Explained

What's hot (20)

PDF
Database migrations with Flyway and Liquibase
PPTX
Don’t Get Caught with An Out of Support MS SQL Server…
PPTX
ESB Fundamentals 3.7
PPT
Brightcove presentation on Automated Testing
PPTX
PPTX
Apex world 2018 continuously delivering APEX
PPTX
Bringing DevOps to the Database
PPTX
Mule tcat server - Server profiles
PDF
Ansible Automation for Oracle RMAN / Apex Restores
PPTX
ASP.NET Core Demos Part 2
PPT
Database testing with JMeter
PPTX
Mule dataweave
PPTX
ASP.NET Core Demos
PPTX
Fix My Functions: TSQL User Defined Functions in SQL Server
PDF
Continuous DB migration based on carbon5 framework
PDF
Борис Трофимов. Continuous Database migration-это просто!
PPTX
Uniqueness of java
PDF
KnowItPresentation
PPTX
Selenium
Database migrations with Flyway and Liquibase
Don’t Get Caught with An Out of Support MS SQL Server…
ESB Fundamentals 3.7
Brightcove presentation on Automated Testing
Apex world 2018 continuously delivering APEX
Bringing DevOps to the Database
Mule tcat server - Server profiles
Ansible Automation for Oracle RMAN / Apex Restores
ASP.NET Core Demos Part 2
Database testing with JMeter
Mule dataweave
ASP.NET Core Demos
Fix My Functions: TSQL User Defined Functions in SQL Server
Continuous DB migration based on carbon5 framework
Борис Трофимов. Continuous Database migration-это просто!
Uniqueness of java
KnowItPresentation
Selenium
Ad

Similar to Beyond EBR, Quantum Columns, Spook Joins and Virtual Integrity for ZDT Data Versioning (20)

PPT
Advanced data modeling
PDF
Presentation online application upgrade of oracle's bug db with edition-ba...
PPT
Database intro
PPTX
Oracle applications r12.2, ebr, online patching means lot of work for devel...
PPTX
Developer's Approach to Code Management
PPT
Ch10
PPTX
Edition Based Redefinition
PPTX
Edition Based Redefinition - Continuous Database Application Evolution with O...
PPTX
Introducing and Demonstrating Oracle Database 11gR2's Killer Feature – Editio...
PPTX
SQL: tricks and cheats
PPT
demo2.ppt
PPTX
Structured Query Language (SQL) _ Edu4Sure Training.pptx
PDF
EDITION & TARGET EDITION & Edition-Based Redefinition (EBR) in Oracle
PPTX
Database theory and modeling
PPTX
Introduction to SQL Antipatterns
PDF
Data Mining And Data Warehousing Laboratory File Manual
PDF
OOW19 - Read consistency
PPSX
DISE - Database Concepts
PPT
NORMALIZATION in database management systems
PPT
Pragmatics Driven Issues in Data and Process Integrity in Enterprises
Advanced data modeling
Presentation online application upgrade of oracle's bug db with edition-ba...
Database intro
Oracle applications r12.2, ebr, online patching means lot of work for devel...
Developer's Approach to Code Management
Ch10
Edition Based Redefinition
Edition Based Redefinition - Continuous Database Application Evolution with O...
Introducing and Demonstrating Oracle Database 11gR2's Killer Feature – Editio...
SQL: tricks and cheats
demo2.ppt
Structured Query Language (SQL) _ Edu4Sure Training.pptx
EDITION & TARGET EDITION & Edition-Based Redefinition (EBR) in Oracle
Database theory and modeling
Introduction to SQL Antipatterns
Data Mining And Data Warehousing Laboratory File Manual
OOW19 - Read consistency
DISE - Database Concepts
NORMALIZATION in database management systems
Pragmatics Driven Issues in Data and Process Integrity in Enterprises
Ad

Recently uploaded (20)

PPTX
Introduction to Basics of Ethical Hacking and Penetration Testing -Unit No. 1...
PPTX
MODULE 8 - DISASTER risk PREPAREDNESS.pptx
PPTX
DISORDERS OF THE LIVER, GALLBLADDER AND PANCREASE (1).pptx
PPTX
ALIMENTARY AND BILIARY CONDITIONS 3-1.pptx
PPTX
AI Strategy room jwfjksfksfjsjsjsjsjfsjfsj
PPTX
iec ppt-1 pptx icmr ppt on rehabilitation.pptx
PPT
Quality review (1)_presentation of this 21
PPTX
Business Ppt On Nestle.pptx huunnnhhgfvu
PPT
Reliability_Chapter_ presentation 1221.5784
PPTX
oil_refinery_comprehensive_20250804084928 (1).pptx
PDF
Galatica Smart Energy Infrastructure Startup Pitch Deck
PPTX
Introduction-to-Cloud-ComputingFinal.pptx
PPTX
Business Acumen Training GuidePresentation.pptx
PDF
“Getting Started with Data Analytics Using R – Concepts, Tools & Case Studies”
PDF
TRAFFIC-MANAGEMENT-AND-ACCIDENT-INVESTIGATION-WITH-DRIVING-PDF-FILE.pdf
PPTX
Introduction to Firewall Analytics - Interfirewall and Transfirewall.pptx
PDF
Foundation of Data Science unit number two notes
PPTX
climate analysis of Dhaka ,Banglades.pptx
PPTX
Introduction to Knowledge Engineering Part 1
PPTX
Database Infoormation System (DBIS).pptx
Introduction to Basics of Ethical Hacking and Penetration Testing -Unit No. 1...
MODULE 8 - DISASTER risk PREPAREDNESS.pptx
DISORDERS OF THE LIVER, GALLBLADDER AND PANCREASE (1).pptx
ALIMENTARY AND BILIARY CONDITIONS 3-1.pptx
AI Strategy room jwfjksfksfjsjsjsjsjfsjfsj
iec ppt-1 pptx icmr ppt on rehabilitation.pptx
Quality review (1)_presentation of this 21
Business Ppt On Nestle.pptx huunnnhhgfvu
Reliability_Chapter_ presentation 1221.5784
oil_refinery_comprehensive_20250804084928 (1).pptx
Galatica Smart Energy Infrastructure Startup Pitch Deck
Introduction-to-Cloud-ComputingFinal.pptx
Business Acumen Training GuidePresentation.pptx
“Getting Started with Data Analytics Using R – Concepts, Tools & Case Studies”
TRAFFIC-MANAGEMENT-AND-ACCIDENT-INVESTIGATION-WITH-DRIVING-PDF-FILE.pdf
Introduction to Firewall Analytics - Interfirewall and Transfirewall.pptx
Foundation of Data Science unit number two notes
climate analysis of Dhaka ,Banglades.pptx
Introduction to Knowledge Engineering Part 1
Database Infoormation System (DBIS).pptx

Beyond EBR, Quantum Columns, Spook Joins and Virtual Integrity for ZDT Data Versioning

  • 1. Beyond EBR (Draft) Quantum Columns, Spooky Joins and Virtual Integrity for ZDT Data Versioning Jeff Jacobs, Consulting Data Architect Jeffrey Jacobs & Associates
  • 3. The Problem • Complex Application • 1,000s of Tables and Views • Referential integrity constraints require enforcement • Application code in PL/SQL, Java, etc. • New releases/upgrades/patches require significant downtime
  • 4. Partial Solution - Edition Based Redefinition (EBR) • Migrate to Edition Based Redefinition EBR for Zero Down Time (ZDT) release • Stage and test new release in same infrastructure independent of current release
  • 5. EBR Features • EBR manages editions of an application for: • PL/SQL changes • DDL changes • EBR’s edition triggers provide the ability to synch data between editions for changes to DDL • Edition to be used by code governed by SYS_CONTEXT variable • Very transparent to existing code • Each edition has an EDITION_NAME
  • 6. What is Seed Data? • Seed Data tables are (usually) reference only tables • May be parent to multiple Non-Seed Data tables • “Seed Data” tables contain data that is added/updated for a new release • Data needs to be “versioned” for each release • Data is not synched across releases • Data changes not due to changes in DDL • New, coordinated version of data for multiple tables for new edition • Examples • Field labels for application screen • Text • Font • Color • Size • Demo/sample data • Etc.
  • 7. Solution Goals • EBR does not provide support for managing Seed Data • But we want independent Seed Data for each edition • Minimal or no changes to existing DML • Minimal or no changes to existing code • Minimal or no affect on performance • Avoid creation of new DB objects, i.e. VIEWS, synonyms, etc. • Minimize rework • Preserve referential integrity enforcement
  • 9. SYS_CONTEXT Variables • What are they? • How to create? • <code sample> • How to use? • <code sample>
  • 10. Quantum Column Physics POP Quiz! (Schrodinger’s Cat + Quantum Superposition) • Can a given row’s virtual column have multiple values at the same instant in time with no in-flight transactions? • Yes • Call this a “Quantum Column” (QC) • How? • Virtual column is based on a SYS_CONTEXT variable • Value of QC is determined by value of SYS_CONTEXT variables • Can this be used to solve our Seed Data problem? • TBD!
  • 11. Never Include a Quantum Column in an Index • QCs are inherently non-deterministic • Value is based on session’s value of SYS_CONTEXT variable at time of query • Virtual column value is determined at runtime • Indexes are deterministic: • A virtual column’s value is persisted in the index with the value at the time of INSERT/UPDATE
  • 12. “Bollocks” – Bryn Lewellyn • Starting simple, focus on normal runtime behavior • Seed data patching issues later • How it’s done! • Add a Quantum Column to child table based on EBR SYS_CONTEXT variable • We’ll name the Quantum Column “EDITION_NAME_QC” • Drop the FK constraint(s) • Add a non-virtual version column to parent/Seed table • Holds the value of EBR editions • We’ll name this “EDITION_NAME • Drop PK constraint • Recreate PK constraint with prior columns plus new version column • Add Virtual Private Database expression to parent/Seed table to use appropriate EBR edition value • Normal runtime code uses above EBR SYS_CONTEXT variable value • Recreate FK • NO CHANGES TO EXISTING DML! Demos • Query to show original query works without new columns in join • Add new release to Seed Data with updated/new info • Show same query works in both editions returning appropriate data • Show referential integrity works
  • 13. Part 1 – QCs and Foreign Key Constraints • FK columns may be based on a virtual column • Virtual column may be based on SYS_CONTEXT variable value • Such as EBR’s <need name> • QC is a virtual column • But what about the parent table’s primary key?
  • 14. Part 2 – Modify Seed Table Primary Key • Add new column, “EDITION NAME” to PK • DEFAULT value of EBR_EDITION • PK now consists of original PK, i.e. “FIELD_NAME” • Patching code explicitly manages value of EDITION_NAME • Application code INSERT addressed later
  • 15. New Data Model Diagram
  • 16. VPD Example (Spooky Join) • VPD provides the additional join column between the Seed Data table and the child table • “Spooky” join
  • 17. Spooky Join Demo • Create and populate tables with 1 release of data • Run Query • Enable EBR • Drop constraints • Add columns, PK and VPD
  • 18. Virtual Integrity Constraint Demo • Add FK constraint • Insert into child table with valid original PK column values • succeeds • Demo Spooky Join • Attempt to INSERT with invalid original PK column values • fails
  • 19. Important Stuff! • QC column can be added to any non-Seed table • FK constraint need not be changed if no Seed table reference • DO NOT ADD QC VIRTUAL COLUMN TO INDEX! • Inherently non-deterministic value! • Adding to index persists value • No need to use new columns in DML • DO NOT use EDITION_NAME (QC and parent PK columns) in DML • VPD handles appropriate join • For normal application runtime • Create virtual column with SYS_CONTEXT • Create new PK column with DEFAULT VALUE. (Double check this) • Seed data patching process needs explicit control
  • 20. Recap • Demo’ed and explained basic technique
  • 21. Life Is Never That Simple • Distinguish between: • Normal application code • Code to manage Seed Data – requires explicit control of values • Distinguish between: • Release/upgrade – a new version of the application • Typically requires new Seed Data • Patch/fix • No, or very few, changes to Seed Data • EBR may have many editions of either type • Need indirection for SYS_CONTEXT variables and EBR Edition values • What if end user can update/add to Seed Data table?
  • 22. More Things to Consider • The technique described assumes a complete set of Seed Data for ZDT EBR Rollover to a given release • For new release, typically bulk copy/MERGE from prior release either: • At start of release work • Prior to rollover • For a fix/patch requiring a only a small amount of Seed Data changes and small downtime is acceptable • Backward MERGE from pending release
  • 23. Beyond Simple EBR – Context Variable Management • There may be many EBR editions • DDL and PL/SQL changes form a single line inheritance structure • Each EBR edition holds only “true” changes • Not every new edition requires Seed Data changes • Solution • Create new set of SYS_CONTEXT variable, i.e. • RUNTIME_EDITION holds EBR edition name for current application code release • PATCHING_EDITION holds EBR edition name for the next release • Create a mapping table between DEFAULT_EBR and SYS_CONTEXT variable values • RUNTIME_EDITION <> EBR Default • Consider not using edition names • Morph edition name into “release” values
  • 25. Application Code INSERT/UPDATE • Can application code INSERT/UPDATE into Seed Data Table • If Yes: • INSERT/UPDATE should be controlled in application, not ad-hoc INSERT/UPDATE • Prior to rollover, MERGE from runtime edition into patch edition • May need to handle sequence/identity column issues • Potential conflict between new release values and application values • Out of Scope • Assumes a brief freeze of such INSERT/UPDATE before rollover • Worst case requires AFTER INSERT/AFTER UPDATE triggers
  • 26. Beyond EBR • This technique is NOT dependent on EBR!!! • QC, Spook Joins, Virtual Integrity Constraints • A new technique for versioning multi-row, multi-table datasets