数据库
首页 > 数据库> > Docker快速搭建Oracle服务

Docker快速搭建Oracle服务

作者:互联网

演示视频参考: https://www.bilibili.com/video/BV1pr4y1N7jw/

1. 前置环境

  1. CentOS7.8

  2. Docker

2. 搭建Oracle服务

  1. 拉取Oracle镜像

    docker pull registry.cn-hangzhou.aliyuncs.com/helowin/oracle_11g
    
  2. 运行镜像

    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
    
  3. 进入容器设置用户信息

    docker exec -it oracle_11g bash
    
  4. 切换root用户,密码:helowin

  5. 配置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
    
  6. 创建建立sqlplus软连接

    ln -s $ORACLE_HOME/bin/sqlplus /usr/bin
    
  7. 切换到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;
    
  8. 验证

3. pl/sql developer连接

  1. 修改tnsnames.ora,添加连接串

    ORCL_DOCKER =
      (DESCRIPTION =
        (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.71.148)(PORT = 1521))
        (CONNECT_DATA =
          (SERVER = DEDICATED)
          (SERVICE_NAME = helowin)
        )
      )
    
  2. pl/sql developer连接测试

标签:bin,11g,helowin,oracle,sqlplus,ORACLE,Oracle,Docker,搭建
来源: https://blog.csdn.net/m0_37613503/article/details/113837027