Skip to content

使用docker来安装oracle,方便快速搭建开发和测试环境

Notifications You must be signed in to change notification settings

ws1990/oracle-install

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 

Repository files navigation

1. 概述

本文档为了方便命令展示,采用markdown语法,建议使用专门编辑器进行查看(或由工具转换成html);数据库安装采用docker运行,在需要快速搭建开发和测试环境的时候,可以采用该方案;

2. docker安装

docker安装可以查看阿里云镜像帮助手册,大体步骤如下:

# step 1: 安装必要的一些系统工具
yum install -y yum-utils device-mapper-persistent-data lvm2
# Step 2: 添加软件源信息
yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
# Step 3: 更新并安装 Docker-CE
yum makecache fast
yum -y install docker-ce
# Step 4: 开启Docker服务
systemctl start docker
# Setp 5: 开机启动Docker
systemctl enable docker

3. Oracle数据库安装运行

3.1 数据库镜像

数据库镜像已经上传阿里云镜像仓库,可以直接pull;当然也可以根据官方的手册,自己生成镜像。

# 1. pull镜像
docker pull registry.cn-hangzhou.aliyuncs.com/wangsong/oracle-12c:12.2.0.1-ee
# 2. tag镜像
docker tag registry.cn-hangzhou.aliyuncs.com/wangsong/oracle-12c:12.2.0.1-ee oracle/database:12.2.0.1-ee

3.2 数据库运行

# 1. 创建容器持久数据目录
mkdir /home/oracle
mkdir /home/oracle/oradata
mkdir /home/oracle/scripts
chown -R 54321:54321 /home/oracle
# 2. 上传init.sh脚本到/home/oracle/scripts目录并修改拥有者
chown /home/oracle/scripts/init.sh
# 3. 启动容器(密码根据实际情况进行修改,不建议使用简单的如oracle之类的,本例中就是一个典型的反面案例)
docker run -d \
--name oracle \
-p 5500:5500 -p 1521:1521 \
-v /etc/timezone:/etc/timezone \
-v /etc/localtime:/etc/localtime \
-v /home/oracle/oradata:/opt/oracle/oradata \
-v /home/oracle/scripts:/opt/oracle/scripts/setup \
-e ORACLE_SID=weas -e ORACLE_PDB=weaspdb -e ORACLE_PWD=oracle \
oracle/database:12.2.0.1-ee

4. 参考

  1. oracle官方镜像

About

使用docker来安装oracle,方便快速搭建开发和测试环境

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages