Docker安装Oracle_11g数据库并配置

简介: Docker安装Oracle_11g数据库并配置

一文搞懂Docker的安装 https://blog.csdn.net/qq_44895681/article/details/105540702


环境


CentOS 7.5


Docker 20.10.2


Oracle_11g


安装Oracle数据库


1.搜索oracle镜像


docker search oracle

[root@localhost ~]# docker search oracle
NAME                                  DESCRIPTION                                     STARS     OFFICIAL   AUTOMATED
oraclelinux                           Official Docker builds of Oracle Linux.         731       [OK]
jaspeen/oracle-11g                    Docker image for Oracle 11g database            169                  [OK]
oracleinanutshell/oracle-xe-11g                                                       138
wnameless/oracle-xe-11g-r2            Oracle Express Edition 11g Release 2 on Ubun…   58
absolutapps/oracle-12c-ee             Oracle 12c EE image with web management cons…   46
araczkowski/oracle-apex-ords          Oracle Express Edition 11g Release 2 on Ubun…   30                   [OK]
truevoly/oracle-12c                   Copy of sath89/oracle-12c image (https://git…   27
bofm/oracle12c                        Docker image for Oracle Database                24                   [OK]
datagrip/oracle                       Oracle 11.2 & 12.1.0.2-se2 & 11.2.0.2-xe        20                   [OK]
quillbuilduser/oracle-18-xe           Oracle 18c XE Image for Quill Testing Purpos…   20
openweb/oracle-tomcat                 A fork off of Official tomcat image with Ora…   8                    [OK]
binarybabel/oracle-jdk                Oracle JDKs (Alpine, CentOS, Debian) rebuilt…   5                    [OK]
iamseth/oracledb_exporter             A Prometheus exporter for Oracle modeled aft…   3
18fgsa/oracle-client                  Hosted version of the Oracle Container Image…   2
paulosalgado/oracle-java8-ubuntu-16   Oracle Java 8 on Ubuntu 16.04 LTS.              2                    [OK]
softwareplant/oracle                  oracle db                                       2                    [OK]
arm64v8/oraclelinux                   Official Docker builds of Oracle Linux.         1
roboxes/oracle7                       A generic Oracle Linux 7 base image.            1
publicisworldwide/oracle-core         This is the core image based on Oracle Linux…   1                    [OK]
amd64/oraclelinux                     Official Docker builds of Oracle Linux.         1
toolsmiths/oracle7-test                                                               0
bitnami/oraclelinux-extras            Oracle Linux base images                        0                    [OK]
bitnami/oraclelinux-runtimes          Oracle Linux runtime-optimized images           0                    [OK]
pivotaldata/oracle7-test              Oracle Enterprise Linux (OEL) image for GPDB…   0
gizmotronic/oracle-java               Ubuntu 16.04 image with Oracle Java             0                    [OK]

2.拉取阿里云oracle镜像


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

[root@localhost ~]# docker pull registry.aliyuncs.com/helowin/oracle_11g
Using default tag: latest
latest: Pulling from helowin/oracle_11g
ed5542b8e0e1: Already exists
a3ed95caeb02: Already exists
1e8f80d0799e: Already exists
Digest: sha256:4c12b98372dfcbaafcd9564a37c8d91456090a5c6fb07a4ec18270c9d9ef9726
Status: Image is up to date for registry.aliyuncs.com/helowin/oracle_11g:latest
registry.aliyuncs.com/helowin/oracle_11g:latest

3.查看镜像拉取情况


docker iamges

[root@localhost ~]# docker images
REPOSITORY                                             TAG          IMAGE ID       CREATED       SIZE
...
registry.aliyuncs.com/helowin/oracle_11g               latest       3fa112fd3642   5 years ago   6.85GB

4.创建并启动oracle容器

默认启动方式:
[root@localhost ~]# docker run -itd -p 1521:1521 --name oracle_11g --restart=always registry.aliyuncs.com/helowin/oracle_11g
持久化启动方式:
docker run  -itd -p 1521:1521 --name oracle --restart=always --mount source=oracle_vol,target=/home/oracle/app/oracle/oradata registry.aliyuncs.com/helowin/oracle_11g

5.查看进程与启动状态

[root@localhost ~]# netstat -antulp
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 0.0.0.0:1521            0.0.0.0:*               LISTEN      35497/docker-proxy
......
[root@localhost ~]# ss -antulp | grep :1521
tcp    LISTEN     0      128       *:1521                  *:*                   users:(("docker-proxy",pid=35497,fd=4))
[root@localhost ~]# docker ps
CONTAINER ID   IMAGE                                      COMMAND                  CREATED        STATUS        PORTS                    NAMES
3edfba76f476   registry.aliyuncs.com/helowin/oracle_11g   "/bin/sh -c '/home/o…"   42 hours ago   Up 42 hours   0.0.0.0:1521->1521/tcp   oracle_11g

6.以退出不中断容器的方式进入容器

[root@localhost ~]# docker exec -it oracle_11g bash
[oracle@3edfba76f476 /]$

7.配置容器内环境变量

[root@localhost ~]# docker exec -it oracle_11g bash
1.切换为root用户
      # 密码默认为 helowin
[oracle@3edfba76f476 /]$ su root         
Password:                                
2.添加环境变量
[root@3edfba76f476 /]# vi /etc/profile      
...
     61 export ORACLE_HOME=/home/oracle/app/oracle/product/11.2.0/dbhome_2
     63 export ORACLE_SID=helowin
     65 export PATH=$ORACLE_HOME/bin:$PATH
...
3.使配置生效
[root@3edfba76f476 /]# source  /etc/profile
4.创建软链接
[root@3edfba76f476 /]# ln -s $ORACLE_HOME/bin/sqlplus /usr/bin

8.操作oracle

1.切换回oracle用户
[root@3edfba76f476 /]# su - oracle
2.登录sqlplus
[oracle@3edfba76f476 ~]$ sqlplus /nolog
SQL*Plus: Release 11.2.0.1.0 Production on Sat Jan 30 16:32:18 2021
Copyright (c) 1982, 2009, Oracle.  All rights reserved.
SQL> conn /as sysdba;
Connected.
3.修改sys、system用户密码
SQL> alter user system identified by 123456;
SQL> alter user sys identified by 123456;
SQL> alter profile default limit PASSWORD_LIFE_TIME UNLIMITED;
4.创建用户
SQL> create user root identified by 123456;
SQL> grant connect,resource,dba to root;
SQL> show user;      # 查看当前用户
USER is "SYS"

注意:外部工具连接数据库时,需要配置开放防火墙相应端口。若是阿里云,则需要开放安全组。


相关文章
|
8月前
|
Oracle 关系型数据库 Linux
【赵渝强老师】Oracle数据库配置助手:DBCA
Oracle数据库配置助手(DBCA)是用于创建和配置Oracle数据库的工具,支持图形界面和静默执行模式。本文介绍了使用DBCA在Linux环境下创建数据库的完整步骤,包括选择数据库操作类型、配置存储与网络选项、设置管理密码等,并提供了界面截图与视频讲解,帮助用户快速掌握数据库创建流程。
741 93
|
7月前
|
Oracle 关系型数据库 Linux
【赵渝强老师】使用NetManager创建Oracle数据库的监听器
Oracle NetManager是数据库网络配置工具,用于创建监听器、配置服务命名与网络连接,支持多数据库共享监听,确保客户端与服务器通信顺畅。
399 0
|
10月前
|
关系型数据库 应用服务中间件 nginx
Docker一键安装中间件(RocketMq、Nginx、MySql、Minio、Jenkins、Redis)
本系列脚本提供RocketMQ、Nginx、MySQL、MinIO、Jenkins和Redis的Docker一键安装与配置方案,适用于快速部署微服务基础环境。
|
8月前
|
关系型数据库 数据库 PostgreSQL
docker 安装 Postgres 17.6
本文介绍如何通过Docker安装和配置PostgreSQL 17.6。内容包括拉取镜像、导出配置文件、运行容器并挂载数据与配置文件目录,以及进入容器使用psql操作数据库的完整步骤,便于持久化管理和自定义配置。
1485 3
docker 安装 Postgres 17.6
|
7月前
|
NoSQL 算法 Redis
【Docker】(3)学习Docker中 镜像与容器数据卷、映射关系!手把手带你安装 MySql主从同步 和 Redis三主三从集群!并且进行主从切换与扩容操作,还有分析 哈希分区 等知识点!
Union文件系统(UnionFS)是一种**分层、轻量级并且高性能的文件系统**,它支持对文件系统的修改作为一次提交来一层层的叠加,同时可以将不同目录挂载到同一个虚拟文件系统下(unite several directories into a single virtual filesystem) Union 文件系统是 Docker 镜像的基础。 镜像可以通过分层来进行继承,基于基础镜像(没有父镜像),可以制作各种具体的应用镜像。
841 6
|
7月前
|
Java Linux 虚拟化
【Docker】(1)Docker的概述与架构,手把手带你安装Docker,云原生路上不可缺少的一门技术!
1. Docker简介 1.1 Docker是什么 为什么docker会出现? 假定您在开发一款平台项目,您的开发环境具有特定的配置。其他开发人员身处的环境配置也各有不同。 您正在开发的应用依赖于您当前的配置且还要依赖于某些配置文件。 您的企业还拥有标准化的测试和生产环境,且具有自身的配置和一系列支持文件。 **要求:**希望尽可能多在本地模拟这些环境而不产生重新创建服务器环境的开销 问题: 要如何确保应用能够在这些环境中运行和通过质量检测? 在部署过程中不出现令人头疼的版本、配置问题 无需重新编写代码和进行故障修复
682 2
|
8月前
|
SQL Oracle 关系型数据库
Oracle数据库创建表空间和索引的SQL语法示例
以上SQL语法提供了一种标准方式去组织Oracle数据库内部结构,并且通过合理使用可以显著改善查询速度及整体性能。需要注意,在实际应用过程当中应该根据具体业务需求、系统资源状况以及预期目标去合理规划并调整参数设置以达到最佳效果。
585 8
|
文字识别 Oracle 关系型数据库
oracle slient静默安装并配置数据库及仅安装数据库不配置数据库shell
仅安装数据库软件不配置数据库 ./x86oracle.sh /ruiy/ocr/DBSoftware/app/oracle /ruiy/ocr/DBSoftware/app/oraInventory /ruiy/ins_soft.
928 0

热门文章

最新文章