top of page

Keep Sessions Alive Through Patching: Transparent Application Continuity on Exadata in Oracle Database@Azure

OmerNarman
Oct 25
8 min read

Exadata Database Service in Oracle Database@Azure patches its VM clusters in a rolling fashion, one node at a time, and the database never goes fully down. Whether the users notice depends on something the patch cannot control: how the application's sessions are connected. Sessions connected to the wrong kind of service lose their work, raise errors, and leave the application team convinced that "the database went down".


Transparent Application Continuity (TAC) closes that gap. When an instance stops or fails, the driver reconnects to a surviving instance and replays the in-flight work, so the user sees a short pause instead of an error. This post configures a TAC service on a two-node VM cluster, writes the connection string for applications in Azure, and then proves it with a controlled instance stop.



The Use Case

An order-entry application runs on Azure virtual machines and connects to a RAC database on an Exadata VM cluster in Oracle Database@Azure. Every quarterly maintenance window has produced a burst of ORA-03113 and ORA-25408 errors in the application log. The goal is that planned maintenance and a single instance failure no longer surface as errors to users.


Environment used in this runbook


  • Database: Oracle Database 19c (19.24), RAC container database SALESCDB with PDB SALESPDB

  • Platform: Exadata Database Service on Oracle Database@Azure, two-node VM cluster

  • Instances: SALESCDB1 on node salesaz-node1, SALESCDB2 on node salesaz-node2

  • Application: Java application on Azure VMs using the Oracle JDBC driver 19c with Universal Connection Pool (UCP)

  • New service: sales_tac.example.internal, preferred on both instances



How Transparent Application Continuity Works

  • Requests: the driver or pool marks where each unit of work begins and ends. A connection pool does this automatically on borrow and return.

  • Transaction Guard: with commit_outcome enabled, the database records whether the last transaction committed, so a replay never commits the same work twice.

  • Replay: if the session is lost in the middle of a request, the driver reconnects to another instance, restores the session state, and re-executes the calls of the interrupted request. If anything in the replayed calls would give a different result, replay is rejected and the application receives the original error.

  • Draining: for planned maintenance, the service is stopped on one instance with a drain timeout. Sessions finish their requests and move at a safe point, so most of them never need a replay at all.


Application Continuity is included with Oracle RAC and with Active Data Guard; no separate licence is needed on Exadata Database Service.



Step 1: Check the Cluster and the Existing Services

Start by recording what the application connects to today. Most problem services were created years ago with no high-availability attributes at all.


Shell

# On salesaz-node1, as oracle

srvctl status database -db SALESCDB_AZ

srvctl config service -db SALESCDB_AZ | grep -E 'Service name|Failover type|Commit Outcome|Drain timeout'

Expected output

Instance SALESCDB1 is running on node salesaz-node1
Instance SALESCDB2 is running on node salesaz-node2
Service name: sales_app.example.internal
Failover type:
Commit Outcome: false
Drain timeout:

What to expect: Both instances running, and the existing application service with no failover type, commit outcome disabled and no drain timeout. That service can only offer basic connect-time failover: a session that is cut off simply gets an error.



Step 2: Create a Service for Transparent Application Continuity

Create a new service rather than altering the one in production use, so you can move the application across in a controlled way. Run srvctl as the oracle user on any node. For a PDB, name the PDB with -pdb so the service starts there.


Shell

srvctl add service -db SALESCDB_AZ -pdb SALESPDB \

-service sales_tac.example.internal \

-preferred SALESCDB1,SALESCDB2 \

-failovertype AUTO \

-failover_restore AUTO \

-commit_outcome TRUE \

-replay_init_time 600 \

-retention 86400 \

-drain_timeout 300 \

-stopoption IMMEDIATE \

-notification TRUE \

-clbgoal SHORT -rlbgoal SERVICE_TIME

srvctl start service -db SALESCDB_AZ -service sales_tac.example.internal

srvctl status service -db SALESCDB_AZ -service sales_tac.example.internal

Expected output

Service sales_tac.example.internal is running on instance(s) SALESCDB1,SALESCDB2

What this does:


  • -failovertype AUTO with -failover_restore AUTO enables Transparent Application Continuity. The value TRANSACTION would enable classic Application Continuity, which needs explicit request boundaries in the code.

  • -commit_outcome TRUE turns on Transaction Guard, which replay depends on.

  • -replay_init_time 600 stops a replay from starting more than 600 seconds after the request began, so very old work is never re-executed.

  • -retention 86400 keeps the commit outcome for a day.

  • -drain_timeout 300 with -stopoption IMMEDIATE gives sessions five minutes to finish their requests when the service is stopped on an instance, then stops what is left.

  • -notification TRUE publishes Fast Application Notification (FAN) events, which tell the pool immediately that an instance is going away.



Step 3: Confirm the Service Attributes in the Database

srvctl stores the configuration in the cluster; the database sees it in DBA_SERVICES once the service has started. Check it there too, because that is what the session layer actually uses.


SQL

-- Connected to SALESPDB as a DBA

COLUMN name FORMAT A28

COLUMN failover_type FORMAT A13

COLUMN failover_restore FORMAT A16

COLUMN commit_outcome FORMAT A14

SELECT name, failover_type, failover_restore, commit_outcome,

replay_initiation_timeout AS replay_init, drain_timeout

FROM dba_services

WHERE name LIKE 'sales%';

Expected output

NAME                         FAILOVER_TYPE FAILOVER_RESTORE COMMIT_OUTCOME REPLAY_INIT DRAIN_TIMEOUT
---------------------------- ------------- ---------------- -------------- ----------- -------------
sales_app.example.internal                 NONE             NO
sales_tac.example.internal   AUTO          AUTO             YES                    600           300

What to expect: The new service shows AUTO, AUTO and YES with the timeouts you set. The old service shows the gaps from Step 1. If the new row is missing, the service has not started in this PDB: check the -pdb value and srvctl status.



Step 4: Grant KEEP Privileges for Mutable Values

Replay must produce the same results as the original calls. Functions such as SYSDATE, SYSTIMESTAMP, SYS_GUID and sequence NEXTVAL return different values each time, so the application user must be allowed to keep the original values during a replay.


SQL

GRANT KEEP DATE TIME TO app_user;

GRANT KEEP SYSGUID TO app_user;

-- For sequences owned by the application schema

ALTER SEQUENCE app_owner.order_seq KEEP;

GRANT KEEP SEQUENCE ON app_owner.order_seq TO app_user;

SELECT sequence_owner, sequence_name, keep_value

FROM dba_sequences

WHERE sequence_owner = 'APP_OWNER';

Expected output

Grant succeeded.

Grant succeeded.

Sequence altered.

Grant succeeded.

SEQUENCE_OWNER SEQUENCE_NAME   K
-------------- --------------- -
APP_OWNER      ORDER_SEQ       Y

What to expect: KEEP_VALUE is Y for the sequence. Without these grants, replay is still attempted, but any request that used SYSDATE or a sequence value is rejected during replay, and the user gets the original error. Repeat the ALTER SEQUENCE and the grant for every sequence the application uses.



Step 5: Write a Resilient Connection String for Azure Applications

The connect string decides how quickly a client finds a surviving instance. Use the SCAN name of the VM cluster, which the Azure application VMs resolve through the private DNS zone of the virtual network, and the retry settings Oracle's high-availability guidance recommends.


Shell

# tnsnames.ora entry (or the same descriptor in the JDBC URL)

SALES_TAC =

(DESCRIPTION =

(CONNECT_TIMEOUT = 90)(RETRY_COUNT = 50)(RETRY_DELAY = 3)(TRANSPORT_CONNECT_TIMEOUT = 3)

(ADDRESS_LIST =

(LOAD_BALANCE = on)

(ADDRESS = (PROTOCOL = TCP)(HOST = salesaz-scan.example.internal)(PORT = 1521)))

(CONNECT_DATA = (SERVICE_NAME = sales_tac.example.internal)))

# From an application VM: resolve the SCAN name and test the alias

getent hosts salesaz-scan.example.internal

tnsping SALES_TAC

Expected output

10.20.4.31      salesaz-scan.example.internal
10.20.4.32      salesaz-scan.example.internal
10.20.4.33      salesaz-scan.example.internal

Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (CONNECT_TIMEOUT = 90)(RETRY_COUNT = 50)(RETRY_DELAY = 3)(TRANSPORT_CONNECT_TIMEOUT = 3) ...
OK (8 msec)

What this does: The SCAN name resolves to three addresses in the Exadata client subnet. TRANSPORT_CONNECT_TIMEOUT abandons an unreachable address after 3 seconds, and RETRY_COUNT with RETRY_DELAY keeps trying for long enough to ride through a node restart. In the application, use UCP (or another pool that marks request boundaries) and make sure the FAN events can reach the client: with the 19c JDBC driver, FAN over ONS is configured automatically from the connect string, but port 6200 must be open from the VM cluster's client subnet to the application VMs in the network security group.



Step 6: Move the Application to the New Service

Change the application's data source to the SALES_TAC descriptor and restart the application, or switch one application server at a time. Then confirm where the sessions are connected.


SQL

SELECT inst_id, service_name, COUNT(*) AS sessions

FROM gv$session

WHERE username = 'APP_USER'

GROUP BY inst_id, service_name

ORDER BY inst_id, service_name;

Expected output

   INST_ID SERVICE_NAME                   SESSIONS
---------- ------------------------------ ----------
         1 sales_tac.example.internal             62
         2 sales_tac.example.internal             58

What to expect: All application sessions on the new service, spread roughly evenly over both instances by the load-balancing goals. Sessions still on sales_app.example.internal come from an application server that was not switched yet.



Step 7: Take a Baseline of the Application Continuity Statistics

The database counts requests, protected calls and replays. Take a reading before the test so the difference afterwards shows exactly what happened.


SQL

COLUMN name FORMAT A60

SELECT name, SUM(value) AS total

FROM gv$sysstat

WHERE name IN ('cumulative requests',

'cumulative user calls in requests',

'cumulative user calls protected by Application Continuity',

'successful replays by Application Continuity',

'rejected replays by Application Continuity')

GROUP BY name

ORDER BY name;

Expected output

NAME                                                              TOTAL
------------------------------------------------------------ ----------
cumulative requests                                              418221
cumulative user calls in requests                               2911470
cumulative user calls protected by Application Continuity      2902118
rejected replays by Application Continuity                            0
successful replays by Application Continuity                          0

How to read it: Divide the protected calls by the user calls in requests: here 2,902,118 of 2,911,470, so 99.7% of the application's work is protected. A low ratio means the pool is not marking request boundaries, or the application uses something replay cannot protect, such as an ALTER SESSION it never restores. Compare against an AWR report for a whole day of normal load before you trust the number.



Step 8: Prove It with a Rolling Instance Stop

Now rehearse what rolling maintenance does: stop the service on one instance with draining, then stop that instance. Run the application's normal load, or a load test, while you do it.


Shell

# Drain the service from instance 1, give sessions up to 300 seconds, then stop the instance

srvctl stop instance -db SALESCDB_AZ -instance SALESCDB1 \

-stopoption IMMEDIATE -drain_timeout 300 -failover

srvctl status service -db SALESCDB_AZ -service sales_tac.example.internal

# Bring it back afterwards

srvctl start instance -db SALESCDB_AZ -instance SALESCDB1

Expected output

Service sales_tac.example.internal is running on instance(s) SALESCDB2

What to expect: The command waits while sessions drain, then stops the instance. The service keeps running on SALESCDB2, and the application log shows no ORA-03113, ORA-25408 or ORA-03135 errors. Users see, at most, a request that takes a few seconds longer.


Run the statistics query from Step 7 again to see what the test did:


SQL

SELECT name, SUM(value) AS total

FROM gv$sysstat

WHERE name IN ('cumulative requests',

'cumulative user calls in requests',

'cumulative user calls protected by Application Continuity',

'successful replays by Application Continuity',

'rejected replays by Application Continuity')

GROUP BY name

ORDER BY name;

Expected output

NAME                                                              TOTAL
------------------------------------------------------------ ----------
cumulative requests                                              431507
cumulative user calls in requests                               3004821
cumulative user calls protected by Application Continuity      2995388
rejected replays by Application Continuity                            0
successful replays by Application Continuity                         14

What to expect: Successful replays rise by a small number, the sessions that were still mid-request when the drain timeout ended, and rejected replays stay at zero. Everything else moved at a request boundary without needing a replay.


Tip: If rejected replays rise, the database alert log and the client trace name the reason. The usual causes are a missing KEEP grant, a call that was not replayable (for example UTL_HTTP), or a request that started more than replay_init_time seconds earlier.


Step 9: Let OCI Maintenance Use the Same Mechanism

The rolling patching that OCI runs on the VM cluster stops each node in turn and relies on the services' drain timeouts. With the service from Step 2 in place, the maintenance you scheduled in the OCI console (reached from the Azure portal's Oracle Database@Azure page) behaves exactly like the test in Step 8.


Shell

# Before a maintenance run: check every application service has the attributes

srvctl config service -db SALESCDB_AZ | grep -E 'Service name|Failover type|Drain timeout'

Expected output

Service name: sales_app.example.internal
Failover type:
Drain timeout:
Service name: sales_tac.example.internal
Failover type: AUTO
Drain timeout: 300 seconds

What this does: It lists every service with its failover type and drain timeout. Any application service with empty values will still produce errors during maintenance. Once every application has moved to the new service, remove the old one with srvctl remove service after stopping it, so nobody connects to it by accident.



Summary

Rolling patching on Exadata Database Service in Oracle Database@Azure keeps the database up, but only the service configuration keeps users' work alive. Create a RAC service with -failovertype AUTO, -failover_restore AUTO, -commit_outcome TRUE and a drain timeout, grant KEEP privileges for dates, GUIDs and sequences, and give Azure applications a connect string with SCAN, retries and short transport timeouts, through a pool that marks request boundaries. Measure the protected-call ratio, prove the setup with a draining instance stop, and make sure every application service carries the same attributes before the next maintenance window.

Recent Posts

See All

Comments


bottom of page