大橙子网站建设,新征程启航
为企业提供网站建设、域名注册、服务器等服务
环境准备
在龙文等地区,都构建了全面的区域性战略布局,加强发展的系统性、市场前瞻性、产品创新能力,以专注、极致的服务理念,为客户提供网站设计、成都做网站 网站设计制作定制制作,公司网站建设,企业网站建设,成都品牌网站建设,营销型网站,外贸网站制作,龙文网站建设费用合理。
宿主机:CentOS Linux release 7.3.1611
Docker Version: 1.12.5
Oracle 11.2.0.4
基础镜像: docker.io/centos
主要步骤
1. 使用centos镜像运行容器
docker run -it -p 192.168.10.51:1521:1521 --name os4oracle -v /container_data/oracle_data:/oracle docker.io/centos
PS: 已在宿主机上解压Oracle安装文件到/container_data/oracle_data/database中
2. 在容器中执行如下操作
groupadd dba
groupadd oinstall
useradd -m -g oinstall -G dba oracle
passwd oracle
useradd nobody
mkdir -p /opt/oracle
mkdir -p /opt/oracle/product/11.2.0/db_1
chown -R oracle:dba /opt
chmod -R 775 /opt
yum -y install gcc
yum -y install make
yum -y install binutils
yum -y install gcc-c++
yum -y install compat-libstdc++-33
yum -y install elfutils-libelf-devel
yum -y install elfutils-libelf-devel-static
yum -y install ksh
yum -y install libaio
yum -y install libaio-devel
yum -y install numactl-devel
yum -y install sysstat
yum -y install unixODBC
yum -y install unixODBC-devel
yum -y install pcre-devel
/etc/security/limits.conf
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
/etc/sysctl.conf
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 2097152
kernel.shmmax = 936870912
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
net.ipv4.ip_local_port_range = 9000 65500
net.core.rmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048576
/home/oracle/.bash_profile
export ORACLE_BASE=/opt/oracle
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1
export ORACLE_SID=orcl
export ORACLE_TERM=xterm
export PATH=$ORACLE_HOME/bin:/usr/sbin:$PATH
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
export LANG=en_US
export NLS_LANG=AMERICAN_AMERICA.ZHS16GBK
3.准备静默安装需要的应答文件和创建数据库需要的模板文件(在可视化的环境中生成)
本例中db_install.rsp 内容如下:
oracle.install.responseFileVersion=/oracle/install/rspfmt_dbinstall_response_schema_v11_2_0
oracle.install.option=INSTALL_DB_SWONLY
ORACLE_HOSTNAME
UNIX_GROUP_NAME=dba
INVENTORY_LOCATION=/opt/oraInventory
SELECTED_LANGUAGES=en,zh_CN
ORACLE_HOME=/opt/oracle/product/11.2.0/db_1
ORACLE_BASE=/opt/oracle
oracle.install.db.InstallEdition=EE
oracle.install.db.EEOptionsSelection=true
oracle.install.db.optionalComponents=oracle.rdbms.partitioning:11.2.0.4.0,oracle.oraolap:11.2.0.4.0,oracle.rdbms.dm:11.2.0.4.0,oracle.rdbms.dv:11.2.0.4.0,oracle.rdbms.lbac:11.2.0.4.0,oracle.rdbms.rat:11.2.0.4.0
oracle.install.db.DBA_GROUP=dba
oracle.install.db.OPER_GROUP=dba
oracle.install.db.CLUSTER_NODES=
oracle.install.db.isRACOneInstall=
oracle.install.db.racOneServiceName=
oracle.install.db.config.starterdb.type=GENERAL_PURPOSE
oracle.install.db.config.starterdb.globalDBName=orcl
oracle.install.db.config.starterdb.SID=orcl
oracle.install.db.config.starterdb.characterSet=ZHS16GBK
oracle.install.db.config.starterdb.memoryOption=true
oracle.install.db.config.starterdb.memoryLimit=512
oracle.install.db.config.starterdb.installExampleSchemas=false
oracle.install.db.config.starterdb.enableSecuritySettings=true
oracle.install.db.config.starterdb.password.ALL=oracle
oracle.install.db.config.starterdb.password.SYS=
oracle.install.db.config.starterdb.password.SYSTEM=
oracle.install.db.config.starterdb.password.SYSMAN=
oracle.install.db.config.starterdb.password.DBSNMP=
oracle.install.db.config.starterdb.control=DB_CONTROL
oracle.install.db.config.starterdb.gridcontrol.gridControlServiceURL=
oracle.install.db.config.starterdb.automatedBackup.enable=false
oracle.install.db.config.starterdb.automatedBackup.osuid=
oracle.install.db.config.starterdb.automatedBackup.ospwd=
oracle.install.db.config.starterdb.storageType=FILE_SYSTEM_STORAGE
oracle.install.db.config.starterdb.fileSystemStorage.dataLocation=/oracle/oracle_data
oracle.install.db.config.starterdb.fileSystemStorage.recoveryLocation=
oracle.install.db.config.asm.diskGroup=
oracle.install.db.config.asm.ASMSNMPPassword=
MYORACLESUPPORT_USERNAME=
MYORACLESUPPORT_PASSWORD=
SECURITY_UPDATES_VIA_MYORACLESUPPORT=
DECLINE_SECURITY_UPDATES=true
PROXY_HOST=
PROXY_PORT=
PROXY_USER=
PROXY_PWD=
PROXY_REALM=
COLLECTOR_SUPPORTHUB_URL=
oracle.installer.autoupdates.option=
oracle.installer.autoupdates.downloadUpdatesLoc=
AUTOUPDATES_MYORACLESUPPORT_USERNAME=
AUTOUPDATES_MYORACLESUPPORT_PASSWORD=
建库模板文件
在可视化的环境中通过dbca生成,重点注意修改参数 JAVA_JIT_ENABLED 为false
本例生成模板文件内容如下:
[root@srv5 oracle_data]# cat orcl.dbc
MULTIPURPOSE
20
40
false
false
{ORACLE_BASE}/admin/{DB_UNIQUE_NAME}/pfile/init.ora
{ORACLE_HOME}/dbs/spfile{SID}.ora
{ORACLE_HOME}/assistants/dbca/templates/Seed_Database.dfb
seeddata
{ORACLE_BASE}/oradata/{DB_UNIQUE_NAME}/system01.dbf
{ORACLE_BASE}/oradata/{DB_UNIQUE_NAME}/sysaux01.dbf
{ORACLE_BASE}/oradata/{DB_UNIQUE_NAME}/undotbs01.dbf
{ORACLE_BASE}/oradata/{DB_UNIQUE_NAME}/users01.dbf
{ORACLE_BASE}/oradata/{DB_UNIQUE_NAME}/temp01.dbf
100
16
3
1
8
false
51200
1
false
51200
1
false
51200
1
4.静默安装oracle软件
./runInstaller -ignoreSysPrereqs -ignorePrereq -silent -responseFile /home/oracle/db_install.rsp
5.静默创建数据库
dbca -silent -createDatabase -templateName /home/oracle/orcl.dbc -gdbName orcl -sid orcl -responseFile NO_VALUE -characterSet ZHS16GBK
屏幕上输入两次密码后脚本开始运行
6.至此,数据库成功安装,可以自行测试一番。亦可保存次容器为镜像供后续使用。
PS: 如没有执行第3步中修改JAVA_JIT_ENABLED为false,则会遇到如下问题:
建库脚本执行到76%后挂起,查看日志会发现如下错误:
[root@2c9aedc92450 orcl]# cat postDBCreation.log
BEGIN
*
ERROR at line 1:
ORA-29516: Aurora assertion failure: Assertion failure at joez.c:3422
Bulk load of method java/lang/Object.
ORA-06512: at line 3
IF CatbundleCreateDir(:catbundleLogDir) = 0 THEN
*
ERROR at line 71:
ORA-06550: line 71, column 14:
PLS-00201: identifier 'CATBUNDLECREATEDIR' must be declared
ORA-06550: line 71, column 11:
PL/SQL: Statement ignored
网上查得该问题的解决办法:
http://blog.csdn.net/xiangsir/article/details/18740803