在centos7上使用Docker安装oracle 11g

在centos7上使用Docker安装oracle 11g

启动docker 

service docker start

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

 用 docker images 命令查看镜像

docker images

运行镜像

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

进入容器修改账号密码

3.1,检查容器是否运行成功

docker ps

启动oracle

docker start oracle

3.2,进入容器:docker exec -it oracle bash

3.3,切换回root用户

[oracle@a151f9478f94 /]$ exit

exit

[root@localhost ~]#

3.4,编辑环境变量 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

(注意:按i进入编辑模式,输入上述命令后,按ESC键退出编辑模式,再输入:wq保存退出)

3.6,使得修改生效: 

[root@localhost ~]# source /etc/profile

3.7,进入容器(此处的id就是第一个命令下的id),加载一下用户环境变量,进入容器后,自动是oracle用户

 

[root@localhost ~]# docker ps

CONTAINER ID        IMAGE                                      COMMAND                  CREATED             STATUS              PORTS                    NAMES

a151f9478f94        registry.aliyuncs.com/helowin/oracle_11g   "/bin/sh -c '/home/o…"   3 hours ago         Up 3 hours          0.0.0.0:1521->1521/tcp   oracle

 

[root@localhost ~]# docker exec -it a151f9478f94 /bin/bash

[oracle@a151f9478f94 /]$ source ~/.bash_profile

 

[oracle@a151f9478f94 /]$ sqlplus /nolog

SQL*Plus: Release 11.2.0.1.0 Production on Wed Sep 4 14:44:44 2019

Copyright (c) 1982, 2009, Oracle.  All rights reserved.

 

SQL> conn / as  sysdba                                ## 使用sysdba 连接oracle,最大权限,os认证,只能在本机上登陆使用。

Connected.

SQL> alter user system identified by system;          ## 修改用户 system 的密码为 oracle ,可以自定义

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      ##退出编辑SQL

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

[oracle@a151f9478f94 /]$ exit    ##回到root用户

exit

[root@localhost ~]#

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

comeoffbest

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值