Oracle: Use Docker Compose for Oracle Autonomous Database

Oracle: Use Docker Compose for Oracle Autonomous Database

Oracle Autonomous Database is "an easy-to-use, fully autonomous database that scales elastically and delivers fast query performance. As a service, Autonomous Database does not require database administration."

You can use Oracle Autonomous Database in Oracle Cloud. But if you don't have that, or you prefer to test it on-premise, using Oracle Autonomous Database in Docker is a very easy way to install and test it.

Here's my docker-compose.yml:

services:
  oracle-adb:
    image: ghcr.io/oracle/adb-free:latest-23ai
    cap_add:
      - SYS_ADMIN
    ports:
      - 1521:1521
      - 1522:1522
      - 8443:8443
      - 27017:27017
    environment:
      - WORKLOAD_TYPE=ATP
      - WALLET_PASSWORD=XxXxXxXx00##
      - ADMIN_PASSWORD=XxXxXxXx00##

I start it using

# docker compose pull
# docker compose up -d

Then we can have a look at the logs:

# docker compose logs -f
oracle-adb-1  | Archive:  /u01/POD1.zip
oracle-adb-1  |    creating: /u01/app/oracle/oradata/
oracle-adb-1  |    creating: /u01/app/oracle/oradata/POD1/
oracle-adb-1  |    creating: /u01/app/oracle/oradata/POD1/2B100066D43155A4E0636402000ADF73/
oracle-adb-1  |    creating: /u01/app/oracle/oradata/POD1/2B100066D43155A4E0636402000ADF73/datafile/
oracle-adb-1  |   inflating: /u01/app/oracle/oradata/POD1/redo01.log
oracle-adb-1  |    creating: /u01/app/oracle/oradata/POD1/2761FFC126A12A3CE063F6C15E646B1B/
oracle-adb-1  |    creating: /u01/app/oracle/oradata/POD1/2761FFC126A12A3CE063F6C15E646B1B/datafile/
oracle-adb-1  |   inflating: /u01/app/oracle/oradata/POD1/redo02.log
oracle-adb-1  |    creating: /u01/app/oracle/oradata/POD1/datafile/
oracle-adb-1  |   inflating: /u01/app/oracle/oradata/POD1/datafile/o1_mf_sysaux_mqrd671g_.dbf
oracle-adb-1  |   inflating: /u01/app/oracle/oradata/POD1/datafile/o1_mf_temp_mqrfg7t1_.tmp
oracle-adb-1  |   inflating: /u01/app/oracle/oradata/POD1/datafile/o1_mf_data_mqrdb286_.dbf
oracle-adb-1  |   inflating: /u01/app/oracle/oradata/POD1/datafile/o1_mf_system_mqrd2fdr_.dbf
oracle-adb-1  |   inflating: /u01/app/oracle/oradata/POD1/datafile/o1_mf_undotbs1_mqrfg644_.dbf
oracle-adb-1  |    creating: /u01/app/oracle/oradata/POD1/2B0FF3150CFE518BE0636402000ACC28/
oracle-adb-1  |    creating: /u01/app/oracle/oradata/POD1/2B0FF3150CFE518BE0636402000ACC28/datafile/
oracle-adb-1  |    creating: /u01/app/oracle/oradata/POD1/276380EFD2BD9338E063F6C15E6499F5/
oracle-adb-1  |    creating: /u01/app/oracle/oradata/POD1/276380EFD2BD9338E063F6C15E6499F5/datafile/
oracle-adb-1  |    creating: /u01/app/oracle/oradata/POD1/onlinelog/
oracle-adb-1  |    creating: /u01/app/oracle/oradata/POD1/2B0FFEAC928D5575E0636402000A9EB2/
oracle-adb-1  |    creating: /u01/app/oracle/oradata/POD1/2B0FFEAC928D5575E0636402000A9EB2/datafile/
oracle-adb-1  |    creating: /u01/app/oracle/oradata/POD1/controlfile/
oracle-adb-1  |   inflating: /u01/app/oracle/oradata/POD1/controlfile/o1_mf_mqrdhpdz_.ctl
oracle-adb-1  | TIME ELAPSED Unzipping /u01/POD1.zip: 0 minutes and 25 seconds elapsed
oracle-adb-1  | User input JSON not found
oracle-adb-1  | MY ADB WORKLOAD_TYPE is ATP
oracle-adb-1  | MY ADB CUSTOM NAME is MYATP
[...]
oracle-adb-1  | 2025-01-16T08:50:11.550Z INFO        CursorMonitor 61
oracle-adb-1  | 2025-01-16T08:50:11.555Z INFO        TransactionMonitor 13
oracle-adb-1  | 2025-01-16T08:50:11.549Z INFO        RequestMonitor 7
oracle-adb-1  | 2025-01-16T08:50:11.832Z INFO        AccessLogMonitor 1801 0
[...]

From inside of the container, we can see that the Oracle listener is started and has some services registered:

# lsnrctl status
LSNRCTL for Linux: Version 23.0.0.0.0 - Production on 17-JAN-2025 06:35:10

Copyright (c) 1991, 2024, Oracle.  All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=0.0.0.0)(PORT=1521)(FIREWALL=OFF)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 23.0.0.0.0 - Production
Start Date                16-JAN-2025 07:48:08
Uptime                    0 days 22 hr. 47 min. 3 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /u01/app/oracle/product/23.0.0.0/dbhome_1/network/admin/listener.ora
Listener Log File         /u01/app/oracle/diag/tnslsnr/5b296a230f5c/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=0.0.0.0)(PORT=1521)(FIREWALL=OFF)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcps)(HOST=0.0.0.0)(PORT=1522)(FIREWALL=OFF)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcps)(HOST=5b296a230f5c)(PORT=5950))(Security=(my_wallet_directory=/u01/app/oracle/wallets/tls_wallet))(Presentation=HTTP)(Session=RAW))
Services Summary...
Service "MYATP_high.adb.oraclecloud.com" has 1 instance(s).
  Instance "POD1", status READY, has 2 handler(s) for this service...
Service "MYATP_low.adb.oraclecloud.com" has 1 instance(s).
  Instance "POD1", status READY, has 2 handler(s) for this service...
Service "MYATP_medium.adb.oraclecloud.com" has 1 instance(s).
  Instance "POD1", status READY, has 2 handler(s) for this service...
Service "MYATP_tp.adb.oraclecloud.com" has 1 instance(s).
  Instance "POD1", status READY, has 2 handler(s) for this service...
Service "MYATP_tpurgent.adb.oraclecloud.com" has 1 instance(s).
  Instance "POD1", status READY, has 2 handler(s) for this service...
Service "POD1" has 1 instance(s).
  Instance "POD1", status READY, has 2 handler(s) for this service...
Service "POD1XDB" has 1 instance(s).
  Instance "POD1", status READY, has 1 handler(s) for this service...
Service "myatp" has 1 instance(s).
  Instance "POD1", status READY, has 2 handler(s) for this service...
The command completed successfully

Unfortunately, we can't log in using SQL*plus and shared memory:

# sqlplus / as sysdba

SQL*Plus: Release 23.0.0.0.0 - Production on Fri Jan 17 06:39:46 2025
Version 23.6.0.24.11

Copyright (c) 1982, 2024, Oracle.  All rights reserved.

ERROR:
ORA-01017: invalid credential or not authorized; logon denied
Help: https://docs.oracle.com/error-help/db/ora-01017/

But we can use the service:

# sqlplus admin/XxXxXxXx00##@localhost/MYATP_high.adb.oraclecloud.com

And can use SQLcl for connection:

# sql admin/XxXxXxXx00##@localhost:1521/MYATP_high.adb.oraclecloud.com
SQLcl: Release 24.3 Production auf Do. Jan. 16 11:06:33 2025

Copyright (c) 1982, 2025, Oracle. All rights reserved. Alle Rechte vorbehalten.

Last Successful login time: Do Jan 16 2025 11:06:34 +01:00

Verbunden mit:
Oracle Database 23ai Enterprise Edition Release 23.0.0.0.0 - Production
Version 23.6.0.24.11

Bot connections can be used to connect to the database, from within the container as well as from outside (as the port is exposed by configuration).

As you can see in the docker-compose.yml, there's also a port 8443 exposed. It can be used for SQL Developer Web, APEX and OAuth2-Management for REST-APIs:

Subscribe to Martin's Blog

Don’t miss out on the latest issues. Sign up now to get access to the library of members-only issues.
jamie@example.com
Subscribe