2024年3月19日火曜日

podmanを使って作成したデータベースのデータファイルをホストに配置する

以前の記事「podmanとYAML形式の構成ファイルを使って色々なCloudの仮想マシンにOracle APEXを実装する」で作成したOracle Database 23c Freeのコンテナに含まれているデータファイルをホストのディレクトリに配置します。データベースのコンテナを作り直しても、今までに更新したデータが維持されるようになります。

Oracle Cloudのコンピュート・インスタンス上で作業を行いますが、どのクラウドでも同じ作業になります。

以下のコマンドを実行し、Oracle APEXの日本語環境ができた状態から作業を始めます。

podman kube play apex.yaml

Oracle APEXのインストールが完了していると、コンテナとしてapex-dbとapex-ordsが実行されています。

podman ps

[oracle@apex ~]$ podman ps

CONTAINER ID  IMAGE                                               COMMAND               CREATED         STATUS                   PORTS                                                                   NAMES

1cf094624321  localhost/podman-pause:4.6.1-1709891383                                   15 minutes ago  Up 15 minutes            0.0.0.0:1521->1521/tcp, 0.0.0.0:8181->8181/tcp, 0.0.0.0:8443->8443/tcp  d97f7f4fc304-infra

34b8e0978f17  container-registry.oracle.com/database/free:latest  /bin/bash -c $ORA...  15 minutes ago  Up 15 minutes (healthy)  0.0.0.0:1521->1521/tcp, 0.0.0.0:8181->8181/tcp, 0.0.0.0:8443->8443/tcp  apex-db

c99b4818b275  container-registry.oracle.com/database/ords:latest  /bin/sh -c bash /...  15 minutes ago  Up 15 minutes            0.0.0.0:1521->1521/tcp, 0.0.0.0:8181->8181/tcp, 0.0.0.0:8443->8443/tcp  apex-ords

[oracle@apex ~]$ 


データベースを安全に停止するため、Oracle REST Data Servicesのコンテナを停止します。

podman stop apex-ords

[oracle@apex ~]$ podman stop apex-ords

WARN[0010] StopSignal SIGTERM failed to stop container apex-ords in 10 seconds, resorting to SIGKILL 

apex-ords

[oracle@apex ~]$ 


コンテナapex-ordsの停止を確認します。

podman ps

[oracle@apex ~]$ podman ps

CONTAINER ID  IMAGE                                               COMMAND               CREATED         STATUS                   PORTS                                                                   NAMES

1cf094624321  localhost/podman-pause:4.6.1-1709891383                                   18 minutes ago  Up 18 minutes            0.0.0.0:1521->1521/tcp, 0.0.0.0:8181->8181/tcp, 0.0.0.0:8443->8443/tcp  d97f7f4fc304-infra

34b8e0978f17  container-registry.oracle.com/database/free:latest  /bin/bash -c $ORA...  18 minutes ago  Up 18 minutes (healthy)  0.0.0.0:1521->1521/tcp, 0.0.0.0:8181->8181/tcp, 0.0.0.0:8443->8443/tcp  apex-db

[oracle@apex ~]$ 


コンテナapex-dbに接続し、データベースを停止します。

podman exec -it apex-db sh
sqlplus / as sysdba
shutdown immediate
exit
exit


[oracle@apex ~]$ podman exec -it apex-db sh

sh-4.4$ sqlplus / as sysdba


SQL*Plus: Release 23.0.0.0.0 - Production on Tue Mar 19 04:53:23 2024

Version 23.3.0.23.09


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



Connected to:

Oracle Database 23c Free Release 23.0.0.0.0 - Develop, Learn, and Run for Free

Version 23.3.0.23.09


SQL> shutdown immediate

Database closed.

Database dismounted.

ORACLE instance shut down.

SQL> exit

Disconnected from Oracle Database 23c Free Release 23.0.0.0.0 - Develop, Learn, and Run for Free

Version 23.3.0.23.09

sh-4.4$ exit

exit

[oracle@apex ~]$ 


コンテナapex-db内のボリュームを、ホストからアクセスできるようにマウントします。マウントしたのち、コンテナ内の/opt/oracle/oradata以下をホストの/home/oracle/oradataにコピーします。

podman unshare
mnt=$(podman mount apex-db)
echo $mnt
cp -rp ${mnt}/opt/oracle/oradata /home/oracle/oradata
exit


[oracle@apex ~]$ podman unshare

[root@apex ~]# mnt=$(podman mount apex-db)

[root@apex ~]# echo $mnt

/home/oracle/.local/share/containers/storage/overlay/e1a28653ac26d67ea16304ef7a506eb39e53e35e1bccf3e543609e427428c483/merged

[root@apex ~]# cp -rp ${mnt}/opt/oracle/oradata /home/oracle/oradata

[root@apex ~]# exit

exit

[oracle@apex ~]$ 


opcユーザーに戻ります。/home/oracle/oradata以下の所有者をコンテナ内での所有者のUIDとGIDに変更します。このUIDとGIDは、ホスト側でコンテナを起動しているユーザー、グループも同じになるように構成しています。

sudo chown -R 54321:54321 /home/oracle/oradata

ユーザーoracleに切り替え、パスワード・ファイルorapwFREEに特別な権限を設定します。

sudo su - oracle
cd /home/oracle/oradata/dbconfig/FREE
chmod 4640 orapwFREE
ls -l

[opc@apex ~]$ sudo su - oracle

Last login: Tue Mar 19 05:04:51 GMT 2024 on pts/1

[oracle@apex ~]$ cd /home/oracle/oradata/dbconfig/FREE

[oracle@apex FREE]$ chmod 4640 orapwFREE

[oracle@apex FREE]$ ls -l

total 24

-rw-r-----. 1 oracle oinstall  448 Sep  2  2023 listener.ora

-rwSr-----. 1 oracle oinstall 2048 Mar 19 04:32 orapwFREE

-rw-r--r--. 1 oracle oinstall  779 Sep  2  2023 oratab

-rw-r-----. 1 oracle oinstall 2560 Mar 19 04:52 spfileFREE.ora

-rw-r-----. 1 oracle oinstall   69 Sep  2  2023 sqlnet.ora

-rw-r-----. 1 oracle oinstall  690 Sep  2  2023 tnsnames.ora

[oracle@apex FREE]$ 


ポッドapexを作り直します。

ポッドを作成する際にusernsオプションを与えて、コンテナからデータファイルにアクセスする際のUIDとGIDを維持する必要がありますが、YAML構成ファイルでの設定方法を見つけることができませんでした。

そのため、ポッドapexとコンテナapex-dbおよびapex-ordsを、それぞれpodmanコマンドを実行して作成します。

最初に実行されているポッドapexを停止し、削除します。

podman pod stop apex
podman pod rm apex

[oracle@apex ~]$ podman pod stop apex

d97f7f4fc3046a525eb0edd5113d44840d2afe46208c6dfeb3c717dff78008dd

[oracle@apex ~]$ podman pod rm apex

d97f7f4fc3046a525eb0edd5113d44840d2afe46208c6dfeb3c717dff78008dd

[oracle@apex ~]$ 


ポッドapexを作成します。usernsオプションを付加します。

podman pod create --userns=keep-id:uid=54321,gid=54321 -p 1521:1521 -p 8181:8181 -p 8443:8443 --name apex

[oracle@apex ~]$ podman pod create --userns=keep-id:uid=54321,gid=54321 -p 1521:1521 -p 8181:8181 -p 8443:8443 --name apex

d9533877a55b2d2eb26270813efbbe543a896013dacdbdb3892c43de0136556d

[oracle@apex ~]$ 


Oracle Database 23c Freeのコンテナapex-dbを作成します。

podman run -d --pod apex --name apex-db --privileged -e ORACLE_PWD=<SYSのパスワード> -v /home/oracle/oradata:/opt/oracle/oradata container-registry.oracle.com/database/free:latest

[oracle@apex ~]$ podman run -d --pod apex --name apex-db --privileged -e ORACLE_PWD=******** -v /home/oracle/oradata:/opt/oracle/oradata container-registry.oracle.com/database/free:latest

65fb106770515edbc0201cd6ba4a2d58628faa28388d21c56394f97eec87e126

[oracle@apex ~]$ 


データベースの起動を確認します。

podman logs apex-db

[oracle@apex ~]$ podman logs apex-db

cat: /sys/fs/cgroup/memory.max: No such file or directory

Starting Oracle Net Listener.

Oracle Net Listener started.

Starting Oracle Database instance FREE.

Oracle Database instance FREE started.


The Oracle base remains unchanged with value /opt/oracle


SQL*Plus: Release 23.0.0.0.0 - Production on Tue Mar 19 05:17:55 2024

Version 23.3.0.23.09


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



Connected to:

Oracle Database 23c Free Release 23.0.0.0.0 - Develop, Learn, and Run for Free

Version 23.3.0.23.09


SQL> 

User altered.


SQL> 

User altered.


SQL> 

Session altered.


SQL> 

User altered.


SQL> Disconnected from Oracle Database 23c Free Release 23.0.0.0.0 - Develop, Learn, and Run for Free

Version 23.3.0.23.09

The Oracle base remains unchanged with value /opt/oracle

#########################

DATABASE IS READY TO USE!

#########################

The following output is now a tail of the alert.log:

2024-03-19T05:17:53.235853+00:00

===========================================================

Dumping current patch information

===========================================================

No patches have been applied

===========================================================

2024-03-19T05:17:54.876031+00:00

FREEPDB1(3):Opening pdb with Resource Manager plan: DEFAULT_PLAN

Completed: Pluggable database FREEPDB1 opened read write 

Completed: ALTER DATABASE OPEN

2024-03-19T05:18:33.096208+00:00

FREEPDB1(3):Resize operation completed for file# 12, fname /opt/oracle/oradata/FREE/FREEPDB1/system01.dbf, old size 409600K, new size 419840K

[oracle@apex ~]$ 


Oracle REST Data Servicesのコンテナapex-ordsを作成します。マッピングするディレクトリは/etc/ords/configだけになります。

podman run -d --pod apex --name apex-ords --privileged -v /home/oracle/ords_config:/etc/ords/config container-registry.oracle.com/database/ords:latest

[oracle@apex ~]$ podman run -d --pod apex --name apex-ords --privileged -v /home/oracle/ords_config:/etc/ords/config container-registry.oracle.com/database/ords:latest

35434b3bce4ab517a153c5d423a244f62e719b6c4cf748fc2e2c532e7d2e43d1

[oracle@apex ~]$ 


以上で作業は完了です。

podman ps

[oracle@apex ~]$ podman ps

CONTAINER ID  IMAGE                                               COMMAND               CREATED         STATUS                  PORTS                                                                   NAMES

5078042f61c3  localhost/podman-pause:4.6.1-1709891383                                   6 minutes ago   Up 4 minutes            0.0.0.0:1521->1521/tcp, 0.0.0.0:8181->8181/tcp, 0.0.0.0:8443->8443/tcp  d9533877a55b-infra

65fb10677051  container-registry.oracle.com/database/free:latest  /bin/bash -c $ORA...  4 minutes ago   Up 4 minutes (healthy)  0.0.0.0:1521->1521/tcp, 0.0.0.0:8181->8181/tcp, 0.0.0.0:8443->8443/tcp  apex-db

35434b3bce4a  container-registry.oracle.com/database/ords:latest  /bin/sh -c bash /...  45 seconds ago  Up 45 seconds           0.0.0.0:1521->1521/tcp, 0.0.0.0:8181->8181/tcp, 0.0.0.0:8443->8443/tcp  apex-ords

[oracle@apex ~]$ 


データベースのデータファイルがホスト側のディレクトリに配置されたため、コンテナapex-dbを再作成してもデータが維持されるようになりました。

完

2024年3月14日木曜日

Oracle Database 23c FreeのコンテナだけでOracle APEXを実行する

以前にOracle Database 23c FreeとOracle REST Data Servicesの2つのコンテナを実行してOracle APEXの環境を作った(こちらの記事)のですが、Matt Mulvaneyさんの以下の記事では、Oracle Database 23c FreeのコンテナにORDSをインストールして環境を作っていました。

Oracle 23c Free Docker, APEX & ORDS all in one simple guide

Oracle REST Data ServicesのコンテナはAPEXやORDSのセットアップを起動時に実行する機能が含まれていますが、日本語は対象外なので手作業は必要になっています。

Apple MシリーズのMacのcolimaの環境でOracle Database 23c Freeのコンテナを実行し、そのコンテナにOracle APEXを導入してみました。以下より簡単に手順を紹介します。

colimaの準備が完了している状態から作業を始めます。

最初にOracle Database 23c Freeが動作するコンテナをapexdbとして作成します。ORDSを接続するためオプションに -p 8443:8443 を追加します。

docker run -d --name apexdb -p 1521:1521 -p 8443:8443 -e ORACLE_PWD=<SYSのパスワード> container-registry.oracle.com/database/free:latest

状態がhealtyになるまで待ちます。

% docker run -d --name apexdb -p 1521:1521 -p 8443:8443 -e ORACLE_PWD=******** container-registry.oracle.com/database/free:latest

de36227ae6e65f4fefb354d3cd899573a7c6235da2981cb56bbb2217f3e0514f

% docker ps

CONTAINER ID   IMAGE                                                COMMAND                   CREATED          STATUS                             PORTS                                                                                  NAMES

de36227ae6e6   container-registry.oracle.com/database/free:latest   "/bin/bash -c $ORACL…"   18 seconds ago   Up 16 seconds (health: starting)   0.0.0.0:1521->1521/tcp, :::1521->1521/tcp, 0.0.0.0:8443->8443/tcp, :::8443->8443/tcp   apexdb

% 


状態がhealtyになったところで、手元のPCにダウンロードしたOracle APEXのインストール・メディア(を展開したもの)から、APEXのインストールを行います。コンテナにはAPEXを含めず、静的リソースはCDNから参照するようにします。

インストールにはSQLclを使います。ダウンロードしたapex-latest.zipを展開すると作成されるディレクトリapexに移動して実行します。

sql sys@localhost/freepdb1 as sysdba

apex % sql sys@localhost/freepdb1 as sysdba



SQLcl: 木 3月 14 15:10:15 2024のリリース23.4 Production


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


パスワード (**********?) ******

接続先:

Oracle Database 23c Free Release 23.0.0.0.0 - Develop, Learn, and Run for Free

Version 23.3.0.23.09


SQL>


静的リソースの参照先としてCDNのURLを与えて、APEXをインストールします。

@apexins SYSAUX SYSAUX TEMP https://static.oracle.com/cdn/apex/23.2.0/

インストールが完了するまで待ちます。

SQL> @apexins SYSAUX SYSAUX TEMP https://static.oracle.com/cdn/apex/23.2.0/

...set_appun.sql


PL/SQLプロシージャが正常に完了しました。



:CDB    

_______ 

YES     



:CDB_ROOT    

____________ 

NO           



:META_LINK    

_____________ 

LOCAL         


...set_ufrom_and_upgrade.sql


PL/SQLプロシージャが正常に完了しました。


[中略]




APEXのインストールが終了したら、続けて日本語リソースをインストールします。

@load_trans JAPANESE

iming for: Phase 3 (Switch)

Elapsed:    1.82



timing for: Complete Installation

Elapsed:   48.33


SYS> @load_trans JAPANESE


PL/SQLプロシージャが正常に完了しました。


Installing Oracle APEX translation - JAPANESE



. ORACLE

.

. Application Express Hosted Development Service Installation.

..............................................................


PL/SQLプロシージャが正常に完了しました。


--application/set_environment

API Last Extended:20231031


[中略]



日本語リソースのインストールが終了したら、ユーザーAPEX_PUBLIC_USERをアンロックします。

alter user apex_public_user account unlock no authentication;

...done

Adjust instance settings


PL/SQLプロシージャが正常に完了しました。


SYS> alter user apex_public_user account unlock no authentication;


User APEX_PUBLIC_USERが変更されました。


SYS> 


APEXの管理者ユーザー(デフォルトはADMIN)とパスワードを設定します。

@apxchpwd

パスワードを設定すると、APEXのインストール作業は終了です。

SYS> @apxchpwd

...set_appun.sql

================================================================================

This script can be used to change the password of an Oracle APEX

instance administrator. If the user does not yet exist, a user record will be

created.

================================================================================

Enter the administrator's username [ADMIN] 

User "ADMIN" does not yet exist and will be created.


Enter ADMIN's email [ADMIN] 

Enter ADMIN's password [] *********

Created instance administrator ADMIN.



SYS> exit

Oracle Database 23c Free Release 23.0.0.0.0 - Develop, Learn, and Run for Free

Version 23.3.0.23.09から切断されました

apex % 


作成したコンテナにORDSをインストールします。rootユーザーで接続します。

docker exec -it apexdb su

% docker exec -it apexdb su

[root@de36227ae6e6 oracle]# 


JDK17の最新版をダウンロードします。

curl -OL https://download.oracle.com/java/17/latest/jdk-17_linux-x64_bin.rpm

[root@de36227ae6e6 oracle]# curl -OL https://download.oracle.com/java/17/latest/jdk-17_linux-x64_bin.rpm

  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current

                                 Dload  Upload   Total   Spent    Left  Speed

100  173M  100  173M    0     0  8354k      0  0:00:21  0:00:21 --:--:-- 7841k

[root@de36227ae6e6 oracle]# 


ダウンロードしたRPMをインストールします。

dnf -y localinstall jdk-17_linux-x64_bin.rpm

[root@de36227ae6e6 oracle]# dnf -y localinstall jdk-17_linux-x64_bin.rpm

Oracle Linux 8 BaseOS Latest (x86_64)           6.3 kB/s | 3.6 kB     00:00    

Oracle Linux 8 BaseOS Latest (x86_64)           6.3 MB/s |  71 MB     00:11    

Oracle Linux 8 Application Stream (x86_64)       24 kB/s | 3.9 kB     00:00    

Oracle Linux 8 Application Stream (x86_64)      7.6 MB/s |  55 MB     00:07    

Oracle Linux 8 Development Packages (x86_64)     15 kB/s | 3.3 kB     00:00    

Oracle Linux 8 Development Packages (x86_64)    7.1 MB/s | 125 MB     00:17    

Last metadata expiration check: 0:01:09 ago on Thu Mar 14 07:59:17 2024.

Dependencies resolved.

================================================================================

 Package       Architecture  Version                  Repository           Size

================================================================================

Installing:

 jdk-17        x86_64        2000:17.0.10-11          @commandline        174 M


Transaction Summary

================================================================================

Install  1 Package


Total size: 174 M

Installed size: 303 M

Downloading Packages:

Running transaction check

Transaction check succeeded.

Running transaction test

Transaction test succeeded.

Running transaction

  Preparing        :                                                        1/1 

  Installing       : jdk-17-2000:17.0.10-11.x86_64                          1/1 

  Running scriptlet: jdk-17-2000:17.0.10-11.x86_64                          1/1 

jexec setup failed


  Verifying        : jdk-17-2000:17.0.10-11.x86_64                          1/1 


Installed:

  jdk-17-2000:17.0.10-11.x86_64                                                 


Complete!

[root@de36227ae6e6 oracle]# 


ORDSをインストールします。

dnf -y --repofrompath ol8_oracle_software,http://yum.oracle.com/repo/OracleLinux/OL8/oracle/software/x86_64 install ords

[root@de36227ae6e6 oracle]# dnf -y --repofrompath ol8_oracle_software,http://yum.oracle.com/repo/OracleLinux/OL8/oracle/software/x86_64 install ords

Added ol8_oracle_software repo from http://yum.oracle.com/repo/OracleLinux/OL8/oracle/software/x86_64

ol8_oracle_software                             175 kB/s | 109 kB     00:00    

Last metadata expiration check: 0:00:02 ago on Thu Mar 14 08:04:52 2024.

Dependencies resolved.

================================================================================

 Package     Architecture  Version             Repository                  Size

================================================================================

Installing:

 ords        noarch        23.4.0-8.el8        ol8_oracle_software        108 M

Installing dependencies:

 lsof        x86_64        4.93.2-1.el8        ol8_baseos_latest          253 k


Transaction Summary

================================================================================

Install  2 Packages


Total download size: 108 M

Installed size: 113 M

Downloading Packages:

(1/2): lsof-4.93.2-1.el8.x86_64.rpm             940 kB/s | 253 kB     00:00    

(2/2): ords-23.4.0-8.el8.noarch.rpm             7.7 MB/s | 108 MB     00:14    

--------------------------------------------------------------------------------

Total                                           7.7 MB/s | 108 MB     00:14     

Running transaction check

Transaction check succeeded.

Running transaction test

Transaction test succeeded.

Running transaction

  Preparing        :                                                        1/1 

  Installing       : lsof-4.93.2-1.el8.x86_64                               1/2 

  Running scriptlet: ords-23.4.0-8.el8.noarch                               2/2 

  Installing       : ords-23.4.0-8.el8.noarch                               2/2 

  Running scriptlet: ords-23.4.0-8.el8.noarch                               2/2 

INFO: Before starting ORDS service, run the below command as user oracle:

         ords --config /etc/ords/config install


  Verifying        : lsof-4.93.2-1.el8.x86_64                               1/2 

  Verifying        : ords-23.4.0-8.el8.noarch                               2/2 


Installed:

  lsof-4.93.2-1.el8.x86_64               ords-23.4.0-8.el8.noarch              


Complete!

[root@de36227ae6e6 oracle]# 


ORDSを構成します。

su - oracle
cd /etc/ords/config
ords install

ORDSの構成時の指定はほとんどデフォルトです。データベースとコネクション・プールの両方を構成します。

database service nameにはfreepdb1を指定します。

administrator usernameはsys、database passwordはOracle Database 23c Freeのコンテナ作成時に指定したパスワードを指定します。

CDNへのアクセスがHTTPSであるため、protocolにはHTTPSを選択します。HTTPS portは8443です。インストールしたORDSにはlocalhostを宛先として接続するため、SSL hostnameにlocalhostを指定します。

APEX static resources locationに/home/oracle/iを指定していますが、静的リソースはCDNを参照するため、この設定が使われることはありません。

[root@de36227ae6e6 oracle]# su - oracle

Last login: Thu Mar 14 06:03:27 UTC 2024

[oracle@de36227ae6e6 ~]$ cd /etc/ords/config

[oracle@de36227ae6e6 config]$ ords install

2024-03-14T08:07:44Z INFO ORDS has not detected the option '--config' and this will be set up to the default directory.


ORDS: Release 23.4 Production on Thu Mar 14 08:07:54 2024


Copyright (c) 2010, 2024, Oracle.


Configuration:

  /etc/ords/config/


The configuration folder /etc/ords/config does not contain any configuration files.


Oracle REST Data Services - Interactive Install


  Enter a number to select the type of installation

    [1] Install or upgrade ORDS in the database only

    [2] Create or update a database pool and install/upgrade ORDS in the database

    [3] Create or update a database pool only

  Choose [2]: 

  Enter a number to select the database connection type to use

    [1] Basic (host name, port, service name)

    [2] TNS (TNS alias, TNS directory)

    [3] Custom database URL

  Choose [1]: 

  Enter the database host name [localhost]: 

  Enter the database listen port [1521]: 

  Enter the database service name [orcl]: freepdb1

  Provide database user name with administrator privileges.

    Enter the administrator username: sys

  Enter the database password for SYS AS SYSDBA: *********

Connecting to database user: SYS AS SYSDBA url: jdbc:oracle:thin:@//localhost:1521/freepdb1


Retrieving information.

  Enter the default tablespace for ORDS_METADATA and ORDS_PUBLIC_USER [SYSAUX]: 

  Enter the temporary tablespace for ORDS_METADATA and ORDS_PUBLIC_USER [TEMP]: 

  Enter a number to select additional feature(s) to enable:

    [1] Database Actions  (Enables all features)

    [2] REST Enabled SQL and Database API

    [3] REST Enabled SQL

    [4] Database API

    [5] None

  Choose [1]: 

  Enter a number to configure and start ORDS in standalone mode

    [1] Configure and start ORDS in standalone mode

    [2] Skip

  Choose [1]: 

  Enter a number to select the protocol

    [1] HTTP

    [2] HTTPS

  Choose [1]: 2 

  Enter the HTTPS port [8443]: 

  Enter a number to select the certificate type

    [1] Use self-signed certificate (generates automatically)

    [2] Use my SSL certificate (requires SSL certificate and SSL certificate private key)

  Choose [1]: 

  Enter the SSL hostname: localhost

  Enter the APEX static resources location: /home/oracle/i

2024-03-14T08:10:00.134Z WARNING     The apex images folder /home/oracle/i does not exist.

The setting named: db.connectionType was set to: basic in configuration: default

The setting named: db.hostname was set to: localhost in configuration: default

The setting named: db.port was set to: 1521 in configuration: default

The setting named: db.servicename was set to: freepdb1 in configuration: default

The setting named: plsql.gateway.mode was set to: proxied in configuration: default

The setting named: db.username was set to: ORDS_PUBLIC_USER in configuration: default

The setting named: db.password was set to: ****** in configuration: default

The setting named: feature.sdw was set to: true in configuration: default

The global setting named: database.api.enabled was set to: true

The setting named: restEnabledSql.active was set to: true in configuration: default

The setting named: security.requestValidationFunction was set to: ords_util.authorize_plsql_gateway in configuration: default

The global setting named: standalone.https.port was set to: 8443

The global setting named: standalone.https.host was set to: localhost

The global setting named: standalone.static.path was set to: /home/oracle/i

The global setting named: standalone.static.context.path was set to: /i

The global setting named: standalone.context.path was set to: /ords

The global setting named: standalone.doc.root was set to: /etc/ords/config/global/doc_root

2024-03-14T08:10:04.309Z INFO        Created folder /etc/ords/config/logs

2024-03-14T08:10:04.310Z INFO        The log file is defaulted to the current wo


defaultのプールの接続がVALIDとして表示されるとORDSの構成は完了です。

Mapped local pools from /etc/ords/config/databases:

  /ords/                              => default                        => VALID     



2024-03-14T08:14:10.412Z INFO        Oracle REST Data Services initialized

Oracle REST Data Services version : 23.4.0.r3461619

Oracle REST Data Services server info: jetty/10.0.18

Oracle REST Data Services java info: Java HotSpot(TM) 64-Bit Server VM 17.0.10+11-LTS-240


CTRL-Cを入力して終了します。

コンテナの起動時にORDSを自動起動するスクリプトを作成します。スクリプトは/opt/oracle/scripts/startup以下に配置します。

cd /opt/oracle/scripts/startup

ファイル01_ords.shを以下の内容で作成します。


[oracle@de36227ae6e6 startup]$ cat 01_ords.sh

#!/bin/sh


nohup /usr/local/bin/ords --config /etc/ords/config serve > /home/oracle/ords.log 2>&1 &

[oracle@de36227ae6e6 startup]$ 


以上でORDSの構成も完了です。

コンテナapexdbをリスタートして、接続確認を行います。

docker restart apexdb

以下のURLに接続します。データベースとORDSが起動するまでに少々時間がかかります。

https://localhost:8443/ords/

自己署名証明書によるHTTPSなので、証明書のエラーが発生します。エラーを無視して接続します。


ORDSのラインディグ・ページが表示されます。


以上でOracle APEXのインストールは完了です。

この状態でコンテナapexdbを停止しcommitしてイメージを保存しておくと、APEXのインスールをした状態のコンテナを作成することができます。

docker stop apexdb
docker commit apexdb apexdb:v1


保存したイメージから同じ条件でコンテナapexdb2を作成します。

docker run -d --name apexdb2 -p 1521:1521 -p 8443:8443 -e ORACLE_PWD=<SYSのパスワード> apexdb:v1

完