docker 安装 oracle11g
生活随笔
收集整理的這篇文章主要介紹了
docker 安装 oracle11g
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
目錄
?
一 前言
二 實現
1、下載oracle鏡像
2、檢查鏡像
3、運行鏡像
4、配置oracle服務
?5、修改oracle默認密碼(可選)
三? 驗證
一 前言
1、需要docker環境,oracle鏡像
2、本文使用windows-docker環境
| 操作系統 | winodws10 64 |
| docker | Docker version 18.09.2, build 6247962 |
| 網絡模式 | 橋接 |
| oracle鏡像 | registry.cn-hangzhou.aliyuncs.com/helowin/oracle_11g |
二 實現
1、下載oracle鏡像
docker pull registry.cn-hangzhou.aliyuncs.com/helowin/oracle_11g #此鏡像為阿里云基于centos7 打包的oracle11g鏡像 約為6g2、檢查鏡像
docker images3、運行鏡像
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 #注意 1、宿主機端口不可沖突 可以通過(window系統)netstat -a 查詢宿主機已使用端口 否則docker: Error response from daemon: driver failed programming external connectivity on endpoint oracle11g (0ab988bf0e46eab2786a6fe764bfc92281e5b3fa6129d408fe9b9dc4479502b1): Error starting userland proxy: Bind for 0.0.0.0:8080: unexpected error Permission denied.2、若啟動失敗 需要先docker rm 服務名 否則 docker: Error response from daemon: Conflict. The container name "/oracle11g" is already in use by container "a5cb047193e7e9928b6502f1218bcecea98bafbf57927504014fe22908a56c09". You have to remove (or rename) that container to be able to reuse that name. See 'docker run --help'.4、配置oracle服務
step1:進入容器
docker exec -it oracle11g /bin/bashstep2:修改環境變量
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! 按entersource /etc/profile ##注意 1、必須使用su root 否則 文件只讀無法保存E45: 'readonly' option is set (add ! to override)2、必須source /etc/profile 否則 環境變量無效[root@a757a7352392 /]# echo $ORACLE_HOME[root@a757a7352392 /]#step3:配置軟連接
ln -s $ORACLE_HOME/bin/sqlplus /usr/bin?
?5、修改oracle默認密碼(可選)
| 賬號 | system |
| 密碼 | helowin |
| sid | helowin |
?step1:切換用戶
#容器切換oracle用戶 su oracle ##注意 1、需要切換到oracle用戶 否則 Enter user-name: system Enter password: ERROR: ORA-12546: TNS:permission denied?
step2:修改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;#啟動數據庫 startup;?
三? 驗證
?
總結
以上是生活随笔為你收集整理的docker 安装 oracle11g的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 小程序上传文件到阿里云oss
- 下一篇: |密码狗|Dongle|克隆狗|U盘狗