- 拉取镜像
- 建立映射目录并赋权
- 启动容器
- 创建PDB用户
- 测试登录
拉去的是阿里云的oracle19c 的镜像
docker pull registry.cn-hangzhou.aliyuncs.com/zhuyijun/oracle:19c
等待拉取完毕后,查看images
[root@localhost /]# docker images REPOSITORY TAG IMAGE ID CREATED SIZE mysql latest 3218b38490ce 4 months ago 516MB registry.cn-hangzhou.aliyuncs.com/zhuyijun/oracle 19c 7b5eb4597688 21 months ago 6.61GB建立映射目录并赋权
[root@localhost /]# mkdir /data/oracle/oradata [root@localhost /]# chmod 777 /data/oracle/oradata启动容器
docker run -d -p 1521:1521 -p 5502:5500 -e ORACLE_SID=ORCLCDB -e ORACLE_PDB=ORCLPDB -e ORACLE_PWD=oracle -e ORACLE_EDITION=standard -e ORACLE_CHARACTERSET=AL32UTF8 -v /data/oracle/oradata/:/opt/oracle/oradata/ --name oracle_19c registry.cn-hangzhou.aliyuncs.com/zhuyijun/oracle
oracle容器运行后会自动创建PDB,但是需要时间,可以通过查看日志的方式来判断安装是否结束
Prepare for db operation 8% complete Copying database files 31% complete Creating and starting Oracle instance 32% complete 36% complete 40% complete 43% complete 46% complete Completing Database Creation 51% complete 54% complete Creating Pluggable Databases 58% complete 77% complete Executing Post Configuration Actions 100% complete Database creation complete. For details check the logfiles at: /opt/oracle/cfgtoollogs/dbca/ORCLCDB. Database Information: Global Database Name:ORCLCDB System Identifier(SID):ORCLCDB Look at the log file "/opt/oracle/cfgtoollogs/dbca/ORCLCDB/ORCLCDB.log" for further details. SQL*Plus: Release 19.0.0.0.0 - Production on Sat May 14 07:14:03 2022 Version 19.3.0.0.0 Copyright (c) 1982, 2019, Oracle. All rights reserved. Connected to: Oracle Database 19c Standard Edition 2 Release 19.0.0.0.0 - Production Version 19.3.0.0.0 SQL> System altered. SQL> System altered. SQL> Pluggable database altered. SQL> PL/SQL procedure successfully completed. SQL> Disconnected from Oracle Database 19c Standard Edition 2 Release 19.0.0.0.0 - Production Version 19.3.0.0.0 The Oracle base remains unchanged with value /opt/oracle ######################### DATABASE IS READY TO USE! ######################### The following output is now a tail of the alert.log: ORCLPDB(3):ALTER DATABASE DEFAULT TABLESPACE "USERS" ORCLPDB(3):Completed: ALTER DATABASE DEFAULT TABLESPACE "USERS" 2022-05-14T07:14:03.436776+00:00 ALTER SYSTEM SET control_files='/opt/oracle/oradata/ORCLCDB/control01.ctl' SCOPE=SPFILE; 2022-05-14T07:14:03.439826+00:00 ALTER SYSTEM SET local_listener='' SCOPE=BOTH; ALTER PLUGGABLE DATABASE ORCLPDB SAVE STATE Completed: ALTER PLUGGABLE DATABASE ORCLPDB SAVE STATE XDB initialized. 2022-05-14T07:23:58.240070+00:00 ORCLPDB(3):Resize operation completed for file# 10, old size 327680K, new size 337920K
出现以上的提示就是安装完成了。
创建PDB用户首先登录docker容器
docker exec -it cec11 /bin/bash
登录sqlplus 创建PDB用户
[oracle@cec11fa8577e ~]$ sqlplus / as sysdba
SQL*Plus: Release 19.0.0.0.0 - Production on Sat May 14 08:06:32 2022
Version 19.3.0.0.0
Copyright (c) 1982, 2019, Oracle. All rights reserved.
Connected to:
Oracle Database 19c Standard Edition 2 Release 19.0.0.0.0 - Production
Version 19.3.0.0.0
SQL> show pdbs
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
3 ORCLPDB READ WRITE NO
SQL> alter session set container=ORCLPDB;
Session altered.
SQL> create user pdbtest1 identified by pdbtest1;
User created.
SQL> grant dba to pdbtest1;
Grant succeeded.
测试登录



