【愚公系列】2022 年 03 月 Docker 容器 Oracle 的搭建
前言
oracle 作为一个重量级的大型关系型数据库、在各行各业的使用中都是很常见的、但是 oracle 配置异常麻烦、使用过 oracle 的工程师应该都有体会、特别是在 liunx 中配置,遇到的坑数不胜数、本文介绍 oracle 在 Docker 环境下的安装减少本机配置的麻烦。
一、Oracle 的搭建
1.拉取镜像
复制代码
本文以 oracle_11g 版本为例

二、Oracle 旧版本兼容配置
如果不兼容旧版本,启动 oracle 容器会报 Exited 139 错误,解决方案如下:1.在这个 %userprofile%文件夹下创建一个.wslconfig 文件

文件内容如下:
复制代码
上面文件创建好之后
在 cmd 中执行wsl --shutdown
重启 docker desktop
三、Oracle 的配置
1.启动 oracle
复制代码
参数说明:
-d
后台进程运行--name
容器名称-p
port:port 本地端口:容器端口

启动完成之后,使用:docker ps 查看程序运行情况。

2.进入镜像进行配置
进入镜像进行配置
复制代码

3.切换到 root 用户下进行配置
复制代码
密码:helowin

4.编辑 profile 文件配置 ORACLE 环境变量
复制代码
最后添加以下 3 行配置
复制代码
保存 ::wq
让配置生效:source /etc/profile
5.创建软连接
复制代码
6.切换到 oracle 用户
复制代码
7.登录 sqlplus 并修改 sys、system 用户密码
复制代码

8.修改 sys、system 用户密码并刷新权限
复制代码

退出:exit;
9.查看一下 oracle 实例状态
复制代码

10.用 nacivat 连接 oracle 数据库
服务名:helowin(一定要填写 helowin)密码:oracle(第 12 步设置的密码)

版权声明: 本文为 InfoQ 作者【愚公搬代码】的原创文章。
原文链接:【http://xie.infoq.cn/article/74b70d6b694edea55a3d9ce20】。文章转载请联系作者。
评论