centos7下容器安装oracle11g
1、docker 镜像拉取以及启动
docker hub拉取镜像
docker pull jaspeen/oracle-11g
创建宿主机oracle安装目录以及数据目录
mkdir -p /server/oracle mkdir -p /server/dpdump
下载 oracle 并存放于服务器中
oracle 下载网址:https://www.oracle.com/database/technologies/oracle-database-software-downloads.html
解压缩并删除安装包
压缩包放到/server/oracle目录
[ oracle]# ls linux.x64_11gR2_database_1of2 linux.x64_11gR2_database_2of2
unzip linux.x64_11gR2_database_1of2.zip unzip linux.x64_11gR2_database_2of2.zip
[ oracle]# ls database
启动 docker
docker run -d -p 1521:1521 -v /server/oracle:/install -v /server/dpdump:/opt/oracle/dpdump --name=oracle11g jaspeen/oracle-11g
查看启动状态:
[ oracle]# docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES c5e913b4e96b jaspeen/oracle-11g "/assets/entrypoin..." 3 days ago Up 3 seconds 0.0.0.0:1521->1521/tcp, 8080/tcp oracle11g2、自己的 docker 镜像制作
2、自己的 docker 镜像制作
由于版权问题,拉取下来的 docker 镜像是不包含任何版本的 oracle 的
故在启动 docker 后,需要创建一个自己的镜像以备使用
[ oracle]# docker commit oracle11g oracle11g-installed [ oracle]# docker images REPOSITORY TAG IMAGE ID CREATED SIZE oracle11g-installed latest 4a55732efad1 3 days ago 2.83 GB docker.io/jaspeen/oracle-11g latest 0c8711fe4f0f 4 years ago 281 MB
3、使用pl/sql连接oracle
进入oracle容器
docker exec -it 8164f1475ee5 /bin/bash
修改oracle环境变量
[ /]# cd etc [ etc]# vi profile #在最后增加 export ORACLE_HOME=/opt/oracle/app/product/11.2.0/dbhome_1 export ORACLE_SID=orcl export PATH=$ORACLE_HOME/bin:$PATH #保存离开 :wq [ ~] source /etc/profile #使得修改生效
登陆oracle账号
[ /]# su - oracle Last login: Tue Jun 9 13:01:34 UTC 2020 [ ~]$ sqlplus /nolog SQL*Plus: Release 11.2.0.1.0 Production on Tue Jun 9 13:15:18 2020 Copyright (c) 1982, 2009, Oracle. All rights reserved. SQL> conn /as sysdba Connected. SQL> alter user system identified by system; User altered. SQL> alter user sys identified by sys; User altered. SQL> create user ETS identified by ETS; User created. SQL> grant connect,resource,dba to ETS; Grant succeeded. SQL> exit Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production With the Partitioning, OLAP, Data Mining and Real Application Testing options [ ~]$ exit logout [ /]#
使用pl/sql连接
相关推荐
流云追风 2020-07-04
lklong 2020-11-22
oraclemch 2020-11-06
shilukun 2020-10-10
周嘉笙 2020-11-09
iilegend 2020-10-19
EricRay 2020-10-16
zhuzhufxz 2020-09-16
dataminer 2020-08-17
bfcady 2020-08-16
Hody 2020-08-16
FightFourEggs 2020-08-16
数据库设计 2020-08-16
Seandba 2020-08-16
Omega 2020-08-16
zjyzz 2020-08-16
yanghuatong 2020-08-16
ktyl000 2020-08-16