[Oracle Database] 公式Docker Imageを利用してOracle Database 19c環境を構築してみた(解決したエラー編)

本記事の目的

昨日、「公式Docker Imageを利用してOracle Database 19c環境を構築してみた」という記事にて、サクっとOracle 19c環境を構築したのですが、実は構築が成功するまでは色々と問題に遭遇しました。

問題の内容としては、かなーりショボイものやら、原因不明のものまで様々ですが、いつか誰かの役に立つかもなのでまとめてみます。

※個人的には、うまくいった話だけでなく、そこまでの苦労話やら出来なかった話やらを読む(聞く)のも楽しいので、自らそれを実践してみる試みです。が、あまりにもショボイ問題も含むため、(遭遇したエラー編)ではなく(解決したエラー編)と書いて、せめてもの前向き感を出してみました。

なお、対処を反映した詳細な手順については、昨日の記事を参照してください。

 

検証内容(解決したエラー編)

buildDockerImage.sh実行エラー(1)

[opc@comp-reiwa01 dockerfiles]$ ./buildDockerImage.sh -v 19.3.0 -e
./buildDockerImage.sh: line 54: docker: command not found
./buildDockerImage.sh: line 58: [: : integer expression expected
Checking if required packages are present and valid...
LINUX.X64_193000_db_home.zip: OK
==========================
DOCKER info:
./buildDockerImage.sh: line 161: docker: command not found
==========================
Building image 'oracle/database:19.3.0-ee' ...
./buildDockerImage.sh: line 193: docker: command not found

ERROR: Oracle Database Docker Image was NOT successfully created.
ERROR: Check the output and correct any reported problems with the docker build operation.

原因:dockerがインストールされてなかった
対処:dockerをインストールした

 

buildDockerImage.sh実行エラー(2)

[opc@comp-reiwa01 dockerfiles]$ ./buildDockerImage.sh -v 19.3.0 -e
Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get http://%2Fvar%2Frun%2Fdocker.sock/v1.39/version: dial unix /var/run/docker.sock: connect: permission denied
./buildDockerImage.sh: line 58: [: : integer expression expected
Checking if required packages are present and valid...
LINUX.X64_193000_db_home.zip: OK
==========================
DOCKER info:
Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get http://%2Fvar%2Frun%2Fdocker.sock/v1.39/info: dial unix /var/run/docker.sock: connect: permission denied★
==========================
Building image 'oracle/database:19.3.0-ee' ...
Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Post http://%2Fvar%2Frun%2Fdocker.sock/v1.39/build?buildargs=%7B%22DB_EDITION%22%3A%22ee%22%7D&cachefrom=%5B%5D&cgroupparent=&cpuperiod=0&cpuquota=0&cpusetcpus=&cpusetmems=&cpushares=0&dockerfile=Dockerfile&forcerm=1&labels=%7B%7D&memory=0&memswap=0&networkmode=default&nocache=1&rm=1&session=f67kk0l4klsne96h5wzk7oxqb&shmsize=0&t=oracle%2Fdatabase%3A19.3.0-ee&target=&ulimits=null&version=1: dial unix /var/run/docker.sock: connect: permission denied

ERROR: Oracle Database Docker Image was NOT successfully created.
ERROR: Check the output and correct any reported problems with the docker build operation.
[opc@comp-reiwa01 dockerfiles]$

原因:実行ユーザにdocker実行権限がなかった
対処:実行ユーザをOSのdockerグループに所属させるか、rootにて実行すればOK

 

buildDockerImage.sh実行エラー(3)

[opc@comp-reiwa01 dockerfiles]$ sudo ./buildDockerImage.sh -v 19.3.0 -e
Checking if required packages are present and valid...
LINUX.X64_193000_db_home.zip: OK
==========================
(中略)


Step 7/23 : RUN chmod ug+x $INSTALL_DIR/*.sh && sync && $INSTALL_DIR/$CHECK_SPACE_FILE && $INSTALL_DIR/$SETUP_LINUX_FILE && rm -rf $INSTALL_DIR
---> Running in 97b7738df5fd
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
checkSpace.sh: ERROR - There is not enough space available in the docker container.★
checkSpace.sh: The container needs at least 18 GB, but only 17 GB are available.
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Removing intermediate container 97b7738df5fd
The command '/bin/sh -c chmod ug+x $INSTALL_DIR/*.sh && sync && $INSTALL_DIR/$CHECK_SPACE_FILE && $INSTALL_DIR/$SETUP_LINUX_FILE && rm -rf $INSTALL_DIR' returned a non-zero code: 1

ERROR: Oracle Database Docker Image was NOT successfully created.
ERROR: Check the output and correct any reported problems with the docker build operation.

原因:Dockerイメージを展開する先のディスク領域不足
対処:該当ディスク領域の拡張(今回はブートボリュームを100GBまで拡張して対処)

 

docker run実行エラー(1)

[opc@comp-reiwa01 19.3.0]$ sudo docker run -d --name 19c -p 1521:1521 -p 5500:5500 -v /opt/oracle/product/19c:/opt/oracle/oradata oracle/database:19.3.0-ee
37b1791bc71d687c7c5da22f20d7ed9f233e9c51ab9da59be132b259abe0bba3

原因:(厳密にはエラーではないが)docker runで-dを付けるとバックグラウンド実行されるので、エラー発生した際に気付きにくい。
対処:-dオプションを付けずに実行する

 

docker run実行エラー(2)

[opc@comp-reiwa01 19.3.0]$ sudo docker run -d --name 19c -p 1521:1521 -p 5500:5500 -v /opt/oracle/product/19c:/opt/oracle/oradata oracle/database:19.3.0-ee
docker: Error response from daemon: Conflict. The container name "/19c" is already in use by container "37b1791bc71d687c7c5da22f20d7ed9f233e9c51ab9da59be132b259abe0bba3". 
You have to remove (or rename) that container to be able to reuse that name.

原因:既に起動中のコンテナ名を指定してrunしようとしたため ※docker runでエラー発生した場合に再実行する場合に注意
対処:docker rm <コンテナID>で一度削除する

 

[opc@comp-reiwa01 ~]$ sudo docker run --name 19c -p 1521:1521 -p 5500:5500 -v /opt/oracle/product/19c:/opt/oracle/oradata oracle/database:19.3.0-ee


ORACLE PASSWORD FOR SYS, SYSTEM AND PDBADMIN: xvdprkh3+0Q=1

LSNRCTL for Linux: Version 19.0.0.0.0 - Production on 04-MAY-2019 11:34:00

Copyright (c) 1991, 2019, Oracle. All rights reserved.

Starting /opt/oracle/product/19c/dbhome_1/bin/tnslsnr: please wait...

TNSLSNR for Linux: Version 19.0.0.0.0 - Production
System parameter file is /opt/oracle/product/19c/dbhome_1/network/admin/listener.ora
Log messages written to /opt/oracle/diag/tnslsnr/e95244199e50/listener/alert/log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1)))
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=0.0.0.0)(PORT=1521)))

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 19.0.0.0.0 - Production
Start Date 04-MAY-2019 11:34:00
Uptime 0 days 0 hr. 0 min. 0 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /opt/oracle/product/19c/dbhome_1/network/admin/listener.ora
Listener Log File /opt/oracle/diag/tnslsnr/e95244199e50/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=0.0.0.0)(PORT=1521)))
The listener supports no services
The command completed successfully
Prepare for db operation
Cannot create directory "/opt/oracle/oradata/ORCLCDB".
8% complete
Copying database files
31% complete
100% complete
(中略)

SQL*Plus: Release 19.0.0.0.0 - Production on Sat May 4 11:34:33 2019
Version 19.3.0.0.0

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


Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0

SQL> ALTER SYSTEM SET control_files='/opt/oracle/oradata/ORCLCDB/control01.ctl' scope=spfile
*
ERROR at line 1:
ORA-32001: write to SPFILE requested but no SPFILE is in use


SQL>
System altered.

SQL> ALTER PLUGGABLE DATABASE ORCLPDB1 SAVE STATE
*
ERROR at line 1:
ORA-01109: database not open


SQL> BEGIN DBMS_XDB_CONFIG.SETGLOBALPORTENABLED (TRUE); END;

*
ERROR at line 1:
ORA-06550: line 1, column 7:
PLS-00201: identifier 'DBMS_XDB_CONFIG.SETGLOBALPORTENABLED' must be declared
ORA-06550: line 1, column 7:
PL/SQL: Statement ignored


SQL> Disconnected from Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0
mkdir: cannot create directory '/opt/oracle/oradata/dbconfig': Permission denied★
mv: cannot stat '/opt/oracle/product/19c/dbhome_1/dbs/spfileORCLCDB.ora': No such file or directory
mv: cannot stat '/opt/oracle/product/19c/dbhome_1/dbs/orapwORCLCDB': No such file or directory
mv: cannot move '/opt/oracle/product/19c/dbhome_1/network/admin/sqlnet.ora' to '/opt/oracle/oradata/dbconfig/ORCLCDB/': No such file or directory
mv: cannot move '/opt/oracle/product/19c/dbhome_1/network/admin/listener.ora' to '/opt/oracle/oradata/dbconfig/ORCLCDB/': No such file or directory
mv: cannot move '/opt/oracle/product/19c/dbhome_1/network/admin/tnsnames.ora' to '/opt/oracle/oradata/dbconfig/ORCLCDB/': No such file or directory
cp: cannot create regular file '/opt/oracle/oradata/dbconfig/ORCLCDB/': No such file or directory★
ln: failed to create symbolic link '/opt/oracle/product/19c/dbhome_1/network/admin/sqlnet.ora': File exists
ln: failed to create symbolic link '/opt/oracle/product/19c/dbhome_1/network/admin/listener.ora': File exists
ln: failed to create symbolic link '/opt/oracle/product/19c/dbhome_1/network/admin/tnsnames.ora': File exists
cp: cannot stat '/opt/oracle/oradata/dbconfig/ORCLCDB/oratab': No such file or directory
ORACLE_HOME = [/home/oracle] ? ORACLE_BASE environment variable is not being set since this
information is not available for the current user ID .
You can set ORACLE_BASE manually if it is required.
Resetting ORACLE_BASE to its previous value or ORACLE_HOME
The Oracle base remains unchanged with value /opt/oracle
/opt/oracle/checkDBStatus.sh: line 26: sqlplus: command not found
#####################################
########### E R R O R ###############
DATABASE SETUP WAS NOT SUCCESSFUL!
Please check output for further info!
########### E R R O R ###############
#####################################
(以降、省略)

原因:該当コンテナの展開先ディレクトリの権限エラー
対処:今回はディレクトリ名変換が不要のため、-vを指定せずで対処

補足:
上記の実行結果に表示されているエラーメッセージの通り、コンテナ展開先のディレクトリ権限の設定に起因した問題と思われるものの、実はまだ根本解決は出来ておらず。。

同様事象がgithub上のissueとしていくつか登録されており、-vで指定するディレクトリ(今回であれば/opt/oracle/oradata)のファイル所有者を適切に設定(id:54321を設定)すれば解決できるとコメントされているが、自分の環境で以下の試しただけではうまく解決せず。
# [root@comp-reiwa01 ~]# chown 54321:54322 /opt/oracle/product/19c
# [root@comp-reiwa01 ~]# ls -ld /opt/oracle/product/19c
# drwxrwxrwx. 2 54321 54322 6 May 4 12:14 /opt/oracle/product/19c

-vオプションなしで成功したというコメントがあったので、試したところ無事成功。

if i delete “-v /home/DATA/oracle_12c/sharedData:/opt/oracle/oradata ” ,it’s successful,but add it that is failed..why..

今回は検証用途のため「/opt/oracle/oradata」に展開したい要件はなかったので、このまま深追いせず。

 

参考情報

oracle/docker-images Issues
⇒公式Docker Imageでエラー出たら、まずはissuesをチェックするのが良さそう。

Permission denied error for oracle/database:12.2.0.1-se2 container #783

Problem with container run #227

 

スポンサードリンク

Be the first to comment

Leave a Reply

Your email address will not be published.


*