在centos7 上用docker 安装 oracle11g

这里写目录标题

一、准备环境

记录下在centos7下通过docker安装oracle11g的过程。首先准备好Linu主机。(参考链接: link

二、安装

1、安装Docker

1)、yum 包更新到最新

shell 复制代码
yum update

2)、安装需要的软件包,

yum-util 提供yum-config-manager功能,另外两个是devicemapper驱动依赖的

shell 复制代码
yum install -y yum-utils device-mapper-persistent-data lvm2

3)、 设置yum源

shell 复制代码
yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo

4)、 安装docker,出现输入的界面都按 y

shell 复制代码
yum install -y docker-ce

5)、 查看docker版本,验证是否验证成功

shell 复制代码
docker -v

2、Docker启动

docker启动服务的命令是:

1)、启动

shell 复制代码
systemctl start docker

2)、重启docker服务

shell 复制代码
systemctl restart  docker

3)、重启docker服务

shell 复制代码
sudo service docker restart

4)、关闭docker

shell 复制代码
service docker stop
shell 复制代码
systemctl stop docker

3、安装oracle

1)、拉取oracle镜像

oracle的镜像比较大,拉取的时间较长。

shell 复制代码
docker pull registry.cn-hangzhou.aliyuncs.com/helowin/oracle_11g

下载完毕后可以用命令查看镜像。

shell 复制代码
docker images

2)、启动创建容器

shell 复制代码
docker run -d -p 1521:1521 --name oracle_11g registry.cn-hangzhou.aliyuncs.com/helowin/oracle_11g

3)、启动启动容器

shell 复制代码
docker start oracle_11g

4)、启动进入容器终端

shell 复制代码
docker exec -it oracle_11g bash

这个时候进入了oracle终端,切换docker的root身份。

shell 复制代码
su - root(密码 helowin)

编辑profile文件。

shell 复制代码
vi /etc/profile

在文件最后添加下列数据并保存 。

shell 复制代码
export ORACLE_HOME=/home/oracle/app/oracle/product/11.2.0/dbhome_2
export ORACLE_SID=helowin
export PATH=$ORACLE_HOME/bin:$PATH

5)、启动软件连接

创建软连接。

shell 复制代码
ln -s $ORACLE_HOME/bin/sqlplus /usr/bin

切换身份。

shell 复制代码
su - oracle

在终端连接oracle数据库。

sql 复制代码
sqlplus /nolog
conn /as sysdba

6)、启动修改sys、system用户密码

sql 复制代码
alter user system identified by oracle;
alter user sys identified by oracle;
ALTER PROFILE DEFAULT LIMIT PASSWORD_LIFE_TIME UNLIMITED;

7)、创建一个新用户

创建用户以及设置密码:

sql 复制代码
create user username identified by password;

为用户user1授权:

sql 复制代码
grant connect, resource to user1;

三、测试

DBeaver登录

  • 数据库名: helowin
  • 用户:system
  • 密码:oracle
    也可以用新建的用户取连接。

四、再次登录

如果主机关闭了,再次登录的时候启动docker和镜像即可。

shell 复制代码
systemctl start docker
shell 复制代码
docker start oracle_11g
相关推荐
DevOps-IT3 分钟前
HTTP状态码(常见 HTTP Status Code 查询)
运维·服务器·网络·网络协议·http
Y.O.U..3 分钟前
Kubernetes-资源清单(1)
容器·kubernetes
释怀不想释怀9 分钟前
Docker(安装软件)
运维·docker·容器
网硕互联的小客服13 分钟前
服务器 CPU 温度过高需要进行的物理处理和软件处理有哪些?
运维·服务器
济61724 分钟前
linux(第十三期)--filezilla使用方法(实现ubuntu和windows11文件互传)-- Ubuntu20.04
linux·运维·ubuntu
HIT_Weston25 分钟前
91、【Ubuntu】【Hugo】搭建私人博客:侧边导航栏(五)
linux·运维·ubuntu
阿巴~阿巴~27 分钟前
从不可靠到100%可靠:TCP与网络设计的工程智慧全景解析
运维·服务器·网络·网络协议·tcp/ip·智能路由器
超龄超能程序猿33 分钟前
Docker常用中间件部署笔记:MongoDB、Redis、MySQL、Tomcat快速搭建
笔记·docker·中间件
一殊酒36 分钟前
【Figma】Figma自动化
运维·自动化·figma
奔波霸的伶俐虫38 分钟前
windows docker desktop 安装修改镜像学习
学习·docker·容器