[关闭]
@clisdodo 2019-11-19T17:03:21.000000Z 字数 17517 阅读 3550

Oracle 19c SI ASM UDEV方式静默搭建(OEL 7.7)

OEL7.7 19c SingleInstance ASM


AskScuti :搭建类 2-0-3 Oracle 19c 单实例ASM采用UDEV方式静默搭建

你需要知道的

磁盘 容量 作用
/dev/sdb 32.2 GB Oracle Software
/dev/sdc 1073 MB OCR1
/dev/sdd 1073 MB OCR2
/dev/sde 1073 MB OCR3
/dev/sdf 214.7 GB Data1
/dev/sdg 214.7 GB Data2
/dev/sdh 107.4 GB Archived
/dev/sdi 536.9 GB Backup

1 操作系统安装

2 环境配置

2.1 磁盘分区及格式化

2.2 主机环境设置

  1. su - oracle
  2. vim .bash_profile
  3. PS1="[`whoami`@`hostname`:"'$PWD]$'
  4. export PS1
  5. export TMP=/tmp
  6. export TMPDIR=$TMP
  7. ORACLE_BASE=/u01/app/oracle; export ORACLE_BASE
  8. ORACLE_HOME=$ORACLE_BASE/product/19.3.0/dbhome_1; export ORACLE_HOME
  9. ORACLE_SID=SIASM19C; export ORACLE_SID
  10. ORACLE_TERM=xterm; export ORACLE_TERM
  11. NLS_DATE_FORMAT="yyyy-mm-dd HH24:MI:SS"; export NLS_DATE_FORMAT
  12. NLS_LANG=AMERICAN_AMERICA.ZHS16GBK;export NLS_LANG
  13. PATH=.:$PATH:$HOME/bin:$ORACLE_BASE/product/19.3.0/dbhome_1/bin:$ORACLE_HOME/bin; export PATH
  14. THREADS_FLAG=native; export THREADS_FLAG
  15. if [ $USER = "oracle" ] || [ $USER = "grid" ]; then
  16. if [ $SHELL = "/bin/ksh" ]; then
  17. ulimit -p 16384
  18. ulimit -n 65536
  19. else
  20. ulimit -u 16384 -n 65536
  21. fi
  22. umask 022
  23. fi
  1. su - grid
  2. vim .bash_profile
  3. PS1="[`whoami`@`hostname`:"'$PWD]$'
  4. export PS1
  5. umask 022
  6. export TMP=/tmp
  7. export TMPDIR=$TMP
  8. ORACLE_SID=+ASM; export ORACLE_SID
  9. ORACLE_TERM=xterm; export ORACLE_TERM
  10. ORACLE_BASE=/u01/app/grid; export ORACLE_BASE
  11. ORACLE_HOME=/u01/app/19.3.0/grid; export ORACLE_HOME
  12. NLS_DATE_FORMAT="yyyy-mm-dd HH24:MI:SS"; export NLS_DATE_FORMAT
  13. PATH=.:$PATH:$HOME/bin:$ORACLE_HOME/bin; export PATH
  14. THREADS_FLAG=native; export THREADS_FLAG
  15. if [ $USER = "oracle" ] || [ $USER = "grid" ]; then
  16. if [ $SHELL = "/bin/ksh" ]; then
  17. ulimit -p 16384
  18. ulimit -n 65536
  19. else
  20. ulimit -u 16384 -n 65536
  21. fi
  22. umask 022
  23. fi

3 ASM 磁盘配置

3.1 设置白名单

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

3.2 确认SCSI标识符

分区 SCSI标识符
/usr/lib/udev/scsi_id -g -u -d /dev/sdc1 36000c2976a776add818a93264891b590
/usr/lib/udev/scsi_id -g -u -d /dev/sdd1 36000c29312aa0a9406f202760c690e9d
/usr/lib/udev/scsi_id -g -u -d /dev/sde1 36000c29e98d5ab3b8fe9cc4bba81f723
/usr/lib/udev/scsi_id -g -u -d /dev/sdf1 36000c299f75c2fea6123eede18dc7f3b
/usr/lib/udev/scsi_id -g -u -d /dev/sdg1 36000c29de5af3331b80aac9bfc85e7aa
/usr/lib/udev/scsi_id -g -u -d /dev/sdh1 36000c298de4210b35dfe718a1e146866
/usr/lib/udev/scsi_id -g -u -d /dev/sdi1 36000c29c7f5fa636f0b246b2e98789dd

3.3 编辑UDEV规则文件

  1. KERNEL=="sd?1", SUBSYSTEM=="block", PROGRAM=="/usr/lib/udev/scsi_id -g -u -d /dev/$parent", RESULT=="36000c2976a776add818a93264891b590", 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=="36000c29312aa0a9406f202760c690e9d", 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=="36000c29e98d5ab3b8fe9cc4bba81f723", 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=="36000c299f75c2fea6123eede18dc7f3b", 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=="36000c29de5af3331b80aac9bfc85e7aa", 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=="36000c298de4210b35dfe718a1e146866", SYMLINK+="oracleasm/asm-archived", OWNER="grid", GROUP="asmadmin", MODE="0660"
  7. KERNEL=="sd?1", SUBSYSTEM=="block", PROGRAM=="/usr/lib/udev/scsi_id -g -u -d /dev/$parent", RESULT=="36000c29c7f5fa636f0b246b2e98789dd", SYMLINK+="oracleasm/asm-backup", OWNER="grid", GROUP="asmadmin", MODE="0660"

4 数据库软件安装(静默)

chown -R oracle:oinstall /soft
chmod -R 775 /soft
su - oracle
cd $ORACLE_HOME (注意oracle用户家目录:/u01/app/oracle/product/19.3.0/dbhome_1)
unzip -q /soft/19c-DB-V982063-01.zip 

./runInstaller -ignorePrereq -waitforcompletion -silent \
-responseFile /u01/app/oracle/product/19.3.0/dbhome_1/install/response/db_install.rsp \
oracle.install.option=INSTALL_DB_SWONLY \
UNIX_GROUP_NAME=oinstall \
INVENTORY_LOCATION=/u01/app/oraInventory \
SELECTED_LANGUAGES=en,en_GB \
ORACLE_HOME=/u01/app/oracle/product/19.3.0/dbhome_1 \
ORACLE_BASE=/u01/app/oracle \
oracle.install.db.InstallEdition=EE \
oracle.install.db.OSDBA_GROUP=dba \
oracle.install.db.OSOPER_GROUP=oper \
oracle.install.db.OSBACKUPDBA_GROUP=dba \
oracle.install.db.OSDGDBA_GROUP=dba \
oracle.install.db.OSKMDBA_GROUP=dba \
oracle.install.db.OSRACDBA_GROUP=dba \
SECURITY_UPDATES_VIA_MYORACLESUPPORT=false \
DECLINE_SECURITY_UPDATES=true

su - root

As a root user, execute the following script(s):
    1. /u01/app/oraInventory/orainstRoot.sh
    2. /u01/app/oracle/product/19.3.0/dbhome_1/root.sh

5 创建并启动监听(静默)

su - oracle
cd $ORACLE_HOME
lsnrctl stop

netca -silent -responseFile /u01/app/oracle/product/19.3.0/dbhome_1/assistants/netca/netca.rsp

lsnrctl status
lsnrctl start

6 GI 软件安装(静默)

6.1 配置安装

su - grid
cd $ORACLE_HOME (注意grid用户家目录:/u01/app/19.3.0/grid)
unzip -q /soft/19c-GI-V982068-01.zip

su - root
cd /u01/app/19.3.0/grid/cv/rpm/
chmod +x *
rpm -ivh cvuqdisk-1.0.10-1.rpm

su - grid
cd $ORACLE_HOME

./gridSetup.sh -ignorePrereq -waitforcompletion -silent \
-responseFile /u01/app/19.3.0/grid/install/response/gridsetup.rsp \
oracle.install.option=HA_CONFIG \
INVENTORY_LOCATION=/u01/app/oraInventory \
ORACLE_BASE=/u01/app/grid \
oracle.install.asm.storageOption=ASM \
oracle.install.asm.SYSASMPassword=oracle \
oracle.install.asm.monitorPassword=oracle \
oracle.install.asm.diskGroup.name=ocr \
oracle.install.asm.diskGroup.redundancy=NORMAL \
oracle.install.asm.diskGroup.AUSize=4 \
oracle.install.asm.diskGroup.diskDiscoveryString=/dev/oracleasm/* \
oracle.install.asm.diskGroup.disks=/dev/oracleasm/asm-ocr1,/dev/oracleasm/asm-ocr2,/dev/oracleasm/asm-ocr3 \
oracle.install.asm.OSDBA=asmdba \
oracle.install.asm.OSOPER=asmoper \
oracle.install.asm.OSASM=asmadmin \
oracle.install.crs.config.gpnp.configureGNS=false \
oracle.install.crs.config.useIPMI=false \
oracle.install.asm.upgradeASM=false

# root 执行脚本(等待 root 用户执行完毕,再去执行 grid 脚本)
As a root user, execute the following script(s):
    1. /u01/app/19.3.0/grid/root.sh

# grid 执行脚本(Attention! 执行这个脚本前,请先仔细阅读 6.2 小节:脚本补充说明)
As install user, execute the following command to complete the configuration.
/u01/app/19.3.0/grid/gridSetup.sh -executeConfigTools -responseFile /u01/app/19.3.0/grid/install/response/gridsetup.rsp [-silent]

6.2 脚本补充说明

6.3 查看 ASM 集群组件状态

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

6.4 查看 ASM 实例监听状态

[grid@asmsi19c:/u01/app/19.3.0/grid]$lsnrctl status

LSNRCTL for Linux: Version 19.0.0.0.0 - Production on 14-NOV-2019 08:21:34

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

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=asmsi19c)(PORT=1522)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 19.0.0.0.0 - Production
Start Date                14-NOV-2019 00:43:45
Uptime                    0 days 7 hr. 37 min. 48 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/asmsi19c/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=asmsi19c)(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 图形化创建(略)

7.2 静默创建

# 创建 ASM 磁盘组:DATA (/dev/oracleasm/asm-data1 | /dev/oracleasm/asm-data2)

asmca -silent -createDiskGroup \
-diskGroupName data \
-disk '/dev/oracleasm/asm-data1' \
-disk '/dev/oracleasm/asm-data2' \
-redundancy NORMAL \
-au_size 4 \
-compatible.asm '19.0.0.0.0' \
-compatible.rdbms '19.0.0.0.0' \
-compatible.advm '19.0.0.0.0'

# 创建 ASM 磁盘组:ARCHIVE (/dev/oracleasm/asm-archived)

asmca -silent -createDiskGroup \
-diskGroupName archive -disk '/dev/oracleasm/asm-archived' \
-redundancy EXTERNAL \
-au_size 4 \
-compatible.asm '19.0.0.0.0' \
-compatible.rdbms '19.0.0.0.0' \
-compatible.advm '19.0.0.0.0'

7.3 SQL 语句创建

8 创建数据库(静默)

dbca -silent -createDatabase -templateName General_Purpose.dbc \
-gdbname SIASM19C \
-sid SIASM19C \
-databaseConfigType SI \
-createAsContainerDatabase TRUE \
-numberOfPDBs 1 \
-pdbName sales \
-useLocalUndoForPDBs TRUE \
-pdbAdminPassword oracle \
-sysPassword oracle \
-systemPassword oracle \
-characterSet AL32UTF8 \
-memoryPercentage 40 \
-storageType ASM \
-diskGroupName DATA \
-asmsnmpPassword oracle

9 实例的开启与关闭

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