安装 oracle12c-docker

  1. 下载oracle-12.2.0.1的安装包并上传到服务器上。
  2. github下载文件并上传到服务器上
    注意:安装文件包要放到dockerfile/12.2.0.1目录中
  3. build oracle-docker镜像
./buildDockerImage.sh -v 12.2.0.1 -e -i

Usage: buildDockerImage.sh -v [version] [-e | -s | -x] [-i] [-o] [Docker build option]
Builds a Docker Image for Oracle Database.

Parameters:
   -v: version to build
       Choose one of: 11.2.0.2  12.1.0.2  12.2.0.1
   -e: creates image based on 'Enterprise Edition'
   -s: creates image based on 'Standard Edition 2'
   -x: creates image based on 'Express Edition'
   -i: ignores the MD5 checksums
   -o: passes on Docker build option

* select one edition only: -e, -s, or -x
  1. 运行镜像
    应该先设置一下主机上用来存放数据的目录权限:
    chmod 777 -R /vdb1/db/docker-oracle-data/
    要不然启动容器时创建数据库会提示权限不足。
docker run --name oracle12c \
-p 1521:1521 -p 5500:5500 \
-v  /vdb1/db/docker-oracle-data:/opt/oracle/oradata \
oracle/database:12.2.0.1-ee

原来oracle12c里新出一个CDB和PDB的概念,允许一个数据库容器(CDB)承载多个可插拔数据库(PDB)。
docker exec oracle/database:12.2.0.1-ee ./setPassword.sh <your password>

docker run --name <container name> \
-p 1521:1521 -p 5500:5500 \
-e ORACLE_CHARACTERSET=<your character set> \
-v [<host mount point>:]/opt/oracle/oradata \
oracle/database:12.2.0.1-ee

Parameters:
   --name:        The name of the container (default: auto generated)
   -p:            The port mapping of the host port to the container port. 
                  Two ports are exposed: 1521 (Oracle Listener), 5500 (OEM Express)
   -e ORACLE_SID: The Oracle Database SID that should be used (default: ORCLCDB)
   -e ORACLE_PDB: The Oracle Database PDB name that should be used (default: ORCLPDB1)
   -e ORACLE_PWD: The Oracle Database SYS, SYSTEM and PDB_ADMIN password (default: auto generated)
   -e ORACLE_CHARACTERSET:
                  The character set to use when creating the database (default: AL32UTF8)
   -v /opt/oracle/oradata
                  The data volume to use for the database.
                  Has to be writable by the Unix "oracle" (uid: 54321) user inside the container!
                  If omitted the database will not be persisted over container recreation.
   -v /opt/oracle/scripts/startup | /docker-entrypoint-initdb.d/startup
                  Optional: A volume with custom scripts to be run after database startup.
                  For further details see the "Running scripts after setup and on startup" section below.
   -v /opt/oracle/scripts/setup | /docker-entrypoint-initdb.d/setup
                  Optional: A volume with custom scripts to be run after database setup.
                  For further details see the "Running scripts after setup and on startup" section below.

 

作者:潘祖龙
链接:https://www.jianshu.com/p/3dcc43640c3a
來源:简书
简书著作权归作者所有,任何形式的转载都请联系作者获得授权并注明出处。

© 版权声明
THE END
喜欢就支持一下吧
点赞0 分享