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でSQL*Loaderを動かしたい

Posted at

DockerでSQL*Loaderを動かす方法を紹介します。

手順

① Dockerfileの作成

以下のようなDockerfileを用意します。

FROM oraclelinux:9

ARG release=19
ARG update=19

RUN dnf -y install oracle-instantclient-release-el9                 && \
    dnf -y install oracle-instantclient${release}.${update}-basic   && \
    dnf -y install oracle-instantclient${release}.${update}-sqlplus && \
    dnf -y install oracle-instantclient${release}.${update}-tools

ENV PATH=$PATH:/usr/lib/oracle/${release}.${update}/client64/bin

CMD ["sqlldr"]

releaseやupdateに指定する値は以下のURLから確認できます。

② Dockerイメージの作成

Dockerイメージを作成します。タグ名などは任意です。

docker build . -t oracle/sqlldr:19.19

③ Dockerの利用

作成したDockerを利用して、SQL*Loaderを実行するには、以下のコマンドを実行します。

docker run --rm -it \
  oracle/sqlldr:19.19 \
  sqlldr userid="devuser/Passw0rd@oracle-db-host:1521/XEPDB1" control='product.ctl'

なお、Oracle DatabaseをDockerで起動している場合は--netオプションの設定が必要になる場合があります。詳細は以下の記事を参照してください。

参考

環境情報

BANNER BANNER_FULL BANNER_LEGACY CON_ID
Oracle Database 21c Express Edition Release 21.0.0.0.0 - Production Oracle Database 21c Express Edition Release 21.0.0.0.0 - Production
Version 21.3.0.0.0
Oracle Database 21c Express Edition Release 21.0.0.0.0 - Production 0
C:\>docker version
Client:
 Cloud integration: v1.0.35+desktop.5
 Version:           24.0.7
 API version:       1.43
 Go version:        go1.20.10
 Git commit:        afdd53b
 Built:             Thu Oct 26 09:08:44 2023
 OS/Arch:           windows/amd64
 Context:           default

Server: Docker Desktop 4.26.1 (131620)
 Engine:
  Version:          24.0.7
  API version:      1.43 (minimum version 1.12)
  Go version:       go1.20.10
  Git commit:       311b9ff
  Built:            Thu Oct 26 09:08:02 2023
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.6.25
  GitCommit:        d8f198a4ed8892c764191ef7b3b06d8a2eeb5c7f
 runc:
  Version:          1.1.10
  GitCommit:        v1.1.10-0-g18a0cb0
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0
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?