一、下载镜像
docker pull registry.cn-hangzhou.aliyuncs.com/zhuyijun/oracle:19c
通过docker images 命令查看 如下图:已经有oracle 19c镜像。
二、创建挂载文件
# 创建文件
mkdir -p /home/data/oracle/oradata# 授权,不授权会导致后面安装失败
chmod 777 /home/data/oracle/oradata
三、启动镜像
docker run -d \
-p 1521:1521 -p 5500:5500 \
-e ORACLE_SID=ORCLCDB \
-e ORACLE_PDB=ORCLPDB \
-e ORACLE_PWD=123456 \
-e ORACLE_EDITION=standard \
-e ORACLE_CHARACTERSET=AL32UTF8 \
-v /home/data/oracle/oradata:/opt/oracle/oradata \
--name orcl19c \
registry.cn-hangzhou.aliyuncs.com/zhuyijun/oracle:19c
四、连接Oracle
docker exec -it orcl19c /bin/bashsqlplus / as sysdbashow pdbs;
五、在pdb数据库创建用户
--查看当前容器数据库select sys_context('USERENV','CON_NAME') from dual;--打开PDB容器数据库(假设查询到PDB容器库名称为orclpdb)alter pluggable database ORCLPDB open;--切换容器数据库alter session set container=ORCLPDB;--创建用户create user messi identified by 123456;--用户授权
grant connect to messi;
grant imp_full_database to messi;
grant resource to messi;
grant create database link to messi;
grant create public synonym to messi;
grant create synonym to messi;
grant create view to messi;
grant unlimited tablespace to messi;
grant execute on dbms_crypto to messi;
六、连接oracle
ps原文地址:https://blog.xiaolc.cn/index.php/archives/73/