【Docker】拉取Oracle 11g镜像配置

以下是基于阿里云服务器Centos 7操作

1.拉取Oracle11g镜像

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

image

等待下载即可……

下载完成后,使用下列命令查看镜像

docker images

image

从上图可以清楚看到镜像拉取完毕

2.创建容器

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

说明:如果没有添加1521,先添加1521端口

image

我的安装成功后出现上图

3.启动容器

docker start oracle11g

image


4.进入镜像配置

docker exec -it oracle11g bash

image


5.配置Oracle环境变量

切换到root用户

用户名:root

密码:helowin


[root@a8a161b66e1d /]# 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


6.创建软链接

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

image

切换到iracle用户下(注意中间有-)

su – oracle

image


7.连接数据库

[oracle@a8a161b66e1d ~]$ sqlplus /nolog

SQL*Plus: Release 11.2.0.1.0 Production on Wed Oct 10 12:54:06 2018

Copyright (c) 1982, 2009, Oracle.  All rights reserved.
SQL> conn / as sysdba
Connected.
SQL> alter user system identified by system;

User altered.

SQL> alter user sys identified by sys;

User altered.

SQL> create user ETS identified by ETS ;

User created.

SQL> grant connect,resource,dba to ETS ;

Grant succeeded.

8.配置本地tnsnames.ora文件

LS =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = 121.78.157.187)(PORT = 1521))
    )
    (CONNECT_DATA =
       (SERVER = DEDICATED)
      (SERVICE_NAME = helowin)

    )
  )

接下来就可以使用pl/sql进行连接了

posted @ 2018-10-10 13:08  OLIVER_QIN  阅读(18074)  评论(3编辑  收藏  举报