CentOS 7.7 1908 使用 Docker 安装 Oracle 11g

  1. 安装 Oracle:
    docker pull registry.cn-hangzhou.aliyuncs.com/helowin/oracle_11g
  2. 查看已安装的镜像:
    docker images
    查看结果:
    [root@localhost ~]# docker images
    REPOSITORY                                             TAG                 IMAGE ID            CREATED             SIZE
    registry.cn-hangzhou.aliyuncs.com/helowin/oracle_11g   latest              3fa112fd3642        4 years ago         6.85 GB
    [root@localhost ~]# 
    
  3. 创建并允许 Oracle:
    docker run --restart=always -p 11521:1521 --name oracle_11g -d registry.cn-hangzhou.aliyuncs.com/helowin/oracle_11g
  4. 查看已创建、运行的镜像:
    docker ps -a
    运行结果:
    [root@localhost ~]# docker ps -a
    CONTAINER ID        IMAGE                                                  COMMAND                  CREATED             STATUS              PORTS                     NAMES
    eaa6746586a6        registry.cn-hangzhou.aliyuncs.com/helowin/oracle_11g   "/bin/sh -c '/home..."   53 seconds ago      Up 45 seconds       0.0.0.0:11521->1521/tcp   oracle_11g
    [root@localhost ~]#
  5. 开放端口:
    firewall-cmd --zone=public --add-port=11521/tcp --permanent
    firewall-cmd --reload
    firewall-cmd --list-all
  6. 登录 Docker 中 Oracle 软件所在的 oracle 用户:
    docker exec -it oracle_11g bash
    运行结果:
    [root@localhost ~]# docker exec -it oracle_11g bash
    [oracle@eaa6746586a6 /]$ 
  7. 查看 oracle 用户:
    id oracle
    运行结果:
    [oracle@eaa6746586a6 /]$ id oracle
    uid=500(oracle) gid=500(oinstall) groups=500(oinstall),501(dba),502(oper)
    [oracle@eaa6746586a6 /]$ 
    
  8. 查看监听:
    lsnrctl status
    运行结果:
    [oracle@eaa6746586a6 /]$ lsnrctl status
    bash: lsnrctl: command not found
    [oracle@eaa6746586a6 /]$ 
    
    刷新环境变量:
    source /home/oracle/.bash_profile
    再次查看监听:
    [oracle@eaa6746586a6 /]$ lsnrctl status
    
    LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 10-JUN-2020 23:19:48
    
    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                10-JUN-2020 23:10:25
    Uptime                    0 days 0 hr. 9 min. 23 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/eaa6746586a6/listener/alert/log.xml
    Listening Endpoints Summary...
      (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
      (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=eaa6746586a6)(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@eaa6746586a6 /]$ 
    
  9. 连接:
    服务:helowin 或 helowinXDB
    用户名:system
    密码:helowin

     
  10. 登录 root:
    root 密码:helowin
    [oracle@eaa6746586a6 /]$ su root
    Password: 
    [root@eaa6746586a6 /]# 
    退出 root:
    [root@eaa6746586a6 /]# exit
    exit
    [oracle@eaa6746586a6 /]$ 
    
    退出 oracle:
    转到本机:
    [oracle@eaa6746586a6 /]$ exit
    exit
    [root@localhost ~]# 
    

     
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章