注:https://github.com/sunrainwater/oracle-11g.git 上已经有完善的安装代码
克隆git代码,生成镜像
直接执行:
docker run -it –privileged –name oracle11g -p 1521:1521 -v /data:/install oracle-11g-scripts
(最后面不加bash,不然不会自动执行,而是进去到容器里了)
1、将oracle安装包上传到宿主机,并解压(例:/data目录下)
[root@localhost data]# ll
total 2487256
drwxr-xr-x. 7 440 200 4096 Aug 27 2013 database
drwx------. 2 root root 16384 Aug 30 23:23 lost+found
-rw-r--r--. 1 root root 1395582860 Aug 30 23:59 p13390677_112040_Linux-x86-64_1of7.zip
-rw-r--r--. 1 root root 1151304589 Aug 30 23:59 p13390677_112040_Linux-x86-64_2of7.zip
2、用Docker官网的镜像启动,并将/data 挂载到/install 下
docker run -it --privileged --name oracle11g -p 1521:1521 -v /data:/install jaspeen/oracle-11g bash
3、将db_install.rsp拷贝到 /assets 下 (因为镜像里的是oracle 11.2.0.1),并授予x权限
[root@37ad936c72bf ~]# cd /install/database/response/
[root@37ad936c72bf response]# ll
total 80
-rw-r--r--. 1 oracle oinstall 25116 Aug 27 2013 db_install.rsp
-rwxr-xr-x. 1 oracle oinstall 44533 Aug 27 2013 dbca.rsp
-rwxr-xr-x. 1 oracle oinstall 5871 Aug 27 2013 netca.rsp
[root@37ad936c72bf assets]chmod +x db_install.rsp
4、修改 db_install.rsp
可将文件修改好,只需要修改其中的主机名即可
sed -i "s/localhost/$HOSTNAME/g" db_install.rsp
或
直接修改文件
####################################################################
## Copyright(c) Oracle Corporation 1998,2013. All rights reserved.##
## ##
## Specify values for the variables listed below to customize ##
## your installation. ##
## ##
## Each variable is associated with a comment. The comment ##
## can help to populate the variables with the appropriate ##
## values. ##
## ##
## IMPORTANT NOTE: This file contains plain text passwords and ##
## should be secured to have read permission only by oracle user ##
## or db administrator who owns this installation. ##
## ##
####################################################################
#------------------------------------------------------------------------------
# Do not change the following system generated value.
#
# 标注响应文件版本,这个版本必须和要#安装的数据库版本相同,安装检验无法通过,不能更改
#------------------------------------------------------------------------------
oracle.install.responseFileVersion=/oracle/install/rspfmt_dbinstall_response_schema_v11_2_0
#------------------------------------------------------------------------------
# Specify the installation option.
# It can be one of the following:
#
# 选择安装类型:1.只装数据库软件 2.安装数据库软件并建库 3.升级数据库
# - INSTALL_DB_SWONLY
# - INSTALL_DB_AND_CONFIG
# - UPGRADE_DB
#-------------------------------------------------------------------------------
oracle.install.option=INSTALL_DB_SWONLY
#-------------------------------------------------------------------------------
# Specify the hostname of the system as set during the install. It can be used
# to force the installation to use an alternative hostname rather than using the
# first hostname found on the system. (e.g., for systems with multiple hostnames
# and network interfaces)
#
# 指定操作系统主机名,通过hostname命令获得
#-------------------------------------------------------------------------------
ORACLE_HOSTNAME=bcd668678bfe
#-------------------------------------------------------------------------------
# Specify the Unix group to be set for the inventory directory.
#
# 指定oracle inventory目录的所有者,通常会是oinstall或者dba
#-------------------------------------------------------------------------------
UNIX_GROUP_NAME=oinstall
#-------------------------------------------------------------------------------
# Specify the location which holds the inventory files.
# This is an optional parameter if installing on
# Windows based Operating System.
#
# 指定产品清单oracle inventory目录的路径,如果是Win平台下可以省略
#-------------------------------------------------------------------------------
INVENTORY_LOCATION=/opt/oracle/oraInventory
#-------------------------------------------------------------------------------
# Specify the languages in which the components will be installed.
#
# en : English ja : Japanese
# fr : French ko : Korean
# ar : Arabic es : Latin American Spanish
# bn : Bengali lv : Latvian
# pt_BR: Brazilian Portuguese lt : Lithuanian
# bg : Bulgarian ms : Malay
# fr_CA: Canadian French es_MX: Mexican Spanish

本文提供Oracle 11g在Docker容器中的安装步骤,包括准备安装包、配置响应文件、安装软件及数据库等关键环节。特别强调了几个常见问题及其解决方法。

4525

被折叠的 条评论
为什么被折叠?



