Oracle-Docker
参考
https://www.hangge.com/blog/cache/detail_2797.html
安装步骤
拉取镜像
1 | docker pull registry.cn-hangzhou.aliyuncs.com/helowin/oracle_11g |
默认配置运行
1 | docker run -d -p 1521:1521 --name oracle11g registry.cn-hangzhou.aliyuncs.com/helowin/oracle_11g |
自定义配置运行「不推荐」
创建
docker/oracle11g
目录,拷贝容器数据目录到本地1
docker container cp oracle11g:/home/oracle/app/oracle/oradata study/docker/oracle11g
启动
1
docker run -d -p 1521:1521 --name oracle11g registry.cn-hangzhou.aliyuncs.com/helowin/oracle_11g -v /Users/mac126/study/docker/oracle11g/oradata/helowin:/home/oracle/app/oracle/oradata/helowin
配置客户端
进入 oracle 的命令环境
1
docker exec -it oracle11g bash
切换到 oracle 数据库的 root 用户下(原密码为:helowin,修改为 123456)
1
2
3
4su root
#修改 root 密码
passwd编辑 profile 文件,在末尾处添加如下 ORACLE 环境变量参数后保存退出「SID 不做修改」
1
2
3
4
5vi /etc/profile
export ORACLE_HOME=/home/oracle/app/oracle/product/11.2.0/dbhome_2
export ORACLE_SID=helowin
export PATH=$ORACLE_HOME/bin:$PATH创建软连接
1
ln -s $ORACLE_HOME/bin/sqlplus /usr/bin
切换到 oracle 用户
1
su - oracle
登录 sqlplus
1
2sqlplus /nolog
conn /as sysdba连接测试「SID 为 helowin」
使用
1 | docker exec -it oracle11g bash |
本博客所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来自 王文哲的博客!