环境:
2G 内存,60G 硬盘阿里云一台(带宽 1M),配置如下图:
软件:docker
Docker version 1.6.2, build 7c8fca2
相关 link
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
可以下载旧版:docker pull wnameless/oracle-xe-11g:14.04.4
2:运行镜像文件
shell:docker run -d -p 49160:22 -p 49161:1521 wnameless/oracle-xe-11g
映射了两个端口出来。
镜像网站上说: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;`
欢迎来到这里!
我们正在构建一个小众社区,大家在这里相互信任,以平等 • 自由 • 奔放的价值观进行分享交流。最终,希望大家能够找到与自己志同道合的伙伴,共同成长。
注册 关于