docker 搭建 Oracle 数据库

本贴最后更新于 1374 天前,其中的信息可能已经沧海桑田

Linux中基于docker 安装 Oracle

  一、前期准备,安装好docker,docker安装

  二、基于docker搭建Oracle

    1、拉取Oracle镜像文件

      docker pull registry.cn-hangzhou.aliyuncs.com/helowin/oracle_11g

    2、镜像下载完后查看Oracle镜像

      

    3、运行Oracle镜像,创建并启动容器

      docker run -d -p 1521:1521 --name oracle11g registry.cn-hangzhou.aliyuncs.com/helowin/oracle_11g

     4、查看容器是否启动

      

    5、进入容器配置配置文件

      5.1 docker exec -it oracle11g bash 进入容器

      

      5.2 切换到Oracle数据库容器的root 用户下

       su root

        root用户密码:helowin

      

      5..3 编辑配置文件

      vi /etc/profile

      在profile文件中配置ORACLE的环境变量

      export ORACLE_HOME=/home/oracle/app/oracle/product/11.2.0/dbhome_2

      export ORACLE_SID=helowin

      export PATH=ORACLE_HOME/bin:PATH

      

       注:使用source /etc/profile,否者环境变量无法生效

    6、创建sqlplus 软连接

      ln -s $ORACLE_HOME/bin/sqlplus /usr/bin

      注:没有软连接,使用sqlplus 命令时提示 bash sqlplus : command not found

    7、依次执行以下命令,创建一个用户,并赋予账户相应的权限

      su oracle

      sqlplus /nolog

      conn /as sysdba;

      alter user system identified bysytem; //修改system账户的密码为system

      alter user sys identified by sys;//修改sys账户的密码为sys

      ALTER PROFILE DEFAULT LIMIT PASSWORD_LIFE_TIME UNLIMITED;//修改配置文件并生效

      create user test identified by test;//创建用户

      grant connect,resource,dba to test;//给用户赋予权限

   8、可以使用navicat连接数据库

   注:可以去https://www.cnblogs.com/yuanxiaosong/articles/13224606.html

回帖
请输入回帖内容 ...