Linux(centos)下使用Docker安裝Oracle_11g
1、拉取映象
docker pull registry.cn-hangzhou.aliyuncs.com/helowin/oracle_11g
映象詳情:https://dev.aliyun.com/detail.html?spm=5176.1972343.2.8.E6Cbr1&repoId=1969
由於映象我已經拉取,所以此處顯示已存在,檢視映象資訊
docker iamges
2、建立並容器資訊
docker run -d -p 1521:1521 –name oracle_11g registry.aliyuncs.com/helowin/oracle_11g
由於此處我的容器已經建立(命令如想,容器名稱 oracle_11g)此處我直接啟動即可。
docker start oracle_11g
3、進入控制檯設定使用者資訊
docker exec -it oracle_11g bash
登入sqlplus,此處發現sqlplus命令不可用,所以需要進行相關配置,操作步驟如下:
(1)、切換到root使用者模式下
su root
輸入密碼helowin
(2)、編輯profile檔案配置ORACLE環境變數
vi /etc/profile 並在檔案最後新增如下命令
export ORACLE_HOME=/home/oracle/app/oracle/product/11.2.0/dbhome_2
export ORACLE_SID=helowin
export PATH=PATH
推出並儲存。
(3)、軟體連線
ln -s $ORACLE_HOME/bin/sqlplus /usr/bin
因為我已經建立過所以包標誌已存在。
(4)、切換到oracle 使用者
登入sqlplus並修改sys、system使用者密碼
sqlplus /nolog
conn /as sysdba
接著執行下面命令
alter user system identified by oracle;
alter user sys identified by oracle;
ALTER PROFILE DEFAULT LIMIT PASSWORD_LIFE_TIME UNLIMITED;
4、登入驗證
登入成功
5、提交修改
docker commit 容器名稱或ID 新的映象名稱:版本