docker 部署oracle

一、获取oracle docker-image

https://github.com/oracle/docker-images

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

将oracle安装包放到对应的目录下面

[root@base 19.3.0]# pwd
/opt/oracle/docker-images/OracleDatabase/SingleInstance/dockerfiles/19.3.0
[root@base 19.3.0]# ll
total 2988100
-rwxr-xr-x 1 root root       2474 Feb 22 20:32 checkDBStatus.sh
-rwxr-xr-x 1 root root        904 Feb 22 20:32 checkSpace.sh
-rw-r--r-- 1 root root         63 Feb 22 20:32 Checksum.ee
-rw-r--r-- 1 root root         63 Feb 22 20:32 Checksum.se2
-rw-r--r-- 1 root root       5313 Feb 22 20:32 configTcps.sh
-rwxr-xr-x 1 root root       8689 Feb 22 20:32 createDB.sh
-rw-r--r-- 1 root root       1567 Feb 22 20:32 createObserver.sh
-rw-r--r-- 1 root root       9204 Feb 22 20:32 dbca.rsp.tmpl
-rw-r--r-- 1 root root       6878 Feb 22 20:32 db_inst.rsp
-rw-r--r-- 1 root root       4911 Feb 22 20:32 Dockerfile
-rwxr-xr-x 1 root root       2712 Feb 22 20:32 installDBBinaries.sh
-rw-r--r-- 1 root root 3059705302 Feb 22 20:35 LINUX.X64_193000_db_home.zip       <<<<<<
-rw-r--r-- 1 root root       2013 Feb 22 20:32 relinkOracleBinary.sh
-rwxr-xr-x 1 root root      10698 Feb 22 20:32 runOracle.sh
-rwxr-xr-x 1 root root       1021 Feb 22 20:32 runUserScripts.sh
-rwxr-xr-x 1 root root       1141 Feb 22 20:32 setPassword.sh
-rwxr-xr-x 1 root root       1057 Feb 22 20:32 setupLinuxEnv.sh
-rwxr-xr-x 1 root root        679 Feb 22 20:32 startDB.sh

二、开始制作镜像

2.1 docker安装

[root@test opt]# docker --version
Docker version 23.0.1, build a5ee5b1

2.2 制作镜像

2.2.1 报错处理

[root@base dockerfiles]# pwd
/opt/oracle/docker-images/OracleDatabase/SingleInstance/dockerfiles
[root@base dockerfiles]# ll
total 28
drwxr-xr-x 2 root root  126 Feb 22 20:32 11.2.0.2
drwxr-xr-x 2 root root 4096 Feb 22 20:32 12.1.0.2
drwxr-xr-x 2 root root 4096 Feb 22 20:32 12.2.0.1
drwxr-xr-x 2 root root 4096 Feb 22 20:32 18.3.0
drwxr-xr-x 2 root root  140 Feb 22 20:32 18.4.0
drwxr-xr-x 2 root root 4096 Feb 22 20:34 19.3.0
drwxr-xr-x 2 root root 4096 Feb 22 20:32 21.3.0
-rwxr-xr-x 1 root root 7091 Feb 22 20:32 buildContainerImage.sh
[root@base dockerfiles]# ./buildContainerImage.sh -v 19.3.0 -e -i
Checking Docker version.
Docker version is below the minimum required version 17.09
Please upgrade your Docker installation to proceed.
[root@base dockerfiles]#

解决方法:
将buildContainerImage.sh中 MIN_DOCKER_VERSION="17.09" 修改为 MIN_DOCKER_VERSION="17.9"

2.2.2 制作完成

.....
Oracle Database container image for 'ee' version 19.3.0 is ready to be extended:

    --> oracle/database:19.3.0-ee

  Build completed in 1091 seconds.
.....
# 看到以上信息则表示制作完成

# 查看
[root@base dockerfiles]# docker images
REPOSITORY        TAG         IMAGE ID       CREATED         SIZE
oracle/database   19.3.0-ee   b86218da14c8   2 minutes ago   6.68GB

三、以容器方式运行

docker run --name oracle19c -d -p 1521:1521 -p 5500:5500 -p 2484:2484 -e ORACLE_SID=ORCL -e ORACLE_PWD=root -e ENABLE_ARCHIVELOG=true -e ENABLE_TCPS=true -v /opt/oracle:/home/oracle b86218da14c8

运行完成:

image-20230222212708981

检验:

[root@test ~]# docker exec -it oracle19c /bin/bash
bash-4.2$ sqlplus system/root as sysdba

SQL*Plus: Release 19.0.0.0.0 - Production on Wed Feb 22 13:31:19 2023
Version 19.3.0.0.0

Copyright (c) 1982, 2019, Oracle.  All rights reserved.


Connected to:
Oracle Database 19c Enterprise Edition 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 ORCLPDB1                       READ WRITE NO
SQL>

作者:likaifei

出处:https://www.cnblogs.com/likaifei/p/17146254.html

版权:本作品采用「署名-非商业性使用-相同方式共享 4.0 国际」许可协议进行许可。

posted @   adai_kfl  阅读(174)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· winform 绘制太阳,地球,月球 运作规律
· AI与.NET技术实操系列(五):向量存储与相似性搜索在 .NET 中的实现
· 超详细:普通电脑也行Windows部署deepseek R1训练数据并当服务器共享给他人
· 上周热点回顾(3.3-3.9)
· AI 智能体引爆开源社区「GitHub 热点速览」
more_horiz
keyboard_arrow_up light_mode palette
选择主题
点击右上角即可分享
微信分享提示