Bo's Oracle Station

【博客文章2016】Oracle12c RAC和Grid Infrastructure部署系列三:ASM新特性:Flex ASM

2016-10-7 16:57| 发布者: admin| 查看: 471| 评论: 0|原作者: Bo Tang

摘要: Flex ASM是集群高可用性发展史上的又一次让人叹为观止的提升。Oracle称其为Oracle数据库服务器基于集群的巩固性(Cluster Based Database Consolidation)。从12c这个版本开始,打破了以前版本中的“ASM实例只能服务于本机数据实例”铁律。要想使用后续系列要介绍的Flex Cluster必需先配置本章的Flex ASM,但是要使用Flex ASM不必同时使用Flex Cluster。

Author: Bo Tang


摘要

12c中, Oracle数据库服务器实例(作为ASM实例的客户)可以通过网络访问其他节点上的Flex ASM实例。有了Flex ASM,整个集群就不必运行那么多的ASM实例。也就是说不需要做ASM实例对应于节点的1:1映射。这样减少了资源占用,并且节点越多节省优势越大。更重要的是:如果一个Flex ASM实例死亡, 它的客户(比如:同一台物理机上的Oracle数据库服务器实例)仍能通过网络访问其他节点上的Flex ASM实例。这样就提高了Oracle数据库服务器基于集群的巩固性(Cluster Based Database Consolidation)。

在本文中,我们将继续使用Oracle12c RACGrid Infrastructure部署系列二》最后遗留下来的环境(该环境虽然在系列二最后已经被破坏了,但是破坏前已经做好了备份)。本文从备份启动实验起始环境。在实验过程中,首先转换现有的标准ASMStandard ASM)到Flex ASM,然后设置Flex ASM实例计数ASM Cardinality)。最后做Oracle数据库服务器基于集群的巩固性测试。


微信查看请扫:


目录

1. Flex ASM体系结构

2. 滚动转换(不是升级)现有的标准ASMStandard ASM)到Flex ASM

2.1 查看原始实验环境

2.2 第一阶段:asmca图形界面转换

2.3 第二阶段:以root身份运行“converttoFlexASM.sh”脚本

2.4 查看转换成功后的实验环境

2.5 校正Flex ASM实例计数(ASM Cardinality

3. 测试Flex ASM

3.1 加载工作负载

3.2 强迫关闭+ASM2实例,查看Flex ASM起到作用

3.3 手动启动刚才被强迫关闭的+ASM2实例

3.4 重分配db12c2数据库服务器实例连接回到+ASM2实例

总结

正文


1. Flex ASM体系结构

在以前的版本中,只有本地运行的ASM实例才能被同一物理机上的Oracle数据库服务器实例(作为ASM实例的客户)所访问到。如果某节点上的ASM实例死亡,所有该节点上的数据库服务器实例(作为ASM实例的客户)都要跟着死亡。为了区分新的Flex ASMOracle把以前版本的ASM称为:标准ASMStandard ASM)。

因为Oracle在以前版本的RAC/ASM中采用的是“Share Every Thing”的策略,所以在集群中随着节点数目的增多,ASM管理的“extent map”等元数据量会呈排列组合的级数增加,同样节点重配置时产生的事件量也会呈排列组合的级数增加。下图回顾了Oracle RAC/ASM发展简史:


12c中, Oracle数据库服务器实例(作为ASM实例的客户)可以通过网络访问其他节点上的Flex ASM实例。有了Flex ASM,整个集群就不必运行那么多的ASM实例。也就是说不需要做ASM实例对应于节点的1:1映射。这样减少了资源占用,并且节点越多节省优势越大。更重要的是:如果一个Flex ASM实例死亡, 它的客户(比如:同一台物理机上的Oracle数据库服务器实例)仍能通过网络访问其他节点上的Flex ASM实例。这样就提高了Oracle数据库服务器基于集群的巩固性(Cluster Based Database Consolidation)。


2. 滚动转换(不是升级)现有的标准ASMFlex ASM

在本文中,我们将继续使用Oracle12c RACGrid Infrastructure部署系列二》最后遗留下来的环境(该环境虽然在系列二最后已经被破坏了,但是破坏前已经做好了备份)。本文从备份启动实验起始环境。在实验过程中,首先转换现有的标准ASMStandard ASM)到Flex ASM,然后设置Flex ASM实例计数ASM Cardinality)。最后做Oracle数据库服务器基于集群的巩固性测试。


2.1 查看原始实验环境

Oracle12c RACGrid Infrastructure部署系列二》最后遗留下来的环境,是标准ASM环境,不是Flex ASM环境。集群中的两个节点上都运行着标准ASM实例:


[grid@station11 ~]$ asmcmd showclustermode

ASM cluster : Flex mode disabled

[grid@station11 ~]$ srvctl config asm

ASM home:

Password file: +DATA/orapwASM

ASM listener: LISTENER

[grid@station11 ~]$ srvctl status asm -verbose

ASM is running on station12,station11

Detailed state on node station11: Started

Detailed state on node station12: Started


2.2 第一阶段:asmca图形界面转换

grid用户,在station11调用asmca命令在图形界面执行转换:



asmca默认打开的选项卡是“Disk Groups”,请点到“ASM Instances”选项卡。并在该界面上点击“Convert to Oracle Flex ASM”按钮。



在“ASM Listener Port”栏中填写一个ASM监听器端口。该端口事先不能被占用,在此我们选择“1522”端口。

在 “Select the network(s) to be used for ASM ”表格里看到“Interface Name”左边显示为 “*”。这是因为本文中两台主机环境中的两个内网网卡(eth1eth2)都配置的是 “172.31.118.*”网段。请钩选“*”左边的复选框。

如果你的主机环境中只有一个内网网卡(比如:eth1),那么在 “Select the network(s) to be used for ASM ”表格里的“Interface Name”左边将显示为 “eth1”。在这种情况下ASM网与集群cluster_interconnect网会共用这同一个内网界面。但是如果你的主机环境中有两个以上的内网网卡(比如本文环境:eth1eth2),则可以物理分开ASM网与集群cluster_interconnect网。

ASM网是用于Flex ASM实例和它的客户(比如数据库服务器实例)进行跨节点传送ASM元数据等信息使用的。这是Flex ASM的工作通道,必需保证畅通。

最后我们注意到“Configure Oracle Flex ASM to run clusterwide”左边的复选框。顾名思义如果选中它就是指每个节点都要运行一个Flex ASM实例。这不就和以前的标准ASM没有什么区别了吗?是的,其实这个复选框存在的意义就是为了让Flex ASM也服务于混杂环境中可能存在的12.1以前的数据库服务器(它们没法连接到别的物理主机上的ASM实例)。

在本文的环境中,因为我们不使用混杂环境(我们的数据库服务器是12.1.0.2版本的),所以不选这个选项。如果不选这个选项,在整个集群中会默认配置一组数目为3Flex ASM实例。



开始获取原始实验环境中的标准ASM实例信息:



界面提示:要求确认要关闭station11上的GI进行滚动转换:



正在执行转换的第一阶段(图形界面进行):



(附:如果使用静默方式运行asmca,命令如下:asmca -silent -convertToFlexASM -asmNetworks */172.31.118.0 -asmListenerPort 1522


2.3 第二阶段:以root身份运行“converttoFlexASM.sh”脚本



当被提示以root身份运行脚本converttoFlexASM.sh”时,就进入执行转换的第二阶段。请在命令行以root身份执行。

该脚本只要在station11上执行(就是那个运行asmca的节点)就可以了。解释一下该脚本所做的工作:它首先重启station11上的GI,随后在 station11上滚动转换;再然后重启station12上的GI,最后再滚动转换。

注意:脚本没有执行完成之前,不能点击asmca界面上的“Close”按钮。


[root@station11 ~]# /u01/app/grid/cfgtoollogs/asmca/scripts/converttoFlexASM.sh

CRS-2673: Attempting to stop 'ora.crsd' on 'station11'

CRS-2790: Starting shutdown of Cluster Ready Services-managed resources on 'station11'

CRS-2673: Attempting to stop 'ora.FRA.dg' on 'station11'

CRS-2673: Attempting to stop 'ora.DATA.dg' on 'station11'

CRS-2673: Attempting to stop 'ora.db12c.db' on 'station11'

CRS-2673: Attempting to stop 'ora.LISTENER_SCAN1.lsnr' on 'station11'

CRS-2673: Attempting to stop 'ora.LISTENER.lsnr' on 'station11'

CRS-2677: Stop of 'ora.FRA.dg' on 'station11' succeeded

CRS-2677: Stop of 'ora.DATA.dg' on 'station11' succeeded

CRS-2677: Stop of 'ora.LISTENER_SCAN1.lsnr' on 'station11' succeeded

CRS-2673: Attempting to stop 'ora.scan1.vip' on 'station11'

CRS-2677: Stop of 'ora.LISTENER.lsnr' on 'station11' succeeded

CRS-2673: Attempting to stop 'ora.station11.vip' on 'station11'

CRS-2677: Stop of 'ora.scan1.vip' on 'station11' succeeded

CRS-2672: Attempting to start 'ora.scan1.vip' on 'station12'

CRS-2677: Stop of 'ora.station11.vip' on 'station11' succeeded

CRS-2672: Attempting to start 'ora.station11.vip' on 'station12'

CRS-2677: Stop of 'ora.db12c.db' on 'station11' succeeded

CRS-2676: Start of 'ora.scan1.vip' on 'station12' succeeded

CRS-2672: Attempting to start 'ora.LISTENER_SCAN1.lsnr' on 'station12'

CRS-2676: Start of 'ora.station11.vip' on 'station12' succeeded

CRS-2676: Start of 'ora.LISTENER_SCAN1.lsnr' on 'station12' succeeded

CRS-2673: Attempting to stop 'ora.ons' on 'station11'

CRS-2677: Stop of 'ora.ons' on 'station11' succeeded

CRS-2673: Attempting to stop 'ora.net1.network' on 'station11'

CRS-2677: Stop of 'ora.net1.network' on 'station11' succeeded

CRS-2792: Shutdown of Cluster Ready Services-managed resources on 'station11' has completed

CRS-2677: Stop of 'ora.crsd' on 'station11' succeeded

CRS-2673: Attempting to stop 'ora.ctssd' on 'station11'

CRS-2673: Attempting to stop 'ora.evmd' on 'station11'

CRS-2673: Attempting to stop 'ora.storage' on 'station11'

CRS-2677: Stop of 'ora.storage' on 'station11' succeeded

CRS-2673: Attempting to stop 'ora.asm' on 'station11'

CRS-2677: Stop of 'ora.ctssd' on 'station11' succeeded

CRS-2677: Stop of 'ora.evmd' on 'station11' succeeded

CRS-2677: Stop of 'ora.asm' on 'station11' succeeded

CRS-2673: Attempting to stop 'ora.cluster_interconnect.haip' on 'station11'

CRS-2677: Stop of 'ora.cluster_interconnect.haip' on 'station11' succeeded

CRS-2673: Attempting to stop 'ora.cssd' on 'station11'

CRS-2677: Stop of 'ora.cssd' on 'station11' succeeded

CRS-2672: Attempting to start 'ora.evmd' on 'station11'

CRS-2672: Attempting to start 'ora.cssdmonitor' on 'station11'

CRS-2676: Start of 'ora.cssdmonitor' on 'station11' succeeded

CRS-2672: Attempting to start 'ora.cssd' on 'station11'

CRS-2672: Attempting to start 'ora.diskmon' on 'station11'

CRS-2676: Start of 'ora.diskmon' on 'station11' succeeded

CRS-2676: Start of 'ora.evmd' on 'station11' succeeded

CRS-2676: Start of 'ora.cssd' on 'station11' succeeded

CRS-2672: Attempting to start 'ora.ctssd' on 'station11'

CRS-2672: Attempting to start 'ora.cluster_interconnect.haip' on 'station11'

CRS-2676: Start of 'ora.ctssd' on 'station11' succeeded

CRS-2676: Start of 'ora.cluster_interconnect.haip' on 'station11' succeeded

CRS-2672: Attempting to start 'ora.asm' on 'station11'

CRS-2676: Start of 'ora.asm' on 'station11' succeeded

CRS-2672: Attempting to start 'ora.storage' on 'station11'

CRS-2676: Start of 'ora.storage' on 'station11' succeeded

CRS-2672: Attempting to start 'ora.crsd' on 'station11'

CRS-2676: Start of 'ora.crsd' on 'station11' succeeded

Oracle Grid Infrastructure restarted in node station11

PRCC-1014 : ASMNET1LSNR_ASM 已在运行

PRCR-1004 : 资源 ora.ASMNET1LSNR_ASM.lsnr 已在运行

PRCR-1079 : 无法启动资源 ora.ASMNET1LSNR_ASM.lsnr

CRS-5702: Resource 'ora.ASMNET1LSNR_ASM.lsnr' is already running on 'station11'

ASM listener ASMNET1LSNR_ASM running already

CRS-2673: Attempting to stop 'ora.crsd' on 'station12'

CRS-2790: Starting shutdown of Cluster Ready Services-managed resources on 'station12'

CRS-2673: Attempting to stop 'ora.LISTENER_SCAN3.lsnr' on 'station12'

CRS-2673: Attempting to stop 'ora.LISTENER_SCAN2.lsnr' on 'station12'

CRS-2673: Attempting to stop 'ora.cvu' on 'station12'

CRS-2673: Attempting to stop 'ora.LISTENER.lsnr' on 'station12'

CRS-2673: Attempting to stop 'ora.oc4j' on 'station12'

CRS-2673: Attempting to stop 'ora.db12c.db' on 'station12'

CRS-2673: Attempting to stop 'ora.ASMNET1LSNR_ASM.lsnr' on 'station12'

CRS-2677: Stop of 'ora.cvu' on 'station12' succeeded

CRS-2672: Attempting to start 'ora.cvu' on 'station11'

CRS-2677: Stop of 'ora.LISTENER_SCAN3.lsnr' on 'station12' succeeded

CRS-2673: Attempting to stop 'ora.scan3.vip' on 'station12'

CRS-2677: Stop of 'ora.LISTENER_SCAN2.lsnr' on 'station12' succeeded

CRS-2673: Attempting to stop 'ora.scan2.vip' on 'station12'

CRS-2677: Stop of 'ora.LISTENER.lsnr' on 'station12' succeeded

CRS-2673: Attempting to stop 'ora.station12.vip' on 'station12'

CRS-2677: Stop of 'ora.ASMNET1LSNR_ASM.lsnr' on 'station12' succeeded

CRS-2676: Start of 'ora.cvu' on 'station11' succeeded

CRS-2677: Stop of 'ora.scan3.vip' on 'station12' succeeded

CRS-2672: Attempting to start 'ora.scan3.vip' on 'station11'

CRS-2677: Stop of 'ora.scan2.vip' on 'station12' succeeded

CRS-2672: Attempting to start 'ora.scan2.vip' on 'station11'

CRS-2673: Attempting to stop 'ora.mgmtdb' on 'station12'

CRS-2677: Stop of 'ora.db12c.db' on 'station12' succeeded

CRS-2677: Stop of 'ora.station12.vip' on 'station12' succeeded

CRS-2672: Attempting to start 'ora.station12.vip' on 'station11'

CRS-2676: Start of 'ora.scan3.vip' on 'station11' succeeded

CRS-2672: Attempting to start 'ora.LISTENER_SCAN3.lsnr' on 'station11'

CRS-2676: Start of 'ora.scan2.vip' on 'station11' succeeded

CRS-2672: Attempting to start 'ora.LISTENER_SCAN2.lsnr' on 'station11'

CRS-2676: Start of 'ora.station12.vip' on 'station11' succeeded

CRS-2677: Stop of 'ora.mgmtdb' on 'station12' succeeded

CRS-2673: Attempting to stop 'ora.MGMTLSNR' on 'station12'

CRS-2677: Stop of 'ora.MGMTLSNR' on 'station12' succeeded

CRS-2672: Attempting to start 'ora.MGMTLSNR' on 'station11'

CRS-2677: Stop of 'ora.oc4j' on 'station12' succeeded

CRS-2672: Attempting to start 'ora.oc4j' on 'station11'

CRS-2676: Start of 'ora.LISTENER_SCAN3.lsnr' on 'station11' succeeded

CRS-2676: Start of 'ora.LISTENER_SCAN2.lsnr' on 'station11' succeeded

CRS-2676: Start of 'ora.MGMTLSNR' on 'station11' succeeded

CRS-2672: Attempting to start 'ora.mgmtdb' on 'station11'

CRS-2676: Start of 'ora.oc4j' on 'station11' succeeded

CRS-2673: Attempting to stop 'ora.DATA.dg' on 'station12'

CRS-2673: Attempting to stop 'ora.FRA.dg' on 'station12'

CRS-2677: Stop of 'ora.DATA.dg' on 'station12' succeeded

CRS-2677: Stop of 'ora.FRA.dg' on 'station12' succeeded

CRS-2676: Start of 'ora.mgmtdb' on 'station11' succeeded

CRS-2673: Attempting to stop 'ora.ons' on 'station12'

CRS-2677: Stop of 'ora.ons' on 'station12' succeeded

CRS-2673: Attempting to stop 'ora.net1.network' on 'station12'

CRS-2677: Stop of 'ora.net1.network' on 'station12' succeeded

CRS-2792: Shutdown of Cluster Ready Services-managed resources on 'station12' has completed

CRS-2677: Stop of 'ora.crsd' on 'station12' succeeded

CRS-2673: Attempting to stop 'ora.ctssd' on 'station12'

CRS-2673: Attempting to stop 'ora.evmd' on 'station12'

CRS-2673: Attempting to stop 'ora.storage' on 'station12'

CRS-2677: Stop of 'ora.storage' on 'station12' succeeded

CRS-2673: Attempting to stop 'ora.asm' on 'station12'

CRS-2677: Stop of 'ora.ctssd' on 'station12' succeeded

CRS-2677: Stop of 'ora.evmd' on 'station12' succeeded

CRS-2677: Stop of 'ora.asm' on 'station12' succeeded

CRS-2673: Attempting to stop 'ora.cluster_interconnect.haip' on 'station12'

CRS-2677: Stop of 'ora.cluster_interconnect.haip' on 'station12' succeeded

CRS-2673: Attempting to stop 'ora.cssd' on 'station12'

CRS-2677: Stop of 'ora.cssd' on 'station12' succeeded

CRS-2672: Attempting to start 'ora.evmd' on 'station12'

CRS-2672: Attempting to start 'ora.cssdmonitor' on 'station12'

CRS-2676: Start of 'ora.cssdmonitor' on 'station12' succeeded

CRS-2672: Attempting to start 'ora.cssd' on 'station12'

CRS-2672: Attempting to start 'ora.diskmon' on 'station12'

CRS-2676: Start of 'ora.diskmon' on 'station12' succeeded

CRS-2676: Start of 'ora.evmd' on 'station12' succeeded

CRS-2676: Start of 'ora.cssd' on 'station12' succeeded

CRS-2672: Attempting to start 'ora.ctssd' on 'station12'

CRS-2672: Attempting to start 'ora.cluster_interconnect.haip' on 'station12'

CRS-2676: Start of 'ora.ctssd' on 'station12' succeeded

CRS-2676: Start of 'ora.cluster_interconnect.haip' on 'station12' succeeded

CRS-2672: Attempting to start 'ora.asm' on 'station12'

CRS-2676: Start of 'ora.asm' on 'station12' succeeded

CRS-2672: Attempting to start 'ora.storage' on 'station12'

CRS-2676: Start of 'ora.storage' on 'station12' succeeded

CRS-2672: Attempting to start 'ora.crsd' on 'station12'

CRS-2676: Start of 'ora.crsd' on 'station12' succeeded

Oracle Grid Infrastructure restarted in node station12


脚本成功执行完成后,点击asmca界面上的“Close”按钮。



经过以上两个阶段的转换,Flex ASM转换成功了:



2.4 查看转换成功后的实验环境


[grid@station11 ~]$ asmcmd showclustermode

ASM cluster : Flex mode enabled

[grid@station11 ~]$ srvctl config asm

ASM home:

Password file: +DATA/orapwASM

ASM listener: LISTENER

ASM instance count: 3

Cluster ASM listener: ASMNET1LSNR_ASM

[grid@station11 ~]$ srvctl status asm -verbose

ASM is running on station12,station11

Detailed state on node station11: Started

Detailed state on node station12: Started


[grid@station11 ~]$ crsctl stat res ora.asm -t

--------------------------------------------------------------------------------

Name Target State Server State details

--------------------------------------------------------------------------------

Cluster Resources

--------------------------------------------------------------------------------

ora.asm

1 ONLINE ONLINE station11 Started,STABLE

2 ONLINE ONLINE station12 Started,STABLE

3 OFFLINE OFFLINE STABLE

--------------------------------------------------------------------------------


注意到本文2.3节中的converttoFlexASM.sh”脚本最后居然把ASM实例数目设置成“3”这个默认值。当然这也不奇怪,这是本文2.2节中提到的不选“Configure Oracle Flex ASM to run clusterwide”左边的复选框进行转换系统定的默认值。但是我们只有两个节点,下节会进行校正。

下面查看两台主机上的ASM网和ASM listener


[grid@station11 ~]$ netstat -lntp | grep :1522

(Not all processes could be identified, non-owned process info

will not be shown, you would have to be root to see it all.)

tcp 0 0 172.31.118.11:1522 0.0.0.0:* LISTEN 9460/tnslsnr

tcp 0 0 172.31.118.211:1522 0.0.0.0:* LISTEN 9460/tnslsnr

[grid@station11 grid]$ lsnrctl status ASMNET1LSNR_ASM


LSNRCTL for Linux: Version 12.1.0.2.0 - Production on 14-OCT-2016 10:56:51


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


Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=ASMNET1LSNR_ASM)))

STATUS of the LISTENER

------------------------

Alias ASMNET1LSNR_ASM

Version TNSLSNR for Linux: Version 12.1.0.2.0 - Production

Start Date 14-OCT-2016 09:34:56

Uptime 0 days 1 hr. 21 min. 55 sec

Trace Level off

Security ON: Local OS Authentication

SNMP OFF

Listener Parameter File /u01/app/12.1.0/grid/network/admin/listener.ora

Listener Log File /u01/app/grid/diag/tnslsnr/station11/asmnet1lsnr_asm/alert/log.xml

Listening Endpoints Summary...

(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=ASMNET1LSNR_ASM)))

(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=172.31.118.211)(PORT=1522)))

(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=172.31.118.11)(PORT=1522)))

Services Summary...

Service "+ASM" has 2 instance(s).

Instance "+ASM1", status READY, has 2 handler(s) for this service...

Instance "+ASM2", status READY, has 1 handler(s) for this service...

The command completed successfully


[grid@station12 ~]$ netstat -lntp | grep :1522

(Not all processes could be identified, non-owned process info

will not be shown, you would have to be root to see it all.)

tcp 0 0 172.31.118.12:1522 0.0.0.0:* LISTEN 10099/tnslsnr

tcp 0 0 172.31.118.212:1522 0.0.0.0:* LISTEN 10099/tnslsnr

[grid@station12 ~]$ lsnrctl status ASMNET1LSNR_ASM


LSNRCTL for Linux: Version 12.1.0.2.0 - Production on 14-OCT-2016 10:59:53


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


Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=ASMNET1LSNR_ASM)))

STATUS of the LISTENER

------------------------

Alias ASMNET1LSNR_ASM

Version TNSLSNR for Linux: Version 12.1.0.2.0 - Production

Start Date 14-OCT-2016 09:35:58

Uptime 0 days 1 hr. 23 min. 54 sec

Trace Level off

Security ON: Local OS Authentication

SNMP OFF

Listener Parameter File /u01/app/12.1.0/grid/network/admin/listener.ora

Listener Log File /u01/app/grid/diag/tnslsnr/station12/asmnet1lsnr_asm/alert/log.xml

Listening Endpoints Summary...

(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=ASMNET1LSNR_ASM)))

(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=172.31.118.212)(PORT=1522)))

(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=172.31.118.12)(PORT=1522)))

Services Summary...

Service "+ASM" has 2 instance(s).

Instance "+ASM1", status READY, has 1 handler(s) for this service...

Instance "+ASM2", status READY, has 2 handler(s) for this service...

The command completed successfully


2.5 校正Flex ASM实例计数(ASM Cardinality

如前所述,在整个集群中会默认配置一组数目为3Flex ASM实例。Flex ASM实例计数(ASM Cardinality)是指:在整个集群中必需保证有几个Flex ASM实例在运行。Flex ASM实例计数最小值为“2”。我们把就它设为“2”以符合我们的节点计数。设置Flex ASM实例计数的操作的原则是这样的:按照Flex ASM实例计数的设置,某个Flex ASM实例会被自动添加和删除。如果一个正在运行着的Flex ASM实例被删除,那么原先连接到它的数据库服务器实例会被自动且透明地连接到集群里其他的Flex ASM实例;同样某个Flex ASM实例发生意外故障时,也会这样自动处理。


[grid@station11 ~]$ srvctl modify asm -count 2


我们验证以上设置的Flex ASM实例计数:


[grid@station11 ~]$ srvctl config asm

ASM home:

Password file: +DATA/orapwASM

ASM listener: LISTENER

ASM instance count: 2

Cluster ASM listener: ASMNET1LSNR_ASM

[grid@station11 ~]$ crsctl stat res ora.asm -t

--------------------------------------------------------------------------------

Name Target State Server State details

--------------------------------------------------------------------------------

Cluster Resources

--------------------------------------------------------------------------------

ora.asm

1 ONLINE ONLINE station11 Started,STABLE

2 ONLINE ONLINE station12 Started,STABLE

--------------------------------------------------------------------------------

[grid@station11 ~]$ sqlplus / as sysasm


SQL*Plus: Release 12.1.0.2.0 Production on Sat Oct 8 10:41:10 2016


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



Connected to:

Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production

With the Real Application Clusters and Automatic Storage Management options


SQL> set linesize 1000

SQL> col client_instance_name format a20

SQL> col ASM_INSTANCE_NAME format a20

SQL> col DB_NAME format a20

SQL> col STATUS format a20

SQL> select distinct i.instance_name asm_instance_name, c.instance_name client_instance_name,

2 c.db_name, c.status

3 from gv$instance i, gv$asm_client c

4 where i.inst_id=c.inst_id;


ASM_INSTANCE_NAME CLIENT_INSTANCE_NAME DB_NAME STATUS

-------------------- -------------------- -------------------- --------------------

+ASM1 +ASM1 +ASM CONNECTED

+ASM1 -MGMTDB _mgmtdb CONNECTED

+ASM1 db12c1 db12c CONNECTED

+ASM2 +ASM2 +ASM CONNECTED

+ASM2 db12c2 db12c CONNECTED


从以上最后的查询语句可以得知:环境中db12c1数据库服务器实例和_mgmtdb集群管理实例连接到+ASM1实例;db12c2数据库服务器实例连接到 +ASM2实例。

下面的语句查询是哪个节点运行着+ASM2实例:


SQL> select instance_name,host_name from gv$instance

2 where host_name='station12.example.com';


INSTANCE_NAME

------------------------------------------------

HOST_NAME

--------------------------------------------------------------------------------

+ASM2

station12.example.com


下面的语句查询是哪个节点运行着db12c2数据库服务器实例:


[grid@station11 ~]$ srvctl status database -d db12c

Instance db12c1 is running on node station11

Instance db12c2 is running on node station12


3. 测试Flex ASM

3.1 加载工作负载

我们在db12c2数据库服务器实例上加载工作负载:


[oracle@station12 ~]$ sqlplus /nolog


SQL*Plus: Release 12.1.0.2.0 Production on Fri Oct 14 15:52:21 2016


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


SQL> conn system/oracle_4U

Connected.

SQL> update sh.sales set AMOUNT_SOLD=AMOUNT_SOLD+1 ;

保证其持续运行中


3.2 强迫关闭+ASM2实例,查看Flex ASM起到作用

加载工作负载同时,强迫关闭+ASM2(就是db12c2数据库服务器实例正连接着的那个Flex ASM实例):


[grid@station11 ~]$ srvctl stop asm -node station12 -stopoption ABORT -force



[root@station12 ~]# ps -eo pid,command | grep 'asm_smon_+ASM2' | grep -v grep | cut -c -6


查看集群范围内Flex ASM实例的运行情况,确认+ASM2实例已经死亡:


[grid@station11 ~]$ srvctl status asm -verbose

ASM is running on station11

Detailed state on node station11: Started

Detailed state on node station12: Instance Shutdown


以下查询语句证实了Flex ASM新特性在起作用:db12c2数据库服务器实例被自动且透明地连接到 +ASM1实例,避免了崩溃,提高了Oracle数据库服务器基于集群的巩固性


[grid@station11 ~]$ sqlplus / as sysasm


SQL*Plus: Release 12.1.0.2.0 Production on Sat Oct 8 21:26:55 2016


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



Connected to:

Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production

With the Real Application Clusters and Automatic Storage Management options


SQL> set linesize 1000

SQL> col client_instance_name format a20

SQL> col ASM_INSTANCE_NAME format a20

SQL> col DB_NAME format a20

SQL> col STATUS format a20

SQL> select distinct i.instance_name asm_instance_name, c.instance_name client_instance_name,

2 c.db_name, c.status

3 from gv$instance i, gv$asm_client c

4 where i.inst_id=c.inst_id;


ASM_INSTANCE_NAME CLIENT_INSTANCE_NAME DB_NAME STATUS

-------------------- -------------------- -------------------- --------------------

+ASM1 +ASM1 +ASM CONNECTED

+ASM1 -MGMTDB _mgmtdb CONNECTED

+ASM1 db12c1 db12c CONNECTED

+ASM1 db12c2 db12c CONNECTED

-----------------------------------------------------------------------------------


3.3 手动启动刚才被强迫关闭的+ASM2实例

下面我们要手动启动刚才被强迫关闭的+ASM2实例:


[grid@station11 ~]$ srvctl start asm -node station12

[grid@station11 ~]$ srvctl status asm -verbose

ASM is running on station12,station11

Detailed state on node station11: Started

Detailed state on node station12: Started


在目前的12.1.0.2GI版本中还不能做到让db12c2数据库服务器实例自动连接回+ASM2实例:


[grid@station11 ~]$ sqlplus / as sysasm


SQL*Plus: Release 12.1.0.2.0 Production on Sat Oct 8 21:34:53 2016


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



Connected to:

Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production

With the Real Application Clusters and Automatic Storage Management options


SQL> set linesize 1000

SQL> col client_instance_name format a20

SQL> col ASM_INSTANCE_NAME format a20

SQL> col DB_NAME format a20

SQL> col STATUS format a20

SQL> select distinct i.instance_name asm_instance_name, c.instance_name client_instance_name,

2 c.db_name, c.status

3 from gv$instance i, gv$asm_client c

4 where i.inst_id=c.inst_id;


ASM_INSTANCE_NAME CLIENT_INSTANCE_NAME DB_NAME STATUS

-------------------- -------------------- -------------------- --------------------

+ASM1 +ASM1 +ASM CONNECTED

+ASM1 -MGMTDB _mgmtdb CONNECTED

+ASM1 db12c1 db12c CONNECTED

+ASM1 db12c2 db12c CONNECTED


3.4 重分配db12c2数据库服务器实例连接回到+ASM2实例

如果本文3.1节中运行的工作负载结束了,那么请在会话中提交后,再一次运行此工作负载。工作负载能够安然结束,本身就证明了在之前实验中+ASM2被杀死并没有伤害到db12c2数据库服务器实例。


SQL> commit;


Commit complete.


SQL> update sh.sales set AMOUNT_SOLD=AMOUNT_SOLD+1 ;


请保证以下所有实验是在以上工作负载伴随下进行。

接下来,我们要重分配db12c2数据库服务器实例连接回+ASM2实例。


[grid@station11 ~]$ sqlplus /nolog


SQL*Plus: Release 12.1.0.2.0 Production on Thu Oct 13 11:32:10 2016


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


SQL> conn / as sysasm

Connected.

SQL> alter system relocate client 'db12c2:db12c';


System altered.

SQL> set linesize 1000

SQL> col client_instance_name format a20

SQL> col ASM_INSTANCE_NAME format a20

SQL> col DB_NAME format a20

SQL> col STATUS format a20

SQL> select distinct i.instance_name asm_instance_name, c.instance_name client_instance_name,

2 c.db_name, c.status

3 from gv$instance i, gv$asm_client c

4 where i.inst_id=c.inst_id;


ASM_INSTANCE_NAME CLIENT_INSTANCE_NAME DB_NAME STATUS

-------------------- -------------------- -------------------- --------------------

+ASM1 +ASM1 +ASM CONNECTED

+ASM1 -MGMTDB _mgmtdb CONNECTED

+ASM1 db12c1 db12c CONNECTED

+ASM2 db12c2 db12c CONNECTED

-----------------------------------------------------------------------------------


当我们使用命令“alter system relocate client 'db12c2:db12c'”时,不能指定把数据库服务器实例连接到哪一个ASM实例。系统会根据当前Flex ASM实例组(包含Flex ASM实例计数规定的Flex ASM实例个数)中每一个Flex ASM实例负载的轻重,指派负载最轻的那个Flex ASM实例来执行连接。

注意,在生产环境中如果某个数据库服务器实例已经连接到负载最小的Flex ASM实例,这时如果运行以上的relocate命令会导致它断开Flex ASM实例再重新连接回这个Flex ASM实例。

在整个relocate过程中,数据库服务器实例上的工作负载仍在执行,完全不受影响。我们得出推论:如果不是以上蓄意破坏的情况,而是为了维护某个节点上的Flex ASM实例而有计划地关闭它,同样也不会对数据库服务器实例于集群的巩固造成任何影响。可见Flex ASM是集群高可用性发展史上的又一次让人叹为观止的提升。

最后我们来看一下station12上的alter日志。以便更深入地了解从数据库服务器实例重连接Flex ASM实例到手工重分配Flex ASM实例的整个过程。以下日志中红字部分对应于强迫关闭+ASM2实例时发生的事件信息;蓝色部分对应于手工重分配db12c2数据库服务器实例连接回+ASM2实例时发生的事件信息。


[grid@station12 ~]$ grep -A 1 -B 1 -n --color 'ASMB' /u01/app/oracle/diag/rdbms/db12c/db12c2/trace/alert_db12c2.log

......

3890:NOTE: ASMB connected to ASM instance +ASM2 osid: 12419 (Flex mode; client id 0xffffffffffffffff)

3891-NOTE: initiating MARK startup

--

3937-Sat Oct 08 08:43:55 2016

3938:NOTE: ASMB mounting group 1 (DATA)

3939-NOTE: Assigning number (1,0) to disk (AFD:RACDISK1)

--

3965-Sat Oct 08 08:43:56 2016

3966:NOTE: ASMB mounting group 2 (FRA)

3967-NOTE: Assigning number (2,0) to disk (AFD:RACDISK10)

--

4351-PXMN started with pid=30, OS id=27011

4352:Starting background process ASMB

4353-Sat Oct 08 10:15:00 2016

--

4355-Sat Oct 08 10:15:00 2016

4356:ASMB started with pid=32, OS id=27015

4357-Starting background process MMON

--

4399-Sat Oct 08 10:15:01 2016

4400:NOTE: ASMB registering with ASM instance as Flex client 0xffffffffffffffff (reg:1996504787) (new connection)

4401-Sat Oct 08 10:15:01 2016

--

4404-Sat Oct 08 10:15:02 2016

4405:NOTE: ASMB connected to ASM instance +ASM2 osid: 27040 (Flex mode; client id 0x10002)

4406-NOTE: initiating MARK startup

--

4419-Sat Oct 08 10:15:04 2016

4420:NOTE: ASMB mounting group 1 (DATA)

4421-NOTE: ASM background process initiating disk discovery for grp 1 (reqid:0)

--

4449-Sat Oct 08 10:15:05 2016

4450:NOTE: ASMB mounting group 2 (FRA)

4451-NOTE: ASM background process initiating disk discovery for grp 2 (reqid:0)

--

4656-Sat Oct 08 21:24:45 2016

4657:NOTE: ASMB registering with ASM instance as Flex client 0x10002 (reg:2215351567) (reconnect)

4658:NOTE: ASMB connected to ASM instance +ASM1 osid: 31150 (Flex mode; client id 0x10002)

4659:NOTE: ASMB rebuilding ASM server state

4660:NOTE: ASMB rebuilt 2 (of 2) groups

4661:NOTE: ASMB rebuilt 19 (of 19) allocated files

4662-NOTE: fetching new locked extents from server

4663-NOTE: 0 locks established; 0 pending writes sent to server

4664:SUCCESS: ASMB reconnected & completed ASM server state

4665-Sat Oct 08 21:24:49 2016

--

4839-Sat Oct 08 21:41:22 2016

4840:NOTE: ASMB relocating from ASM instance +ASM1 (ASM-initiated)

4841:NOTE: ASMB registering with ASM instance as Flex client 0x10002 (reg:2834229225) (reconnect)

4842:NOTE: ASMB connected to ASM instance +ASM2 osid: 5431 (Flex mode; client id 0x10002)

4843:NOTE: ASMB rebuilding ASM server state

4844:NOTE: ASMB rebuilt 2 (of 2) groups

4845:NOTE: ASMB rebuilt 17 (of 17) allocated files

4846-NOTE: fetching new locked extents from server

4847-NOTE: 0 locks established; 0 pending writes sent to server

4848:SUCCESS: ASMB reconnected & completed ASM server state

4849-Sat Oct 08 21:41:24 2016


总结
	

Flex ASM是集群高可用性发展史上的又一次让人叹为观止的提升。Oracle称其为Oracle数据库服务器基于集群的巩固性(Cluster Based Database Consolidation)。12c这个版本开始,打破了以前版本中的“ASM实例只能服务于本机数据库服务器实例”铁律。要想使用后续系列要介绍的Flex Cluster必需先配置本章的Flex ASM,但是要使用Flex ASM不必同时使用Flex Cluster


路过

雷人

握手

鲜花

鸡蛋

QQ|手机版|Bo's Oracle Station   

GMT+8, 2022-3-22 12:24 , Processed in 0.056934 second(s), 21 queries .

返回顶部