centos7 docker 安裝oracle11g

centos7 docker 安裝oracle11g
一、下載oracle鏡像
sudo docker pull registry.cn-hangzhou.aliyuncs.com/helowin/oracle_11g
二、檢查鏡像
sudo docker images
三、運行鏡像
sudo docker run --restart=always -d -p 8080:8080 -p 1521:1521 --name oracle11g registry.cn-hangzhou.aliyuncs.com/helowin/oracle_11g
命令解析
docker run #運行容器
--restart=always #啓動策略 設置爲保持重啓
-d #後臺運行
-p 8080:8080 #端口映射
-p 1521:1521 #端口映射
--name oracle11g #服務命名
-v /data/oracle:/data/oracle #若是須要掛載使用此參數
registry.cn-hangzhou.aliyuncs.com/helowin/oracle_11g
 
四、配置oracle服務
step1:進入容器
docker exec -it oracle11g /bin/bash
step2:修改環境變量
su root
#密碼 helowin
vi /etc/profile
#行末 unset -f pathmunge 下一行 按i 粘貼以下環境變量
export ORACLE_HOME=/home/oracle/app/oracle/product/11.2.0/dbhome_2
export ORACLE_SID=helowin
export PATH=$ORACLE_HOME/bin:$PATH
#按esc 輸入 :wq! 按enter
source /etc/profile #刷新環境變量
step3:配置軟鏈接
ln -s $ORACLE_HOME/bin/sqlplus /usr/bin
5修改oracle用戶 
#容器切換oracle用戶
su oracle
 
#登陸oracle dba
sqlplus /nolog;
conn /as sysdba;
 
#修改初始帳號
alter user system identified by system;
alter user sys identified by system;
 
#添加本身的dba帳號
create user my_account identified by my_password;
grant connect,resource,dba to my_account;
 
#設置密碼永不過時
ALTER PROFILE DEFAULT LIMIT PASSWORD_LIFE_TIME UNLIMITED;
 
#關閉
shutdown immediate;
 
#啓動數據庫
 
0
相關文章
相關標籤/搜索