Docker 安装Oracle

虚拟内存需要8G以上
硬盘空间需要100G以上

参考教程:https://github.com/oracle/docker-images/tree/master/OracleDatabase/SingleInstance

1、到Oracle官方的Github下载Dockerfile


https://github.com/oracle/docker-images/tree/master/OracleDatabase/SingleInstance/dockerfiles



2、下载Oracle安装包



Database Software Downloads | Oracle



并放到Dockerimages相应的版本目录下,例如是18.30文件夹下



3、运行buildDockerImages.sh


./buildDockerImage.sh -v 18.30 -e


大概要等很久


可以再开一个SSH窗口,查看Images列表的状态,它会自动生成好几个镜像,然后最终又只剩下一个


“oracle/database     18.3.0-ee           2f2da38d0d2d        5 hours ago         8.39GB”




4、更改文件夹权限chown 54321:root /softworkconfig/docker/oracle/data/oradata




5、创建createOracle.sh



#!/bin/bashdocker stop oracle1830docker rm oracle1830docker run --name oracle1830 \        -p 1521:1521 -p 5500:5500 \        -it \        -e ORACLE_SID=oraclesid \        -e ORACLE_PDB=oraclepdb \        -e ORACLE_PWD=qweQWEasdASD \        -e ORACLE_CHARACTERSET=AL32UTF8 \        -v /softworkconfig/docker/oracle/data/oradata:/opt/oracle/oradata \        -v /softworkconfig/docker/oracle/data/startup:/opt/oracle/scripts/startup \        -v /softworkconfig/docker/oracle/data/setup:/opt/oracle/scripts/setup \        -v /softworkconfig/docker/oracle/data/docker-entrypoint-initdb.d:/docker-entrypoint-initdb.d \        oracle/database:18.3.0-ee

运行,等到出现 


#########################DATABASE IS READY TO USE!########################
6、登录测试
sqlplus sys/<your password>@//localhost:1521/<your SID> as sysdbasqlplus system/<your password>@//localhost:1521/<your SID>sqlplus pdbadmin/<your password>@//localhost:1521/<Your PDB name>
7、创建用户
sqlplus sys/qweQWEasdASD@//localhost:1521/oraclesid as sysdba
alter session set container=oraclepdb;

create user syni identified by qweQWEasdASD;grant CONNECT to syni;
grant resource to syni;

指定表空间:
alter user syni default tablespace "syni_tablespace";
alter user syni temporary tablespace "syni_tmptablespace";
alter user syni quota unlimited on "syni_tablespace3";
双引号很重要
8、使用用户登录 sqlplus syni/qweQWEasdASD@oraclepdb;

Docker 安装Oracle

 

上一篇:树莓派远程连接工具VNC使用教程


下一篇:Oracle数据 11 和12不同带来连接字符串的坑