docker安装和配置oracle11G

1. 开始拉取镜像-执行命令:

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

下载的过程少长,等待吧,喝杯咖啡,休息一会!(镜像6.8G)

下载完成后 查看镜像: docker images

2. 创建容器

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

这里说一下,命令后面的地址一定要是你下载的镜像地址也就是你拉取镜像名字,否则会出现名字已存在等问题!

如果创建成功能会返回容器id

3. 启动容器

  docker start oracle11g

进入镜像进行配置

 docker exec -it oracle11g bash

切换到root 用户下

   su root
  密码:helowin

注意这里还是在容器当中。。有朋友退去了。。。。。。。

4. 编辑profile文件配置ORACLE环境变量

在docker中查找并编辑profile文件 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

在最后加上

保存并退出 :wq

5. oracle的配置

1. 创建软连接

  ln -s $ORACLE_HOME/bin/sqlplus /usr/bin

2. 切换到oracle 用户

这里还要说一下,一定要写中间的 - 必须要,否则软连接无效

6. oracle数据库的操作

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

  sqlplus /nolog
  conn /as sysdba

2. 修改和创建用户

接着执行下面命令

    alter user system identified by system;

    alter user sys identified by sys;

    也可以创建用户  create user test identified by test;

   并给用户赋予权限  grant connect,resource,dba to test;

3. scott用户的开启

  --解锁scott用户(安装时若使用默认情况没有解锁和设置密码进行下列操作,要超级管理员操作)
  alter user scott account unlock;

  --解锁scott用户的密码【此句也可以用来重置密码】
  alter user scott identified by tiger;

7. navicat连接

打开navicat后(navicat12不用配置oci.dll文件了)

直接新建连接

原文地址:https://www.cnblogs.com/laoluoits/p/13942119.html