在centos7上使用Docker安装oracle 11g
发布日期:2021-11-17 09:22:30
浏览次数:23
分类:技术文章
本文共 3320 字,大约阅读时间需要 11 分钟。
如果还没安装docker,可查看
1、拉取 docker 镜像:
[root@localhost ~]# docker pull registry.cn-hangzhou.aliyuncs.com/helowin/oracle_11gUsing default tag: latestlatest: Pulling from helowin/oracle_11ged5542b8e0e1: Pull complete a3ed95caeb02: Pull complete 1e8f80d0799e: Pull complete Digest: sha256:4c12b98372dfcbaafcd9564a37c8d91456090a5c6fb07a4ec18270c9d9ef9726Status: Downloaded newer image for registry.cn-hangzhou.aliyuncs.com/helowin/oracle_11g:latest
该镜像由阿里云提供,比较大,可能需要下载一会
等待下载即可……
2、用 docker images 命令查看镜像
[root@localhost ~]# docker imagesREPOSITORY TAG IMAGE ID CREATED SIZEregistry.cn-hangzhou.aliyuncs.com/helowin/oracle_11g latest 3fa112fd3642 3 years ago 6.85GB
运行镜像
docker run -d -p 1521:1521 --name oracle registry.aliyuncs.com/helowin/oracle_11g
3、进入容器修改账号密码
3.1,检查容器是否运行成功
[root@localhost ~]# docker psCONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMESa151f9478f94 registry.aliyuncs.com/helowin/oracle_11g "/bin/sh -c '/home/o…" About a minute ago Up 30 seconds 0.0.0.0:1521->1521/tcp oracle
启动oracle
[root@localhost ~]# docker start oracle
3.2,进入容器:docker exec -it oracle bash
[root@localhost ~]# docker exec -it oracle bash[oracle@a151f9478f94 /]$
3.3,切换回root用户
[oracle@a151f9478f94 /]$ exitexit[root@localhost ~]#
3.4,编辑环境变量 vi /etc/profile 在文件的末尾添加一下内容
export ORACLE_HOME=/home/oracle/app/oracle/product/11.2.0/dbhome_2export ORACLE_SID=helowinexport PATH=$ORACLE_HOME/bin:$PATH
(注意:按i进入编辑模式,输入上述命令后,按ESC键退出编辑模式,再输入:wq保存退出)
3.6,使得修改生效:
[root@localhost ~]# source /etc/profile
3.7,进入容器(此处的id就是第一个命令下的id),加载一下用户环境变量,进入容器后,自动是oracle用户
[root@localhost ~]# docker psCONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMESa151f9478f94 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 /nologSQL*Plus: Release 11.2.0.1.0 Production on Wed Sep 4 14:44:44 2019Copyright (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 ##退出编辑SQLDisconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit ProductionWith the Partitioning, OLAP, Data Mining and Real Application Testing options[oracle@a151f9478f94 /]$ exit ##回到root用户exit[root@localhost ~]#
4.连接 账号system密码system服务名helowin
用Navicat连接
用plsql连接
为方便plsql连接,可在本地instantclient_11_2配置tnsnames.ora文件
LS = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.116.129)(PORT = 1521)) ) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = helowin) ) )
转载地址:https://blog.csdn.net/u014069688/article/details/100533501 如侵犯您的版权,请留言回复原文章的地址,我们会给您删除此文章,给您带来不便请您谅解!
发表评论
最新留言
能坚持,总会有不一样的收获!
[***.219.124.196]2024年04月19日 02时24分13秒
关于作者
喝酒易醉,品茶养心,人生如梦,品茶悟道,何以解忧?唯有杜康!
-- 愿君每日到此一游!
推荐文章
android学习笔记----简易音乐播放器原理
2019-04-27
Unity编辑器扩展——标签属性Attribute
2019-04-27
Unity中实现拖拽操作
2019-04-27
Unity中的UGUI事件系统
2019-04-27
C#中的常量
2019-04-27
C#中的静态变量与非静态变量
2019-04-27
C#中的ref、out、params关键字
2019-04-27
C#中的多态性
2019-04-27
C#中的命名空间
2019-04-27
设计模式——状态模式
2019-04-27
设计模式——工厂模式
2019-04-27
Unity中实现有限状态机FSM
2019-04-27
Unity中实现反弹
2019-04-27
U3D游戏开发框架(九)——事件序列
2019-04-27
Unity中解决“SetDestination“ can only be called on an active agent that has been placed on a NavMesh
2019-04-27
Unity中的刚体
2019-04-27
Unity中的坐标转换
2019-04-27
Unity中为什么不能对transform.position.x直接赋值?
2019-04-27
Unity中物体移动方法详解
2019-04-27