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 ~]# 
    

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