zoukankan      html  css  js  c++  java
  • docker安装oracle12c记录

    系统是centos7.9

    1.安装docker

    yum -y install docker
    systemctl start docker
    systemctl restart docker.service

    2.拉取镜像

    nohup docker pull registry.cn-hangzhou.aliyuncs.com/lhrbest/oracle_12cr2_ee_lhr_12.2.0.1:2.0 &

    3.创建容器并运行

    docker run -itd --name 12c -h lhrora1221
    --privileged=true -p 1521:1521 -p 222:22 -p 5500:5500 -p 5501:5501
    registry.cn-hangzhou.aliyuncs.com/lhrbest/oracle_12cr2_ee_lhr_12.2.0.1:2.0 init

    --加-itd参数是让docker启动后能一直运行,如果不加,则在容器启动后执行完就立刻退出了
    --加-h 指定容器的hostname
    --加–name为容器指定一个名称
    --加--privileged=true container内的root拥有真正的root权限
    查看镜像

    [root@oracle19c ~]# docker ps -a
    CONTAINER ID        IMAGE                                                                        COMMAND             CREATED             STATUS              PORTS                                               
                                NAMES8a60370241ca        registry.cn-hangzhou.aliyuncs.com/lhrbest/oracle_12cr2_ee_lhr_12.2.0.1:2.0   "init"              About an hour ago   Up About an hour    0.0.0.0:1521->1521/tcp, 0.0.0.0:5500-5501->5500-5501
    /tcp, 0.0.0.0:222->22/tcp   12c[root@oracle19c ~]# 
    

      

    4.启动数据库

    docker exec -it 12c bash

    [root@lhrora1221 /]# su - oracle
    Last login: Fri Aug 21 11:24:52 CST 2020 on pts/4
    [oracle@lhrora1221 ~]$ sas
    
    SQL*Plus: Release 12.2.0.1.0 Production on Mon Mar 8 14:11:52 2021
    
    Copyright (c) 1982, 2016, Oracle.  All rights reserved.
    
    Connected to an idle instance.
    
    SYS@lhrcdb1> startup
    ORACLE instance started.
    
    Total System Global Area  805306368 bytes
    Fixed Size		    8797928 bytes
    Variable Size		  494928152 bytes
    Database Buffers	  293601280 bytes
    Redo Buffers		    7979008 bytes
    Database mounted.
    Database opened.
    SYS@lhrcdb1> show con_name
    
    CON_NAME
    ------------------------------
    CDB$ROOT
    SYS@lhrcdb1> show pdbs;
    
        CON_ID CON_NAME			  OPEN MODE  RESTRICTED
    ---------- ------------------------------ ---------- ----------
    	 2 PDB$SEED			  READ ONLY  NO
    	 3 LHRPDB1			  MOUNTED
    SYS@lhrcdb1>  alter session set container=LHRPDB1;
    
    Session altered.
    
    SYS@lhrcdb1> startup
    Pluggable Database opened.
    SYS@lhrcdb1> show parameter service_name
    
    NAME				     TYPE		    VALUE
    ------------------------------------ ---------------------- ------------------------------
    service_names			     string		    lhrcdb1
    

      

    5.启动监听,绑定数据库

    lsnrctl start

    6.客户端登录,遇到的小问题

    ora_28040:没有匹配的验证协议

    vi /u01/app/oracle/product/19.3.0/dbhome_1/network/admin/

    在末端添加SQLNET.ALLOWED_LOGON_VERSION=8

    连接显示用户名或密码错误

    原因是用了servicename

    SYS@lhrcdb1> show parameter service_name
    
    NAME				     TYPE		    VALUE
    ------------------------------------ ---------------------- ------------------------------
    service_names			     string		    lhrcdb1
    SYS@lhrcdb1> 
    

      应该用show con_name;

    具体如下:

    SQL*Plus: Release 12.2.0.1.0 Production on Mon Mar 8 15:46:37 2021
    
    Copyright (c) 1982, 2016, Oracle.  All rights reserved.
    
    
    Connected to:
    Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production
    
    SYS@lhrcdb1> show con_name;
    
    CON_NAME
    ------------------------------
    CDB$ROOT
    SYS@lhrcdb1> alter session set container=LHRPDB1;
    
    Session altered.
    
    SYS@lhrcdb1> show con_name;
    
    CON_NAME
    ------------------------------
    LHRPDB1
    SYS@lhrcdb1> startup
    Pluggable Database opened.
    SYS@lhrcdb1> 
    

    test/TEST
    8.136.199.98:1521/LHRPDB1(测试环境,随时销毁,不用去测试)

    7.删除容器和镜像

    [root@oracle19c ~]# docker images
    REPOSITORY TAG IMAGE ID CREATED SIZE
    docker.io/lhrbest/oracle19clhr_asm_db_12.2.0.3 2.0 433d38c3c0b1 6 months ago 47.5 GB
    registry.cn-hangzhou.aliyuncs.com/lhrbest/oracle19clhr_asm_db_12.2.0.3 2.0 433d38c3c0b1 6 months ago 47.5 GB
    [root@oracle19c ~]# docker rmi 433d38c3c0b1
    Error response from daemon: conflict: unable to delete 433d38c3c0b1 (must be forced) - image is referenced in multiple repositories
    [root@oracle19c ~]# docker rmi -f 433d38c3c0b1
    Untagged: docker.io/lhrbest/oracle19clhr_asm_db_12.2.0.3:2.0
    Untagged: docker.io/lhrbest/oracle19clhr_asm_db_12.2.0.3@sha256:a3779200fe0e8d1fd663770f3fa139696fd36f7653a9d42dc1a82c189a14e8f8
    Untagged: registry.cn-hangzhou.aliyuncs.com/lhrbest/oracle19clhr_asm_db_12.2.0.3:2.0
    Untagged: registry.cn-hangzhou.aliyuncs.com/lhrbest/oracle19clhr_asm_db_12.2.0.3@sha256:a3779200fe0e8d1fd663770f3fa139696fd36f7653a9d42dc1a82c189a14e8f8
    Deleted: sha256:433d38c3c0b12dc2c150fcd51c599d87d29e8276626a1a0dcfdc1e9f5176604d
    Deleted: sha256:37e758819e9b41688d16d7b68f8e546cbc6291c91d90a718e44f6d118a2437c7
    [root@oracle19c ~]# docker images
    REPOSITORY TAG IMAGE ID CREATED SIZE
    [root@oracle19c ~]# df -h
    Filesystem Size Used Avail Use% Mounted on
    devtmpfs 3.8G 0 3.8G 0% /dev
    tmpfs 3.8G 0 3.8G 0% /dev/shm
    tmpfs 3.8G 520K 3.8G 1% /run
    tmpfs 3.8G 0 3.8G 0% /sys/fs/cgroup
    /dev/vda1 99G 2.6G 92G 3% /
    tmpfs 768M 0 768M 0% /run/user/0

    We only live once, and time just goes by.
  • 相关阅读:
    MySQL 入门教程
    .net 定时服务
    【搜索面板】规格信息单选
    【搜索面板查询】品牌单选(term过滤查询)
    【搜索框查询】搜索功能+搜索框内容回显
    商品上下架(发布订阅模式)
    Canal广告缓存实现(工作队列模式)
    FastDFS分布式文件系统(适合存储小文件 )
    跨域(浏览器限制本行为)
    购物网站项目
  • 原文地址:https://www.cnblogs.com/jycjy/p/14499012.html
Copyright © 2011-2022 走看看