docker安装oracle11gR2

如果还没安装docker,可查看Linux下安装与卸载docker笔记

1、拉取 docker 镜像:

命令:docker pull registry.cn-hangzhou.aliyuncs.com/helowin/oracle_11g
 
该镜像由阿里云提供,比较大,可能需要下载一会,等待下载即可。

2、查看 docker 镜像:

命令:docker images

然后运行镜像:docker run -d -p 1521:1521 --name oracle registry.aliyuncs.com/helowin/oracle_11g

3、进入容器修改账户密码

3.1 检查容器是否运行成功

命令:docker ps
启动orcle:docker start oracle (oracle也可以写成容器的id)

3.2 进入容器

命令:docker exec -it oracle bash

3.3 切换回root用户

直接退出:exit

3.4 编辑环境变量 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

注意:按i进入编辑模式,输入上述命令后,按ESC键退出编辑模式,再输入:wq保存退出

3.5 使得修改生效

命令:source /etc/profile

3.6 进入容器(此处的id就是第一个命令下的id),加载一下用户环境变量,进入容器后,自动是oracle用户

3.6.1 进入容器

命令:docker ps
      docker exec -it  容器id   /bin/bash

3.6.2 加载用户环境变量

命令: source ~/.bash_profile

3.6.3 oracle用户修改密码

使用sysdba 连接oracle
命令:sqlplus /nolog
      conn /as sysdba
 
连接成功后,修改system用户的密码
命令:alter user system identified by system;(修改密码为system)
     alter user sys identified by sys;(修改密码为sys)
 
退出编辑sql命令:exit

4、连接账号:system,密码:system,服务名:helowin

这里我选择plsql进行连接oracle
 

以上为本人自己记录的笔记,参考文章地址:https://blog.csdn.net/u014069688/article/details/100533501



猜你喜欢

转载自www.cnblogs.com/pingpinghua/p/12191054.html