docker启动oracle

作者: 净土_0342 | 来源:发表于2019-08-14 23:08 被阅读0次

    1、切换到root账号下,如果是普通账号,下面操作指令前面加sudo

    2.搜索oracle镜像

    docker search oracle

    3.下载oracle镜像

    docker pull registry.cn-hangzhou.aliyuncs.com/qida/oracle-xe-11g

    4.查看镜像

    docker images

    docker images registry.cn-hangzhou.aliyuncs.com/qida/oracle-xe-11g

    img

    5.从下载的镜像创建并启动容器

    docker run -d -p 1521:1521 --name oracle registry.cn-hangzhou.aliyuncs.com/qida/oracle-xe-11g

    这里把新建的容器命名为oracle,并且是做了-d的端口映射的。

    6.查看当前运行的容器

    docker ps

    img

    7.进入已经启动的Oracle的容器

    docker exec -it oracle bash

    img

    8.加载环境变量

    source /home/oracle/.bash_profile

    9.进入sqlplus

    sqlplus /nolog

    img

    10.使用sysdba角色登录sqlplus

    conn sys/oracle as sysdba

    img

    11.查看当前实例下的数据库

    select name from v$database;
    
    img

    12.查看有多少个数据表

    img

    13.退出sqlplus

    exit

    14.退出容器

    exit 或Ctrl+D

    15.重新进入已经运行的oracle容器,重新执行下面指令

    docker exec -it oracle11 bash

    16.如果容器停用了,则重新启动, 用你实际的容器ID代替下面的container_ID

    docker start container_ID

    17.停用正在运行的容器

    docker stop container_ID

    1. 解锁scott用户

      SQL> alter user scott account unlock;
      User altered.
      SQL> commit;
      Commit complete.
      SQL> conn scott/tiger
      ERROR:
      ORA-28001: the password has expired
      Changing password for scott
      New password:
      Retype new password:
      Password changed
      Connected.
      SQL> 
      
    2. 新增用户

      sql> create user test identified by test;
      sql> grant connect,resource,dba to test;
      

      注意用docker安装的oracle实例名为:helowin,就是下图的sid。

    3. 使用dataGrip连接oracle数据库

    数据库安装完成后,使用默认的sid为helowin,端口为1521,scott/tiger即可连接

    image.png

    转载自:https://www.cnblogs.com/SH170706/p/10563899.html

    相关文章

      网友评论

        本文标题:docker启动oracle

        本文链接:https://www.haomeiwen.com/subject/yzpojctx.html