git地址:https://github.com/oracle/docker-images/tree/master/OracleDatabase/SingleInstance

docker 安装

  1. curl -fsSL https://get.docker.com | bash -s docker --mirror Aliyun

image.png

下载构建文件

  1. git clone https://github.com/oracle/docker-images.git

image.png

下载对应数据库到对应目录

  1. # 数据库复制到对应的版本文件夹下面去
  2. cp linuxamd64_12102_database_1of2.zip /root/docker-images/OracleDatabase/SingleInstance/dockerfiles/12.1.0.2
  3. cp linuxamd64_12102_database_2of2.zip /root/docker-images/OracleDatabase/SingleInstance/dockerfiles/12.1.0.2

image.png

镜像构建

  1. cd /root/docker-images/OracleDatabase/SingleInstance/dockerfiles/
  2. ./buildDockerImage.sh -v 12.1.0.2 -e

image.png

构建过程

image.png
第七步耗时较久。
image.png
image.png
image.png
image.png
image.png
国外服务器下载到构建完成在一刻钟左右

运行测试

image.png

  1. +++++++++++++++++++++++++++++++++
  2. # 第一行日志为密码:ORACLE PASSWORD FOR SYS, SYSTEM AND PDBADMIN: vxnwyZDpds8=1
  3. +++++++++++++++++++++++++++++++++
  4. # 修改密码:docker exec <container name> ./setPassword.sh <your password>
  5. # 启动前先对挂载目录授权,否则报错,启动失败
  6. chmod -R 777 /data/oral12c
  7. docker run --name oral12c \
  8. -p 1521:1521 \
  9. -p 5500:5500 \
  10. -v /data/oral12c:/opt/oracle/oradata \
  11. -d oracle/database:12.1.0.2-ee
  12. docker run --name <container name> \
  13. -p <host port>:1521 \
  14. -p <host port>:5500 \
  15. -e TZ=Asia/Shanghai \
  16. -e ORACLE_SID=<your SID> \
  17. -e ORACLE_PDB=<your PDB name> \
  18. -e ORACLE_PWD=<your database passwords> \
  19. -e INIT_SGA_SIZE=<your database SGA memory in MB> \
  20. -e INIT_PGA_SIZE=<your database PGA memory in MB> \
  21. -e ORACLE_EDITION=<your database edition> \
  22. -e ORACLE_CHARACTERSET=<your character set> \
  23. -v /etc/localtime:/etc/localtime:ro \
  24. -v [<host mount point>:]/opt/oracle/oradata \
  25. oracle/database:19.3.0-ee
  26. # 中文:ORACLE_CHARACTERSET = ZHS16GBK
  27. 更多参数:
  28. --name: The name of the container (default: auto generated).
  29. -p: The port mapping of the host port to the container port.
  30. Two ports are exposed: 1521 (Oracle Listener), 5500 (OEM Express).
  31. -e ORACLE_SID: The Oracle Database SID that should be used (default: ORCLCDB).
  32. -e ORACLE_PDB: The Oracle Database PDB name that should be used (default: ORCLPDB1).
  33. -e ORACLE_PWD: The Oracle Database SYS, SYSTEM and PDB_ADMIN password (default: auto generated).
  34. -e INIT_SGA_SIZE:
  35. The total memory in MB that should be used for all SGA components (optional).
  36. Supported 19.3 onwards.
  37. -e INIT_PGA_SIZE:
  38. The target aggregate PGA memory in MB that should be used for all server processes attached to the instance (optional).
  39. Supported 19.3 onwards.
  40. -e ORACLE_EDITION:
  41. The Oracle Database Edition (enterprise/standard).
  42. Supported 19.3 onwards.
  43. -e ORACLE_CHARACTERSET:
  44. The character set to use when creating the database (default: AL32UTF8).
  45. -v /opt/oracle/oradata
  46. The data volume to use for the database.
  47. Has to be writable by the Unix "oracle" (uid: 54321) user inside the container!
  48. If omitted the database will not be persisted over container recreation.
  49. -v /opt/oracle/scripts/startup | /docker-entrypoint-initdb.d/startup
  50. Optional: A volume with custom scripts to be run after database startup.
  51. For further details see the "Running scripts after setup and on startup" section below.
  52. -v /opt/oracle/scripts/setup | /docker-entrypoint-initdb.d/setup
  53. Optional: A volume with custom scripts to be run after database setup.
  54. For further details see the "Running scripts after setup and on startup" section below.

image.png
启动报错
image.png
image.png
启动成功
image.png
放行端口

  1. firewall-cmd --permanent --add-port=1521/tcp --zone=public
  2. firewall-cmd --permanent --add-port=5500/tcp --zone=public
  3. firewall-cmd --reload

服务名:ORCLCDB

image.png

访问 EM

chrome://settings/content/flash
https://localhost:5500/em/
image.png
image.png
image.png