【DB宝4】只需2步即可拥有Oracle19c的ASM+DB环境

【DB宝4】只需2步即可拥有Oracle19c的ASM+DB环境

目录

公众号地址:https://mp.weixin.qq.com/s?__biz=MzIzOTA2NjEzNQ==&mid=2454779249&idx=1&sn=ffbac44408ab2fe893208230364f6c74&chksm=fe8b9809c9fc111f66ca71af9f8d14e88b8d2d32d5ca02ee4fd10460ba9191cb9cddba49e60c&scene=21#wechat_redirect

一、从Docker Hub下载小麦苗上传的镜像

小麦苗的Docker Hub的地址:https://hub.docker.com/u/lhrbest

-- 下载镜像命令:
docker pull lhrbest/oracle19casm_lhr:1.0

镜像有点大,下载时间取决于自己的网络环境,建议晚上放后台下载:

-- 放后台下载镜像命令:
nohup docker pull lhrbest/oracle19casm_lhr:1.0 &

下载完成后:

[root@docker35 ~]# docker images | grep oracle19casm_lhr
lhrbest/oracle19casm_lhr         1.0                 d695caf63520        17 hours ago        46.6GB

二、创建容器

--创建容器
docker run -itd -h lhr2019ocpasm --name oracle19casmlhr  -p 1521:1521 -p 5500:5500 -p 5501:5501 --privileged=true lhrbest/oracle19casm_lhr:1.0  /usr/sbin/init
--进入容器
docker exec -it oracle19casmlhr bash

三、尽情使用吧

注意事项:
① 该镜像使用二进制包的方式安装Oracle 19c企业版的ASM和db,包括一个CDB,名称为lhr19cdb,一个非cdb,名称为lhr19sdb,所有密码均为lhr
② ASM磁盘脚本:/etc/initASMDISK.sh

3.1 数据库使用示例:

[root@docker35 ~]# docker ps
CONTAINER ID        IMAGE                          COMMAND                  CREATED             STATUS              PORTS                                                                   NAMES
b9c33f914de6        lhrbest/oracle19casm_lhr:1.0   "/usr/sbin/init"         17 hours ago        Up 17 hours         0.0.0.0:1521->1521/tcp, 22/tcp, 5501-5501/tcp, 0.0.0.0:5500->5500/tcp   oracle19casmlhr

[root@docker35 ~]# docker exec -it oracle19casmlhr bash
[root@lhr2019ocpasm /]# oracleasm listdisks
ASM1
ASM2
ASM3
ASM4
ASM5
ASM6
ASM7
[root@lhr2019ocpasm /]# crsctl stat res -t
--------------------------------------------------------------------------------
Name           Target  State        Server                   State details       
--------------------------------------------------------------------------------
Local Resources
--------------------------------------------------------------------------------
ora.DATA.dg
               ONLINE  ONLINE       lhr2019ocpasm            STABLE
ora.FRA.dg
               ONLINE  ONLINE       lhr2019ocpasm            STABLE
ora.LISTENER.lsnr
               ONLINE  ONLINE       lhr2019ocpasm            STABLE
ora.asm
               ONLINE  ONLINE       lhr2019ocpasm            Started,STABLE
ora.ons
               OFFLINE OFFLINE      lhr2019ocpasm            STABLE
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
ora.cssd
      1        ONLINE  ONLINE       lhr2019ocpasm            STABLE
ora.diskmon
      1        OFFLINE OFFLINE                               STABLE
ora.evmd
      1        ONLINE  ONLINE       lhr2019ocpasm            STABLE
ora.lhr19cdb.db
      1        ONLINE  ONLINE       lhr2019ocpasm            Open,HOME=/u01/app/o
                                                             racle/product/19.3.0
                                                             /dbhome_1,STABLE
ora.lhr19sdb.db
      1        ONLINE  ONLINE       lhr2019ocpasm            Open,HOME=/u01/app/o
                                                             racle/product/19.3.0
                                                             /dbhome_1,STABLE
--------------------------------------------------------------------------------

[root@lhr2019ocpasm /]# su - oracle
Last login: Sun Jun 28 16:36:43 CST 2020 on pts/0
[oracle@lhr2019ocpasm ~]$ sas

SQL*Plus: Release 19.0.0.0.0 - Production on Mon Jun 29 10:13:11 2020
Version 19.3.0.0.0

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


Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0

SYS@lhr19cdb> show pdbs

    CON_ID CON_NAME                       OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
         2 PDB$SEED                       READ ONLY  NO
SYS@lhr19cdb> exit
Disconnected from Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0


[oracle@lhr2019ocpasm dbs]$ . oraenv
ORACLE_SID = [lhr19cdb] ? lhr19sdb
The Oracle base remains unchanged with value /u01/app/oracle
[oracle@lhr2019ocpasm dbs]$ sas

SQL*Plus: Release 19.0.0.0.0 - Production on Mon Jun 29 10:18:45 2020
Version 19.3.0.0.0

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


Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0

SYS@lhr19sdb> show pdbs
SYS@lhr19sdb> exit
Disconnected from Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0
[oracle@lhr2019ocpasm dbs]$ ps -ef|grep pmon
grid      1173     1  0 Jun28 ?        00:00:05 asm_pmon_+ASM
oracle    1642     1  0 Jun28 ?        00:00:07 ora_pmon_lhr19cdb
oracle   23410     0  0 10:17 ?        00:00:00 ora_pmon_lhr19sdb
oracle   23882 23073  0 10:18 pts/2    00:00:00 grep --color=auto pmon
[oracle@lhr2019ocpasm dbs]$ lsnrctl status

LSNRCTL for Linux: Version 19.0.0.0.0 - Production on 29-JUN-2020 10:19:02

Copyright (c) 1991, 2019, Oracle.  All rights reserved.

Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 19.0.0.0.0 - Production
Start Date                28-JUN-2020 17:29:47
Uptime                    0 days 16 hr. 49 min. 14 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /u01/app/19.3.0/grid/network/admin/listener.ora
Listener Log File         /u01/app/grid/diag/tnslsnr/lhr2019ocpasm/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=lhr2019ocpasm)(PORT=1521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcps)(HOST=lhr2019ocpasm)(PORT=5500))(Security=(my_wallet_directory=/u01/app/oracle/product/19.3.0/dbhome_1/admin/lhr19cdb/xdb_wallet))(Presentation=HTTP)(Session=RAW))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcps)(HOST=lhr2019ocpasm)(PORT=5501))(Security=(my_wallet_directory=/u01/app/oracle/admin/lhr19sdb/xdb_wallet))(Presentation=HTTP)(Session=RAW))
Services Summary...
Service "+ASM" has 1 instance(s).
  Instance "+ASM", status READY, has 1 handler(s) for this service...
Service "+ASM_DATA" has 1 instance(s).
  Instance "+ASM", status READY, has 1 handler(s) for this service...
Service "+ASM_FRA" has 1 instance(s).
  Instance "+ASM", status READY, has 1 handler(s) for this service...
Service "86b637b62fdf7a65e053f706e80a27ca" has 1 instance(s).
  Instance "lhr19cdb", status READY, has 1 handler(s) for this service...
Service "lhr19cdb" has 1 instance(s).
  Instance "lhr19cdb", status READY, has 1 handler(s) for this service...
Service "lhr19cdbXDB" has 1 instance(s).
  Instance "lhr19cdb", status READY, has 1 handler(s) for this service...
Service "lhr19sdb" has 1 instance(s).
  Instance "lhr19sdb", status READY, has 1 handler(s) for this service...
Service "lhrsdbXDB" has 1 instance(s).
  Instance "lhr19sdb", status READY, has 1 handler(s) for this service...
The command completed successfully

从监听中可以看到,数据库lhr19cdb的EM端口为5500,数据库lhr19sdb的EM端口为5501

3.2 在外部访问容器内数据库

Microsoft Windows [版本 10.0.17134.765]
(c) 2018 Microsoft Corporation。保留所有权利。

C:\Users\lhrxxt>sqlplus sys/lhr@192.168.1.35:1521/lhr19cdb as sysdba

SQL*Plus: Release 12.1.0.2.0 Production on Mon Jun 29 10:22:29 2020

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


Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production

SYS@192.168.1.35:1521/lhr19cdb> show pdbs

    CON_ID CON_NAME                       OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
         2 PDB$SEED                       READ ONLY  NO
SYS@192.168.1.35:1521/lhr19cdb> exit
Disconnected from Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production

C:\Users\lhrxxt>sqlplus sys/lhr@192.168.1.35:1521/lhr19sdb as sysdba

SQL*Plus: Release 12.1.0.2.0 Production on Mon Jun 29 10:22:40 2020

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


Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production

SYS@192.168.1.35:1521/lhr19sdb>

3.3 访问容器内的EM

访问地址:

https://192.168.1.35:5500/em
https://192.168.1.35:5501/em

3.4 使用ssh连接到容器内


C:\Users\lhrxxt>ssh root@192.168.1.35 -p222
The authenticity of host '[192.168.1.35]:222 ([192.168.1.35]:222)' can't be established.
ECDSA key fingerprint is SHA256:F5eg+8MD/fIIF5xnbNr1P0ddok7orVtFb+jji5xq33I.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '[192.168.1.35]:222' (ECDSA) to the list of known hosts.
root@192.168.1.35's password:
Last login: Wed Jun 24 11:07:12 2020
[root@lhr2019ocpasm ~]#
[root@lhr2019ocpasm ~]#
[root@lhr2019ocpasm ~]#
[root@lhr2019ocpasm ~]# crsctl stat res -t
--------------------------------------------------------------------------------
Name           Target  State        Server                   State details
--------------------------------------------------------------------------------
Local Resources
--------------------------------------------------------------------------------
ora.DATA.dg
               ONLINE  ONLINE       lhr2019ocpasm            STABLE
ora.FRA.dg
               ONLINE  ONLINE       lhr2019ocpasm            STABLE
ora.LISTENER.lsnr
               ONLINE  ONLINE       lhr2019ocpasm            STABLE
ora.asm
               ONLINE  ONLINE       lhr2019ocpasm            Started,STABLE
ora.ons
               OFFLINE OFFLINE      lhr2019ocpasm            STABLE
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
ora.cssd
      1        ONLINE  ONLINE       lhr2019ocpasm            STABLE
ora.diskmon
      1        OFFLINE OFFLINE                               STABLE
ora.evmd
      1        ONLINE  ONLINE       lhr2019ocpasm            STABLE
ora.lhr19cdb.db
      1        ONLINE  OFFLINE      lhr2019ocpasm            Instance Shutdown,ST
                                                             ARTING
ora.lhr19sdb.db
      1        ONLINE  ONLINE       lhr2019ocpasm            Open,HOME=/u01/app/o
                                                             racle/product/19.3.0
                                                             /dbhome_1,STABLE
--------------------------------------------------------------------------------

About Me


● 本文作者:小麦苗,部分内容整理自网络,若有侵权请联系小麦苗删除
● 本文在个人微 信公众号(DB宝)上有同步更新
● QQ群号: 230161599 、618766405,微信群私聊
● 个人QQ号(646634621),微 信号(db_bao),注明添加缘由
● 于 2020年7月 在西安完成
● 最新修改时间:2020年7月
● 版权所有,欢迎分享本文,转载请保留出处


●小麦苗的微店: https://weidian.com/s/793741433?wfr=c&ifr=shopdetail
●小麦苗出版的数据库类丛书: http://blog.itpub.net/26736162/viewspace-2142121/
●小麦苗OCP、OCM、高可用、DBA学习班: http://blog.itpub.net/26736162/viewspace-2148098/
●数据库笔试面试题库及解答: http://blog.itpub.net/26736162/viewspace-2134706/


使用微信客户端扫描下面的二维码来关注小麦苗的微信公众号(DB宝)及QQ群(DBA宝典)、添加小麦苗微信, 学习最实用的数据库技术。
小麦苗信息


包括详细的安装过程和每一的说明,以及安装注意事项 一、 说明 2 二、 安装前 2 (一) 相关知识点 2 1. RAC概述 2 2. GI(Grid Infrastructure) 4 (二) 安装前环境准备 4 1. 安装骤 4 2. 虚拟机硬件环境准备 5 3. 安装包下载 6 4. 安装部署时间控制 6 5. 安装过程应注意的地方 7 (三) 生产环境安装部署注意事项: 7 三、 实验环境配置 7 (一) 虚拟环境配置 7 (二) 配置OS 11 1) 关闭防火墙 11 2) 修改host文件或配置DNS解释SCANIP(配置过程如下) 11 3) 配置节点互信(所有节点的基于用户oracle,grid的互信) 12 4) 创建组和用户,加权限 13 5) 用户环境变量配置 13 6) 创建目录,给予目录权限   14 7) 配置系统文件 14 a) 配置oracle、grid用户的shell限制 14 b) 修改/etc/pam.d/login配置文件 15 c) 修改内核配置文件/etc/sysctl.conf 15 d) 修改/etc/sysctl.conf过程中报错处理: 15 8) 配置共享磁盘 (在一个节点执行即可) 16 a) 分区 16 b) 配置UDEV绑定磁盘分区 17 9) 安装GI、Oracle、等要的包 17 四、 安装配置cluster集群软件及ASM 19 (一) 安装前检查 19 (二) 开始安装GI 21 (三) 检查安装结果 57 (四) 安装数据库oracle 软件、创建ASM磁盘组 61 五、 集群数据库的创建 79 六、 安装后任务 96 (一) 官方建议的两个安装后置任务 96 (二) 删除GI、数据库(具体参考另一文档) 97 (三) 软件下载 98 (四) 参考 98
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

打赏作者

AiDBA宝典

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

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

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

打赏作者

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

抵扣说明:

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

余额充值