Oracle 18c 12c RAC flex asm特性测试
在11g rac中asm实例与oracle实例通常需要在同一个节点上,一旦节点上的asm实例异常终止,其所对应的oracle实例也会被终止,单节点数据库失败。然而在18c rac中默认已开启flex asm特性,单节点asm实例中断并不会影响oracle数据库的业务,反而会自动连接存活节点上的asm实例。
实际经过测试发现此FLEX特性在12C R2(12.2.0.1)就已存在
下面是18c与12.1.0.2的功能测试
一、Oracle 18c
1 查看rac集群模式
[root@rac1 ~]# asmcmd showclustermode
ASM cluster : Flex mode enabled - Direct Storage Access
默认已开启flex特性
2 查看节点asm实例状态
[root@rac1 ~]# srvctl status asm -detail
ASM is running on rac1,rac2 ----->asm在两个节点上运行
ASM is enabled.
ASM instance +ASM1 is running on node rac1
Number of connected clients: 2
Client names: orcl1:orcl:rac-18c rac1:_OCR:rac-18c
ASM instance +ASM2 is running on node rac2
Number of connected clients: 3
Client names: -MGMTDB:_mgmtdb:rac-18c orcl2:orcl:rac-18c rac2:_OCR:rac-18c
3 查看数据库实例状态
[root@rac1 ~]# srvctl status database -d orcl -detail
Instance orcl1 is running on node rac1
Instance orcl1 is connected to ASM instance +ASM1 ---->此时节点1上的orcl实例连接的是+ASM1
Instance orcl2 is running on node rac2
Instance orcl2 is connected to ASM instance +ASM2
4 强制关闭节点1上的asm实例
[root@rac1 ~]# ps -ef|grep pmon
grid 3517 1 0 14:50 ? 00:00:00 asm_pmon_+ASM1
oracle 3828 1 0 14:50 ? 00:00:00 ora_pmon_orcl1
[root@rac1 ~]# srvctl stop asm -node rac1 -stopoption abort -force
[root@rac1 ~]# ps -ef|grep pmon
oracle 3828 1 0 14:50 ? 00:00:00 ora_pmon_orcl1
root 7130 108701 0 14:56 pts/3 00:00:00 grep --color=auto pmon
5 查看asm实例信息
[root@rac1 ~]# srvctl status asm
ASM is running on rac2 ---->此时asm只在节点2上运行
[root@rac1 ~]# srvctl status database -d orcl -detail
Instance orcl1 is running on node rac1
Instance orcl1 is connected to ASM instance +ASM2 -->节点1已切换到节点2上的asm实例
Instance orcl2 is running on node rac2
Instance orcl2 is connected to ASM instance +ASM2
[root@rac1 ~]# srvctl status asm -detail
ASM is running on rac2
ASM is enabled.
ASM instance +ASM2 is running on node rac2
Number of connected clients: 4
Client names: -MGMTDB:_mgmtdb:rac-18c orcl1:orcl:rac-18c orcl2:orcl:rac-18c rac2:_OCR:rac-18c
6 测试节点1上的数据库
```sql
[oracle@rac1 ~]$ sqlplus / as sysdba
SQL*Plus: Release 18.0.0.0.0 - Production on Fri Feb 15 14:58:18 2019
Version 18.3.0.0.0
Copyright © 1982, 2018, Oracle. All rights reserved.
Connected to:
Oracle Database 18c Enterprise Edition Release 18.0.0.0.0 - Production
Version 18.3.0.0.0
SQL> select status from v$instance;
STATUS
------------
OPEN
SQL> select open_mode from v$database;
OPEN_MODE
--------------------
READ WRITE
在节点1上数据库实例并未受到影响
7 再次启动节点1的asm实例
[root@rac1 ~]# srvctl start asm -node rac1
[root@rac1 ~]# srvctl status asm -detail
ASM is running on rac1,rac2 --->asm实例又重新恢复
ASM is enabled.
ASM instance +ASM1 is running on node rac1
Number of connected clients: 2
Client names: orcl1:orcl:rac-18c rac1:_OCR:rac-18c
ASM instance +ASM2 is running on node rac2
Number of connected clients: 3
Client names: -MGMTDB:_mgmtdb:rac-18c orcl2:orcl:rac-18c rac2:_OCR:rac-18c
Oracle 12.1.0.2
1 查看集群模式
[grid@rac1 ~]$ asmcmd showclustermode
ASM cluster : Flex mode disabled
未开启flex
2 手动kill asm进程
[grid@rac1 ~]$ ps -ef|grep pmon
grid 13836 1 0 15:52 ? 00:00:00 asm_pmon_+ASM1
grid 14200 1 0 15:52 ? 00:00:00 mdb_pmon_-MGMTDB
grid 31316 12331 0 16:26 pts/0 00:00:00 grep --color=auto pmon
[grid@rac1 ~]$ srvctl status asm
ASM is running on rac1,rac2
[grid@rac1 ~]$ srvctl status database -d orcl
Instance orcl1 is not running on node rac1
Instance orcl2 is running on node rac2
[grid@rac1 ~]$ kill -9 13836
3 查看节点1状态
[grid@rac1 ~]$ srvctl status asm
ASM is running on rac2
[grid@rac1 ~]$ srvctl status database -d orcl
Instance orcl1 is not running on node rac1
Instance orcl2 is running on node rac2