1.下載oracle11g
- 1.在oracle官網(wǎng)下載數(shù)據(jù)庫
linux.x64_11gR2_database_1of2.zip
linux.x64_11gR2_database_2of2.zip - 2.解壓
unzip linux.x64_11gR2_database_1of2.zip -d ~/t
unzip linux.x64_11gR2_database_2of2.zip -d ~/t
2.拉取鏡像
docker pull jaspeen/oracle-11g
3.安裝
- 1.安裝
docker run -d --privileged -p 1521:1521 -v ~/t:/install -v /dpdump:/opt/oracle/dpdump --name=oracle11g jaspeen/oracle-11g
如果要把數(shù)據(jù)保存在容器外,按下面步驟執(zhí)行
mkidr /oracle11g/app
sudo chmod 777 /oracle11g/app 或 sudo chown -R 440:200 /oracle11g/app #兩種執(zhí)行一種即可
docker run -d --privileged -p 1521:1521 -v ~/t:/install -v /dpdump:/opt/oracle/dpdump -v /oracle11g/app:/opt/oracle/app --name=oracle11g jaspeen/oracle-11g
- 2.設(shè)置
等待一段時(shí)間后進(jìn)入
docker exec -it oracle11g /bin/bash #進(jìn)入容器
su - oracle #切換到oracle用戶
sqlplus / as sysdba #進(jìn)入數(shù)據(jù)庫
alter user scott account unlock; -- 解鎖scott用戶
commit; -- 提交
conn scott/tiger -- 連接會提示修改密碼域携,修改完就可以連接了
如果在最后一步出錯可以退出后執(zhí)行下面操作
sqlplus / as sysdba #進(jìn)入數(shù)據(jù)庫
alter user scott identified by 123456; -- 修改密碼
SELECT * FROM dba_profiles s WHERE s.profile='DEFAULT' AND resource_name='PASSWORD_LIFE_TIME'; -- 查看系統(tǒng)profiles中PASSWORD_LIFE_TIME設(shè)置,默認(rèn)180天
ALTER PROFILE DEFAULT LIMIT PASSWORD_LIFE_TIME UNLIMITED; -- 設(shè)置密碼永不過期 #可以不做
如果需要允許system用戶登陸,修改system用戶密碼即可
sqlplus / as sysdba #進(jìn)入數(shù)據(jù)庫
alter user system identified by 123456; -- 修改密碼