[关闭]
@clisdodo 2019-11-28T09:14:34.000000Z 字数 15951 阅读 3339

Oracle 12cR2 SI ASM UDEV方式静默搭建(RHEL 7.6)

2级类 RHEL7.6 ASM


AskScuti :搭建类 2-0-4 Oracle 12cR2 单实例ASM采用UDEV方式图形化搭建(补丁)

你需要知道的

磁盘 容量 作用
/dev/sdb 53.7 GB Oracle Oinstall /u01
/dev/sdc 21.5 GB /soft
/dev/sdd 1073 MB OCR1
/dev/sde 1073 MB OCR2
/dev/sdf 1073 MB OCR3
/dev/sdg 10.7 GB Data1
/dev/sdh 10.7 GB Data2
/dev/sdi 5368 MB Archived
/dev/sdj 5368 MB Archived

1 操作系统安装

2 环境配置

2.1 磁盘分区及格式化

2.2 主机环境设置

编辑文件 /etc/security/limits.conf 添加以下行

    grid soft nproc 2047
    grid hard nproc 16384
    grid soft nofile 1024
    grid hard nofile 65536
    grid soft stack 10240
    grid hard stack 32768
    oracle soft nproc 2047
    oracle hard nproc 16384
    oracle soft nofile 1024
    oracle hard nofile 65536
    oracle soft stack 10240
    oracle hard stack 32768

编辑文件 /etc/sysctl.conf 添加以下行

    fs.aio-max-nr = 1048576
    fs.file-max = 6815744
    kernel.sem = 250 32000 100 128
    net.ipv4.ip_local_port_range = 9000 65500
    net.core.rmem_default = 262144
    net.core.rmem_max = 4194304
    net.core.wmem_default = 262144
    net.core.wmem_max = 1048586
    kernel.panic_on_oops = 1
    kernel.shmmax = 3865470566
    kernel.shmall = 943718
    kernel.shmmni = 4096

    执行 `sysctl -p` 生效

3 ASM 磁盘配置

3.1 设置受信任白名单

编辑文件 /etc/scsi_id 添加选项 options=-g,如果没有那么创建它。

    [root@henry ~]# echo "options=-g" > /etc/scsi_id.config

3.2 确认SCSI标识符

通过命令 /usr/lib/udev/scsi_id -g -u -d 分区名 确认标识符,最终对应关系如下

分区 SCSI标识符
/usr/lib/udev/scsi_id -g -u -d /dev/sdd1 36000c29e076a000862d076f7a78e49fa
/usr/lib/udev/scsi_id -g -u -d /dev/sde1 36000c291247d41ae0b6e4de1010a804e
/usr/lib/udev/scsi_id -g -u -d /dev/sdf1 36000c2988874adeef1f38ace210f5880
/usr/lib/udev/scsi_id -g -u -d /dev/sdg1 36000c291e32472781a955708abf73555
/usr/lib/udev/scsi_id -g -u -d /dev/sdh1 36000c29ba3f4122dc84d6da542853dbb
/usr/lib/udev/scsi_id -g -u -d /dev/sdi1 36000c29ed0661d93abe1b463b8d98223
/usr/lib/udev/scsi_id -g -u -d /dev/sdj1 36000c29670666047c13b65aace55e38c

3.3 编辑UDEV规则文件

  1. KERNEL=="sd?1", SUBSYSTEM=="block", PROGRAM=="/usr/lib/udev/scsi_id -g -u -d /dev/$parent", RESULT=="36000c29e076a000862d076f7a78e49fa", SYMLINK+="oracleasm/asm-ocr1", OWNER="grid", GROUP="asmadmin", MODE="0660"
  2. KERNEL=="sd?1", SUBSYSTEM=="block", PROGRAM=="/usr/lib/udev/scsi_id -g -u -d /dev/$parent", RESULT=="36000c291247d41ae0b6e4de1010a804e", SYMLINK+="oracleasm/asm-ocr2", OWNER="grid", GROUP="asmadmin", MODE="0660"
  3. KERNEL=="sd?1", SUBSYSTEM=="block", PROGRAM=="/usr/lib/udev/scsi_id -g -u -d /dev/$parent", RESULT=="36000c2988874adeef1f38ace210f5880", SYMLINK+="oracleasm/asm-ocr3", OWNER="grid", GROUP="asmadmin", MODE="0660"
  4. KERNEL=="sd?1", SUBSYSTEM=="block", PROGRAM=="/usr/lib/udev/scsi_id -g -u -d /dev/$parent", RESULT=="36000c291e32472781a955708abf73555", SYMLINK+="oracleasm/asm-data1", OWNER="grid", GROUP="asmadmin", MODE="0660"
  5. KERNEL=="sd?1", SUBSYSTEM=="block", PROGRAM=="/usr/lib/udev/scsi_id -g -u -d /dev/$parent", RESULT=="36000c29ba3f4122dc84d6da542853dbb", SYMLINK+="oracleasm/asm-data2", OWNER="grid", GROUP="asmadmin", MODE="0660"
  6. KERNEL=="sd?1", SUBSYSTEM=="block", PROGRAM=="/usr/lib/udev/scsi_id -g -u -d /dev/$parent", RESULT=="36000c29ed0661d93abe1b463b8d98223", SYMLINK+="oracleasm/asm-archived1", OWNER="grid", GROUP="asmadmin", MODE="0660"
  7. KERNEL=="sd?1", SUBSYSTEM=="block", PROGRAM=="/usr/lib/udev/scsi_id -g -u -d /dev/$parent", RESULT=="36000c29670666047c13b65aace55e38c", SYMLINK+="oracleasm/asm-archived2", OWNER="grid", GROUP="asmadmin", MODE="0660"

---分割线---

20190921OCP 班的同学们,拿到环境后,从这里开始。环境已完成标题1至标题3的所有搭建,同时在 /soft 文件夹里包含OPatch工具及GI补丁。请按照以下步骤完成所有操作。你也可以选择从零开始,按照文档搭建新环境。

4 数据库软件安装

image_1dq0rknh91ebk1ng847314501qb49.png-362.5kB

image_1dq0rl01s189ppuo8cpoig9sum.png-342.9kB

image_1dq0rl7kcnoji531ohh1sbm12as13.png-345.1kB

image_1dq0s4dlf1pukfpk7s1imkuud1g.png-364.5kB

image_1dq0s4jbt18b070v1etn6ckqc1t.png-362.8kB

image_1dq0s4p05imkpguabqik4a102a.png-362.8kB

image_1dq0s50q9h9gg41f5t7ud1r022n.png-375.8kB

image_1dq0s6nr166v1q6e1ae9ajap2134.png-370.4kB

image_1dq0s7tvq1nbf1k931sj2sgju6p3h.png-378.7kB

image_1dq0sumdd1eed1scici7hnon353u.png-304.6kB

image_1dq0t6pgk1cv31nrluhg94810e4b.png-253.3kB

image_1dq0ta1j9s3p1st6uli1rfh12ts4o.png-312.7kB

5 监听创建

image_1dq11tma012re9inqdurhg15dm55.png-553.5kB

image_1dq11u0e71c4n140o1an4d09hqg5i.png-543.3kB

image_1dq11ueii1v3r17f2bo0nbg1kod5v.png-536.8kB

image_1dq11uneolcs1rpknijuroffh6c.png-541.6kB

image_1dq11v27013344c2e3scgpr276p.png-532.7kB

image_1dq11vckucbp1da41jq2j1q1lfg76.png-534kB

image_1dq120ma9d7qm7p19fv9gc1jmi7j.png-550.7kB

6 GI 软件安装

6.1 解压GI软件

# 切换 grid 用户进行解压

[grid@henry ~]$ cd $ORACLE_HOME
[grid@henry grid]$ unzip -q /soft/12c-linuxx64_12201_grid_home.zip 

# 查看当前默认 OPatch 版本

[grid@henry grid]$ OPatch/opatch version
OPatch Version: 12.2.0.1.6

OPatch succeeded.

# 解压 OPatch 工具覆盖当前文件夹,提示输入:A

[grid@henry grid]$ unzip /soft/p6880880_122010_Linux-x86-64.zip 

Archive:  /soft/p6880880_122010_Linux-x86-64.zip
  inflating: OPatch/emdpatch.pl      
replace OPatch/oplan/oplan? [y]es, [n]o, [A]ll, [N]one, [r]ename: A

# 查看当前 OPatch 工具版本

[grid@henry grid]$ OPatch/opatch version
OPatch Version: 12.2.0.1.17

OPatch succeeded.

6.2 解压 GI 补丁

[grid@henry grid]$ cd /soft/

[grid@henry soft]$ unzip -q p29708720_122010_Linux-x86-64.zip

6.3 打补丁并运行程序

[grid@henry soft]$ cd $ORACLE_HOME
[grid@henry grid]$ ./gridSetup.sh -applyPSU /soft/29708720/
Preparing the home to patch...
Applying the patch /soft/29708720/...
Successfully applied the patch.
The log can be found at: /u01/app/oraInventory/logs/GridSetupActions2019-11-19_02-07-56PM/installerPatchActions_2019-11-19_02-07-56PM.log
Launching Oracle Grid Infrastructure Setup Wizard...

image_1dq151pgulg3gau1ogd1vvpu280.png-330.2kB

image_1dq157ut31b71f0q7ls1bag19q18d.png-359.6kB

image_1dq15950d1894oq0kek10mkhcr8q.png-358.4kB

image_1dq15amqb1g9110va9gsb2i1i1597.png-338.9kB

image_1dq15b7le13uep3pqceil889qa4.png-346.8kB

image_1dq15bfjd18d4116718vp1tfijc5ah.png-332.9kB

image_1dq15d3ei98a1f9ft6fhbbv4bbu.png-336.3kB

image_1dq15dc58136p1vlq1f8on6h10i2cb.png-331kB

image_1dq15e1ib1m6k17081fc41u0i1vicco.png-345.4kB

image_1dq15e8vr174hehp2vv1scm71ed5.png-335.4kB

image_1dq15en4q1uaf9ae180qdut16o2di.png-325.6kB

image_1dq15gelr1jua1n0fa0ab6n6b6dv.png-347.4kB

这里有两个警告:物理内存建议8G/集群验证包。你可选择忽略警告,因为是单实例,它们不会阻止后面的安装操作。为保证完整性,你也可以选择安装集群验证包,12cR2 版本中,你可以在 oracle 数据库解压目录中找到它 /soft/database/rpm;也可以在 oracle 家目录中找到它 /u01/app/oracle/product/12.2.0.1/db_1/cv/rpm

# 切换 root 进行安装

[grid@henry ~]$ su - root
[root@henry rpm]# rpm -ivh cvuqdisk-1.0.10-1.rpm 
Preparing...                          ################################# [100%]
Updating / installing...
   1:cvuqdisk-1.0.10-1                ################################# [100%]

# 点击 Check Again

image_1dq164jrb4v85fsnu2dr7m88es.png-344.4kB

image_1dq166tlmk661n6atri1etp19m8fp.png-359.6kB

image_1dq1674n4fj6e758ch8fl17k1g6.png-350kB

image_1dq16aurc1acbe4h8nj11fq1to8hj.png-354.5kB

image_1dq16ebigk5t1cgm1pgn17qd1mhi0.png-300.5kB

image_1dq16ftp4j31101s15mas411hn9id.png-259kB

image_1dq16pcdu1r7lgm412b81krr1r8kiq.png-218.1kB

脚本执行成功后,点击 OK 继续安装,如果报以下错误,说明没有对GI进行补丁。

# 错误消息示例片段
2019/07/09 23:45:46 CLSRSC-330: Adding Clusterware entries to file 'oracle-ohasd.service'
2019/07/09 23:48:02 CLSRSC-400: A system reboot is required to continue installing.
The command '/u01/app/12.2.0/grid/perl/bin/perl -I/u01/app/12.2.0/grid/perl/lib -I/u01/app/12.2.0/grid/crs/install /u01/app/12.2.0/grid/crs/install/roothas.pl ' execution failed

image_1dq175tqg4c41jkf9lhfn21mu0p.png-321kB

# 查看集群组件状态

[grid@henry:/home/grid]$crsctl stat res -t
--------------------------------------------------------------------------------
Name           Target  State        Server                   State details       
--------------------------------------------------------------------------------
Local Resources
--------------------------------------------------------------------------------
ora.LISTENER.lsnr
               ONLINE  ONLINE       henry                    STABLE
ora.OCR.dg
               ONLINE  ONLINE       henry                    STABLE
ora.asm
               ONLINE  ONLINE       henry                    Started,STABLE
ora.ons
               OFFLINE OFFLINE      henry                    STABLE
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
ora.cssd
      1        ONLINE  ONLINE       henry                    STABLE
ora.diskmon
      1        OFFLINE OFFLINE                               STABLE
ora.driver.afd
      1        ONLINE  ONLINE       henry                    STABLE
ora.evmd
      1        ONLINE  ONLINE       henry                    STABLE
--------------------------------------------------------------------------------

# 查看 ASM 实例监听

[grid@henry:/home/grid]$lsnrctl status

LSNRCTL for Linux: Version 12.2.0.1.0 - Production on 19-NOV-2019 15:00:57

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

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=henry)(PORT=1522)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 12.2.0.1.0 - Production
Start Date                19-NOV-2019 14:51:16
Uptime                    0 days 0 hr. 9 min. 40 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /u01/app/12.2.0.1/grid/network/admin/listener.ora
Listener Log File         /u01/app/grid/diag/tnslsnr/henry/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=henry)(PORT=1522)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1522)))
Services Summary...
Service "+ASM" has 1 instance(s).
  Instance "+ASM", status READY, has 1 handler(s) for this service...
Service "+ASM_OCR" has 1 instance(s).
  Instance "+ASM", status READY, has 1 handler(s) for this service...
The command completed successfully

7 ASM 磁盘组创建

7.1 ASMCA 工具创建

image_1dq17n1drobsed41dq93d71ehe16.png-295.3kB

image_1dq17qdknl2k1evh19fhv745f2j.png-251kB

路径不对无法映射?看下后面第 10 小节的 错误处理

image_1dq1b1o6r5b51rhs4go15ur9oj19.png-272.5kB

image_1dq1bamgvphunijleau9dtng49.png-272.7kB

image_1dq1bb5kp6pcf9e1p9t11boq514m.png-256.4kB

7.2 ASMCA 静默创建

asmca -silent -createDiskGroup \
-diskGroupName ARCHIVED \
-disk '/dev/oracleasm/asm-archived1' \
-disk '/dev/oracleasm/asm-archived2' \
-redundancy NORMAL \
-au_size 4 \
-compatible.asm '12.2.0.1.0' \
-compatible.rdbms '12.2.0.1.0' \
-compatible.advm '12.2.0.1.0'

7.3 SQL 语句创建

8 数据库创建

image_1dq1c0lienom7e91n461d1i174k53.png-330.1kB

image_1dq1c0vt7vhq7n6jcebs4160d5g.png-338.2kB

image_1dq1c1aqk1nsafv5jv5ij7vla5t.png-349.8kB

image_1dq1c77qt7a91fkmdngrse64f8a.png-351.1kB

image_1dq1chq07gqhi2cccr1hjt1iu92c.png-352.6kB

image_1dq1cifc21bivgll17hcltf1u932p.png-335.8kB

image_1dq1cj79f776kgl2np1osi1vhd36.png-336.1kB

image_1dq1cjklc1kk6162t7v1okpf433j.png-334.5kB

image_1dq1ck27i76s1jr01actjnh1o40.png-352.2kB

image_1dq1ckdqc14571qsskq11j5v14b64d.png-355kB

image_1dq1cl2kvh4t1bself3s241r6o5a.png-335kB

image_1dq1clfhg1lf11tkn1g17vkps4r5n.png-339.7kB

image_1dq1clnqjh7d14341f2rfq19u064.png-349.1kB

image_1dq1cmo8h1s861a6v1j101ql2171h7h.png-352.8kB

image_1dq1cn0ril0pdm21aju2t2uk47u.png-360.3kB

image_1dq1cnvff18p35qi17guaqe6o48b.png-340.2kB

image_1dq1djro4313379hbk1mejne5a8.png-350.4kB

9 操作验证

9.1 登录 RDBMS 实例

[root@henry ~]# su - oracle
[oracle@henry:/home/oracle]$sqlplus / as sysdba

SQL> select name from v$datafile where con_id=1;

NAME
------------------------------------------------
+DATA/SIASMCDB/DATAFILE/system.256.1024763769
+DATA/SIASMCDB/DATAFILE/sysaux.257.1024763839
+DATA/SIASMCDB/DATAFILE/undotbs1.258.1024763875
+DATA/SIASMCDB/DATAFILE/users.259.1024763875

9.2 登录 ASM 实例

[root@henry ~]# su - grid
[grid@henry:/home/grid]$sqlplus / as sysasm

set linesize 200
col name for a10
col failgroup for a10
col path for a50
col group_number for 99
col disk_number for 99

SQL> select group_number,name,type,total_mb,free_mb,usable_file_mb from v$asm_diskgroup;

GROUP_NUMBER NAME       TYPE     TOTAL_MB    FREE_MB USABLE_FILE_MB
------------ ---------- ------ ---------- ---------- --------------
       1     OCR        NORMAL       3060       2772            876
       2     DATA       NORMAL      20472      13096           6548
       3     ARCHIVED   NORMAL      10232      10056           5028

9.3 关闭 ASM 实例及 RDBMS 实例

10 错误处理

创建 ASM 磁盘报错

image_1dq184q4c1euo0ljoh1eds14nm3d.png-278.9kB

添加新批注
在作者公开此批注前,只有你和作者可见。
回复批注