Oracle Application Continuity — for continuous availability

Christopher Jones
3 min read5 days ago

--

Applications need to be resilient to infrastructure glitches. Oracle Database has powerful features that help your users get their jobs done, without them being aware of planned or unplanned database downtime.

Enjoying some “downtime”. Photo by Rapha Wilde on Unsplash

My colleagues Veronica Dumitriu and Nancy Ikeda previously posted a blog How to Make Application Continuity Most Effective in Oracle Database 23c covering AC (“Application Continuity”) and the related TAC (“Transparent Application Continuity”) features. These High Availability technologies are part of Oracle Database and Oracle Client. They allow applications to continue uninterrupted if there is an outage accessing one database node. They function by the driver client libraries recording the “work” that an application does. If the database instance becomes unavailable before all that “work” is committed to the database, the driver transparently connects to another database instance and replays all the recorded work, before letting the app continue as if there had been no outage. AC and TAC need a database that is configured with multiple instances, e.g RAC.

Veronica and Nancy’s post uses examples from the C language Oracle Call Interface API, which is one of the primary APIs for data access. Here I want to share some working notes about AC and TAC with python-oracledb, the Oracle Database driver for Python.

Before my sabbatical at the start of the year, I had been looking at python-oracledb with AC and TAC, in particular how to run the acchk’ tool to check application coverage. AC and TAC are implemented in Oracle Client libraries, and so are transparently available to python-oracledb apps when using Thick mode against Oracle Datase (on-premise or in the Cloud). AC and TAC are similarly available to other drivers like node-oracledb in Thick mode.

AC and TAC are primarily used for unplanned database outages. Applications that use an Oracle connection pool will handle planned downtime gracefully.

My working notes show how to enable AC and TAC on Oracle Autonomous Database and see what protection they give a sample application. As good as AC and TAC are, there are some things they can’t (and shouldn’t) recover.

You can use acchk to review which code paths in your app will be protected and what database work will be replayed by AC or TAC in the event the database instance currently in use has a failure.

A few general app suggestions:

  • Use python-oracledb Thick mode. This mode is a must.
  • Use a connection pool. Python-oracledb doesn’t (yet) expose the OCIRequestBegin() and OCIRequestEnd() functionality.
  • Use ORDER BY or GROUP BY in SQL statements
  • Set Connection.module and Connection.action
  • Use the Oracle Database 19.11+ acchck coverage report tool
    — This is the successor to Ora*CHK
    — Use it by enabling AC or TAC and then:
    — Use PL/SQL DBMS_APP_CONT_ADMIN package to enable recording
    — Run your app
    — Use DBMS_APP_CONT_ADMIN to get a coverage report

Testing acchk

I was testing using Oracle Autonomous Database. To enable acchk in an on-premise database, review your Oracle documentation.

Enable AC:

sqlplus -l admin@'tcps://adb.xxxx.oraclecloud.com:1522/xxxxx_cjdb_tpurgent.adb.oraclecloud.com?wallet_location=/opt/oracle/cjdb'

execute dbms_app_cont_admin.enable_ac('xxxxx_CJDB_tpurgent.adb.oraclecloud.com', 'LEVEL1', 600);

select name, failover_type from dba_services;

Or enable TAC:

execute DBMS_APP_CONT_ADMIN.ENABLE_TAC('xxxxx_cjdb_tpurgent.adb.oraclecloud.com', 'AUTO', 600);

Give myself access:

grant acchk_read to cj;

grant execute on dbms_app_cont_admin to cj;

Enable recording:

sqlplus -l cj@'tcps://adb.xxxx.oraclecloud.com:1522/xxxxx_cjdb_tpurgent.adb.oraclecloud.com?wallet_location=/opt/oracle/cjdb'

execute dbms_app_cont_admin.acchk_set(true);

The run your Python application eg.:

python acchk-test.py

My app is a web service so put some load on it:

ab -n 100 -c 4 http://127.0.0.1:7000/

View the acchk report:

set serveroutput on format wrapped linesize 160
execute dbms_app_cont_report.acchk_report(dbms_app_cont_report.FULL)

Or a summary report:

set serveroutput on format wrapped linesize 160
execute dbms_app_cont_report.acchk_report(dbms_app_cont_report.SUMMARY)

And disable the analysis:

execute dbms_app_cont_admin.acchk_set(false);

And clear records:

execute dbms_app_cont_admin.acchk_purge(purge_all=>true);

References

--

--

Christopher Jones

Oracle Database Product Manager for language drivers including Python python-oracledb, Node.js node-oracledb, PHP OCI8 and more! On Mastodon: @cjbj@phpc.social