我是靠谱客的博主 眯眯眼中心,最近开发中收集的这篇文章主要介绍docker部署oracle11gDocker部署Oracle11g,觉得挺不错的,现在分享给大家,希望可以做个参考。

概述

Docker部署Oracle11g

1.安装Docker环境。

见我的Docker学习笔记

2.拉取oracle镜像

docker pull registry.cn-hangzhou.aliyuncs.com/helowin/oracle_11g

大约会有6个G左右,需要等待一会,注意拉镜像的时候查硬盘容量大小是否足够否则会失败。

[root@wwy ~]#  docker pull registry.cn-hangzhou.aliyuncs.com/helowin/oracle_11g
Using default tag: latest
latest: Pulling from helowin/oracle_11g
ed5542b8e0e1: Downloading [>                                                  ]  42.46MB/2.993GB
a3ed95caeb02: Download complete 
1e8f80d0799e: Download complete

3.下载完成后查看镜像

docker images

[root@wwy ~]#  docker images 
REPOSITORY                                             TAG       IMAGE ID       CREATED         SIZE
registry.cn-hangzhou.aliyuncs.com/helowin/oracle_11g   latest    3fa112fd3642   6 years ago     6.85GB

4.创建容器

docker run -d -p 1521:1521 --name oracle11g registry.cn-hangzhou.aliyuncs.com/helowin/oracle_11g

[root@wwy ~]# docker run -d -p 1521:1521 --name oracle11g registry.cn-hangzhou.aliyuncs.com/helowin/oracle_11g
fe0af36dd89bc341e31af020ab295052ee8f1df36f243d2e17efdc02a1cd905b

5.进入容器进行配置

docker exec -it oracle11g bash

[root@wwy ~]# docker exec -it oracle11g bash
[oracle@fe0af36dd89b /]$ 

6.数据库配置

使用root登录

[root@wwy ~]# docker exec -it -uroot oracle11g bash

编辑profile文件配置ORACLE环境变量

打开:vi /etc/profile ,在文件最后写上下面内容:

export ORACLE_HOME=/home/oracle/app/oracle/product/11.2.0/dbhome_2

export ORACLE_SID=helowin

export PATH=$ORACLE_HOME/bin:$PATH

保存后执行source /etc/profile 加载环境变量;

source /etc/profile

切换到oracle 用户

su - oracle

这里还要说一下,一定要写中间的内条 - 必须要,否则软连接无效

登录sqlplus并修改sys、system用户密码

sqlplus /nolog   --登录

conn /as sysdba  --连接数据库

alter user system identified by system; --修改system用户账号密码

alter user sys identified by system;--修改sys用户账号密码

create user test identified by test; -- 创建内部管理员账号密码

grant connect,resource,dba to test; --将dba权限授权给内部管理员账号和密码

ALTER PROFILE DEFAULT LIMIT PASSWORD_LIFE_TIME UNLIMITED; --修改密码规则策略为密码永不过期

alter system set processes=1000 scope=spfile; --修改数据库最大连接数据;

修改以上信息后,需要重新启动数据库;

conn /as sysdba

shutdown immediate; --关闭数据库

startup; --启动数据库

exit:退出软链接

这样就部署成功了 ,可以尝试使用Navicat 或者 DataGrip链接

如果是linux服务器部署的需要远程登录。可以使用如下命令测试

sqlplus test/123456@//14.12.197.104:1521/helowin

注意:最后的helowin一定要写,要不然登录不了

yum安装sqlplus

1.下载repo

cd /etc/yum.repos.d
wget http://yum.oracle.com/public-yum-ol7.repo
wget http://public-yum.oracle.com/RPM-GPG-KEY-oracle-ol7 -O /etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
yum makecache
yum install -y oracle-release-el7
bash /usr/bin/ol_yum_configure.sh

2.安装sqlplus

yum install oracle-instantclient18.3-sqlplus.x86_64 -y

3.配置环境变量

find / -name sqlplus
/usr/lib/oracle/18.3/client64/bin/sqlplus
vim /etc/profile	
添加下面三行
export ORACLE_CLIENT_HOME=/usr/lib/oracle/18.3/client64
export LD_LIBRARY_PATH=$ORACLE_CLIENT_HOME/lib
export PATH=$PATH:$ORACLE_CLIENT_HOME/bin
source /etc/profile
sqlplus -v

最后

以上就是眯眯眼中心为你收集整理的docker部署oracle11gDocker部署Oracle11g的全部内容,希望文章能够帮你解决docker部署oracle11gDocker部署Oracle11g所遇到的程序开发问题。

如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(55)

评论列表共有 0 条评论

立即
投稿
返回
顶部