在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
相关推荐
(:满天星:)43 分钟前
第31篇:块设备与字符设备管理深度解析(基于OpenEuler 24.03)
linux·运维·服务器·网络·centos
小陶来咯1 小时前
【仿muduo库实现并发服务器】Acceptor模块
运维·服务器
cui_hao_nan1 小时前
Docker后端部署
运维·docker·容器
ZZH1120KQ1 小时前
Linux系统安全及应用
linux·运维·系统安全
大苏打seven2 小时前
Docker学习笔记:Docker网络
笔记·学习·docker
小扎仙森2 小时前
关于服务器宝塔转移wordperss子比主题问题
运维·服务器
小小小糖果人2 小时前
Linux云计算基础篇(5)
linux·运维·服务器
我不是哆啦A梦2 小时前
破解风电运维“百模大战”困局,机械版ChatGPT诞生?
运维·人工智能·python·算法·chatgpt
小张是铁粉3 小时前
docker在Linux的安装遇到的问题
linux·docker·容器
weixin_7714323113 小时前
linux系统 weblogic10.3.6(jar) 下载及安装
linux·运维·jar