0
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?

DockerでOracleのExpress Edition(21c) と 23c Free の初期構築→接続時にちょっとハマった小ネタ

Posted at

はじめに

そういえば、自宅にOracleってなかったなー。
昔はインストールがめんどくさかったけど、今はDockerがあるから簡単に作れるかな?
って思って、DockerでOracleを入れたけど、ちょっとハマったお話を残します。

誰かのご参考になれば幸いです。

前提

Oracle Express Edition(XE) とは

すべてのユーザーにお勧めの無償Oracle Database
とのこと。

Oracle 23c Free とは

Oracle Database Freeは、Oracle Database Express Edition(XE)の後継リリース
とのこと。

なにをやったか

Oracle Express Edition(XE) の構築

GeminiにOracleのDocker-compose.yml が欲しいとお願いしたら、Oracle Express Edition(XE) の最新版をいただきました。(=21c)

version: "3.8"
services:
  oracle-xe:
    image: container-registry.oracle.com/database/express:latest
    container_name: oracle-xe
    ports:
      - "1521:1521"
      - "5500:5500"
    environment:
      - ORACLE_PWD=your_password
      - ORACLE_CHARACTERSET=AL32UTF8
      - TZ=Asia/Tokyo
    volumes:
      - oracle-xe-data:/opt/oracle/oradata

volumes:
  oracle-xe-data:

その後、SQL Developerで接続したく、以下で接続しました。

ホスト名:localhost
ポート:1521
SID:xe

image.png

Oracle Database 23c Free の構築

その後、最新のOracleは23cと知り、23cが使いたくなりました。

「Oracle Database 23c Free Docker」等で調べてか?Geminiに聞いてか、忘れましたが、こんな感じのDocker-compose.yml を作りました。
(healthcheckは後から追加したかもしれませんが、imageを freeに変えた感じです。)

version: "3.8"
services:
  oracle-free:
    image: container-registry.oracle.com/database/free:latest
    container_name: oracle-free
    ports:
      - "1521:1521"
    environment:
      - ORACLE_PWD=your_password
      - ORACLE_CHARACTERSET=AL32UTF8
      - TZ=Asia/Tokyo
    volumes:
      - oracle-free-data:/opt/oracle/oradata
    healthcheck:
      test: ["CMD", "sqlplus", "-S", "system/your_password@localhost:1521", "SELECT 1 FROM DUAL;"]
      interval: 30s
      timeout: 10s
      retries: 5
    restart: unless-stopped

volumes:
  oracle-free-data:

ハマったこと

いざ、SQL DeveloperでExpress Edtionと同じように接続しようとしましたが、つながらず・。

ホスト名:localhost
ポート:1521
SID:xe

image.png

なぜ?っとハマりました。

原因

SID が XE から FREE に変わっていた。

ネットで調べていたら以下に辿り着き、FREE ということを知りました

対応

SID:FREE に変えて接続

ホスト名:localhost
ポート:1521
SID:FREE

image.png

余談

その後、さらにユーザを作ろうと Pluggable Database(PDB) と Container Database(CDB)の違いにハマったことは別途書く予定になります。

0
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
0
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?