Linux 上 docker 安装 oracle-xe-11g 记录

本贴最后更新于 2557 天前,其中的信息可能已经物是人非

环境:

2G 内存,60G 硬盘阿里云一台(带宽 1M),配置如下图:
16d6203aa6aa40909b1491d3b312c2c5-2017042309.30.38.png

软件:docker

Docker version 1.6.2, build 7c8fca2

docker 镜像站:https://store.docker.com
视频教程:https://asciinema.org/a/45878(oracle 12c)

步骤

1:在镜像站搜索 oracle,第一页有两个(12c 和 11g) ,12c 太大了,要 3 个 G 且下载时间太长,我下载的是 11g

shell:docker pull wnameless/oracle-xe-11g
7842df3511684d1186a99aa368769cfd-2017042309.42.01.png
可以下载旧版:docker pull wnameless/oracle-xe-11g:14.04.4

2:运行镜像文件

shell:docker run -d -p 49160:22 -p 49161:1521 wnameless/oracle-xe-11g
映射了两个端口出来。
eec2c2c8fa6e46a5aff84b488a6334c5-2017042309.52.51.png
镜像网站上说:Run this, if you want the database to be connected remotely:(远程连接)
得加 ```
-e ORACLE_ALLOW_REMOTE=true

 #### 3:查看这个镜像运行log
 shell:`docker logs -f b97da5ba40541b28b05c4b799761f77aa6284f842ef696c16926bbc14a0d2627`
![6d5f6454a888493cb9a5e7e457c45704-2017042309.55.57.png](https://b3logfile.com/file/2017/4/6d5f6454a888493cb9a5e7e457c45704-2017042309.55.57.png?imageView2/2/w/768/format/jpg/interlace/0/q?imageView2/2/w/768/format/jpg/interlace/0/q?imageView2/2/w/768/format/jpg/interlace/0/q?imageView2/2/w/768/format/jpg/interlace/0/q)  
 #### 4:进入容器
 `Login by SSH :
ssh root@localhost -p 49160`
密码: admin
![aac6c15ca87644aea9fdb80cfc1d3c66-2017042310.11.57.png](https://b3logfile.com/file/2017/4/aac6c15ca87644aea9fdb80cfc1d3c66-2017042310.11.57.png?imageView2/2/w/768/format/jpg/interlace/0/q?imageView2/2/w/768/format/jpg/interlace/0/q?imageView2/2/w/768/format/jpg/interlace/0/q?imageView2/2/w/768/format/jpg/interlace/0/q) 

#### 5:切换用户,连接oracle
shell: `su oracle`
shell: `cd $ORACLE_HOME`
shell: `bin/sqlplus / as sysdba`
![84f824986a6247cf8c4b4d2f5f440ed6-2017042310.18.13.png](https://b3logfile.com/file/2017/4/84f824986a6247cf8c4b4d2f5f440ed6-2017042310.18.13.png?imageView2/2/w/768/format/jpg/interlace/0/q?imageView2/2/w/768/format/jpg/interlace/0/q?imageView2/2/w/768/format/jpg/interlace/0/q?imageView2/2/w/768/format/jpg/interlace/0/q) 

#### 6:测试sql

![51e237ab8cf54faca6eacc50c3b54ff5-2017042310.22.14.png](https://b3logfile.com/file/2017/4/51e237ab8cf54faca6eacc50c3b54ff5-2017042310.22.14.png?imageView2/2/w/768/format/jpg/interlace/0/q?imageView2/2/w/768/format/jpg/interlace/0/q?imageView2/2/w/768/format/jpg/interlace/0/q?imageView2/2/w/768/format/jpg/interlace/0/q) 

#### 7:新建用户
 shell:`create user test identified by 123456`
 shell: `grant dba to test;`

![2ed2c9db544c4feeb18d509d6581ec39.png](https://b3logfile.com/file/2017/4/2ed2c9db544c4feeb18d509d6581ec39.png?imageView2/2/w/768/format/jpg/interlace/0/q?imageView2/2/w/768/format/jpg/interlace/0/q) 

#### 8:新建表空间
shell:`create tablespace TEST datafile '/u01/app/oracle/test/test.dbf' size 100M;`
shell:`create user TEST identified by TEST123 default tablespace TEST;`
如果这个TEST用户在其他表空间已存请先删除
shell:`drop user TEST cascade`
然后给连接,dba权限
shell:`grant connect,resource to TEST;`
shell:`grant dba to TEST;`
  • Docker

    Docker 是一个开源的应用容器引擎,让开发者可以打包他们的应用以及依赖包到一个可移植的容器中,然后发布到任何流行的操作系统上。容器完全使用沙箱机制,几乎没有性能开销,可以很容易地在机器和数据中心中运行。

    476 引用 • 899 回帖
  • Linux

    Linux 是一套免费使用和自由传播的类 Unix 操作系统,是一个基于 POSIX 和 Unix 的多用户、多任务、支持多线程和多 CPU 的操作系统。它能运行主要的 Unix 工具软件、应用程序和网络协议,并支持 32 位和 64 位硬件。Linux 继承了 Unix 以网络为核心的设计思想,是一个性能稳定的多用户网络操作系统。

    915 引用 • 931 回帖
  • Oracle

    Oracle(甲骨文)公司,全称甲骨文股份有限公司(甲骨文软件系统有限公司),是全球最大的企业级软件公司,总部位于美国加利福尼亚州的红木滩。1989 年正式进入中国市场。2013 年,甲骨文已超越 IBM,成为继 Microsoft 后全球第二大软件公司。

    103 引用 • 126 回帖 • 448 关注
  • Shell

    Shell 脚本与 Windows/Dos 下的批处理相似,也就是用各类命令预先放入到一个文件中,方便一次性执行的一个程序文件,主要是方便管理员进行设置或者管理用的。但是它比 Windows 下的批处理更强大,比用其他编程程序编辑的程序效率更高,因为它使用了 Linux/Unix 下的命令。

    122 引用 • 73 回帖

相关帖子

欢迎来到这里!

我们正在构建一个小众社区,大家在这里相互信任,以平等 • 自由 • 奔放的价值观进行分享交流。最终,希望大家能够找到与自己志同道合的伙伴,共同成长。

注册 关于
请输入回帖内容 ...