设为首页 收藏本站
云服务器等爆品抢先购,低至4.2元/月
查看: 2738|回复: 3

[经验分享] 利用Docker快速部署Oracle环境

[复制链接]
累计签到:1 天
连续签到:1 天
发表于 2017-3-14 14:08:38 | 显示全部楼层 |阅读模式
                      工作中需要频繁使用Oracle环境,但是每次搭建起来比较消耗时间,本想通过虚拟机模板的方式来快速安装oracle vm,但是每次改ip等环境也很耗时,因此想到docker中有没有已经做好的images,这样就能快速获得Oracle环境。
  root@- rac1:docker search oracle
  INDEX NAME DESCRIPTION STARS OFFICIAL AUTOMATED
  docker.io docker.io/wnameless/oracle-xe-11g Oracle Express 11g R2 on Ubuntu 16.04 LTS 417 [OK]
  docker.io docker.io/oraclelinux Oracle Linux is an open-source operating s... 304 [OK]
  docker.io docker.io/alexeiled/docker-oracle-xe-11g This is a working (hopefully) Oracle XE 11... 203 [OK]
  docker.io docker.io/sath89/oracle-12c Oracle Standard Edition 12c Release 1 with... 112 [OK]
  docker.io docker.io/sath89/oracle-xe-11g Oracle xe 11g with database files mount su... 91 [OK]
  docker.io docker.io/isuper/java-oracle This repository contains all java releases... 52 [OK]
  docker.io docker.io/jaspeen/oracle-11g Docker image for Oracle 11g database 38 [OK]
  docker.io docker.io/oracle/oraclelinux Oracle Linux is an open-source operating s... 34 [OK]
  docker.io docker.io/ingensi/oracle-jdk Official Oracle JDK installed on centos. 20 [OK]
  docker.io docker.io/airdock/oracle-jdk Docker Image for Oracle Java SDK (8 and 7)... 16 [OK]
  docker.io docker.io/oracle/openjdk Docker images containing OpenJDK Oracle Linux 15 [OK]
  docker.io docker.io/cogniteev/oracle-java Oracle JDK 6, 7, 8, and 9 based on Ubuntu ... 12 [OK]
  docker.io docker.io/n3ziniuka5/ubuntu-oracle-jdk Ubuntu with Oracle JDK. Check tags for ver... 12 [OK]
  docker.io docker.io/andreptb/oracle-java Debian Jessie based image with Oracle JDK ... 8 [OK]
  docker.io docker.io/oracle/glassfish GlassFish Java EE Application Server on Or... 8 [OK]
  docker.io docker.io/oracle/nosql Oracle NoSQL on a Docker Image with Oracle... 7 [OK]
  docker.io docker.io/infogene/oracle Image for running Oracle Database 11g Stan... 6 [OK]
  docker.io docker.io/openweb/oracle-tomcat A fork off of Official tomcat image with O... 5 [OK]
  docker.io docker.io/flurdy/oracle-java7 Base image containing Oracle's Java 7 JDK 4 [OK]
  docker.io docker.io/jtech/oracle-jdk A Docker image based on the smallest Linux... 3 [OK]
  docker.io docker.io/davidcaste/debian-oracle-java Oracle Java 8 (and 7) over Debian Jessie 2 [OK]
  docker.io docker.io/kaluzki/oracle kaluzki/oracle 2 [OK]
  docker.io docker.io/clincase/oracle clincase oracle db server image 1 [OK]
  docker.io docker.io/jckrz/debian-oracle-jdk Vanilla Debian + Oracle JDK 1 [OK]
  docker.io docker.io/publicisworldwide/oracle-core This is the core image based on Oracle Lin... 1 [OK]
  可以看到有很多版本,11g,12c
  
  这里选择获取12c版本
  root@- rac1:/home/# docker pull sath89/oracle-12c
  Using default tag: latest
  latest: Pulling from sath89/oracle-12c
  863735b9fd15: Pull complete  
  4fbaa2f403df: Pull complete  
  faadd00cf98e: Downloading [=======>                                           ] 394.8 MB/2.768 GB
  829e2e754405: Download complete  
  
  root@- rac1:/home/# docker images
  REPOSITORY TAG IMAGE ID CREATED SIZE
  docker.io/sath89/oracle-12c latest b8bf52883bc7 5 weeks ago 5.692 GB
  
  使用刚刚下载下来的12g image创建一个container,并运行其上的oracle数据库
  docker run -d -p 8080:8080 -p 1521:1521 -v /my/oracle/data:/u01/app/oracle sath89/oracle-12c
  
  [iyunv@-rac1 ~]# docker logs -f ffbeb07058449672c640ddb4e59b8376dae2e3b4dd54142871da7adbc069ee79
  ls: cannot access /u01/app/oracle/oradata: No such file or directory
  Database not initialized. Initializing database.
  Starting tnslsnr
  Copying database files
  1% complete
  37% complete
  Creating and starting Oracle instance
  40% complete
  45% complete
  62% complete
  Completing Database Creation
  66% 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实例就已经启动好了
  
  可以看到创建的container已经在运行中
  [iyunv@-rac1 ~]~$ docker ps
  CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS                                            NAMES
  9e893d773494        sath89/oracle-12c   "/entrypoint.sh "   15 minutes ago      Up 15 minutes       0.0.0.0:1521->1521/tcp, 0.0.0.0:8080->8080/tcp   clever_chandrasekhar
  进入oracle container
  [iyunv@-rac1 ~]~$ docker exec -it 9e893d773494 /bin/bash
  
  root@9e893d773494:/# su oracle
  oracle@9e893d773494:~$ $ORACLE_HOME/bin/sqlplus / as sysdba
  SQL*Plus: Release 12.1.0.2.0 Production on Fri Feb 24 03:03:00 2017
  Copyright (c) 1982, 2014, Oracle.  All rights reserved.
  SQL>
  Oracle 使用的实例名,用户名,密码如下
  ---------------------------------------------
  hostname: localhost
  port: 1521
  sid: xe
  username: system
  password: oracle
  ---------------------------------------------
  接下来就可以快速使用Oracle12C了
                  


运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-351245-1-1.html 上篇帖子: CentOS 64(位)docker安装与启动 下篇帖子: docker私有仓库 Oracle
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表