使用docker安装Oracle(根据官网整理)

使用docker安装Oracle(根据官网整理),第1张

使用docker安装Oracle docker 登录Oracle仓库的账号。(没有的话,要去Oracle官网注册)
docker login -u 用户名 -p 密码 https://container-registry.oracle.com
拉取镜像并启动容器(请保持足够空间的内存与磁盘大小)
docker run -d --name container_name \
 -p host_port:1521 -p host_port:5500 \
 -e ORACLE_SID=cdb-system-identifer \
 -e ORACLE_PDB=pdb-name \
 -e ORACLE_PWD=oracle-user-password \
 -e INIT_SGA_SIZE=cdb-database-sga-memory-in-mb \
 -e INIT_PGA_SIZE=cdb-database-pga-memory-in-mb \
 -e ORACLE_EDITION=ee-or-se-database-edition \ 
 -e ORACLE_CHARACTERSET=character-set \
 -e ENABLE_ARCHIVELOG=[true|false]
 -v [host-mount-point:]/opt/oracle/oradata \
container-registry.oracle.com/database/enterprise:21.3.0

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 PDBADMIN password. (Default: auto-generated)
 -e INIT_SGA_SIZE:       The total memory in MB that should be used for all SGA components (Optional)
 -e INIT_PGA_SIZE:       The target aggregate PGA memory in MB that should be used for all server processes attached to the instance (Optional)
 -e ORACLE_EDITION:      The Oracle Database Edition [enterprise|standard]. (Default: enterprise)
 -e ORACLE_CHARACTERSET: The character set that you want used when creating the database. (Default: AL32UTF8)
 -e ENABLE_ARCHIVELOG    The ARCHIVELOG mode. By default, set to false. 
                         If set to true, then ARCHIVLOG mode is enabled in the database (for fresh database creation only)
 -v /opt/oracle/oradata
                         The data volume that you want used for the database. Must be writable by the oracle user (uid: 54321) inside the container
                         If omitted, then 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 section "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 that you want run after database setup.
                         For further details see the "Running scripts after setup and on startup" section below.

示例:

docker run -d --name oracle\
-p 1521:1521 -p 5500:5500  \
-e ORACLE_SID=huangwen  \
-e ORACLE_PDB=huangwen  \
-e ORACLE_PWD=huangwen  \
-v /opt/oracle/oradata \
container-registry.oracle.com/database/enterprise:21.3.0
检查一下是否连接成功
docker exec -it dbname sqlplus sys/cdb-user-password@cdb-sid as sysdba
# 示例:
docker exec -it oracle sqlplus sys/huangwen@ORCLCDB as sysdba
最后附上官网地址

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/yw/927650.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-17
下一篇 2022-05-17

发表评论

登录后才能评论

评论列表(0条)

保存