共计 3997 个字符,预计需要花费 10 分钟才能阅读完成。
近工作上面遇到一个性能相关的问题,大体描述一下:批量任务执行的过程中导致数据库 sql 执行时间过长,查看之后是由于批量任务占满数据库连接池导致的,至于为什么批量任务会不受系统控制导致连接池占满就不说了,感觉是公司内部机密。为了能够在自己的博客里面记录这个过程,博主想在自己的 Ubuntu 上安装一个 Oracle,但是下载下来之后发现 Ubuntu 安装 Oracle 会出现各种问题,而且网上解决方案比较少,所以打算使用 Docker 安装,顺便复习一下自己 Docker 的操作。
首先系统中应该存在 Docker 这个运用程序,安装可以使用命令:sudo apt-get install docker.
安装完成之后最好是将 Docker 的源修改一下,修改为阿里大佬的源,讲道理比 docker 官方的源强 100 倍。
搜索 oracle 相关的 docker 源:
work@work:~$ sudo docker search oracle
[sudo] work 的密码:
NAME DESCRIPTION STARS OFFICIAL AUTOMATED
oraclelinux Oracle Linux is an open-source operating s… 402 [OK]
frolvlad/alpine-oraclejdk8 The smallest Docker image with OracleJDK 8… 269 [OK]
alexeiled/docker-oracle-xe-11g This is a working (hopefully) Oracle XE 11… 222 [OK]
sath89/oracle-12c Oracle Standard Edition 12c Release 1 with… 221 [OK]
sath89/oracle-xe-11g Oracle xe 11g with database files mount su… 135 [OK]
isuper/java-oracle This repository contains all java releases… 55 [OK]
jaspeen/oracle-11g Docker image for Oracle 11g database 55 [OK]
oracle/glassfish GlassFish Java EE Application Server on Or… 30 [OK]
oracle/openjdk Docker images containing OpenJDK Oracle Linux 26 [OK]
airdock/oracle-jdk Docker Image for Oracle Java SDK (8 and 7)… 23 [OK]
ingensi/oracle-jdk Official Oracle JDK installed on CentOS. 21 [OK]
wnameless/oracle-xe-11g Dockerfile of Oracle Database Express Edit… 20 [OK]
cogniteev/oracle-java Oracle JDK 6, 7, 8, and 9 based on Ubuntu … 20 [OK]
n3ziniuka5/ubuntu-oracle-jdk Ubuntu with Oracle JDK. Check tags for ver… 14 [OK]
oracle/nosql Oracle NoSQL on a Docker Image with Oracle… 13 [OK]
collinestes/docker-node-oracle A container with Node.js/Oracle instant cl… 9 [OK]
openweb/oracle-tomcat A fork off of Official tomcat image with O… 7 [OK]
sgrio/java-oracle Docker images of Java 7/8 provided by Orac… 7 [OK]
andreptb/oracle-java Debian Jessie based image with Oracle JDK … 7 [OK]
flurdy/oracle-java7 Base image containing Oracle’s Java 7 JDK 5 [OK]
davidcaste/debian-oracle-java Oracle Java 8 (and 7) over Debian Jessie 3 [OK]
teradatalabs/centos6-java8-oracle Docker image of CentOS 6 with Oracle JDK 8… 3
publicisworldwide/oracle-core This is the core image based on Oracle Lin… 1 [OK]
spansari/nodejs-oracledb nodejs with oracledb installed globally on… 1
sigma/nimbus-lock-oracle
在这里我们选 sath89/oracle-12c sudo docker pull sath89/oracle-12c. 替换阿里源之后速度还是挺快的,差不多 10 分钟就能下载完成。查看下载的源,一共 5.7G
work@work:~$ sudo docker images;
REPOSITORY TAG IMAGE ID CREATED SIZE
sath89/oracle-12c latest 17cd1ab9d9a7 2 days ago 5.703 GB
kalilinux/kali-linux-docker latest 8ececeaf404d 9 months ago 1.558 GB 复制代码
创建 docker oracle 容器
work@work:~/app$ sudo docker run -it sath89/oracle-12c
Database not initialized. Initializing database.
Starting tnslsnr
Copying database files
1% complete
3% complete
11% complete
18% complete
26% complete
37% complete
Creating and starting Oracle instance
40% complete
45% complete
50% complete
55% complete
56% complete
60% complete
62% complete
Completing Database Creation
66% complete
70% complete
73% complete
85% complete
96% complete
100% complete
Look at the log file “/u01/app/oracle/cfgtoollogs/dbca/xe/xe.log” for further details.
Configuring Apex console
Database initialized. Please visit http://#containeer:8080/em http://#containeer:8080/apex for extra configuration if needed
Starting web management console
PL/SQL procedure successfully completed.
Starting import from ‘/docker-entrypoint-initdb.d’:
found file /docker-entrypoint-initdb.d//docker-entrypoint-initdb.d/*
[IMPORT] /entrypoint.sh: ignoring /docker-entrypoint-initdb.d/*
Import finished
Database ready to use. Enjoy! ;)
容器启动完成,注意使用此镜像创建的 oracle 用户名和密码为:system/oracle, 然后我们使用本地的 sql 工具连接虚拟机的 oracle。
至此,使用 docker 安装 oracle 完成,安装过程简单,非生产环境可以考虑使用。下一节详细说明以下遇到的性能问题及相关的分析思路。
更多 Oracle 相关信息见 Oracle 专题页面 http://www.linuxidc.com/topicnews.aspx?tid=12
本文永久更新链接地址 :http://www.linuxidc.com/Linux/2017-12/149419.htm