文章目录

  • 一、从Docker Hub或阿里云镜像下载小麦苗上传的镜像文件
  • 二、创建容器并启动数据库
  • 三、尽情使用吧
    • 3.1 数据库使用
    • 3.2 创建数据库(可选)
    • 3.3 EMDC的使用
    • 3.4 使用ssh连接到容器内
    • 3.5 外部客户端连接容器内的数据库

一、从Docker Hub或阿里云镜像下载小麦苗上传的镜像文件

  • 小麦苗的Docker Hub的地址:https://hub.docker.com/u/lhrbest

  • Oracle 11g DB的地址:https://hub.docker.com/repository/docker/lhrbest/oracle_11g_ee_lhr_11.2.0.4/tags?page=1

    [外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-Kp0orYhp-1596083520966)(E:\markdown_jpg\1595594161482.png)]

# 从Docker hub下载,网络不好时,一般比较慢
docker pull lhrbest/oracle_11g_ee_lhr_11.2.0.4:1.0
# 可以选择从阿里云下载,一般比较快
docker pull registry.cn-hangzhou.aliyuncs.com/lhrbest/oracle_11g_ee_lhr_11.2.0.4:1.0
# 从阿里云下载后可以tag成如下形式
docker tag registry.cn-hangzhou.aliyuncs.com/lhrbest/oracle_11g_ee_lhr_11.2.0.4:1.0 lhrbest/oracle_11g_ee_lhr_11.2.0.4:1.0

镜像大概2.95G左右,解压后大约7.6G左右,所以请保留充足的空间。执行过程如下:

[root@lhrdocker ~]# docker search 11.2.0.4 --no-trunc | grep -E "NAME|lhr"
NAME                                          DESCRIPTION                                                                                  STARS               OFFICIAL            AUTOMATED
lhrbest/oracle_11g_ee_lhr_11.2.0.4            Oracle 11g 企业版, 11.2.0.4 ,QQ:646634621,微信公众号:DB宝,作者:小麦苗                                      0
[root@lhrdocker ~]#
[root@docker36 ~]# docker pull registry.cn-hangzhou.aliyuncs.com/lhrbest/oracle_11g_ee_lhr_11.2.0.4:1.0
1.0: Pulling from lhrbest/oracle_11g_ee_lhr_11.2.0.4
5dd797628260: Already exists
ea1a739ab78d: Pull complete
593d06e585fc: Pull complete
Digest: sha256:7a2c2bf264cc9e5b5608deb98abe388c61d8fe2c981ee3475b0d2a38bb1fd8b4
Status: Downloaded newer image for registry.cn-hangzhou.aliyuncs.com/lhrbest/oracle_11g_ee_lhr_11.2.0.4:1.0
registry.cn-hangzhou.aliyuncs.com/lhrbest/oracle_11g_ee_lhr_11.2.0.4:1.0
[root@docker36 ~]# docker tag registry.cn-hangzhou.aliyuncs.com/lhrbest/oracle_11g_ee_lhr_11.2.0.4:1.0  lhrbest/oracle_11g_ee_lhr_11.2.0.4:1.0
[root@docker36 ~]# docker images | grep 11.2.0.4
lhrbest/oracle_11g_ee_lhr_11.2.0.4                                       1.0                 18261f9fdcf0        43 minutes ago      7.61GB
registry.cn-hangzhou.aliyuncs.com/lhrbest/oracle_11g_ee_lhr_11.2.0.4     1.0                 18261f9fdcf0        43 minutes ago      7.61GB

二、创建容器并启动数据库

 # 创建容器
docker run -itd --name lhrora11204 -h lhrora11204 --privileged=true -p 1521:1521 -p 222:22  -p 1158:1158 lhrbest/oracle_11g_ee_lhr_11.2.0.4:1.0 init# 进入容器
docker exec -it lhrora11204 bash# 启动数据库和监听
su - oracle
lsnrctl start
sqlplus / as sysdba
startup
exit# 启动EM
emctl start dbconsole

执行过程:

[root@docker36 ~]# docker exec -it lhrora11204 bash
[root@lhrora11204 /]#
[root@lhrora11204 /]# su - oracle
[oracle@lhrora11204 ~]$
[oracle@lhrora11204 ~]$ lsnrctl startLSNRCTL for Linux: Version 11.2.0.4.0 - Production on 24-JUL-2020 09:20:41Copyright (c) 1991, 2013, Oracle.  All rights reserved.Starting /u01/app/oracle/product/11.2.0.4/dbhome_1/bin/tnslsnr: please wait...TNSLSNR for Linux: Version 11.2.0.4.0 - Production
System parameter file is /u01/app/oracle/product/11.2.0.4/dbhome_1/network/admin/listener.ora
Log messages written to /u01/app/oracle/diag/tnslsnr/lhrora11204/listener/alert/log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=lhrora11204)(PORT=1521)))Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 11.2.0.4.0 - Production
Start Date                24-JUL-2020 09:20:41
Uptime                    0 days 0 hr. 0 min. 0 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /u01/app/oracle/product/11.2.0.4/dbhome_1/network/admin/listener.ora
Listener Log File         /u01/app/oracle/diag/tnslsnr/lhrora11204/listener/alert/log.xml
Listening Endpoints Summary...(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=lhrora11204)(PORT=1521)))
The listener supports no services
The command completed successfully[oracle@lhrora11204 ~]$ sasSQL*Plus: Release 11.2.0.4.0 Production on Fri Jul 24 09:20:50 2020Copyright (c) 1982, 2013, Oracle.  All rights reserved.Connected to an idle instance.SYS@LHR11G> startup
ORACLE instance started.Total System Global Area  325685248 bytes
Fixed Size                  2252944 bytes
Variable Size             188747632 bytes
Database Buffers          130023424 bytes
Redo Buffers                4661248 bytes
Database mounted.
Database opened.
SYS@LHR11G>
SYS@LHR11G> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options[oracle@lhrora11204 ~]$ emctl status dbconsole
Oracle Enterprise Manager 11g Database Control Release 11.2.0.4.0
Copyright (c) 1996, 2013 Oracle Corporation.  All rights reserved.
https://lhrora11204:1158/em/console/aboutApplication
Oracle Enterprise Manager 11g is not running.
------------------------------------------------------------------
Logs are generated in directory /u01/app/oracle/product/11.2.0.4/dbhome_1/lhrora11204_LHR11G/sysman/log
[oracle@lhrora11204 ~]$ emctl start dbconsole
Oracle Enterprise Manager 11g Database Control Release 11.2.0.4.0
Copyright (c) 1996, 2013 Oracle Corporation.  All rights reserved.
https://lhrora11204:1158/em/console/aboutApplication
Starting Oracle Enterprise Manager 11g Database Control ...... started.
------------------------------------------------------------------
Logs are generated in directory /u01/app/oracle/product/11.2.0.4/dbhome_1/lhrora11204_LHR11G/sysman/log
[oracle@lhrora11204 ~]$ emctl status dbconsole
Oracle Enterprise Manager 11g Database Control Release 11.2.0.4.0
Copyright (c) 1996, 2013 Oracle Corporation.  All rights reserved.
https://lhrora11204:1158/em/console/aboutApplication
Oracle Enterprise Manager 11g is running.
------------------------------------------------------------------
Logs are generated in directory /u01/app/oracle/product/11.2.0.4/dbhome_1/lhrora11204_LHR11G/sysman/log

三、尽情使用吧

3.1 数据库使用

[oracle@lhrora11204 ~]$ lsnrctl statusLSNRCTL for Linux: Version 11.2.0.4.0 - Production on 24-JUL-2020 09:23:08Copyright (c) 1991, 2013, Oracle.  All rights reserved.Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 11.2.0.4.0 - Production
Start Date                24-JUL-2020 09:20:41
Uptime                    0 days 0 hr. 2 min. 26 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /u01/app/oracle/product/11.2.0.4/dbhome_1/network/admin/listener.ora
Listener Log File         /u01/app/oracle/diag/tnslsnr/lhrora11204/listener/alert/log.xml
Listening Endpoints Summary...(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=lhrora11204)(PORT=1521)))
Services Summary...
Service "LHR11G" has 1 instance(s).Instance "LHR11G", status READY, has 1 handler(s) for this service...
Service "LHR11GXDB" has 1 instance(s).Instance "LHR11G", status READY, has 1 handler(s) for this service...
The command completed successfully
[oracle@lhrora11204 ~]$ sasSQL*Plus: Release 11.2.0.4.0 Production on Fri Jul 24 09:23:10 2020Copyright (c) 1982, 2013, Oracle.  All rights reserved.Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing optionsSYS@LHR11G> select * from v$version;BANNER
-------------------------------------------------------------------------------
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
PL/SQL Release 11.2.0.4.0 - Production
CORE    11.2.0.4.0      Production
TNS for Linux: Version 11.2.0.4.0 - Production
NLSRTL Version 11.2.0.4.0 - ProductionSYS@LHR11G> select * from v$tablespace;TS# NAME        INCLUD BIGFIL FLASHB ENCRYP
---------- ----------- ------ ------ ------ ------0 SYSTEM      YES    NO     YES1 SYSAUX      YES    NO     YES2 UNDOTBS1    YES    NO     YES4 USERS       YES    NO     YES3 TEMP        NO     NO     YES6 EXAMPLE     YES    NO     YES6 rows selected.SYS@LHR11G>

3.2 创建数据库(可选)

我们也可以自己创建自己需要的数据库,如下所示,

dbca -silent -createDatabase -templateName General_Purpose.dbc -responseFile NO_VALUE \
-gdbname LHR11G2  -sid LHR11G2 \
-sysPassword lhr -systemPassword lhr \
-datafileDestination '/u01/app/oracle/oradata' \
-recoveryAreaDestination '/u01/app/oracle/flash_recovery_area' \
-storageType FS \
-characterset AL32UTF8 -nationalCharacterSet AL16UTF16 \
-sampleSchema true \
-totalMemory 300 \
-databaseType OLTP  \
-emConfiguration NONE

3.3 EMDC的使用

该镜像已经创建好了EMDC (Enterprise Manager Database Control) 了, 所以,可以直接访问,地址为:https://192.168.1.36:1158/em ,sys用户密码为lhr

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-L2mjt6pJ-1596083520969)(E:\markdown_jpg\1595582856573.png)]

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-E2QyS5R3-1596083520973)(E:\markdown_jpg\1595582908536.png)]

3.4 使用ssh连接到容器内

C:\Users\lhrxxt>ssh root@192.168.1.36 -p222
The authenticity of host '[192.168.1.36]:222 ([192.168.1.36]:222)' can't be established.
RSA key fingerprint is SHA256:KCuMsxiuP493oXTYB6R3VNl2BXBEl9Hf9EYtmsAjOEE.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '[192.168.1.36]:222' (RSA) to the list of known hosts.
root@192.168.1.36's password:
Last login: Mon Jul 13 02:59:40 2020 from 172.17.0.1
[root@lhrora11204 ~]#  ps -ef|grep pmon
oracle     1574      0  0 09:20 ?        00:00:00 ora_pmon_LHR11G
root       3882   3856  0 09:28 pts/3    00:00:00 grep pmon

3.5 外部客户端连接容器内的数据库

我们可以在容器外部通过sqlplus或其他工具连接容器内的数据库:

C:\Users\lhrxxt>sqlplus sys/lhr@192.168.1.36/LHR11G AS SYSDBASQL*Plus: Release 12.1.0.2.0 Production on Fri Jul 24 17:29:46 2020Copyright (c) 1982, 2014, Oracle.  All rights reserved.Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing optionsSYS@192.168.1.36/LHR11G>

如果使用PLSQL Developer也是可以连接的,如下:

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-7VnVctO6-1596083520978)(E:\markdown_jpg\1595583097887.png)]

怎么样,是不是很爽,是不是非常方便呢,文末记得点赞哈。

——————————————————————————————————————————

【干货来了|小麦苗IT资料分享】
★小麦苗DB职场干货:https://mp.weixin.qq.com/s/Vm5PqNcDcITkOr9cQg6T7w
★小麦苗数据库健康检查:https://share.weiyun.com/5lb2U2M
★小麦苗微店:https://weidian.com/s/793741433?wfr=c&ifr=shopdetail
★各种操作系统下的数据库安装文件(Linux、Windows、AIX等):https://pan.baidu.com/s/19yJdUQhGz2hTgozb9ATdAw 提取码:4xpv
★小麦苗分享的资料:https://share.weiyun.com/57HUxNi
★小麦苗课堂资料:https://share.weiyun.com/5fAdN5m
★小麦苗课堂试听资料:https://share.weiyun.com/5HnQEuL
★小麦苗出版的相关书籍:https://share.weiyun.com/5sQBQpY
★小麦苗博客文章:https://share.weiyun.com/5ufi4Dx
★数据库系列(Oracle、MySQL、NoSQL):https://share.weiyun.com/5n1u8gv
★公开课录像文件:https://share.weiyun.com/5yd7ukG
★其它常用软件分享:https://share.weiyun.com/53BlaHX
★其它IT资料(OS、网络、存储等):https://share.weiyun.com/5Mn6ESi
★Python资料:https://share.weiyun.com/5iuQ2Fn
★已安装配置好的虚拟机:https://share.weiyun.com/5E8pxvT
——————————————————————————————————————————

About Me
——————————————————————————————————————————
● 本文作者:小麦苗,部分内容整理自网络,若有侵权请联系小麦苗删除
● 《数据库笔试面试宝典》作者
● OCP、OCM、高可用(RAC+DG+OGG)网络班开讲啦,有需要的小伙伴可以私聊我
● 本文在itpub、博客园、CSDN和个人微信公众号( xiaomaimiaolhr)上有同步更新
● 本文itpub地址: http://blog.itpub.net/26736162
● 本文博客园地址: http://www.cnblogs.com/lhrbest
● 本文CSDN地址: https://blog.csdn.net/lihuarongaini
● 本文pdf版、个人简介及小麦苗云盘地址: http://blog.itpub.net/26736162/viewspace-1624453/
● 数据库笔试面试题库及解答: http://blog.itpub.net/26736162/viewspace-2134706/
● DBA宝典今日头条号地址: http://www.toutiao.com/c/user/6401772890/#mid=1564638659405826
——————————————————————————————————————————
● QQ群号: 230161599 、618766405
● 微信群:可加我微信,我拉大家进群,非诚勿扰
● 联系我请加QQ好友 ( 646634621 ),注明添加缘由
● 于 2019-10-01 06:00 ~ 2019-10-31 24:00 在西安完成
● 最新修改时间:2019-10-01 06:00 ~ 2019-10-31 24:00
● 文章内容来源于小麦苗的学习笔记,部分整理自网络,若有侵权或不当之处还请谅解
● 版权所有,欢迎分享本文,转载请保留出处
——————————————————————————————————————————
●小麦苗的微店: https://weidian.com/s/793741433?wfr=c&ifr=shopdetail
●小麦苗出版的数据库类丛书: http://blog.itpub.net/26736162/viewspace-2142121/
●小麦苗OCP、OCM、高可用网络班: http://blog.itpub.net/26736162/viewspace-2148098/
●小麦苗腾讯课堂主页: https://lhr.ke.qq.com/
——————————————————————————————————————————
使用微信客户端扫描下面的二维码来关注小麦苗的微信公众号( xiaomaimiaolhr)
及QQ群(DBA宝典)、添加小麦苗微信, 学习最实用的数据库技术。

——————————————————————————————————————————

【DB宝14】在Docker中只需2步即可拥有Oracle 11g企业版环境(11.2.0.4)相关推荐

  1. 【DB宝4】只需2步即可拥有Oracle19c的ASM+DB环境

    [DB宝4]只需2步即可拥有Oracle19c的ASM+DB环境 文章目录 目录 一.从Docker Hub下载小麦苗上传的镜像 二.创建容器 三.尽情使用吧 3.1 数据库使用示例: 3.2 在外部 ...

  2. 易信推专线电话 通话双方中只需一方安装即可免费通话

    上周微信电话本着实火了一把,通话双方都下载此APP并开通免费通话功能就能使用微信电话本拨打免费网络电话.这个相对有些局限性,易信就抓住这一点于昨日高调发布了3.0预览版,新版本首次新增了专线电话功能, ...

  3. android app在线商城,ECMobile:只需一步即可生成iOS或Android原生APP商城应用

    App 快速开发服务已经屡见不鲜,国内有简网 App 工场.道有道.ECMobile这么简洁--你只需将一个集成过的文件夹放进ECShop(一款被广泛使用的开源 B2C 网店)安装根目录,无需任何配置 ...

  4. android生成ios程序,ECMobile:只需一步即可生成iOS或Android原生APP商城应用

    App 快速开发服务已经屡见不鲜,国内有简网 App 工场.道有道.ECMobile这么简洁--你只需将一个集成过的文件夹放进ECShop(一款被广泛使用的开源 B2C 网店)安装根目录,无需任何配置 ...

  5. 负载均衡服务器可以说虚拟机吗,配置网络负载均衡只需十步即可完成

    不知道作为一名软件研发者,你配置一个网络负载均衡需要多久的时间,你是否在犹豫哪一步应该怎样做?哪一步应该怎样配置?不妨直说,小编完成这项工作只需要十步就可以完成了.如果想知道小编是怎样做到的吗?那就请 ...

  6. pdf如何转word?只需两步即可完成在线pdf转word

    pdf格式文档良好的阅读性以及便捷性,使得其得到了越来越广泛的使用,但是如果我们想要对其中的某些内容进行二次编辑的时候就比较不方便了,需要先将pdf转word后再使用,那么pdf如何转word呢?今天 ...

  7. 电脑计算机音乐删了怎么找回,电脑中误删除的音乐文件如何恢复?只需五步即可搞定!...

    当我们宅在家里做家务时,或者是坐车无聊时,我们都会打开手机上的音乐软件,播放音乐听听歌曲,来让劳动或无聊的时间变得更加轻松.快乐. 而有的人喜欢用手机听歌,而有的人喜欢用电脑听歌,如果使用电脑听歌的话 ...

  8. JDK安装配置-只需两步即可(附jdk安装包,win10系统)

    一.JDK安装(欢迎来到Java世界) (一).下载JDK JDK:Java SE Development Kit(Java SE开发工具包) JDK版本更新太快,但是几乎没有公司直接使用最新JDK做 ...

  9. 无法启动游戏 因为计算机,WeGame只需五步即可解决游戏无法启动的问题!

    对于平时有事儿没事儿都爱玩游戏的小伙伴们来说,想必WeGame大家一定都不陌生.它是一款腾讯发布的游戏平台,有点类似于Steam,在WeGame游戏平台中,拥有种类繁多的游戏,比如目前比较热门的使命召 ...

最新文章

  1. 智慧停车介绍、产业链市场全透析
  2. 接口测试--version2
  3. 2021-04-29 Python绘制柱状图之可视化神器Pyecharts
  4. HTML和CSS进阶
  5. 《Java多线程编程核心技术》读书笔记
  6. 利用计算机进行信息检索,用计算机进行情报检索属于计算机应用中的
  7. 简化企业CMMI5认证过程?
  8. 网易云参数解析(多图)
  9. 孩子学python_教孩子学编程 Python
  10. Linux如何查看端口
  11. 如何使用cpolar内网穿透群晖NAS套件
  12. RegistryKey类的学习(转载)
  13. 佳文分享:CAP定理
  14. php zen kaku代表什么,Convert kana one from another (zen-kaku, han-kaku and more) - PHP 7 中文文档...
  15. 图片转文字软件哪个好用?建议收藏这几款软件
  16. 基于stm32f4的按键检测
  17. 【Unity XR】Unity开发OpenXR
  18. c vscode 高亮,vscode设置代码字体颜色高亮_编程开发工具
  19. keystore导出p12,cer,crt,.key.pem证书文件格式
  20. anti-debug你必须知道的基础篇 All in one

热门文章

  1. plantuml样式_PlantUML之活动图
  2. R_数据视觉化处理_初阶_02
  3. 本地blast详细用法
  4. 一度智信:拼多多店铺怎么盈利
  5. SolidWorks二次开发-关于录制宏保存的格式
  6. 小米手机 miui 8.x开启开发者模式指导
  7. 构建安全新模式,零信任如何破局 ?
  8. wpf 字体模糊_WPF Effect 造成的字体模糊
  9. Makdown编辑器哪个好
  10. Java 给Word指定字符串添加批注