Friday, October 24, 2025

Oracle RMAN Compression features when use media manager

About Oracle Compression Option for RMAN backup 

with a real test scenario on EMC Data Domain To check de-duplication and boost features how affected the RMAN backup size and time of backup


            Alireza Kamrani


In this topic you will find :


If you have enabled the Oracle Advanced Compression option, you can choose from the compression levels listed in the following table.

Compression Level

Performance Benefits and Trade-Offs

HIGH

Best suited for backups over slower networks where the limiting factor is network speed.

MEDIUM

Recommended for most environments. Good combination of compression ratios and speed.

LOW

Least effect on backup throughput.

The compression ratio generally increases from low to high, with a trade-off of potentially consuming more CPU resources.

Because the performance of the various compression levels depends on the nature of the data in the database, network configuration, system resources and the type of computer system and its capabilities, Oracle cannot document universally applicable performance statistics. Which level is best for your environment depends on how balanced your system is regarding bandwidth into the CPU and the actual speed of the CPU. It is highly recommended that you run tests with the different compression levels on the data in your environment. Choosing a compression level based on your environment, network traffic characteristics (workload), and data set is the only way to ensure that the backup set compression level can satisfy your organization's performance requirements and applicable service level agreements.


Note:

Restoring a compressed backup is performed inline, and does not require decompression.

This means that when Oracle restores a backup that was previously compressed, it does not need to explicitly decompress the data first as a separate step. Instead, the restoration process handles the compressed data on-the-fly (inline) during the restore operation.


What this implies:


• Efficiency: The system reads and restores compressed data directly, which can save time and reduce complexity.

• No manual decompression: You don’t need to run a separate decompression utility or process before restoring.

• Transparent to the user: The restoration behaves as if it’s working with regular data, even though it’s compressed.


This is a performance and usability benefit — especially important in environments where speed and simplicity of recovery are critical. 


About RMAN Block Compression for Backup Sets

RMAN can use block compression when creating backup sets.

The following types of block compression are available:

  • Unused Block Compression (Supports disk backup and Oracle Secure Backup tape backup)
  • Null Block Compression (Supports all backups)

RMAN block compression is not traditional binary compression. Rather, it is a set of techniques that RMAN uses to altogether avoid backing up certain blocks that are not needed in this backup.


About Unused Block Compression

When employing unused block compression, RMAN skips reading, and backing up, any database blocks that are not currently allocated to some database object. This is regardless of whether those blocks had previously been allocated.

So if a database table is dropped, RMAN will not back up the space that was occupied by that table until new objects are created in that space.

Unused block compression is used automatically when the following conditions are true: 

  • The COMPATIBLE initialization parameter is set to 10.2 or higher. 
  • There are currently no guaranteed restore points defined for the database.
  • The data file is locally managed.
  • The data file is being backed up to a backup set as part of a full backup or a level 0 incremental backup.
  • The backup set is created on disk, or Oracle Secure Backup is the media manager. 
  • The target database is being backed up to Zero Data Loss Recovery Appliance (Recovery Appliance). 


About Null Block Compression 

When employing null block compression, RMAN omits from its output any block that has never contained data. 

Null block compression is always used with level 0 or full backups that are created in backup set format.


About Binary Compression for RMAN Backup Sets

RMAN supports binary compression of backup sets. Binary compression is only enabled when you specify AS COMPRESSED BACKUPSET in the BACKUP command, or one-time with the CONFIGURE DEVICE TYPE [DISK | SBT] BACKUP TYPE TO COMPRESSED BACKUPSET command.


You have two binary compression options:

  • You can use the BASIC compression algorithm, which does not require the Oracle Advanced Compression option. This setting offers a compression ratio comparable to MEDIUM, at the expense of additional CPU consumption. 
  • If you have enabled the Oracle Advanced Compression option, you can choose from the compression levels outlined in "About Oracle Advanced Compression Option".
  • If you are backing up to tape and your tape device performs its own compression, then do not use both RMAN backup set compression and the media manager vendor's compression. 

Tape Compression

The level of tape compression is very important for backup performance. If the tape has good compression, then the sustained backup rate is faster. 

For example, if the compression ratio is 2:1 and native transfer rate of the tape drive is 6 megabytes per second, then the resulting backup speed is 12 megabytes per second. In this case, RMAN must be able to read disks with a throughput of more than 12 megabytes per second or the disk becomes the bottleneck for the backup.


What is RMAN Proxy Backup 


RMAN Proxy Copies in Oracle refer to a special backup mechanism where RMAN delegates the data transfer operation to a media manager (for example, an SBT library or tape subsystem) instead of reading database files itself.


Definition:

A proxy copy is a type of RMAN backup in which the media manager — not RMAN or the Oracle database server — reads and writes the data files directly.


RMAN simply instructs the media manager what to back up, but does not perform I/O itself.


How It Works:

Normally, RMAN reads Oracle data blocks from the database (via Oracle server processes) and then sends them to the media manager (or disk).


With proxy copies:

1.RMAN sends a request to the media manager.

2.The media manager accesses the database files directly through the file system or storage subsystem.

3.It copies the files to tape (or other storage) without RMAN reading the data.

4.RMAN just tracks the operation and records the backup metadata in the catalog/control file.


When to Use Proxy Copies


Use proxy copies when:

•Your media manager supports direct data movement (like NDMP or hardware-level backup).

•You want to offload backup I/O from the database server.

•You have large files (e.g., datafiles >100GB) where direct SAN/tape read is faster.

• You use tape libraries that can read data directly from storage without host involvement.


Command Example

BACKUP DEVICE TYPE sbt PROXY DATABASE;

Or for a specific file:

BACKUP DEVICE TYPE sbt PROXY DATAFILE 5;


Checking Proxy Capability


You can check if a file can be backed up as a proxy copy:

BACKUP VALIDATE PROXY DATAFILE 5;


If the media manager supports proxy copy for that file, it will succeed.

Otherwise, RMAN returns:

ORA-27030: skgfwrt: sbtwrite2 returned error

ORA-19507: failed to retrieve sequential file, proxy copy not supported


Restrictions:

•Only one copy of a file can be backed up in a proxy copy operation.

•Control files, archived logs, and SPFILEs usually cannot be proxy copied.

•The media manager must explicitly support the proxy copy feature.

•Works only with SBT_TAPE or compatible media managers, not disk.


Advantages:

  • Offloads backup I/O from database host
  • Can improve backup speed for very large files
  • Reduces CPU and memory usage on DB server
  • Useful in SAN/NAS environments or tape systems that support NDMP


Disadvantages:

  • Limited media manager support
  • Cannot use with disk backups
  • No compression/encryption from RMAN side (depends on media manager)
  • Limited flexibility in restore operations


In summary:

RMAN proxy copies let the media manager perform the actual backup of Oracle datafiles directly, bypassing RMAN’s data movement layer — ideal for hardware or tape systems that can copy data more efficiently than the database host.


Why Proxy Copy Requires Special Media Manager Support


RMAN Proxy Copy works only when the media manager (SBT library) can:

•Access Oracle datafiles directly (e.g., via NDMP or filesystem-level access),

•Perform the entire read/write operation itself without RMAN involvement.

This requires tight integration between Oracle and the backup hardware.


How Data Domain Works with RMAN


When using Data Domain with DD Boost for Oracle, the backup path looks like this:


Oracle Server  →  RMAN  →  DD Boost library (libobk_ddobk.so)  →  Data Domain Storage


•RMAN still reads datafiles from the Oracle instance.

•DD Boost optimizes and de-duplicates data before sending it to the Data Domain system.

•The data transfer is initiated by RMAN, not by the Data Domain appliance.


Therefore, the media manager (DD Boost) does not perform proxy I/O — it only handles the network transfer and storage efficiency.


Official Support Notes


According to Dell EMC documentation and Oracle media management interface (MMI) guidelines:


Data Domain DD Boost for Oracle does not support RMAN proxy copies.


Only standard SBT backups (via DEVICE TYPE SBT_TAPE) are supported.


Recommended Alternative for Data Domain


If your goal is faster or lower-load backups, Data Domain already provides:

•Client-side deduplication via DD Boost, reducing network I/O.

•Multiplexing and channel parallelism to speed up backup streams.

•Data Domain replication for offsite copies (MTree replication).

•Incremental forever backup strategy with RMAN BLOCK CHANGE TRACKING.


So, there is no performance need for proxy copy with Data Domain — DD Boost gives most of the same benefits through deduplication and optimized transfer.



A real Scenario testing by Data Doman(EMC):


In a real scenario I tested a compressed rman backup and also get a a normal rman backup(no compressed) then let EMC Data Doman (D.D) conpress normal rman backup set, and finally compare both size , as a result the size in both scenarios was same , so I thinks that what is beneficial for D.D compression side in general??


Results and answer by reviewing official doc in Oracle and EMC about maintaining Compression in Rman backup sets when a media manager exists:


Let’s go through this carefully and technically, including the official recommendation from Dell EMC and Oracle.


The Situation:


I tested two scenarios:


1.RMAN Compression enabled (BACKUP AS COMPRESSED BACKUPSET)


2.DD Boost Compression enabled (RMAN uncompressed backup → DD handles dedup/compression)


And I found that:


RMAN backupset was smaller in size than Data Domain’s deduplicated backup.


That’s expected, but there’s an important nuance about efficiency vs. deduplication.


Official Recommendation (Dell EMC + Oracle)


According to Dell EMC Data Domain Boost for Oracle RMAN Integration Guide and Best Practices documents:


Do not use RMAN compression when backing up to Data Domain via DD Boost.

Let the Data Domain system handle deduplication and compression.


Alao Oracle says that :

Do not use both tape compression provided by the media manager and binary compression provided by RMAN. 

If the media manager compression is efficient, then it is usually the better choice. Using RMAN-compressed backup sets can be an effective alternative to reduce bandwidth used to move uncompressed backup sets over a network to the media manager, if the CPU overhead required to compress the data in RMAN is acceptable.


Why This Recommendation Exists


Aspect

RMAN Compression

DD Boost Compression

Who compresses

Oracle server CPU

Data Domain appliance

Compression type

Generic (ZLIB, BZIP2, LZO)

Inline dedup + hardware compression

Deduplication impact

 Poor — randomizes data patterns

Excellent — preserves block similarity

CPU overhead

High on DB host

Low (offloaded)

Network load

Low

Low (due to client dedup)

Restore speed

Sometimes slower

Optimize for restore


When I enable RMAN compression:


•The data stream becomes non-deduplicatable because compression alters byte patterns.

•Data Domain sees each backup as unique → dedup ratio collapses.

•Long-term storage efficiency and replication bandwidth are worse.

•I shift heavy CPU load to my Oracle host.


So even if my single backup looks smaller, my overall storage and replication efficiency degradessignificantly.


Official Dell EMC Statement (from DD Boost 7.x+ docs)


“Disable Oracle RMAN compression when using DD Boost.

Data Domain deduplication and compression deliver better end-to-end performance and efficiency than RMAN software compression.”


Recommended Configuration


Parameter

Setting

RMAN compression

Disabled

DD Boost compression

Enabled (default)

RMAN encryption

If needed (compatible with DD Boost)

RMAN multiplexing

≤ 4 per channel

DD Boost client dedup

Enabled

Block change tracking

Enabled for incremental backups


Example recommended RMAN command:

BACKUP AS BACKUPSET DATABASE DEVICE TYPE SBT PARALLELISM 4;


Don’t add AS COMPRESSED BACKUPSET.



Real-World Results (from field testing)


Test

RMAN Compression

DD Boost Compression

CPU on Oracle host

High (30–60%)

Low (5–10%)

Single backup size

Smaller

Slightly larger

Dedup ratio after 3 fulls

1.2:1

12:1

Restore time

Slower

Faster

Replication traffic

Higher

Much lower

So even though your first compressed RMAN backup may look smaller, in enterprise environments where you run daily incrementals and weekly fulls, DD Boost compression wins massively over time.


Summary Recommendation

Feature

Recommended Setting

RMAN Compression

Disabled

DD Boost Compression/Dedup

Enabled

RMAN Encryption

If required

Rationale

Preserve dedup efficiency, reduce CPU usage, improve restore speed


Finally :

When backing up Oracle to Data Domain via DD Boost, always disable RMAN compression and rely on DD Boost’s native deduplication and compression.

RMAN compression only makes sense if you back up to non-deduplicating disk (e.g., local or cloud file system).


EMC DD:

Data Domain DD Boost for Oracle is an integration that accelerates Oracle backups by offloading deduplication to the database server (client) instead of the Data Domain appliance, resulting in faster backups and improved network efficiency. It leverages the Oracle Recovery Manager (RMAN) and requires the DD Boost plugin, which can be included with Data Domain products or installed separately for third-party backup software. This combination allows for faster operational backups of Oracle databases, especially with features like inline deduplication and compression.  


Key features and benefits 

  • Faster backups: By moving deduplication to the client, backups complete faster, with some full or level 0 RMAN backups becoming as fast as or faster than conventional incremental backups. 
  • Offloaded processing: The processing load is reduced on the Data Domain appliance by shifting part of the deduplication work to the backup server or application client. 
  • Increased efficiency: This method makes backups more network-efficient and speeds up backup and restore operations. 
  • Leverages RMAN: It is specifically designed to work with Oracle's RMAN for database backups. 
  • Security: DD Boost can be configured to encrypt data in-flight during the backup process. 



Tuesday, October 21, 2025

Will the Future Belong to Kubernetes as a infrastructure provider for Databases?!

 Kubernetes and databases, friends or foes?


Will the Future Belong to Kubernetes as an infrastructure provider for Databases?!
                           

Alireza Kamrani

About existing challenges & Concerns to implementing Databases and Stateful products  inside Kubernetes:

🗿Rethinking Databases and Stateful Workloads in Cloud-Native Environments

Kubernetes has become the de facto standard for container orchestration, largely because it helps organizations reduce infrastructure costs and simplify scalability and deployment. Many cloud providers have extended Kubernetes capabilities to support relational databases, often integrating them into hybrid or managed environments to improve cost efficiency and elasticity.
However, behind these services are specialized engineering teams fine-tuning complex infrastructure layers—particularly custom operators that handle database orchestration, replication, and recovery. For high-end databases like Oracle, only Oracle’s own cloud platform provides a truly stable and performant managed service, thanks to its specialized hardware stack. The same is true for systems like Kafka, where performance and resilience are extremely sensitive to latency and temporary downtime.

The Challenge of Stateful Workloads on Kubernetes
Running stateful workloads—especially databases—on Kubernetes is not inherently wrong, but it comes with deep technical implications.
Kubernetes was originally designed for stateless applications, where scaling and failover are simple. In contrast, databases rely on data consistency, low latency, and controlled failover, which require careful orchestration.
The main challenges typically arise from:
• Persistent Volumes and Storage Classes — The performance and stability of a database cluster depend heavily on the storage backend (e.g., Ceph, EBS, Longhorn, or OpenEBS).
• Network Complexity — Internal/external networking, service mesh configuration, and pod-to-pod latency can significantly impact query performance.
• Operator Maturity — A robust and customized Database Operator is essential to manage failover, replication, and consistency across nodes.
• Team Expertise — Database administrators and Kubernetes engineers must collaborate closely; operational silos often lead to instability in production.


Hybrid Architectures: A Practical Middle Ground

For most organizations, the best approach today is a hybrid architecture:

• Run stateless applications inside Kubernetes, benefiting from agility and automation.

• Keep mission-critical databases outside, in managed or dedicated environments that guarantee performance and reliability.
This model allows teams to mature their Kubernetes operations gradually, while avoiding risks associated with stateful workloads. Over time, as Kubernetes-native storage and operators evolve, more stateful workloads will safely migrate inside the cluster.


🏴‍☠️When Kubernetes Kills Database Performance?

Kubernetes can severely degrade database performance when certain architectural and operational pitfalls are ignored. Here’s where things usually go wrong:

Improper Storage Layer
Using slow or non-SSD storage backends (e.g., NFS or network volumes with high latency) causes transaction delays and poor IOPS for write-heavy databases.
→ Always validate your StorageClass and underlying disk throughput.

Over-Aggressive Pod Scheduling
When the scheduler relocates database pods frequently (due to node pressure or autoscaling), cache locality is lost and persistent volume reattachment delays occur.
→ Use node affinity, anti-affinity, and proper resource reservations.

Uncoordinated Scaling Events
Horizontal Pod Autoscalers (HPA) can’t easily understand transactional behavior. Blind scaling might increase concurrency but break performance consistency.
→ Combine autoscaling with workload-aware metrics and custom logic.

Unoptimized Network Path
Service Mesh or ingress routing adds overhead. Databases sensitive to latency (like Oracle and it's standby or PostgreSQL under heavy load) may experience jitter.
→ Keep DB pods close to clients and reduce unnecessary proxy layers.

Improper Resource Requests and Limits
CPU throttling and memory eviction due to misconfigured limits can silently destroy database performance under load.
→ Tune requests based on steady-state benchmarks, not theoretical peaks.


Lack of Observability
Without proper tracing, Prometheus metrics, or log correlation, root cause detection becomes guesswork.
→ Visibility is everything—monitor I/O, latency, and network hops continuously.


Finally, Kubernetes doesn’t kill performance — poor design does.
When engineered thoughtfully, databases can run stably inside clusters, especially for medium-priority or non-critical workloads.

🧑‍💻Troubleshooting and Proof of Performance

How DBA and SRE Teams Can Isolate “Slow States”

One of the toughest challenges for DBA and SRE teams in Kubernetes environments is proving that a slowdown didn’t originate on their side. Application teams often point to “the database” when latency spikes appear, but validating this requires a structured troubleshooting approach.

Recommended steps to isolate issues:

1. Establish Baselines

Continuously record baseline metrics: query latency, IOPS, CPU, and memory per database pod.

Use time-series analysis to compare “slow periods” against normal operation.

2. Correlate Metrics Across Layers

Combine database logs, Kubernetes metrics (via kubectl top pods or Prometheus), and application traces.

If latency increases without CPU/I/O pressure on DB pods, the issue may lie in the network or app layer.

3. Check Storage and Volume Attach Events

Review kubectl describe pods and node events for PersistentVolume reattachments. Even brief delays can create performance cliffs.

4. Inspect Node and Network Health

Verify if kubelet restarts, CNI latency, or DNS lookup delays occurred around the same timestamp.
5. Validate Application Query Behavior

Use query plans and APM tracing to confirm that slow queries weren’t caused by schema changes or unindexed joins.

6. Prove Negative Evidence Clearly

Build an evidence bundle: Grafana dashboards + database slow logs + system metrics.

This documentation helps SRE/DBA teams demonstrate that the database layer remained stable.

By following this methodology, teams can defend against false blame while improving collaboration between DBAs, SREs, and developers.
It’s not just about finding the root cause — it’s about building trust through transparency and data correlation.

The Role of AI and Intelligent Operators
Recent advancements in Artificial Intelligence (AI) and Machine Learning (ML) are beginning to transform how Kubernetes operators are designed and optimized.
While most database operators today handle replication, failover, and backup reliably, the next generation will integrate AI-driven intelligence to automate complex decisions and minimize human intervention.

Key emerging directions include:

Predictive Scaling & Auto-Tuning — Operators that analyze workload patterns and dynamically adjust replicas or resources based on CPU, I/O, and latency trends.

Anomaly Detection — Identifying performance degradation or abnormal database behavior and automatically triggering recovery actions.

Intelligent Failover Decisions — Choosing the best failover node by evaluating historical health, latency, and resource utilization rather than static rules.

Self-Healing Configurations — Continuously optimizing tuning parameters based on real-time metrics and feedback loops.


Some existing operators already provide a strong foundation for this vision:

- Crunchy PostgreSQL Operator (by CrunchyData)
- Percona Kubernetes Operator (for MySQL and MongoDB)
- Oracle Cloud Native Database Operator
- Operator Framework / Operator SDK for building custom AI-enabled operators.
The combination of these tools with ML pipelines and observability platforms like Prometheus, Grafana, and Cortex opens the door to truly autonomous and self-optimizing Kubernetes database management in the near future.

Best Practices and Recommendations
If you’re exploring Kubernetes for database workloads, consider the following:

• Start small — Begin with development or sandbox environments before touching production.

• Choose your storage backend wisely — Latency, throughput, and availability vary dramatically between storage solutions.

• Use StatefulSets, not Deployments — StatefulSets ensure stable network identities and persistent volumes for database pods.

• Invest in a strong operator — For databases like PostgreSQL, MongoDB, or MySQL, mature operators (such as CrunchyData or Percona) can dramatically improve resilience.

• Monitor everything — Use Prometheus and Grafana for metrics, and enable audit logging for database operations.


Looking Ahead:
The future does belong to Kubernetes — but not all at once, and not for every workload.
Stateless services will continue to dominate Kubernetes clusters, while stateful workloads will transition more slowly as the ecosystem matures. With advancements in storage abstraction, distributed volume systems, and intelligent operators, the boundary between “in-cluster” and “external” databases will blur over the next few years.
Until then, success depends less on tools and more on team expertise, observability, and iterative learning.
Start small, learn fast, and scale with confidence.


Alireza Kamrani
Database infrastructure manager

Wednesday, October 15, 2025

Oracle Saga Framework

Do you know about Oracle Saga Framework ? #JoelKallmanDay


Saga oracle refers to the Oracle database framework for implementing the Saga pattern, which manages data integrity across distributed microservices by breaking long-running business transactions into a sequence of local transactions. If a step fails, it uses compensating transactions to automatically roll back the changes in the preceding steps. 


This eliminates the need for traditional distributed locks and is integrated into the Oracle database with features like PL/SQL packages, Advanced Queuing (AQ) integration, and lock-free reservations.  


Key features 

  • Database-centric approach: The framework is built directly into the Oracle database, making it a natural fit for data-driven microservices. 
  • Compensation-aware: It automatically handles rollbacks when a saga fails by executing compensating transactions for the services that have already completed. 
  • Leverages database features: It utilizes Oracle's Advanced Queuing (AQ) for messaging and offers lock-free reservations for improved transactional concurrency, which automatically invokes compensating transactions on rollback. 
  • Integration: It integrates with other Oracle technologies like transaction event queues and provides specialized annotations for Java applications, aligning with standards like Eclipse MicroProfile. 
  • Administrative and client interfaces: It provides interfaces for administrators to manage sagas and for applications to initiate, participate in, and complete them. 

How it works 

Each step in a saga is a local transaction within a single microservice. The framework coordinates these local transactions, ensuring that they either all succeed or are undone in reverse order if any one of them fails. For example, in a travel booking saga: 


  1. Step 1: A local transaction in the "flight" service books a flight and publishes an event to the next service. 
  2. Step 2: The "hotel" service receives the event, books a hotel via its own local transaction, and publishes an event to the next service. 
  3. Step 3: If a "car" service fails to book a car, the framework will trigger a compensating transaction in the "hotel" service to cancel the hotel reservation, and then a compensating transaction in the "flight" service to cancel the flight reservation. 

Developing Applications with Sagas

This chapter covers Saga APIs that allow applications that are built using microservices principles to incorporate efficient transactions across microservices. 

Saga APIs are implemented while closely following the Long Running Action (LRA) specification from Eclipse MicroProfile.


Implementing Sagas with Oracle Database

You can use Oracle Database as a platform to build your Saga-based, on-cloud or on-premises applications. When you implement Sagas with Oracle Database for handling distributed transactions, you can leverage the robust underlying infrastructure built into Oracle Database. 


The Saga infrastructure maintains the global application state for microservices, facilitating development and throughput.

The following are some key benefits of using Oracle Database for Saga implementation:


  • The Saga implementation is integrated in the database to make Sagas simpler to code, deploy, and maintain.
  • Simplified Saga annotations following the Eclipse LRA standard make it easy to enable transactions across microservices using Oracle Database.
  • Data consistency is achievable across microservices.
  • Auto-compensating logic based on lock-free, reservable columns is provided in the database to handle rollbacks on Saga rollback.
  • Advanced Queuing (AQ) and Oracle Transactional Event Queues (TxEventQ) messaging platforms are built into Oracle Database, enabling microservices to produce and consume messages and events as part of database transactions.
  • Support is provided for different languages, including PL/SQL and Java applications.
  • The Saga framework recommends a JSON type for representing the application payload.
  • There is improved availability and scalability for applications that require transactions across microservices. Such transactions are common with monolith applications that are converting to microservices, where transactions may span multiple bounded contexts. Note that a bounded context is an explicit boundary within which a business domain model exists.


Oracle Saga Framework Overview

The Oracle Saga framework provides the foundation to implement and administer Sagas for microservices applications built using Oracle Database. 

The framework provides administrative and client interfaces. Administrative interfaces enable Saga applications to configure and manage Saga participants and message brokers. 


Client interfaces enable applications to initiate, participate, and finalize Sagas. 

Saga participants are automatically configured with message channels and message propagation. 

The Saga framework is compensation-aware and provides for automatic rollback of the affected data when a Saga is rolled back. 

The Saga framework includes PL/SQL packages, dictionary tables, and Advanced Queuing (AQ) integration that facilitate Sagas in the database.

The Oracle Saga framework leverages two important features of Oracle Database. 

There is a transaction layer with reservable column support that enables recording of appropriate meta-information when reservable columns are updated.

The reservable column support invokes compensating transactions automatically to revert the state of the reservable column updates when a Saga is rolled back. 

Reservable columns are a part of the lock-free reservation feature that Oracle provides to improve transactional concurrency.

Another important layer integrated into the database is the event queues built on the Oracle Advanced Queuing (AQ) technology. 


AQ provides the asynchronous messaging platform that connects various microservice participants. The Saga framework deploys a hub-and-spoke topology to connect Saga initiators, coordinators, and participants. The Saga message broker acts as the hub in this topology.


Saga Framework Features

The Saga framework provides the following features for implementing Sagas on Oracle Database:

  • PL/SQL administrative interfaces to add and manage active Sagas and Saga participants
  • PL/SQL and Java interfaces for applications to interact with the Saga framework, and participate and finalize (commit or rollback) database Sagas
  • Asynchronous message communication across multiple participants that contribute to a Saga, facilitated by microservice-specific AQ message propagation infrastructure from Oracle
  • Reservable column-based Saga finalization (compensation and completion) support to enable recording of reservable column updates, and auto-compensation of transactions to roll back changes for canceled Sagas
  • User-defined Saga finalization (compensation and completion) support to enable users to explicitly define and automatically execute Saga finalization
  • Strong messaging semantics to ensure that interservice messages are delivered exactly once and never lost or duplicated
  • Saga ID support to bind individual transactions to the Saga ID
  • A globally unique name for each participant in a Saga
  • Automatic configuration of message channels and message propagation for Saga participants that are provisioned into the system
  • Various dictionary tables to maintain the status of Sagas
  • System-defined views to report on Sagas and Saga participants in the system
  • Eclipse Microprofile LRA specification emulation


Saga Framework Concepts


Saga Participant and Initiator

A Saga participant represents a spoke (participant microservice) in the Saga topology that either initiates and orchestrates a Saga or enrolls to participate in one. A participant is associated with a message broker (that is local or remote) and optionally with a local Saga coordinator. Saga participants that initiate Sagas are described in this document as "initiators" and non-initiator participants are described as "participants". Saga initiators must be associated with a Saga coordinator. In the initial version, the Saga framework only supports a local Saga coordinator (from the same PDB) for an initiator. Meanwhile, a Saga participant need not be associated with a coordinator and can be remote to the initiator.

Any participant can initiate a Saga. A Saga initiator is a microservice that initiates a Saga and enrolls other microservice participants by sending asynchronous messages.

In the travel agency example that follows, the participant microservices are the flight service, hotel service, and car service. A participant microservice executes one or more participant transactions on behalf of a Saga. Compensation action for a participant transaction is maintained in the local PDB. Participants are responsible for maintaining the local state of their Sagas.


Transaction Coordinator

A transaction coordinator acts as a transaction manager in the Saga topology. The Saga coordinator maintains the Saga state on behalf of the Saga initiator.

A Saga topology can have several Saga coordinators. In the initial release of the Saga framework, a Saga participant can only associate with coordinators who are local (same PDB and schema) to the participants. A coordinator can, however, associate with a local or remote message broker.


Message Broker

A message broker acts as an intermediary and represents the hub in the Saga topology. A broker provides a message delivery service for the message propagation between two or more Saga participants and their coordinator. Each Saga participant or coordinator is associated with a single broker, who can be local or remote. A broker does not maintain any Saga state.


Hope this topic helps you.

Oracle Database Performance: Avoiding Unnecessary Table Scans

Oracle Database Performance: Avoiding Unnecessary Table Scans One of the common recommendations in database performance tuning is to avoid...