1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

WSL2のOL9にOracle DB 23ai Freeをpodmanで導入する

Posted at

前提

  • WSL2が利用できる環境である

Oracle Linux 9 のインストール

有効なディストリビューションの確認

PowerShell、もしくはコマンドプロンプトから wsl --list --online コマンドで有効なディストリビューションを確認します

PS> wsl --list --online
インストールできる有効なディストリビューションの一覧を次に示します。
'wsl.exe --install <Distro>' を使用してインストールします。

NAME                            FRIENDLY NAME
Ubuntu                          Ubuntu
Debian                          Debian GNU/Linux
kali-linux                      Kali Linux Rolling
Ubuntu-18.04                    Ubuntu 18.04 LTS
Ubuntu-20.04                    Ubuntu 20.04 LTS
Ubuntu-22.04                    Ubuntu 22.04 LTS
Ubuntu-24.04                    Ubuntu 24.04 LTS
OracleLinux_7_9                 Oracle Linux 7.9
OracleLinux_8_7                 Oracle Linux 8.7
OracleLinux_9_1                 Oracle Linux 9.1
openSUSE-Leap-15.6              openSUSE Leap 15.6
SUSE-Linux-Enterprise-15-SP5    SUSE Linux Enterprise 15 SP5
SUSE-Linux-Enterprise-15-SP6    SUSE Linux Enterprise 15 SP6
openSUSE-Tumbleweed             openSUSE Tumbleweed

インストールの実施

wsl --install <ディストリビューション名> コマンドでインストールをおこないます
途中で作成するユーザー名とパスワードの入力を求められますので、任意の名称とパスワードを入力してください

PS> wsl --install OracleLinux_9_1
インストール中: Oracle Linux 9.1
Oracle Linux 9.1 がインストールされました。
Oracle Linux 9.1 を起動しています...
Installing, this may take a few minutes...
Please create a default UNIX user account. The username does not need to match your Windows username.
For more information visit: https://aka.ms/wslusers
Enter new UNIX username: <ユーザー名>
Changing password for user xxxxx.
New password: <パスワード>
Retype new password: <パスワード>
passwd: all authentication tokens updated successfully.
Installation successful!

Podmanのインストールと設定

Podmanのインストール

インストールしたOracle Linux9のターミナルを開き、dnfを使ってpodmanをインストールします

$ sudo dnf install podman

Podの作成

必須ではありませんが、今回はPodを作成します
今回はorapodという名前で作成します
※Podとは、複数のコンテナをまとめて運用管理することができる仕組みです

$ podman pod create -p 1521:1521 --name orapod

WSL2ではcgroup1を使用していますが、最新のpodmanでは非推奨という以下の警告がでます

WARN[0000] Using cgroups-v1 which is deprecated in favor of cgroups-v2 with Podman v5 and will be removed in a future version. Set environment variable `PODMAN_IGNORE_CGROUPSV1_WARNING` to hide this warning.

この警告を出さないようにするためには、以下の2つの方法があります

[1] 環境変数PODMAN_IGNORE_CGROUPSV1_WARNINGを設定して警告を抑制する

$ export PODMAN_IGNORE_CGROUPSV1_WARNING=""

[2] cgroup2を使用するように設定変更をおこなう(影響を判断の上で実施してください)
例えば/etc/fstabに以下の設定を追加します
cgroup2 /sys/fs/cgroup cgroup2 rw,nosuid,nodev,noexec,relatime,nsdelegate 0 0

$ sudo vi /etc/fstab
$ cat /etc/fstab
cgroup2 /sys/fs/cgroup cgroup2 rw,nosuid,nodev,noexec,relatime,nsdelegate 0 0

podmanの最初のコマンド実行時に以下の警告が出ます

WARN[0000] "/" is not a shared mount, this could cause issues or missing mounts with rootless containers

WSLではデフォルトで"/"はprivateとしてmountされる仕様のためです。

$ findmnt -o PROPAGATION /
PROPAGATION
private

例えば下記のコマンドを実行すればsharedになりますが、影響を確認の上実施してください

$ sudo mount --make-rshared /
$ findmnt -o PROPAGATION /
PROPAGATION
shared

Oracle Dabase 23ai free コンテナの導入と起動

今回はorafreeという名前にしています
※必要に応じてPodman Volumeを利用してデータ領域等を永続化します(今回は実施しない)

$ podman run -d --pod orapod --name orafree container-registry.oracle.com/database/free:latest

DBの起動確認

DBが起動するまでしばらく待ってから podman logs <コンテナ名> コマンドを実行し、DBのログを確認します
以下のログが出ていれば起動できています

Completed: Pluggable database FREEPDB1 opened read write
Completed: ALTER DATABASE OPEN

$ podman logs orafree
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
#########################
DATABASE IS READY TO USE!
#########################
The following output is now a tail of the alert.log:
PDB$SEED(2):Pluggable Database PDB$SEED Dictionary check complete
PDB$SEED(2):Opening pdb with Resource Manager plan: DEFAULT_PLAN
(3):--ATTENTION--
(3):PARALLEL_MAX_SERVERS (with value 1) is insufficient. This may affect transaction recovery performance.
Modify PARALLEL_MAX_SERVERS parameter to a value > 4 (= parallel servers count computed from parameter FAST_START_PARALLEL_ROLLBACK) in PDB ID 3
FREEPDB1(3):Autotune of undo retention is turned on.
2024-11-26T08:36:07.951456+00:00
FREEPDB1(3):Opening pdb with Resource Manager plan: DEFAULT_PLAN
Completed: Pluggable database FREEPDB1 opened read write
Completed: ALTER DATABASE OPEN

sysとsystem、pdbadminユーザーのパスワード設定

setPassword.sh でsysとsystemとpdbadminユーザーのパスワードを設定します

$ podman exec orafree ./setPassword.sh <パスワード>

SQL*PlusでCDBに接続

sysユーザーでCDBに接続するコマンドは以下の通りです

$ podman exec -it orafree  sqlplus sys/<パスワード>@FREE as sysdba

SQL*PlusでPDBに接続

pdbadminユーザーでPDBに接続するコマンドは以下の通りです

$ podman exec -it orafree  sqlplus pdbadmin/<パスワード>@FREEPDB1

OSへのログイン

OSへのログインするコマンドは以下の通りです

$ podman exec -it orafree  bash
1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?