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

如下是基於阿里雲服務器Centos 7操做sql

1.拉取Oracle11g鏡像docker

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

image

等待下載便可……bash

下載完成後,使用下列命令查看鏡像服務器

docker imagesoracle

image

從上圖能夠清楚看到鏡像拉取完畢app

2.建立容器ide

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

說明:若是沒有添加1521,先添加1521端口3d

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進行鏈接了

相關文章
相關標籤/搜索