Docker--拉取oracle11g镜像

拉取镜像

docker pull registry.cn-hangzhou.aliyuncs.com/helowin/oracle_11g

查看镜像

docker images

在这里插入图片描述

启动容器

docker run -d -p 1521:1521 --name oracle11g registry.cn-hangzhou.aliyuncs.com/helowin/oracle_11g

进入镜像配置

docker exec -it oracle bash

进行软连接:

sqlplus /nolog

发现没有这个命令:

切换到root用户下:

su root  

密码:helowin

编辑profile文件配置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

刷新profile

source profile

切换到oracle用户:

su - oracle

登录sqlplus并修改sys、system用户密码:

sqlplus /nolog

conn /as sysdba

修改密码:

alter user system identified by system;

alter user sys identified by sys;

注意:如果修改密码时提示数据库没有打开:(database not open)
输入:

alter database open;

如果提示(database not mounted)
输入:

alter database mount;

最后刷新表:

ALTER PROFILE DEFAULT LIMIT PASSWORD_LIFE_TIME UNLIMITED;

使用Navicat连接

首先查看oracle 的 lsnrctl 服务:

在这里插入图片描述

随便选一个填入:服务名字段
在这里插入图片描述

即可连接成功。

发布了750 篇原创文章 · 获赞 2115 · 访问量 26万+

猜你喜欢

转载自blog.csdn.net/cold___play/article/details/104279740
今日推荐