2025年4月23日水曜日

Oracle Cloudのコンピュート・インスタンス上でOracle APEXの環境を構築する

先日テスト環境を作成する必要があり、Oracle Cloudのコンピュート・インスタンスを作成して、その上にOracle APEXの環境を作成しました。一番手順が少なく確実な方法として、Oracle Database 23ai FreeとOracle REST Data Servicesを共に、コンテナとして実装しています。

以前にも同じような記事を書いたような覚えはありますが、Oracle Cloudのコンソールが変わったり、思ったように動かなかったりしたので、現時点で動いた手順を記載します。

コンテナの作成および実行にはpodmanを使います。

作成するコンピュート・インスタンスは、OSがOracle Linux 9(9.5)、シェイプはVM.Standard.E5.FlexのOCPU数が2、メモリー12GB、ブロック・ボリュームのサイズを100GBとします。

OCIの見積りページで月次見積りを計算したところ、月次の大体の費用は1万円くらいのようです。あくまで特定の時期に見積もりツールを実行した結果なので、費用についてはご自身で確認するようにしてください。


Oracle Databaseを含むソフトウェアについてはすべて無料のものを使用するため、ソフトウェアに関する費用は発生しません。

以下より作業手順を紹介します。

Oracle Cloudのコンソールよりインスタンスを開きます。

インスタンスの作成をクリックします。


作成するコンピュート・インスタンスの名前apextestとしました。コンパートメントに作成に、コンピュート・インスタンスを作成するコンパートメントを指定します。それ以外はデフォルトから変更していません。


イメージとして、Oracle Linux 9のイメージ・ビルド2025.03.18-0を選択しています。


シェイプとしてVM.Standard.E5.Flexを選択し、OCPUの数2メモリー量(GB)12としています。シェイプとしてE5を選択したのはE6の空きがなかったからで、特別な理由はありません。


のページに移動します。


セキュリティの保護インスタンスの設定はせず、へ進みます。


ネットワーキングについては、コンピュート・インスタンスを作成するコンパートメントにすでに作成されている前提で作業を進めます。

プライマリ・ネットワーク既存の仮想クラウド・ネットワークを選択を選択し、利用できる仮想クラウド・ネットワークコンパートメント仮想クラウド・ネットワークを選択します。

サブネットも同様に既存のサブネットを選択を選択し、利用できるサブネットコンパートメントサブネットを選択します。

プライマリVNIC IPアドレスプライベートIPv4アドレスプライベートIPv4アドレスの自動割当てを選択します。

パブリックIPv4アドレスの自動割当てオンにします。

IPv6アドレスオフになっています。VCNとサブネットでIPv6アドレス指定が有効になっていないため有効にできないようです。IPv6は使用しないので、この設定自体は問題ありませんが、作成したコンピュート・インスタンス上でOracle Datababase 23ai Freeのコンテナを実行するにあたって、IPv6を無効にする必要がありました。


SSHキーの追加キー・ペアを自動で作成を選択し、秘密キーのダウンロードをクリックします。秘密キーのファイルがファイル名ssh-key-YYYY-MM-DD.keyの形式でダウンロードされます。

へ進みます。


ブート・ボリュームカスタム・ブート・ボリューム・サイズを指定しますオンにし、ブート・ボリューム・サイズ(GB)100を指定します。

へ進みます。


これまで設定した基本情報を確認して、作成をクリックします。


コンピュート・インスタンスのプロビジョニングが開始します。


インスタンスのプロビジョニングは、すぐに(今回は1分以内)完了します。

インスタンスをクリックして、作成済みのコンピュート・インスタンスの一覧画面に戻ります。


作成したコンピュート・インスタンスapextestパブリックIPを確認します。このIPアドレスが、これからの作業を行う際に使用する、sshやブラウザでの接続先になります。


コンピュート・インスタンスが作成できたので、sshで接続して構成作業を行います。

ダウンロードした秘密キーのファイルとIPアドレスを指定して、作成したコンピュート・インスタンスにサインインします。ユーザーはopcです。

以下はsshを使用した接続例です。

ssh -i ssh-key-YYYY-MM-DD.key opc@[パブリックIPアドレス]

% ssh -i ssh-key-2025-04-23.key opc@***.***.***.***

The authenticity of host '***.***.***.*** (***.***.***.***)' can't be established.

ED25519 key fingerprint is SHA256:6kdwEDlOXlN4EME+yYvWXMbtdObFsI6dYOgu1BTKgJ0.

This key is not known by any other names.

Are you sure you want to continue connecting (yes/no/[fingerprint])? yes

Warning: Permanently added '***.***.***.***' (ED25519) to the list of known hosts.

[opc@apextest ~]$ 


インスタンスにサインインしたら、最初にOSを最新までアップデートします。

sudo dnf -y update

[opc@apextest ~]$ sudo dnf -y update

Ksplice for Oracle Linux 9 (x86_64)               13 MB/s | 4.3 MB     00:00    

Oracle Linux 9 OCI Included Packages (x86_64)     55 MB/s | 154 MB     00:02    

Oracle Linux 9 BaseOS Latest (x86_64)             77 MB/s |  58 MB     00:00    

Oracle Linux 9 Application Stream Packages (x86_  60 MB/s |  54 MB     00:00    

Oracle Linux 9 Addons (x86_64)                   6.0 MB/s | 673 kB     00:00    

Oracle Linux 9 UEK Release 7 (x86_64)            104 MB/s |  63 MB     00:00    

Dependencies resolved.

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

 Package               Arch   Version                    Repository         Size

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

Installing:

 kernel                x86_64 5.14.0-503.38.1.el9_5      ol9_baseos_latest 2.0 M

 kernel-core           x86_64 5.14.0-503.38.1.el9_5      ol9_baseos_latest  18 M

 kernel-devel          x86_64 5.14.0-503.38.1.el9_5      ol9_appstream      34 M


[中略]


  kernel-uek-5.15.0-307.178.5.el9uek.x86_64                                      

  kernel-uek-core-5.15.0-307.178.5.el9uek.x86_64                                 

  kernel-uek-devel-5.15.0-307.178.5.el9uek.x86_64                                

  kernel-uek-modules-5.15.0-307.178.5.el9uek.x86_64                              


Complete!

[opc@apextest ~]$ 


podmanを含むコンテナを実行するツールcontainer-toolsをインストールします。Oracle Linux以外では、ここでunzipもインストールしておきます。

sudo dnf -y install container-tools 

[opc@apextest ~]$ sudo dnf -y install container-tools

Last metadata expiration check: 0:07:52 ago on Fri 25 Apr 2025 03:29:43 AM GMT.

Dependencies resolved.

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

 Package             Arch   Version                     Repository         Size

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

Installing:

 container-tools     noarch 1-14.0.1.el9                ol9_appstream     7.3 k

Installing dependencies:

 aardvark-dns        x86_64 2:1.12.2-1.el9_5            ol9_appstream     1.0 M

 buildah             x86_64 2:1.37.6-1.0.1.el9_5        ol9_appstream      11 M

 cockpit-podman      noarch 93.1-1.el9_5                ol9_appstream     592 k


[中略]


  skopeo-2:1.16.1-2.el9_5.x86_64                                                

  slirp4netns-1.3.1-1.el9.x86_64                                                

  udica-0.2.8-2.el9.noarch                                                      

  yajl-2.1.0-22.el9.x86_64                                                      


Complete!

[opc@apextest ~]$ 


firewalldの設定を行います。

Oracle Linux 9のイメージはfirewalldがあらかじめインストールされていて、デフォルトで起動します。そうでない場合は、以下のコマンドを実行し、firewalldのインストールや有効化を行う必要があります。

sudo dnf -y install firewalld
sudo systemctl enable firewalld
sudo systemctl start firewalld

firewalldに以下の設定を追加します。

ポート8080(HTTP)、8443(HTTPS)、1521(SQL*Net)に接続許可を与えます。また、ポート80(HTTPの標準ポート)への接続を8080へ、ポート443(HTTPSの標準ポート)をポート8443へ転送する設定を行います。

sudo firewall-cmd --add-port=8080/tcp
sudo firewall-cmd --add-port=8443/tcp
sudo firewall-cmd --add-port=27017/tcp
sudo firewall-cmd --add-port=1521/tcp
sudo firewall-cmd --add-forward-port=port=80:proto=tcp:toport=8080
sudo firewall-cmd --add-forward-port=port=443:proto=tcp:toport=8443
sudo firewall-cmd --runtime-to-permanent
sudo firewall-cmd --list-all

[opc@apextest ~]$ sudo firewall-cmd --add-port=8080/tcp

sudo firewall-cmd --add-port=8443/tcp

sudo firewall-cmd --add-port=27017/tcp

sudo firewall-cmd --add-port=1521/tcp

sudo firewall-cmd --add-forward-port=port=80:proto=tcp:toport=8080

sudo firewall-cmd --add-forward-port=port=443:proto=tcp:toport=8443

sudo firewall-cmd --runtime-to-permanent

sudo firewall-cmd --list-all

success

success

success

success

success

success

success

public (active)

  target: default

  icmp-block-inversion: no

  interfaces: enp0s5

  sources: 

  services: dhcpv6-client ssh

  ports: 8080/tcp 8443/tcp 27017/tcp 1521/tcp

  protocols: 

  forward: yes

  masquerade: no

  forward-ports: 

port=80:proto=tcp:toport=8080:toaddr=

port=443:proto=tcp:toport=8443:toaddr=

  source-ports: 

  icmp-blocks: 

  rich rules: 

[opc@apextest ~]$ 


ユーザーoracle、グループoinstallを作成します。

Oracle Databaseなどはコンテナ内でユーザーoracleとして実行されます。コンテナ内からホストのファイル・システムを参照するにあたって、参照するホスト側にあるディレクトリの所有者のUIDやGIDが、コンテナ内のユーザーoracleと一致するようにします。

sudo groupadd -g 54321 oinstall
sudo useradd -u 54321 -g 54321 oracle

[opc@apextest ~]$ sudo groupadd -g 54321 oinstall

sudo useradd -u 54321 -g 54321 oracle

[opc@apextest ~]$


ユーザーoracleがログインしていなくてもサービスが実行できるように、以下のコマンドを実行します。

sudo loginctl enable-linger 54321

[opc@apextest ~]$ sudo loginctl enable-linger 54321

[opc@apextest ~]$ 


IPv6を無効にします。/etc/sysctl.confに以下の2行を追加します。

sudo vi /etc/sysctl.conf

net.ipv6.conf.all.disable_ipv6=1
net.ipv6.conf.default.disable_ipv6=1


追加後、設定を更新します。

sudo sysctl -p /etc/sysctl.conf

[opc@apextest ~]$ sudo sysctl -p /etc/sysctl.conf

kernel.unknown_nmi_panic = 1

net.ipv6.conf.all.disable_ipv6 = 1

net.ipv6.conf.default.disable_ipv6 = 1

[opc@apextest ~]$ 


以上でOSレベルの構成は完了です。一旦、インスタンスを再起動します。

sudo shutdown -r now

[opc@apextest ~]$ sudo shutdown -r now

[opc@apextest ~]$ Connection to ***.***.***.*** closed by remote host.

Connection to ***.***.***.*** closed.


再度、インスタンスにユーザーopcで接続し、Oracle APEXの構成作業を始めます。

ユーザーoracleに切り替えて作業します。

sudo su - oracle

[opc@apextest ~]$ sudo su - oracle

[oracle@apextest ~]$


あらかじめ、Oracle Database 23ai Freeのコンテナ・イメージをダウンロードします。

podman pull container-registry.oracle.com/database/free:latest

[oracle@apextest ~]$ podman pull container-registry.oracle.com/database/free:latest

Trying to pull container-registry.oracle.com/database/free:latest...

Getting image source signatures

Copying blob 98c750596418 done   | 

Copying blob 98c750596418 done   | 

Copying blob bc2da41e3d7a done   | 

Copying blob 267aca2af8b5 done   | 

Copying blob e75c46a944c1 done   | 

Copying blob 45946172daf4 done   | 

Copying blob 8fa9d70719ed done   | 

Copying blob 8768e23f2b25 done   | 

Copying blob 9e5951d51d8d done   | 

Copying blob f22aa7216fae done   | 

Copying blob e63d4fa6a272 done   | 

Copying blob 62a01ec99fe6 done   | 

Copying blob 594d5b772601 done   | 

Copying blob e37163167ac7 done   | 

Copying blob a929d2ad7ddf done   | 

Copying blob 050ccaa83ceb done   | 

Copying blob aaeae0478ed7 done   | 

Copying blob 614b5a826d89 done   | 

Copying blob dcabeeccf7cf done   | 

Copying blob 68a2849e54ba done   | 

Copying blob b775cdac78fd done   | 

Copying blob c7a80918041e done   | 

Copying config ac5f0e5fb4 done   | 

Writing manifest to image destination

ac5f0e5fb44326e93580e551d167a5c4d5ce66ffcd0f17ae98ef106c891f21fc

[oracle@apextest ~]$ 


Oracle REST Data Servicesのコンテナ・イメージをダウンロードします。

podman pull container-registry.oracle.com/database/ords:latest

[oracle@apextest ~]$ podman pull container-registry.oracle.com/database/ords:latest

Trying to pull container-registry.oracle.com/database/ords:latest...

Getting image source signatures

Copying blob ada6a46d3df6 done   | 

Copying blob b694ec42ef2c done   | 

Copying blob 1ebd134257ee done   | 

Copying blob da6e8ccba81d done   | 

Copying blob ac06ceafe5b9 done   | 

Copying config 70778af2ee done   | 

Writing manifest to image destination

70778af2ee1c0ef9d54888f01453b88e1d9e1a78a48400ebcfdf03c645ee31dd

[oracle@apextest ~]$ 


Oracle APEXの最新のアーカイブをダウンロードします。

curl -OL https://download.oracle.com/otn_software/apex/apex-latest.zip

[oracle@apextest ~]$ curl -OL https://download.oracle.com/otn_software/apex/apex-latest.zip

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

                                 Dload  Upload   Total   Spent    Left  Speed

100  289M  100  289M        0  46.7M      0  0:00:06  0:00:06 --:--:-- 52.0M

[oracle@apextest ~]$ 


ダウンロードしたzipファイルを解凍します。

unzip apex-latest.zip

[oracle@apextest ~]$ unzip apex-latest.zip 

Archive:  apex-latest.zip

  inflating: META-INF/MANIFEST.MF    

  inflating: META-INF/ORACLE_C.SF    

  inflating: META-INF/ORACLE_C.RSA   

   creating: apex/

  inflating: apex/apex_rest_config.sql  

  inflating: apex/apex_rest_config_cdb.sql  

  inflating: apex/apex_rest_config_core.sql  

  inflating: apex/apex_rest_config_nocdb.sql  

  inflating: apex/apexins.sql        

  inflating: apex/apexins1.sql       

  inflating: apex/apexins2.sql       

  inflating: apex/apexins3.sql       

  inflating: apex/apexins_adb.sql    

  inflating: apex/apexins_adb_ext.sql  

  inflating: apex/apexins_cdb.sql  


[中略]


  inflating: apex/utilities/debug/d1.sql  

  inflating: apex/utilities/debug/d2.sql  

  inflating: apex/utilities/debug/ds.sql  

   creating: apex/utilities/support/

  inflating: apex/utilities/support/apex_verify.sql  

[oracle@apextest ~]$   


データベースとORDSを含むポッドとしてapexを作成します。

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

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

19c343b90e5f8b2fff611f4f0330db58193c1447a1e0f380e354abad430f8a7a

[oracle@apextest ~]$ 


データファイルを配置するディレクトリoradataを、/home/oracle以下に作成します。

mkdir oradata

[oracle@apextest ~]$ mkdir oradata

[oracle@apextest ~]$ 


ポッドapex内にOracle Database 23ai Freeのコンテナを作成します。名前はapex-dbとします。

podman run -d --pod apex --name apex-db --privileged -v /home/oracle/oradata:/opt/oracle/oradata -v /home/oracle/apex:/home/oracle/apex container-registry.oracle.com/database/free:latest

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

49cbf428651257b39b32593f2a1370e5cbd11d38c765703c51b5970a177d421e

[oracle@apextest ~]$ 


コンテナapex-dbの作成過程のログを確認します。

podman logs -f apex-db

DATABASE IS READY TO USE!と表示されたら、コンテナの準備は完了です。Ctrl+Cを入力して、ログの確認を終了します。

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

Specify a password to be used for database accounts. Oracle recommends that the password entered should be at least 8 characters in length, contain at least 1 uppercase character, 1 lower case character and 1 digit [0-9]. Note that the same password will be used for SYS, SYSTEM and PDBADMIN accounts:

Confirm the password:

Configuring Oracle Listener.

Listener configuration succeeded.

Configuring Oracle Database FREE.

Enter SYS user password: 

*************** 

Enter SYSTEM user password: 

*************** 

Enter PDBADMIN User Password: 

*****************

Prepare for db operation

7% complete

Copying database files

29% complete

Creating and starting Oracle instance

30% complete

33% complete

36% complete

39% complete

43% complete

Completing Database Creation

47% complete

49% complete

50% complete

Creating Pluggable Databases

54% complete

71% complete

Executing Post Configuration Actions

93% complete

Running Custom Scripts

100% complete

Database creation complete. For details check the logfiles at:

 /opt/oracle/cfgtoollogs/dbca/FREE.

Database Information:

Global Database Name:FREE

System Identifier(SID):FREE

Look at the log file "/opt/oracle/cfgtoollogs/dbca/FREE/FREE.log" for further details.


Connect to Oracle Database using one of the connect strings:

     Pluggable database: apex/FREEPDB1

     Multitenant container database: apex


SQL*Plus: Release 23.0.0.0.0 - Production on Wed Apr 23 03:03:25 2025

Version 23.7.0.25.01


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



Connected to:

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

Version 23.7.0.25.01


SQL> 

System altered.


SQL> 

Pluggable database altered.


SQL> 

PL/SQL procedure successfully completed.


SQL> SQL> 

Session altered.


SQL> 

User created.


SQL> 

Grant succeeded.


SQL> 

Grant succeeded.


SQL> 

Grant succeeded.


SQL> 

User altered.


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

Version 23.7.0.25.01


SQL*Plus: Release 23.0.0.0.0 - Production on Wed Apr 23 03:03:25 2025

Version 23.7.0.25.01


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



Connected to:

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

Version 23.7.0.25.01


SQL> Database closed.

Database dismounted.

ORACLE instance shut down.

SQL> ORACLE instance started.


Total System Global Area 1603789896 bytes

Fixed Size     5424200 bytes

Variable Size   402653184 bytes

Database Buffers 1191182336 bytes

Redo Buffers     4530176 bytes

Database mounted.

SQL> 

Database altered.


SQL> 

Database altered.


SQL> 

Database altered.


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

Version 23.7.0.25.01

The Oracle base remains unchanged with value /opt/oracle


Executing user defined scripts

/opt/oracle/runUserScripts.sh: running /opt/oracle/scripts/extensions/setup/registerService.sh


DONE: Executing user defined scripts


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:

Errors in file /opt/oracle/diag/rdbms/free/FREE/trace/FREE_j001_2991.trc:

ORA-07427: spstp: cannot change directory to dbs.

ORA-27300: OS system dependent operation:chdir() failed with status: 2

ORA-27301: OS failure message: No such file or directory

ORA-27302: failure occurred at: spstp:9

ORA-27303: additional information: error returned by chdir() is 2

2025-04-23T03:03:36.501803+00:00

kkjcre1p: unable to spawn jobq slave process 

2025-04-23T03:03:36.501916+00:00

Errors in file /opt/oracle/diag/rdbms/free/FREE/trace/FREE_cjq0_2956.trc:

2025-04-23T03:03:36.538268+00:00

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

Dumping current patch information

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

No patches have been applied

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

^C[oracle@apextest ~]$ 


作成したデータベースのSYSのパスワードを設定します。この後に設定したパスワードを参照することがあるので、環境変数ORACLE_PWDにパスワードを設定しておきます。

export ORACLE_PWD=[SYSのパスワード]
podman exec -it apex-db sh setPassword.sh $ORACLE_PWD

[oracle@apextest ~]$ export ORACLE_PWD=********

[oracle@apextest ~]$ podman exec -it apex-db sh setPassword.sh $ORACLE_PWD

The Oracle base remains unchanged with value /opt/oracle


SQL*Plus: Release 23.0.0.0.0 - Production on Fri Apr 25 03:56:16 2025

Version 23.7.0.25.01


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



Connected to:

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

Version 23.7.0.25.01


SQL> 

User altered.


SQL> 

User altered.


SQL> 

Session altered.


SQL> 

User altered.


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

Version 23.7.0.25.01

[oracle@apextest ~]$ 


これからOracle APEXをデータベースにインストールします。

コンテナapex-dbに接続します。

podman exec -it apex-db bash

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

bash-4.4$ 


Oracle APEXのメディアが展開されているディレクトリ/home/oracle/apexに移動します。このディレクトリはホストの/home/oracle/apexをマウントしています。

cd apex
ls

bash-4.4$ cd apex

bash-4.4$ ls

LICENSE.txt     apxdevrm_cdb.sql apxrtins_cdb.sql

apex_rest_config.sql     apxdevrm_nocdb.sql apxrtins_nocdb.sql

apex_rest_config_cdb.sql    apxdvins.sql apxsilentins.sql

apex_rest_config_core.sql   apxdvins_cdb.sql builder

apex_rest_config_nocdb.sql  apxdvins_nocdb.sql core

apexins.sql     apxdwngrd.sql coreins.sql

apexins1.sql     apxpatch.sql coreins2.sql

apexins2.sql     apxpatch_cdb.sql coreins3.sql

apexins3.sql     apxpatch_nocdb.sql coreins4.sql

apexins_adb.sql     apxremov.sql coreins5.sql

apexins_adb_ext.sql     apxremov1.sql dbcsconf.sql

apexins_cdb.sql     apxremov2.sql dbcsins.sql

apexins_nocdb.sql     apxremov_cdb.sql devins.sql

appins.sql     apxremov_nocdb.sql images

apxappcon.sql     apxrtins.sql load_trans.sql

apxappcon_ext.sql     apxrtins1.sql utilities

apxchpwd.sql     apxrtins2.sql

apxdevrm.sql     apxrtins3.sql

bash-4.4$ 


sqlplusを起動し、Oracle APEXをデータベースにインストールします。

export NLS_LANG=American_America.AL32UTF8
sqlplus / as sysdba
alter session set container = freepdb1;
@apexins SYSAUX SYSAUX TEMP /i/

bash-4.4$ export NLS_LANG=American_America.AL32UTF8

bash-4.4$ sqlplus / as sysdba


SQL*Plus: Release 23.0.0.0.0 - Production on Fri Apr 25 03:58:15 2025

Version 23.7.0.25.01


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



Connected to:

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

Version 23.7.0.25.01


SQL> alter session set container = freepdb1;


Session altered.


SQL> @apexins SYSAUX SYSAUX TEMP /i/

...set_appun.sql


PL/SQL procedure successfully completed.














...set_ufrom_and_upgrade.sql


PL/SQL procedure successfully completed.







Session altered.



FOO3

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

install2025-04-25_03-58-28.log


. ORACLE

.

. Oracle APEX Installation.

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

.

...set_appun.sql

... Checking prerequisites (MANUAL)


[中略]


The structure of the link to the Oracle APEX development environment is as follows:

http://host:port/ords/apex



timing for: Phase 3 (Switch)

Elapsed:    0.13



timing for: Complete Installation

Elapsed:    4.52


SYS> 


日本語リソースをロードします。

@load_trans JAPANESE

SYS> @load_trans JAPANESE


PL/SQL procedure successfully completed.


Installing Oracle APEX translation - JAPANESE



. ORACLE

.

. Oracle APEX Hosted Development Service Installation.

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


PL/SQL procedure successfully completed.



PL/SQL procedure successfully completed.


--application/set_environment

API Last Extended:20241130

Your Current Version:20241130

This import is compatible with version: 20241130


[中略]


--application/deployment/buildoptions

--application/end_environment

... elapsed: 3.42 sec

...done

Adjust instance settings


PL/SQL procedure successfully completed.


SYS> 


APEX_PUBLIC_USERをアンロックします。

alter user apex_public_user account unlock no authentication;

SYS> alter user apex_public_user account unlock no authentication;


User altered.


SYS> 


管理者ユーザーとパスワードを設定します。

@apxchpwd

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 APEXのインストールは完了です。

コンテナapex-dbから抜け、ホストに戻ります。

exit

SYS> exit

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

Version 23.7.0.25.01

bash-4.4$ exit

exit

[oracle@apextest ~]$ 


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

構成情報を保存するフォルダords_config/home/oracle以下に作成します。

mkdir ords_config

[oracle@apextest ~]$ mkdir ords_config

[oracle@apextest ~]$ 


/home/oracle/apexを/opt/oracle/apexにマウントすることにより、ORDSは/home/oracle/apex/images以下の静的ファイルを参照します。また、データベースにORDSのメタデータがインストールされていないと、初回接続時にメタデータのインストールを実施します。

podman run -d --pod apex --name apex-ords --privileged -e DBHOST=localhost -e DBPORT=1521 -e DBSERVICENAME=freepdb1 -e ORACLE_PWD=$ORACLE_PWD -v /home/oracle/ords_config:/etc/ords/config -v /home/oracle/apex:/opt/oracle/apex container-registry.oracle.com/database/ords:latest

[oracle@apextest ~]$ podman run -d --pod apex --name apex-ords --privileged -e DBHOST=localhost -e DBPORT=1521 -e DBSERVICENAME=freepdb1 -e ORACLE_PWD=$ORACLE_PWD -v /home/oracle/ords_config:/etc/ords/config -v /home/oracle/apex:/opt/oracle/apex container-registry.oracle.com/database/ords:latest

531d73aedb1aee159eb691505b94f429f5b1245ffd522c69ad0e4a9b137f577a

[oracle@apextest ~]$ 


ログを表示し、ORDSの起動状況を確認します。

podman logs -f apex-ords

[oracle@apextest ~]$ podman logs -f apex-ords

INFO : Testing your connection variables.

INFO : Database connection established.

INFO : The Oracle REST Data Services are not installed on your database.

INFO : Installing The Oracle REST Data Services 25.1.0.

INFO : The Oracle REST Data Services 25.1.0 has been installed correctly on your database.

INFO : The container found Oracle APEX version 24.2.0 in the mounted volume.

INFO : The Oracle APEX 24.2.0 is already installed in your database.

INFO : Set plsql.gateway.mode proxied after Oracle APEX was installed.

INFO : Setup standalone.static.path /opt/oracle/apex/images.

INFO : Starting the Oracle REST Data Services instance.


ORDS: Release 25.1 Production on Wed Apr 23 05:51:38 2025


Copyright (c) 2010, 2025, Oracle.


Configuration:

  /etc/ords/config


2025-04-23T05:51:39.632Z INFO        HTTP and HTTP/2 cleartext listening on host: 0.0.0.0 port: 8080

2025-04-23T05:51:39.657Z INFO        Disabling document root because the specified folder does not exist: /etc/ords/config/global/doc_root

2025-04-23T05:51:39.657Z INFO        Default forwarding from / to contextRoot configured.

2025-04-23T05:51:39.727Z SEVERE      ORAMLVERSION null

2025-04-23T05:51:39.732Z INFO        Oracle API for MongoDB listening on port: 27017


[中略]


2025-04-23T05:51:43.120Z INFO        


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

  /ords/                              => default                        => VALID     



2025-04-23T05:51:43.197Z INFO        Oracle REST Data Services initialized

Oracle REST Data Services version : 25.1.0.r1001652

Oracle REST Data Services server info: jetty/12.0.13

Oracle REST Data Services java info: Java HotSpot(TM) 64-Bit Server VM Oracle GraalVM 21.0.2+13.1 (build: 21.0.2+13-LTS-jvmci-23.1-b30 mixed mode, sharing)


2025-04-23T05:51:43.261Z INFO        CursorMonitor 1

2025-04-23T05:51:43.261Z INFO        RequestMonitor 1

2025-04-23T05:51:43.261Z INFO        TransactionMonitor 1

2025-04-23T05:51:43.262Z INFO        AccessLogMonitor 1 0

2025-04-23T05:51:43.262Z INFO        WatchdogMonitor 1



ORDSが正常に起動したら、ORDSやAPEXにアクセスできる状態になっています。

ブラウザより以下のURLにアクセスします。

http://コンピュート・インスタンスのIPアドレス/ords/

以下の画面が表示されます。


APEXを使用するには、管理サービスにアクセスしワークスペースを作るところから始めます。

http://コンピュート・インスタンスのIPアドレス/ords/apex_admin


以降は通常のOracle APEXの操作になります。


今回の記事は以上になります。

追記

ブート・ディスクのサイズを大きくすれば自動的にルート・パーティションが大きくなると勝手に思っていましたが、そうはなっていないようです。

今回はOracle Linuxだったのでoci-growfsを呼び出せば良かったようです。実際の作業は、growpartを使って作業しました。

[root@apextest ~]# /usr/libexec/oci-growfs -y

Volume Group: ocivolume

Volume Path: /dev/ocivolume/root

Mountpoint Data     

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

          mountpoint: /

              source: /dev/mapper/ocivolume-root

     filesystem type: xfs

         source size: 82.8G

                type: lvm

                size: 82.9G

    physical devices: ['/dev/sda3']

    physical volumes: ['/dev/sda', '/dev/sda']

    partition number: ['3']

   volume group name: ocivolume

   volume group path: /dev/ocivolume/root


NOCHANGE: partition 3 is size 205314015. it cannot be grown


Unable to expand /dev/sda3.


No partitions expanded, exit.


[root@apextest ~]# 


以下、パーティションの拡張作業を記録します。毎回実行するコマンドにsudoをつけるのが面倒なので、sudo -sを実行します。

[opc@apextest ~]$ sudo -s

[root@apextest opc]# 


lsblkでディクスの利用状況を確認すると、最小サイズの50GBになっています。

lsblk

[root@apextest opc]# lsblk

NAME               MAJ:MIN RM  SIZE RO TYPE MOUNTPOINTS

sda                  8:0    0  100G  0 disk 

├─sda1               8:1    0  100M  0 part /boot/efi

├─sda2               8:2    0    2G  0 part /boot

└─sda3               8:3    0 44.5G  0 part 

  ├─ocivolume-root 252:0    0 29.5G  0 lvm  /

  └─ocivolume-oled 252:1    0   15G  0 lvm  /var/oled

[root@apextest opc]# 


以下を実行して/dev/sdaの最後のパーティションの/dev/sda3を拡張します。

growpart /dev/sda 3

[root@apextest opc]# growpart /dev/sda 3

CHANGED: partition=3 start=4401152 old: size=93325312 end=97726463 new: size=205314015 end=209715166

[root@apextest opc]#


ルート・ファイルシステムが作成されている(フィジカル・ボリュームとして/dev/sda3を含む)ロジカル・ボリュームの名前を確認します。

lvdisplay

[root@apextest opc]# lvdisplay

  --- Logical volume ---

  LV Path                /dev/ocivolume/oled

  LV Name                oled

  VG Name                ocivolume

  LV UUID                QefVxn-MgHG-dMha-IQdJ-X7sw-6eJR-oA2Pz5

  LV Write Access        read/write

  LV Creation host, time localhost.localdomain, 2025-01-15 19:11:42 +0000

  LV Status              available

  # open                 1

  LV Size                15.00 GiB

  Current LE             3840

  Segments               1

  Allocation             inherit

  Read ahead sectors     auto

  - currently set to     4096

  Block device           252:1

   

  --- Logical volume ---

  LV Path                /dev/ocivolume/root

  LV Name                root

  VG Name                ocivolume

  LV UUID                DVkyyE-aryO-hNLY-7NPc-sMmE-or3u-LKJzzK

  LV Write Access        read/write

  LV Creation host, time localhost.localdomain, 2025-01-15 19:11:42 +0000

  LV Status              available

  # open                 1

  LV Size                29.50 GiB

  Current LE             7552

  Segments               1

  Allocation             inherit

  Read ahead sectors     auto

  - currently set to     4096

  Block device           252:0

   

[root@apextest opc]# 


/dev/sda3の拡張された領域を、ロジカル・ボリューム/dev/ocivolume/rootに与えて拡張します。

lvextend -l +100%FREE /dev/mapper/ocivolume-root

[root@apextest opc]# lvextend -l +100%FREE /dev/mapper/ocivolume-root

  Size of logical volume ocivolume/root changed from 29.50 GiB (7552 extents) to <82.90 GiB (21222 extents).

  Logical volume ocivolume/root successfully resized.

[root@apextest opc]# 


ルート・ファイルシステムはXFSですが、一応確認します。

df -T /

[root@apextest opc]# df -T /

Filesystem                 Type 1K-blocks    Used Available Use% Mounted on

/dev/mapper/ocivolume-root xfs   30867456 9280160  21587296  31% /

[root@apextest opc]#


ファイルシステムを拡張します。

xfs_growfs /

[root@apextest opc]# xfs_growfs /

meta-data=/dev/mapper/ocivolume-root isize=512    agcount=4, agsize=1933312 blks

         =                       sectsz=512   attr=2, projid32bit=1

         =                       crc=1        finobt=1, sparse=1, rmapbt=0

         =                       reflink=1    bigtime=1 inobtcount=1 nrext64=0

data     =                       bsize=4096   blocks=7733248, imaxpct=25

         =                       sunit=0      swidth=0 blks

naming   =version 2              bsize=4096   ascii-ci=0, ftype=1

log      =internal log           bsize=4096   blocks=16384, version=2

         =                       sectsz=512   sunit=0 blks, lazy-count=1

realtime =none                   extsz=4096   blocks=0, rtextents=0

data blocks changed from 7733248 to 21731328

[root@apextest opc]# 


拡張結果を確認します。

df -h /

[root@apextest opc]# df -h /

Filesystem                  Size  Used Avail Use% Mounted on

/dev/mapper/ocivolume-root   83G  9.5G   74G  12% /

[root@apextest opc]#