演示视频参考: https://www.bilibili.com/video/BV1pr4y1N7jw/
1. 前置环境
-
CentOS7.8
-
Docker
2. 搭建Oracle服务
-
拉取Oracle镜像
docker pull registry.cn-hangzhou.aliyuncs.com/helowin/oracle_11g
-
运行镜像
docker run -p 1521:1521 \ --restart=always \ --name oracle_11g \ -v /opt/oracle_data:/home/oracle/app/oracle/oradata/mydata \ registry.cn-hangzhou.aliyuncs.com/helowin/oracle_11g
-
进入容器设置用户信息
docker exec -it oracle_11g bash
-
切换root用户,密码:helowin
-
配置oracle环境变量
vi /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
刷新配置
source /etc/profile
-
创建建立sqlplus软连接
ln -s $ORACLE_HOME/bin/sqlplus /usr/bin
-
切换到oracle用户
登录sqlplus
sqlplus / as sysdba
修改sys和system用户密码
alter user system identified by 123456; alter user sys identified by 123456; ALTER PROFILE DEFAULT LIMIT PASSWORD_LIFE_TIME UNLIMITED;
-
验证
3. pl/sql developer连接
-
修改tnsnames.ora,添加连接串
ORCL_DOCKER = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.71.148)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = helowin) ) )
-
pl/sql developer连接测试