1、安裝阿里的docker源:
cat /etc/docker/daemon.json { "registry-mirrors": ["https://pee6w651.mirror.aliyuncs.com"] }
2、重啟docker服務
systemctl restart docker
3、這里選擇獲取12c版本
docker pull sath89/oracle-12c [root@localhost ~]# docker images|grep 12c sath89/oracle-12c latest ee3351d51185 7 months ago 5.7GB
4、安裝
docker run -d --name oracle -p 8080:8080 -p 1521:1521 -v $PWD/data:/mnt -e TZ=Asia/Shanghai sath89/oracle-12c
5、安裝需要一段時間等出現以下內容說明安裝成功
Database ready to use. Enjoy! ;)
Oracle 使用的實例名,用戶名,密碼如下
---------------------------------------------
hostname: localhost
port: 1521
sid: xe
username: system
password: oracle
進入容器
[root@master oracle]# docker exec -it ef7e5bc1c20e /bin/bash (ef7e5bc1c20e自己容器的ID)
進入容器后是root用戶切換到oracle用戶
root@ef7e5bc1c20e:/# su oracle
使用sysdba登陸
oracle@ef7e5bc1c20e:/$ $ORACLE_HOME/bin/sqlplus / as sysdba
//create tablespace 表空間名稱 datafile 表空間路勁 size 3000m;
SQL>create tablespace bspdb datafile '/u01/app/oracle/oradata/xe/bspdb.dbf' size 3000m;
//create user 用戶名 identified by 密碼 default tablespace 用戶默認使用哪一個表空間;
SQL>create user bspdb identified by 123456 default tablespace bspdb;
//grant 角色1,角色2 to 用戶名;
SQL>grant dba, connect to bspdb;
非生產環境可以考慮這種方法安裝,簡單方便!!