Docker快速搭建Oracle12c

时间:2024-03-15 07:17:12

转载来源:https://hub.docker.com/r/sath89/oracle-12c/

 

Docker快速搭建Oracle12c

 

 

Docker快速搭建Oracle12c

 

使用Docker命令拉取oracle-12c镜像

docker pull sath89/oracle-12c

启动并暴露8080&1521端口,8080可以登录网页端管理,1521是数据连接端口:

docker run -d -p 8080:8080 -p 1521:1521 sath89/oracle-12c

启动并暴露8080&1521端口,并且挂载宿主机目录 /my/oracle/data 到oracle服务器/u01/app/oracle目录,这样database数据就保存在本地宿主机上:

docker run -d -p 8080:8080 -p 1521:1521 -v /my/oracle/data:/u01/app/oracle sath89/oracle-12c

 启动并定制化DBCA总内存大小,DBCA_TOTAL_MEMORY (in Mb):

docker run -d -p 8080:8080 -p 1521:1521 -v /my/oracle/data:/u01/app/oracle -e DBCA_TOTAL_MEMORY=1024 sath89/oracle-12c

 Orale服务器连接参数:

hostname: localhost
port: 1521
sid: xe
service name: xe
username: system
password: oracle

使用如下命令连接sqlplus:

 sqlplus system/[email protected]//localhost:1521/xe 

Password for SYS & SYSTEM:

oracle

 Oracle Web管理端连接参数:

http://localhost:8080/apex
workspace: INTERNAL
user: ADMIN
password: 0Racle$

Apex upgrade up to v 5. (配置Apex   Oracle Application Express)*

docker run -it --rm --volumes-from ${DB_CONTAINER_NAME} --link ${DB_CONTAINER_NAME}:oracle-database -e PASS=YourSYSPASS sath89/apex install

Details could be found here: https://github.com/MaksymBilenko/docker-oracle-apex

Oracle Enterprise Management console (Oracle企业管理控制台):

http://localhost:8080/em
user: sys
password: oracle
connect as sysdba: true

 配置环境变量参数,关闭Web CONSOLE:

docker run -d -e WEB_CONSOLE=false -p 1521:1521 -v /my/oracle/data:/u01/app/oracle sath89/oracle-12c
#You can Enable/Disable it on any time

启动Oracle,并加载初始化脚本:

docker run -d -p 1521:1521 -v /my/oracle/data:/u01/app/oracle -v /my/oracle/init/SCRIPTSorSQL:/docker-entrypoint-initdb.d sath89/oracle-12c

By default Import from docker-entrypoint-initdb.d is enabled only if you are initializing database (1st run).

To customize dump import use IMPDP_OPTIONS env variable like -e IMPDP_OPTIONS="REMAP_TABLESPACE=FOO:BAR" To run import at any case add -e IMPORT_FROM_VOLUME=true

In case of using DMP imports dump file should be named like ${IMPORT_SCHEME_NAME}.dmp

User credentials for imports are ${IMPORT_SCHEME_NAME}/${IMPORT_SCHEME_NAME}

If you have an issue with database init like DBCA operation failed, please reffer to this issue

TODO LIST

  • Web management console HTTPS port
  • Add functionality to run custom scripts on startup, for example User creation
  • Add Parameter that would setup processes amount for database (Currently by default processes=300)
  • Spike with clustering support
  • Spike with DB migration from 11g

In case of any issues please post it here.