在docker中安装oracle

本文的内容来自于oracle官方在github提供的基于docker安装oracle的指导文档,记录我在该文档的指导下安装过程。官方指导文档可以查看后面的参考资料。

下载oracle

下面提供两个版本的oracle的下载链接,我用的是12.1.0.2版本。

12.2.0.1

https://www.oracle.com/technetwork/database/enterprise-edition/downloads/oracle12c-linux-12201-3608234.html

image.png

12.1.0.2

https://www.oracle.com/technetwork/database/enterprise-edition/downloads/database12c-linux-download-2240591.html

image.png

构建oracle镜像

git clone git@github.com:oracle/docker-images.git
cd docker-images/OracleDatabase/SingleInstance/

把下载的二级制文件放到如下目录下:

docker-images/OracleDatabase/SingleInstance/dockerfiles/12.1.0.2/linuxamd64_12102_database_1of2.zip
docker-images/OracleDatabase/SingleInstance/dockerfiles/12.1.0.2/linuxamd64_12102_database_2of2.zip

执行如下命令开始构建docker镜像:

./buildDockerImage.sh -v 12.1.0.2 -e

执行完后,oracle基本安装完成。

……
creating: database/stage/Components/oracle.javavm.containers/
   creating: database/stage/Components/oracle.javavm.containers/12.1.0.2.0/
   creating: database/stage/Components/oracle.javavm.containers/12.1.0.2.0/1/
   creating: database/stage/Components/oracle.javavm.containers/12.1.0.2.0/1/DataFiles/
  inflating: database/stage/Components/oracle.javavm.containers/12.1.0.2.0/1/DataFiles/filegroup2.jar
  inflating: database/stage/Components/oracle.javavm.containers/12.1.0.2.0/1/DataFiles/filegroup1.jar
  inflating: database/install/.oui
Starting Oracle Universal Installer...

Checking Temp space: must be greater than 500 MB.   Actual 37924 MB    Passed
Checking swap space: must be greater than 150 MB.   Actual 965 MB    Passed
Preparing to launch Oracle Universal Installer from /tmp/OraInstall2019-02-14_06-12-58AM. Please wait ...[WARNING] [INS-32055] The Central Inventory is located in the Oracle base.
   ACTION: Oracle recommends placing this Central Inventory in a location outside the Oracle base directory.
You can find the log of this install session at:
 /opt/oracle/oraInventory/logs/installActions2019-02-14_06-12-58AM.log
The installation of Oracle Database 12c was successful.
Please check '/opt/oracle/oraInventory/logs/silentInstall2019-02-14_06-12-58AM.log' for more details.

As a root user, execute the following script(s):
    1. /opt/oracle/oraInventory/orainstRoot.sh
    2. /opt/oracle/product/12.1.0.2/dbhome_1/root.sh



Successfully Setup Software.

This is perl 5, version 14, subversion 1 (v5.14.1) built for x86_64-linux-thread-multi

Copyright 1987-2011, Larry Wall

Perl may be copied only under the terms of either the Artistic License or the
GNU General Public License, which may be found in the Perl 5 source kit.

Complete documentation for Perl, including FAQ lists, should be found on
this system using "man perl" or "perldoc perl".  If you have access to the
Internet, point your browser at http://www.perl.org/, the Perl Home Page.

Removing intermediate container 3efef0c78489
 ---> 4d98ac13db8d
Step 14/24 : FROM base
 ---> cdd70dd65090
Step 15/24 : USER oracle
 ---> Running in 3ce0ade41c74
Removing intermediate container 3ce0ade41c74
 ---> b8c770b07cd1
Step 16/24 : COPY --chown=oracle:dba --from=builder $ORACLE_BASE $ORACLE_BASE
 ---> cc1d8e8ca6d9
Step 17/24 : USER root
 ---> Running in b6235b46bcef
Removing intermediate container b6235b46bcef
 ---> 0870393eddb6
Step 18/24 : RUN $ORACLE_BASE/oraInventory/orainstRoot.sh &&     $ORACLE_HOME/root.sh
 ---> Running in fdd6f3ad07a6
Changing permissions of /opt/oracle/oraInventory.
Adding read,write permissions for group.
Removing read,write,execute permissions for world.

Changing groupname of /opt/oracle/oraInventory to dba.
The execution of the script is complete.
Check /opt/oracle/product/12.1.0.2/dbhome_1/install/root_fdd6f3ad07a6_2019-02-14_06-17-37.log for the output of root script
Removing intermediate container fdd6f3ad07a6
 ---> eff869c79c0d
Step 19/24 : USER oracle
 ---> Running in 62c2918ca056
Removing intermediate container 62c2918ca056
 ---> a5f580477b9b
Step 20/24 : WORKDIR /home/oracle
 ---> Running in cfd6dab67452
Removing intermediate container cfd6dab67452
 ---> a06b3079c6f5
Step 21/24 : VOLUME ["$ORACLE_BASE/oradata"]
 ---> Running in ba7ad4000307
Removing intermediate container ba7ad4000307
 ---> f26a71fbe835
Step 22/24 : EXPOSE 1521 5500
 ---> Running in 46a0979915a8
Removing intermediate container 46a0979915a8
 ---> 3c5d8a869cc4
Step 23/24 : HEALTHCHECK --interval=1m --start-period=5m    CMD "$ORACLE_BASE/$CHECK_DB_FILE" >/dev/null || exit 1
 ---> Running in 12f4b428924c
Removing intermediate container 12f4b428924c
 ---> afc296e6312e
Step 24/24 : CMD exec $ORACLE_BASE/$RUN_FILE
 ---> Running in 7ff4f7a069ac
Removing intermediate container 7ff4f7a069ac
 ---> de6253073cde
Successfully built de6253073cde
Successfully tagged oracle/database:12.1.0.2-ee


  Oracle Database Docker Image for 'ee' version 12.1.0.2 is ready to be extended:

    --> oracle/database:12.1.0.2-ee

  Build completed in 873 seconds.

查看构建的镜像:

$docker images
REPOSITORY                                                   TAG                 IMAGE ID            CREATED             SIZE
oracle/database                                              12.1.0.2-ee         de6253073cde        About an hour ago   5.13GB

运行oracle镜像

docker run --name oracle_12.1.0.2-ee \
-p 1521:1521 -p 5500:5500 \
-e ORACLE_SID=ORCLCDB \
-e ORACLE_PDB=ORCLPDB1 \
-e ORACLE_PWD=<your database passwords> \
-e ORACLE_CHARACTERSET=AL32UTF8 \
-v /data/oracle_in_docker_12.1.0.2_ee/oracle/oradata:/opt/oracle/oradata \
oracle/database:12.1.0.2-ee

安装过程如下:

ORACLE PASSWORD FOR SYS, SYSTEM AND PDBADMIN: gB+UZlv4WqU=1

LSNRCTL for Linux: Version 12.1.0.2.0 - Production on 14-FEB-2019 08:48:45

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

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

TNSLSNR for Linux: Version 12.1.0.2.0 - Production
System parameter file is /opt/oracle/product/12.1.0.2/dbhome_1/network/admin/listener.ora
Log messages written to /opt/oracle/diag/tnslsnr/db094fd2a48b/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 12.1.0.2.0 - Production
Start Date                14-FEB-2019 08:48:46
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/12.1.0.2/dbhome_1/network/admin/listener.ora
Listener Log File         /opt/oracle/diag/tnslsnr/db094fd2a48b/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
Copying database files
1% complete
2% complete
27% complete
Creating and starting Oracle instance
29% complete
32% complete
33% complete
34% complete
38% complete
42% complete
43% complete
45% complete
Completing Database Creation
48% complete
51% complete
53% complete
62% complete
64% complete
72% complete
Creating Pluggable Databases
78% complete
100% complete
Look at the log file "/opt/oracle/cfgtoollogs/dbca/ORCLCDB/ORCLCDB.log" for further details.

SQL*Plus: Release 12.1.0.2.0 Production on Thu Feb 14 08:56:50 2019

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


Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options

SQL>
System altered.

SQL>
Pluggable database altered.

SQL> Disconnected from Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options
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:
Completed: alter pluggable database ORCLPDB1 open
Thu Feb 14 08:56:49 2019
CREATE SMALLFILE TABLESPACE "USERS" LOGGING  DATAFILE  '/opt/oracle/oradata/ORCLCDB/ORCLPDB1/ORCLPDB1_users01.dbf' SIZE 5M REUSE AUTOEXTEND ON NEXT  1280K MAXSIZE UNLIMITED  EXTENT MANAGEMENT LOCAL  SEGMENT SPACE MANAGEMENT  AUTO
Completed: CREATE SMALLFILE TABLESPACE "USERS" LOGGING  DATAFILE  '/opt/oracle/oradata/ORCLCDB/ORCLPDB1/ORCLPDB1_users01.dbf' SIZE 5M REUSE AUTOEXTEND ON NEXT  1280K MAXSIZE UNLIMITED  EXTENT MANAGEMENT LOCAL  SEGMENT SPACE MANAGEMENT  AUTO
ALTER DATABASE DEFAULT TABLESPACE "USERS"
Completed: ALTER DATABASE DEFAULT TABLESPACE "USERS"
Thu Feb 14 08:56:50 2019
ALTER SYSTEM SET control_files='/opt/oracle/oradata/ORCLCDB/control01.ctl' SCOPE=SPFILE;
   ALTER PLUGGABLE DATABASE ORCLPDB1 SAVE STATE
Completed:    ALTER PLUGGABLE DATABASE ORCLPDB1 SAVE STATE
Thu Feb 14 08:57:27 2019
TABLE SYS.WRP$_REPORTS: ADDED INTERVAL PARTITION SYS_P206 (3332) VALUES LESS THAN (TO_DATE(' 2019-02-15 01:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
TABLE SYS.WRP$_REPORTS_DETAILS: ADDED INTERVAL PARTITION SYS_P207 (3332) VALUES LESS THAN (TO_DATE(' 2019-02-15 01:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
TABLE SYS.WRP$_REPORTS_TIME_BANDS: ADDED INTERVAL PARTITION SYS_P210 (3331) VALUES LESS THAN (TO_DATE(' 2019-02-14 01:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
Thu Feb 14 09:11:28 2019
Default pga_aggregate_limit value is too high for the
amount of physical memory in the system
pga_aggregate_limit is 2048 MB
limit based on physical memory and SGA usage is 1198 MB
LSNRCTL for Linux: Version 12.1.0.2.0 - Production on 14-FEB-2019 09:52:02

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

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

TNSLSNR for Linux: Version 12.1.0.2.0 - Production
System parameter file is /opt/oracle/product/12.1.0.2/dbhome_1/network/admin/listener.ora
Log messages written to /opt/oracle/diag/tnslsnr/6cfb36cf79ef/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 12.1.0.2.0 - Production
Start Date                14-FEB-2019 09:52:02
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/12.1.0.2/dbhome_1/network/admin/listener.ora
Listener Log File         /opt/oracle/diag/tnslsnr/6cfb36cf79ef/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

参考资料

https://github.com/oracle/docker-images/tree/master/OracleDatabase/SingleInstance/

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 205,132评论 6 478
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 87,802评论 2 381
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 151,566评论 0 338
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 54,858评论 1 277
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 63,867评论 5 368
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 48,695评论 1 282
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 38,064评论 3 399
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 36,705评论 0 258
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 42,915评论 1 300
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 35,677评论 2 323
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 37,796评论 1 333
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 33,432评论 4 322
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 39,041评论 3 307
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 29,992评论 0 19
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 31,223评论 1 260
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 45,185评论 2 352
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 42,535评论 2 343

推荐阅读更多精彩内容