CentOS 7.7 1908 使用 Docker 创建多个 Oracle 11g

相关文档:
CentOS 7.7 1908 使用 Docker 安装 Oracle 11g


  1. 使用 Docker 创建第二个 Oracle 11g(oracle_11g_2):
    docker run --restart=always -p 11522:1522 --name oracle_11g_2 -d registry.cn-hangzhou.aliyuncs.com/helowin/oracle_11g
  2. 查看运行镜像:
    docker ps -a
    运行结果:
    [root@localhost ~]# docker ps -a
    CONTAINER ID        IMAGE                                                  COMMAND                  CREATED             STATUS              PORTS                               NAMES
    843281daf217        registry.cn-hangzhou.aliyuncs.com/helowin/oracle_11g   "/bin/sh -c '/home..."   3 minutes ago       Up 3 minutes        1521/tcp, 0.0.0.0:11522->1522/tcp   oracle_11g_2
    a89bffd7afe8        registry.cn-hangzhou.aliyuncs.com/helowin/oracle_11g   "/bin/sh -c '/home..."   22 hours ago        Up 4 minutes        0.0.0.0:11521->1521/tcp             oracle_11g
    [root@localhost ~]# 
    
  3. 开通端口:
    firewall-cmd --zone=public --add-port=11522/tcp --permanent
    firewall-cmd --reload
    firewall-cmd --list-all
  4. 进入 oracle_11g_2:
    docker exec -it oracle_11g_2 bash
  5. 执行结果:
    [root@localhost ~]# docker exec -it oracle_11g_2 bash
    [oracle@6f0d3d29babc /]$ 
    
  6. 查看监听:
    lsnrctl status
    运行结果:
    [oracle@6f0d3d29babc /]$ lsnrctl status
    bash: lsnrctl: command not found
    [oracle@6f0d3d29babc /]$ 
    
    刷新环境变量:
    source /home/oracle/.bash_profile
    再次查看监听:
    [oracle@6f0d3d29babc /]$ lsnrctl status
    
    LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 11-JUN-2020 23:36:44
    
    Copyright (c) 1991, 2009, Oracle.  All rights reserved.
    
    Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
    STATUS of the LISTENER
    ------------------------
    Alias                     LISTENER
    Version                   TNSLSNR for Linux: Version 11.2.0.1.0 - Production
    Start Date                11-JUN-2020 23:34:00
    Uptime                    0 days 0 hr. 2 min. 43 sec
    Trace Level               off
    Security                  ON: Local OS Authentication
    SNMP                      OFF
    Listener Parameter File   /home/oracle/app/oracle/product/11.2.0/dbhome_2/network/admin/listener.ora
    Listener Log File         /home/oracle/app/oracle/diag/tnslsnr/6f0d3d29babc/listener/alert/log.xml
    Listening Endpoints Summary...
      (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
      (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=6f0d3d29babc)(PORT=1521)))
    Services Summary...
    Service "helowin" has 1 instance(s).
      Instance "helowin", status READY, has 1 handler(s) for this service...
    Service "helowinXDB" has 1 instance(s).
      Instance "helowin", status READY, has 1 handler(s) for this service...
    The command completed successfully
    [oracle@6f0d3d29babc /]$ 
    
  7. 修改 listener.ora 端口:
    vi /home/oracle/app/oracle/product/11.2.0/dbhome_2/network/admin/listener.ora
    1、将 EXTPROC1521 修改为 EXTPROC1522
    2、将 PORT = 1521 修改为 PORT = 1522
    # listener.ora Network Configuration File: /home/oracle/app/oracle/product/11.2.0/dbhome_2/network/admin/listener.ora
    # Generated by Oracle configuration tools.
    
    LISTENER =
      (DESCRIPTION_LIST =
        (DESCRIPTION =
          (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1522))
          (ADDRESS = (PROTOCOL = TCP)(HOST = )(PORT = 1522))
        )
      )
    
    ADR_BASE_LISTENER = /home/oracle/app/oracle
    
  8. 修改 tnsnames.ora:
    vi /home/oracle/app/oracle/product/11.2.0/dbhome_2/network/admin/tnsnames.ora
    将 PORT = 1521 修改为 PORT = 1522
    # tnsnames.ora Network Configuration File: /home/oracle/app/oracle/product/11.2.0/dbhome_2/network/admin/tnsnames.ora
    # Generated by Oracle configuration tools.
    
    LISTENER_HELOWIN =
      (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1522))
    
    
    HELOWIN =
      (DESCRIPTION =
        (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1522))
        (CONNECT_DATA =
          (SERVER = DEDICATED)
          (SERVICE_NAME = helowin)
        )
      )
  9. 重启监听:
    lsnrctl start
    运行结果:
    [oracle@6f0d3d29babc /]$ lsnrctl start
    
    LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 11-JUN-2020 23:54:32
    
    Copyright (c) 1991, 2009, Oracle.  All rights reserved.
    
    Starting /home/oracle/app/oracle/product/11.2.0/dbhome_2/bin/tnslsnr: please wait...
    
    TNSLSNR for Linux: Version 11.2.0.1.0 - Production
    System parameter file is /home/oracle/app/oracle/product/11.2.0/dbhome_2/network/admin/listener.ora
    Log messages written to /home/oracle/app/oracle/diag/tnslsnr/6f0d3d29babc/listener/alert/log.xml
    Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1522)))
    Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=6f0d3d29babc)(PORT=1522)))
    
    Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1522)))
    STATUS of the LISTENER
    ------------------------
    Alias                     LISTENER
    Version                   TNSLSNR for Linux: Version 11.2.0.1.0 - Production
    Start Date                11-JUN-2020 23:54:32
    Uptime                    0 days 0 hr. 0 min. 0 sec
    Trace Level               off
    Security                  ON: Local OS Authentication
    SNMP                      OFF
    Listener Parameter File   /home/oracle/app/oracle/product/11.2.0/dbhome_2/network/admin/listener.ora
    Listener Log File         /home/oracle/app/oracle/diag/tnslsnr/6f0d3d29babc/listener/alert/log.xml
    Listening Endpoints Summary...
      (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1522)))
      (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=6f0d3d29babc)(PORT=1522)))
    The listener supports no services
    The command completed successfully
    [oracle@6f0d3d29babc /]$ 
    
  10. 重启 oracle:
    1. 使用 dba 登录 Oracle:
      sqlplus / as sysdba
    2. 关闭数据库:
      shutdown immediate;
    3. 开启数据库:
      startup;
  11. 远程连接:


     
  • 1
    点赞
  • 0
    评论
  • 2
    收藏
  • 一键三连
    一键三连
  • 扫一扫,分享海报

©️2021 CSDN 皮肤主题: Age of Ai 设计师:meimeiellie 返回首页
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、C币套餐、付费专栏及课程。

余额充值