Docker 安装Oracle

2021/12/13 19:18:49

本文主要是介绍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的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!


扫一扫关注最新编程教程