docker 部署 Oracle 19c

时间:2023-01-10 19:06:30

标签(空格分隔): Oracle 系列


一:系统环境介绍

操作系统:
     centos7.9x64

oracle19c 配置说明:

主机名:
cat /etc/hosts
----
172.16.10.11    flyfish11
172.16.10.12    flyfish12
172.16.10.13    flyfish13
172.16.10.14    flyfish14
172.16.10.15    flyfish15
172.16.10.16    flyfish16
172.16.10.17    flyfish17
-----
先安装单机版本一台:flyfish11 

本次使用docker 部署 Oracle19c 



一:安装docker

离线安装: docker 

下载地址:https://download.docker.com/linux/static/stable/x86_64/docker-20.10.22.tgz


解压二进制包

tar zxvf docker-20.10.22.tgz
mv docker/* /usr/bin


systemd管理docker

cat > /usr/lib/systemd/system/docker.service << EOF
[Unit]
Description=Docker Application Container Engine
Documentation=https://docs.docker.com
After=network-online.target firewalld.service
Wants=network-online.target
[Service]
Type=notify
ExecStart=/usr/bin/dockerd
ExecReload=/bin/kill -s HUP $MAINPID
LimitNOFILE=infinity
LimitNPROC=infinity
LimitCORE=infinity
TimeoutStartSec=0
Delegate=yes
KillMode=process
Restart=on-failure
StartLimitBurst=3
StartLimitInterval=60s
[Install]
WantedBy=multi-user.target
EOF


创建配置文件

mkdir /etc/docker
cat > /etc/docker/daemon.json << EOF
{
  "registry-mirrors": ["http://f1361db2.m.daocloud.io"]
}
EOF

sudo tee /etc/docker/daemon.json <<-'EOF'
{
"registry-mirrors": ["https://06e8c32c87800f000f9bc00e80a506e0.mirror.swr.myhuaweicloud.com"]
}
EOF



启动并设置开机启动

systemctl daemon-reload
systemctl start docker
systemctl enable docker

docker images 
docker ps -a 

docker 部署 Oracle 19c

下载oracle 19c 镜像

1、拉取镜像
执行命令:docker pull registry.cn-hangzhou.aliyuncs.com/zhuyijun/oracle:19c

2、创建挂载文件
执行命令:mkdir -p /root/data/oracle/oracledata

3、为挂载文件授权
执行命令:chmod 777 /root/data/oracle/oracledata

docker 部署 Oracle 19cdocker 部署 Oracle 19c

二:安装Oracle

2.1 启动Oracle 容器

4、启动

docker run -d  \
-p 1521:1521 \
-e ORACLE_SID=ORACLEDB \
-e ORACLE_PDB=ORACLEPDB \
-e ORACLE_PWD=oracle \
-e ORACLE_EDITION=standard \
-e ORACLE_CHARACTERSET=ZHS16GBK \
-v /root/data/oracle/oracledata:/opt/oracle/oradata \
--name oracle \
registry.cn-hangzhou.aliyuncs.com/zhuyijun/oracle:19c

docker logs -f 816922b0cad6

docker 部署 Oracle 19cdocker 部署 Oracle 19c

2.2 配置Oracle 初始化


连接oracle,执行命令:docker exec -it oracle /bin/bash
连接sysdba,执行命令:sqlplus / as sysdba
显示初始化的数据库,执行命令:show pdbs
修改 system 的密码,执行命令:alter user system identified by system;
修改 sys 的密码,执行命令:alter user sys identified by sys;
设置修改的密码永不过期,执行命令:alter profile default limit password_life_time unlimited;


docker 部署 Oracle 19cdocker 部署 Oracle 19c

show pdbs
alter session set container=ORACLEPDB;
create tablespace skzbtest datafile '/opt/oracle/oradata/ORACLEDB/ORACLEPDB/skzbtest.dbf' size 500M autoextend on maxsize unlimited;
create user skzb identified by skzb123 default tablespace skzbtest;

grant dba to skzb;

docker 部署 Oracle 19c

2.3 dbvs 连接

docker 部署 Oracle 19cdocker 部署 Oracle 19c