docker安裝oracle


       最近工作上面遇到一個性能相關的問題,大體描述一下: 批量任務執行的過程中導致數據庫sql執行時間過長,查看之后是由於批量任務占滿數據庫連接池導致的,至於為什么批量任務會不受系統控制導致連接池占滿就不說了,感覺是公司內部機密。為了能夠在自己的博客里面記錄這個過程,博主想在自己的ubuntu上安裝一個oracle,但是下載下來之后發現ubuntu安裝oracle會出現各種問題,而且網上解決方案比較少,所以打算使用docker安裝,順便復習一下自己docker的操作。

  首先系統中應該存在docker這個運用程序,安裝可以使用命令:sudo apt-get install docker.

  安裝完成之后最好是將docker的源修改一下,修改為阿里大佬的源,講道理比docker官方的源強100倍。詳情請參考http://blog.csdn.net/bwlab/article/details/50542261

  搜索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                                                            0                    [OK]

  在這里我們選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完成,安裝過程簡單,非生產環境可以考慮使用。下一節詳細說明以下遇到的性能問題及相關的分析思路。


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM