环境:
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`

#### 4:进入容器
`Login by SSH :
ssh root@localhost -p 49160`
密码: admin

#### 5:切换用户,连接oracle
shell: `su oracle`
shell: `cd $ORACLE_HOME`
shell: `bin/sqlplus / as sysdba`

#### 6:测试sql

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

#### 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;`
欢迎来到这里!
我们正在构建一个小众社区,大家在这里相互信任,以平等 • 自由 • 奔放的价值观进行分享交流。最终,希望大家能够找到与自己志同道合的伙伴,共同成长。
注册 关于