1、獲取阿里雲的oracle鏡像
docker pull registry.cn-hangzhou.aliyuncs.com/helowin/oracle_11g
2、查看鏡像
docker images
3、啟動容器
docker run -d -it -p 1521:1521 --name oracle11g --restart=always registry.cn-hangzhou.aliyuncs.com/helowin/oracle_11g
4、查看容器狀態
docker ps
5、進入容器
docker exec -it oracle11g bash
6、切換到root賬戶(默認進入之后是oracle賬戶)
su root
輸入密碼:helowin
7、編輯環境變量
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
source /etc/profile 使配置生效
8、創建軟鏈接
ln -s $ORACLE_HOME/bin/sqlplus /usr/bin
9、切換到oracle用戶,登錄sqlplus
su - oracle
sqlplus /nolog
conn /as sysdba
10、修改sys、system用戶密碼:
alter user system identified by xxx;
alter user sys identified by xxx;
alter profile default limit PASSWORD_LIFE_TIME UNLIMITED;
11、創建用戶
用一個具有dba權限的用戶登錄(sysdba),然后輸入以下語句
create user xxx identified by yyy;
grant connect,resource,dba to xxx;
12、查看哪些用戶擁有DBA權限
select * from dba_role_privs where granted_role='DBA';
13、收回某用戶的DBA權限則執行
revoke dba from user_Name;