zoukankan      html  css  js  c++  java
  • docker安装oralce11g

    windows安装的oracle不知道出什么问题了,出现诡异异常,到最后起数据库实例的时候就一直报错,就用docker安装一个

    1、拉取 docker 镜像:
    命令:

    [root@iZbp145axkc98giot5b448Z ~]# docker pull registry.cn-hangzhou.aliyuncs.com/helowin/oracle_11g
    Using default tag: latest
    Trying to pull repository registry.cn-hangzhou.aliyuncs.com/helowin/oracle_11g ...
    latest: Pulling from registry.cn-hangzhou.aliyuncs.com/helowin/oracle_11g
    ed5542b8e0e1: Pull complete
    a3ed95caeb02: Pull complete
    1e8f80d0799e: Pull complete
    Digest: sha256:4c12b98372dfcbaafcd9564a37c8d91456090a5c6fb07a4ec18270c9d9ef9726
    Status: Downloaded newer image for registry.cn-hangzhou.aliyuncs.com/helowin/oracle_11g:latest

    该镜像由阿里云提供,比较大,可能需要下载一会,等待下载即可。
    2、查看 docker 镜像:
    命令:

    root@iZbp145axkc98giot5b448Z ~]# docker images
    REPOSITORY                                             TAG                 IMAGE ID            CREATED             SIZE
    docker.io/elasticsearch                                latest              5acf0e8da90b        18 months ago       486 MB
    docker.io/containerize/elastichd                       latest              c2202f76db37        2 years ago         28.1 MB
    registry.cn-hangzhou.aliyuncs.com/helowin/oracle_11g   latest              3fa112fd3642        4 years ago         6.85 GB
    [root@iZbp145axkc98giot5b448Z ~]# docker run -d -p 1521:1521 --name oracle registry.aliyuncs.com/helowin/oracle_11g
    Unable to find image 'registry.aliyuncs.com/helowin/oracle_11g:latest' locally
    Trying to pull repository registry.aliyuncs.com/helowin/oracle_11g ...
    latest: Pulling from registry.aliyuncs.com/helowin/oracle_11g
    ed5542b8e0e1: Already exists
    a3ed95caeb02: Already exists
    1e8f80d0799e: Already exists
    Digest: sha256:4c12b98372dfcbaafcd9564a37c8d91456090a5c6fb07a4ec18270c9d9ef9726
    Status: Downloaded newer image for registry.aliyuncs.com/helowin/oracle_11g:latest
    188c85d4d5ca044e90f76270bc4ac97d4488c0c2ff526148122c5a1481da6a30

    3、进入容器修改账户密码
    3.1 检查容器是否运行成功
    命令:

    [root@iZbp145axkc98giot5b448Z ~]# docker ps -l
    CONTAINER ID        IMAGE                                      COMMAND                  CREATED             STATUS              PORTS                    NAMES
    188c85d4d5ca        registry.aliyuncs.com/helowin/oracle_11g   "/bin/sh -c '/home..."   45 seconds ago      Up 13 seconds       0.0.0.0:1521->1521/tcp   oracle

    3.2 进入容器
    命令:

    [root@iZbp145axkc98giot5b448Z ~]# docker exec -it 188c85d4d5ca  bash
    [oracle@188c85d4d5ca /]$ pwd
    /
    [oracle@188c85d4d5ca /]$ ls -l
    total 84
    dr-xr-xr-x   2 root root  4096 Dec  3  2013 bin
    dr-xr-xr-x   4 root root  4096 Dec  3  2013 boot
    drwxr-xr-x   5 root root   340 Apr 10 20:48 dev
    drwxr-xr-x   1 root root  4096 Apr 10 20:47 etc
    drwxr-xr-x   1 root root  4096 Aug 29  2014 home
    dr-xr-xr-x   8 root root  4096 Aug 23  2014 lib
    dr-xr-xr-x   7 root root 12288 Aug 23  2014 lib64
    drwxr-xr-x   2 root root  4096 Sep 23  2011 media
    drwxr-xr-x   2 root root  4096 Sep 23  2011 mnt
    drwxr-xr-x   2 root root  4096 Sep 23  2011 opt
    dr-xr-xr-x 113 root root     0 Apr 10 20:48 proc
    dr-xr-x---   3 root root  4096 Aug 26  2014 root
    drwxr-xr-x   3 root root  4096 Apr 10 20:48 run
    dr-xr-xr-x   2 root root  4096 Aug 23  2014 sbin
    drwxr-xr-x   2 root root  4096 Sep 23  2011 selinux
    drwxr-xr-x   2 root root  4096 Sep 23  2011 srv
    dr-xr-xr-x  13 root root     0 Apr  8 14:20 sys
    drwxrwxrwt   1 root root  4096 Apr 10 20:48 tmp
    drwxr-xr-x  13 root root  4096 Aug 23  2014 usr
    drwxr-xr-x   1 root root  4096 Aug 23  2014 var

    3.3 切换回root用户
    su - root 密码helowin

    oracle@188c85d4d5ca dbhome_2]$ su - root
    Password:
    [root@188c85d4d5ca ~]# vi /etc/profile

    3.4 编辑环境变量 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

    注意:按i进入编辑模式,输入上述命令后,按ESC键退出编辑模式,再输入:wq保存退出

    3.5 使得修改生效
    命令:source /etc/profile

    3.6 进入容器(此处的id就是第一个命令下的id),加载一下用户环境变量,进入容器后,自动是oracle用户

    使用sysdba 连接oracle
    命令:

    [root@188c85d4d5ca ~]# su - oracle
    [oracle@188c85d4d5ca ~]$  sqlplus /nolog
    
    SQL*Plus: Release 11.2.0.1.0 Production on Fri Apr 10 20:55:59 2020
    
    Copyright (c) 1982, 2009, Oracle.  All rights reserved.
    
    SQL> conn /as sysdba
    Connected.

    连接成功后,修改system用户的密码
    命令:

    SQL> alter user system identified by system;
    
    User altered.
    
    SQL> alter user sys identified by sys;
    
    User altered.
    
    SQL>

    退出编辑sql命令:exit
    登录截图:

     

  • 相关阅读:
    一次性删除 .svn 文件夹
    vim
    03 练习题:字符串
    04 练习题:元组、列表
    05 练习题:字典
    Python基础学习笔记(07)基础类型操作及转化、编码
    Python基础学习笔记(06)代码块、集合、深浅copy
    Python基础学习笔记(05)字典
    Python基础学习笔记(04)列表、元组
    67.滚轮事件
  • 原文地址:https://www.cnblogs.com/dalianpai/p/12676147.html
Copyright © 2011-2022 走看看