在 Oracle 12c 之前,对于要使用 ASM 的数据库实例来说,所有节点上的 ASM 实例必须已处于运行状态,才能启动数据库实例。如果 ASM 实例未运行,则意味着在存储级使用 ASM 的数据库实例不能启动。这实际上意味着无论采用何种技术(即 RAC、ASM 和共享存储),均不能访问数据库实例。
随着 Oracle 12c 的推出,一个名为 Oracle Flex ASM 的特性解除了上述限制,它的一个主要特性是故障切换到集群中的其他节点。本质上是一个中心和叶架构,Oracle Clusterware 通过一个替代 ASM 实例将故障节点的连接将无缝转移到另一个成员节点。在给定集群中运行的 ASM 实例数被称作 ASM 基数,默认值为 3。但此基数值可以使用 Clusterware 命令修改。
查看是否使用flex asm
查看asm模式
ASMCMD> showclustermode
ASM cluster : Flex mode enabled - Direct Storage Access
ASMCMD> showclusterstate
Normal
查看进程
[+ASM1]@ht01[/home/grid]$ps -ef|grep ckpt
grid 3490 1 0 21:26 ? 00:00:00 asm_ckpt_+ASM1
oracle 4332 1 0 21:27 ? 00:00:00 ora_ckpt_qdtais1
grid 16177 15843 0 21:53 pts/0 00:00:00 grep --color=auto ckpt
查看asm配置
[+ASM1]@ht01[/home/grid]$srvctl config asm -detail
ASM 主目录: <CRS home>
口令文件: +ocr/orapwASM
口令文件备份: +ocr/orapwASM_backup
ASM 监听程序: LISTENER
ASM 已启用。
ASM 已在以下节点上分别启用:
ASM 已在以下节点上分别禁用:
ASM 实例计数: 3
集群 ASM 监听程序: ASMNET1LSNR_ASM
查看asm状态
[+ASM1]@ht01[/home/grid]$srvctl status asm
ASM 正在 ht01,ht02 上运行
关闭asm实例1
[+ASM1]@ht01[/home/grid]$srvctl stop asm -node ht01 -stopoption abort -force
PRCR-1214 : 无法停止资源组 ora.asmgroup
PRCR-1214 : 无法停止资源组 ora.asmgroup
CRS-2670: 无法启动/重新定位 'ora.asm_listener.type', 因为 'ora.asm' 与该资源具有停止时 'hard' 相关性
CRS-5027: 无法停止节点 "ht01" 上的 ASM 实例, 因为集群就绪服务目前正在使用该实例。
CRS-0222: Resource 'RGI: ora.asmgroup 1 1' has dependency error.
使用命令关闭不了,只有强制kill进程
[+ASM1]@ht01[/home/grid]$ps -ef|grep smon
root 3103 1 1 21:25 ? 00:00:26 /u01/app/grid/bin/osysmond.bin
grid 3492 1 0 21:26 ? 00:00:00 asm_smon_+ASM1
oracle 4334 1 0 21:27 ? 00:00:00 ora_smon_qdtais1
grid 17266 15843 0 21:58 pts/0 00:00:00 grep --color=auto smon
[+ASM1]@ht01[/home/grid]$kill -9 3492
[+ASM1]@ht01[/home/grid]$srvctl status asm
ASM 正在 ht02 上运行
观察alert日志
2020-12-01T21:59:12.749475+08:00 *********************************************************************** Fatal NI connect error 12534, connecting to: (DESCRIPTION=(LOCAL=YES)(ADDRESS=(PROTOCOL=beq))) VERSION INFORMATION: TNS for Linux: Version 19.0.0.0.0 - Production Oracle Bequeath NT Protocol Adapter for Linux: Version 19.0.0.0.0 - Production Version 19.3.0.0.0 Time: 01-12月-2020 21:59:12 Tracing not turned on. Tns error struct: ns main err code: 12534 TNS-12534: TNS: 不支持该操作 ns secondary err code: 12560 nt main err code: 0 nt secondary err code: 0 nt OS err code: 0 2020-12-01T21:59:13.629150+08:00 Errors in file /u01/app/oracle/diag/rdbms/qdtais/qdtais1/trace/qdtais1_fenc_4352.trc: ORA-01092: ORACLE instance terminated. Disconnection forced 2020-12-01T21:59:17.143484+08:00 Errors in file /u01/app/oracle/diag/rdbms/qdtais/qdtais1/trace/qdtais1_fenc_4352.trc: ORA-01034: ORACLE not available ORA-27101: shared memory realm does not exist Linux-x86_64 Error: 2: No such file or directory Additional information: 4376 Additional information: -1302266741 2020-12-01T21:59:20.661331+08:00 Errors in file /u01/app/oracle/diag/rdbms/qdtais/qdtais1/trace/qdtais1_fenc_4352.trc: ORA-01034: ORACLE not available ORA-27101: shared memory realm does not exist Linux-x86_64 Error: 2: No such file or directory Additional information: 4376 Additional information: -1302266741 2020-12-01T21:59:24.348536+08:00 Errors in file /u01/app/oracle/diag/rdbms/qdtais/qdtais1/trace/qdtais1_fenc_4352.trc: ORA-01034: ORACLE not available ORA-27101: shared memory realm does not exist Linux-x86_64 Error: 2: No such file or directory Additional information: 4376 Additional information: -1302266741 2020-12-01T21:59:24.627486+08:00 NOTE: ASMB (index:0) registering with ASM instance as Flex client 0xe49415ad9238e09b (reg:504097243) (startid:1058045221) (reconnect) NOTE: ASMB (index:0) (4350) connected to ASM instance +ASM2, osid: 26058 (Flex mode; client id 0xe49415ad9238e09b) NOTE: ASMB (4350) rebuilding ASM server state for all pending groups NOTE: ASMB (4350) rebuilding ASM server state for group 2 (DATADG) 2020-12-01T21:59:25.677453+08:00 NOTE: ASMB (4350) rebuilt 1 (of 1) groups NOTE: ASMB (4350) rebuilt 11 (of 16) allocated files NOTE: (4350) fetching new locked extents from server NOTE: ASMB (4350) 0 locks established; 0 pending writes sent to server SUCCESS: ASMB (4350) reconnected & completed ASM server state for disk group 2 NOTE: ASMB (4350) rebuilding ASM server state for group 1 (ARCHDG) NOTE: ASMB (4350) rebuilt 1 (of 1) groups NOTE: ASMB (4350) rebuilt 5 (of 16) allocated files NOTE: (4350) fetching new locked extents from server NOTE: ASMB (4350) 0 locks established; 0 pending writes sent to server SUCCESS: ASMB (4350) reconnected & completed ASM server state for disk group 1 2020-12-01T21:59:29.347357+08:00 ALTER SYSTEM SET local_listener=' (ADDRESS=(PROTOCOL=TCP)(HOST=192.168.20.232)(PORT=1521))' SCOPE=MEMORY SID='qdtais1'; 2020-12-01T21:59:29.662798+08:00 ALTER SYSTEM SET remote_listener=' ht-scan:1521' SCOPE=MEMORY SID='qdtais1'; 2020-12-01T21:59:29.665003+08:00 ALTER SYSTEM SET listener_networks='' SCOPE=MEMORY SID='qdtais1'; 2020-12-01T21:59:32.117367+08:00 ALTER SYSTEM SET remote_listener=' ht-scan:1521' SCOPE=MEMORY SID='qdtais1'; 2020-12-01T21:59:46.730991+08:00 NOTE: ASMB (4350) relocating from ASM instance +ASM2 (ASM-initiated) NOTE: ASMB (index:0) registering with ASM instance as Flex client 0xe49415ad9238e09b (reg:4092518217) (startid:1058045221) (reconnect) NOTE: ASMB (index:0) (4350) connected to ASM instance +ASM1, osid: 17773 (Flex mode; client id 0xe49415ad9238e09b) NOTE: ASMB (4350) rebuilding ASM server state for all pending groups NOTE: ASMB (4350) rebuilding ASM server state for group 2 (DATADG) NOTE: ASMB (4350) rebuilt 1 (of 1) groups NOTE: ASMB (4350) rebuilt 11 (of 16) allocated files NOTE: (4350) fetching new locked extents from server NOTE: ASMB (4350) 0 locks established; 0 pending writes sent to server 2020-12-01T21:59:47.723692+08:00 SUCCESS: ASMB (4350) reconnected & completed ASM server state for disk group 2 2020-12-01T21:59:47.723778+08:00 NOTE: ASMB (4350) rebuilding ASM server state for group 1 (ARCHDG) NOTE: ASMB (4350) rebuilt 1 (of 1) groups NOTE: ASMB (4350) rebuilt 5 (of 16) allocated files NOTE: (4350) fetching new locked extents from server NOTE: ASMB (4350) 0 locks established; 0 pending writes sent to server SUCCESS: ASMB (4350) reconnected & completed ASM server state for disk group 1 2020-12-01T21:59:57.728906+08:00 Setting Resource Manager plan DEFAULT_MAINTENANCE_PLAN via parameter
查看数据库状态
[qdtais1]@ht01[/home/oracle]$sqlplus / as sysdba
SQL*Plus: Release 19.0.0.0.0 - Production on Tue Dec 1 22:04:39 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
SQL> select open_mode from v$database;
OPEN_MODE
--------------------
READ WRITE
在19C上使用flex asm 是没有问题,在12.1.0.2这个版本中使用FLEX ASM可能会遇到bug导致集群起不来,具体报错
2019-08-13 19:48:30.691 : USRTHRD:893126400: {0:5:3} ORA-12547: TNS:lost contact ORA-12547: TNS:lost contact ORA-15077: could not locate ASM instance serving a required diskgroup
遇到以上错误,卸载重装集群也不行,只能使用stand asm
mos如下:
FLEXASM: Unable to Start CRS After Reboot ORA-12537 ora.storage ORA-
12547 (Doc ID 2294385.1)
Unable To Start CRS stack with ORA-15077 (Doc ID 1938997.1)
Bug 28148720 - Resource 'ora.storage' Failed to Star With Error ORA-15077 (Doc ID
28148720.8)