Docker部署Oracle11g

Docker部署Oracle11g

1.安装Docker环境。

见我的Docker学习笔记

2.拉取oracle镜像

docker pull akaiot/oracle_11g

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

[root@wwy ~]#  docker pull akaiot/oracle_11g
Using default tag: latest
latest: Pulling from akaiot/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
akaiot/oracle_11g   latest    3fa112fd3642   6 years ago     6.85GB

4.创建容器

docker run -d -p 1521:1521 --name oracle11g akaiot/oracle_11g
[root@wwy ~]# docker run -d -p 1521:1521 --name oracle11g akaiot/oracle_11g
fe0af36dd89bc341e31af020ab295052ee8f1df36f243d2e17efdc02a1cd905b

5.进入容器进行配置

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

6.数据库配置

切换到root用户

su root 
# 默认密码是 helowin

编辑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链接

  • 0
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 5
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 5
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值