[opc@apex ~]$ sudo su - oracle
Last login: Thu Mar 21 06:51:58 GMT 2024 on pts/1
[oracle@apex ~]$
[oracle@apex ~]$ mkdir setup startup
[oracle@apex ~]$ ls -l
total 0
drwxr-xr-x. 2 oracle oinstall 6 Mar 21 06:56 setup
drwxr-xr-x. 2 oracle oinstall 6 Mar 21 06:56 startup
[oracle@apex ~]$
[oracle@apex ~]$ ls -l setup
total 4
-rwxr-xr-x. 1 oracle oinstall 2849 Mar 21 06:58 01_install_apex.sh
[oracle@apex ~]$
ディレクトリstartup以下に、Oracle REST Data Servicesを起動するスクリプト01_ords.shを配置します。
[oracle@apex ~]$ ls -l startup
total 4
-rwxr-xr-x. 1 oracle oinstall 99 Mar 21 07:03 01_ords.sh
[oracle@apex ~]$
作成されるデータベースのSYSのパスワードとなる文字列を、podman secretのoracle_pwdに保存します。<パスワード>の部分を実際のパスワードに置き換えて実行します。
echo -n <パスワード> | podman secret create oracle_pwd -
[oracle@apex ~]$ echo -n ******* | podman secret create oracle_pwd -
e710844f1de63ecede82909f3
[oracle@apex ~]$
コンテナapex-dbを作成します。以下のコマンドを実行します。
podman run -d --name apex-db --secret=oracle_pwd \
-p 1521:1521 -p 8181:8181 -p 8443:8443 \
--privileged --userns=keep-id:uid=54321,gid=54321 \
-v /home/oracle/setup:/opt/oracle/scripts/setup -v /home/oracle/startup:/opt/oracle/scripts/startup \
container-registry.oracle.com/database/free:latest
[oracle@apex ~]$ podman run -d --name apex-db --secret=oracle_pwd \
-p 1521:1521 -p 8181:8181 -p 8443:8443 \
--privileged --userns=keep-id:uid=54321,gid=54321 \
-v /home/oracle/setup:/opt/oracle/scripts/setup -v /home/oracle/startup:/opt/oracle/scripts/startup \
container-registry.oracle.com/database/free:latest
Trying to pull container-registry.oracle.com/database/free:latest...
Getting image source signatures
Copying blob b7d28faa08b4 done
Copying blob 43c899d88edc done
Copying blob 089fdfcd47b7 done
Copying blob f8d07bb55995 done
Copying blob 47aa6f1886a1 done
Copying blob c31c8c658c1e done
Copying blob 1d0d5c628f6f done
Copying blob db82a695dad3 done
Copying blob 25a185515793 done
Copying config 39cabc8e6d done
Writing manifest to image destination
9212ba6e9e62d9dd683a54c60c7748ec7ddfc96874351208d7915171a9f4d0e5
[oracle@apex ~]$
[oracle@apex ~]$ podman logs apex-db
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 Thu Mar 21 07:14:21 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!
#########################
Executing user defined scripts
/opt/oracle/runUserScripts.sh: running /opt/oracle/scripts/startup/01_ords.sh
DONE: Executing user defined scripts
The following output is now a tail of the alert.log:
Dumping current patch information
===========================================================
No patches have been applied
===========================================================
2024-03-21T07:14:20.798481+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-21T07:14:23.272674+00:00
FREEPDB1(3):TABLE AUDSYS.AUD$UNIFIED: ADDED INTERVAL PARTITION SYS_P342 (3552) VALUES LESS THAN (TIMESTAMP' 2024-03-22 00:00:00')
[oracle@apex ~]$
Oracle Database 23c Freeのコンテナ・イメージの説明には、/opt/oracle/scripts/seetup以下に配置されている拡張子.shまたは.sqlのファイルは、データベース構成完了後に一度だけ実行されると記載されていますが、なぜか実行されないようです。
podman exec -it apex-db /opt/oracle/scripts/setup/01_install_apex.sh
[oracle@apex ~]$ podman exec -it apex-db /opt/oracle/scripts/setup/01_install_apex.sh
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 173M 100 173M 0 0 118M 0 0:00:01 0:00:01 --:--:-- 118M
Oracle Linux 8 BaseOS Latest (x86_64) 208 kB/s | 3.6 kB 00:00
Oracle Linux 8 BaseOS Latest (x86_64) 49 MB/s | 71 MB 00:01
Oracle Linux 8 Application Stream (x86_64) 299 kB/s | 3.9 kB 00:00
Oracle Linux 8 Application Stream (x86_64) 78 MB/s | 55 MB 00:00
Oracle Linux 8 Development Packages (x86_64) 241 kB/s | 3.3 kB 00:00
Oracle Linux 8 Development Packages (x86_64) 51 MB/s | 126 MB 00:02
Last metadata expiration check: 0:00:11 ago on Thu Mar 21 07:20:55 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:
[中略]
Configuration:
/etc/ords/config/
The global setting named: standalone.static.context.path was set to: /i
ORDS: Release 23.4 Production on Thu Mar 21 07:31:50 2024
Copyright (c) 2010, 2024, Oracle.
Configuration:
/etc/ords/config/
The global setting named: standalone.static.path was set to: /opt/oracle/apex/23.2.0/images
[oracle@apex ~]$
[oracle@apex ~]$ podman restart apex-db
WARN[0010] StopSignal SIGTERM failed to stop container apex-db in 10 seconds, resorting to SIGKILL
apex-db
[oracle@apex ~]$