2
我已經在基於oraclelinux:7.1映像(Docker版本1.12.5)的docker容器中安裝了Oracle 12c。雖然有一個小問題。在運行容器時,我的腳本在目錄/docker-entrypoint-initdb.d中都不會執行(他們創建數據庫用戶,執行授權,設置模式等)。這可能是什麼問題?/docker-entrypoint-initdb.d目錄中的SQL腳本未執行
/docker-entrypoint-initdb.d及其內部的所有SQL文件的權限設置爲777.我可以使用默認系統用戶登錄到數據庫。
下面你會發現Dockerfile複製SQL腳本:
FROM oracle-12c:latest
USER oracle
ENV ORACLE_SID ORCL
ENV ORACLE_HOME /u01/app/oracle/product/12.1/db_1
ENV PATH $PATH:$ORACLE_HOME/bin
USER root
RUN echo $PATH
COPY init-scripts/* /docker-entrypoint-initdb.d/
EXPOSE 1521
從我的容器中的日誌:
2017-01-13T15:43:09.158097846Z
**************************
**** Starting up... ****
**************************
2017-01-13T15:43:09.158142165Z
/home/oracle/.bashrc: line 12: /usr/sbin/groupadd: Permission denied
2017-01-13T15:43:09.308941164Z
LSNRCTL for Linux: Version 12.1.0.2.0 - Production on 13-JAN-2017 15:43:09
2017-01-13T15:43:09.308978154Z
Copyright (c) 1991, 2014, Oracle. All rights reserved.
2017-01-13T15:43:09.308987178Z
Starting /u01/app/oracle/product/12.1/db_1/bin/tnslsnr: please wait...
2017-01-13T15:43:09.314168904Z
TNSLSNR for Linux: Version 12.1.0.2.0 - Production
Log messages written to /u01/app/oracle/diag/tnslsnr/5657f8f40e69/listener/alert/log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=5657f8f40e69)(PORT=1521)))
2017-01-13T15:43:15.939107815Z
Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 12.1.0.2.0 - Production
Start Date 13-JAN-2017 15:43:09
Uptime 0 days 0 hr. 0 min. 6 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Log File /u01/app/oracle/diag/tnslsnr/5657f8f40e69/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=5657f8f40e69)(PORT=1521)))
The listener supports no services
The command completed successfully
/home/oracle/.bashrc: line 12: /usr/sbin/groupadd: Permission denied
Processing Database instance "ORCL": log file /u01/app/oracle/product/12.1/db_1/startup.log
/home/oracle/.bashrc: line 12: /usr/sbin/groupadd: Permission denied
2017-01-13T15:43:42.583817187Z
LSNRCTL for Linux: Version 12.1.0.2.0 - Production on 13-JAN-2017 15:43:42
2017-01-13T15:43:42.583862324Z
Copyright (c) 1991, 2014, Oracle. All rights reserved.
2017-01-13T15:43:42.583872256Z
Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 12.1.0.2.0 - Production
Start Date 13-JAN-2017 15:43:09
Uptime 0 days 0 hr. 0 min. 33 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Log File /u01/app/oracle/diag/tnslsnr/5657f8f40e69/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=5657f8f40e69)(PORT=1521)))
Services Summary...
Service "ORCL" has 1 instance(s).
Instance "ORCL", status READY, has 1 handler(s) for this service...
The command completed successfully
2017-01-13T15:43:42.609310535Z
**************************
**** Startup finished ****
**************************
2017-01-13T15:43:42.609351046Z
我可能失去了一些東西很明顯,但:爲什麼要你在'/泊塢窗,入口點,initdb.d /腳本'可以在第一時間執行/這過程中你希望執行它們?泊塢窗? Oracle數據庫啓動腳本?你的登錄shell? –
@FrankSchmitt:這不是默認行爲嗎? Oracle 11g容器執行這些腳本。 Oracle 12c鏡像基於Dockerfile for Oracle 11g鏡像。我可能錯過了一些東西,但我不知道是什麼。 – lasjak