在centos7上使用Docker安裝oracle 11g


從網上整理主要給自己看。步驟比較簡單。有好的建議可以提哈~ 若侵權我刪掉~

 

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

 

用 docker images 命令查看鏡像

docker images

運行鏡像

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

進入容器修改賬號密碼

3.1,檢查容器是否運行成功

docker ps

啟動oracle

docker start oracle

3.2,進入容器:docker exec -it oracle bash

3.3,切換回root用戶

[oracle@a151f9478f94 /]$ exit

exit

[root@localhost ~]#

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.6,使得修改生效: 

[root@localhost ~]# source /etc/profile

3.7,進入容器(此處的id就是第一個命令下的id),加載一下用戶環境變量,進入容器后,自動是oracle用戶

 

[root@localhost ~]# docker ps

CONTAINER ID        IMAGE                                      COMMAND                  CREATED             STATUS              PORTS                    NAMES

a151f9478f94        registry.aliyuncs.com/helowin/oracle_11g   "/bin/sh -c '/home/o…"   3 hours ago         Up 3 hours          0.0.0.0:1521->1521/tcp   oracle

 

[root@localhost ~]# docker exec -it a151f9478f94 /bin/bash

[oracle@a151f9478f94 /]$ source ~/.bash_profile

 

[oracle@a151f9478f94 /]$ sqlplus /nolog

SQL*Plus: Release 11.2.0.1.0 Production on Wed Sep 4 14:44:44 2019

Copyright (c) 1982, 2009, Oracle.  All rights reserved.

 

SQL> conn / as  sysdba                                ## 使用sysdba 連接oracle,最大權限,os認證,只能在本機上登陸使用。

Connected.

SQL> alter user system identified by system;          ## 修改用戶 system 的密碼為 oracle ,可以自定義

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.

 

SQL> exit      ##退出編輯SQL

Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production

With the Partitioning, OLAP, Data Mining and Real Application Testing options

[oracle@a151f9478f94 /]$ exit    ##回到root用戶

exit

[root@localhost ~]#


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM