11g ASM实例启动过程解析
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
11gR2 RAC ASM启动揭秘
11gR2 RAC中ocr和votedisk终于可以存放在ASM中了,这避免了10g中仍需要为这2个RAC的关键点划分裸设备的窘境,随之11gR2 中ASM的spfile也可以存放到ASM diskgroup中以实现多节点ASM的共享管理了。
这听上去似乎有些不可思议,照常理来说ASM实例启动并mount diskgroup后才能够访问diskgroup上的文件,但是ASM实例只有获得ASM spfile后才能够启动实例,这2者形成了死循环。
我们来解释这个问题:
从11.2开始Oracle Cluterware标示voting disk files的方法较之前的版本11.1或10.2有所区别,11.2之前voting disk file的位置存放在OCR中,但是因为从11.2开始ocr和votedisk 可以存放在ASM了,所以自11.2始voting disk file通过GPNP profile中的CSS voting file discovery string来定位。
CSS voting disk file的discovery string将指向ASM,所以它要使用ASM discovery string的值。
如以下的例子使用udev绑定设备名作为ASM使用的LUN,这些udev获得的设备形式如/dev/rasm-disk* ,我们利用gpnptool get命令获得gpnp profile:
[grid@s1-11g ~]$ gpnptool get
Warning: some command line parameters were defaulted. Resulting command line:
/oracle/grid/bin/gpnptool.bin get -o-
<?xml version="1.0" encoding="UTF-8"?><gpnp:GPnP-Profile Version="1.0" xmlns="/2005/11/gpnp-profile"
xmlns:gpnp="/2005/11/gpnp-profile"
xmlns:orcl="/gpnp/2005/11/gpnp-profile"
xmlns:xsi="/2001/XMLSchema-instance"
xsi:schemaLocation="/2005/11/gpnp-profile gpnp-profile.xsd" ProfileSequence="4" ClusterUId="67b9facd39726f02bfc8e463171fa4b3" ClusterName="s1-11g-cluster" PALocation=""><gpnp:Network-Profile><gpnp:HostNetwork id="gen" HostName="*"><gpnp:Network id="net1" IP="172.16.0.0" Adapter="eth0" Use="public"/><gpnp:Network id="net2" IP="10.10.10.0" Adapter="eth1" Use="cluster_interconnect"/></gpnp:HostNetwork></gpnp:Network-Profile><orcl:CSS-Profile
id="css" DiscoveryString="+asm" LeaseDuration="400"/><orcl:ASM-Profile id="asm" DiscoveryString="/dev/asm*"
SPFile="+OCRVOTE/s1-11g-cluster/asmparameterfile/registry.253.824566899"/><ds:Signature xmlns:ds="/2000/09/xmldsig#"><ds:SignedInfo><ds:CanonicalizationMethod Algorithm="/2001/10/xml-exc-c14n#"/><ds:SignatureMethod
Algorithm="/2000/09/xmldsig#rsa-sha1"/><ds:Reference
URI=""><ds:Transforms><ds:Transform
Algorithm="/2000/09/xmldsig#enveloped-signature"/><ds:Transform Algorithm="/2001/10/xml-exc-c14n#"> <InclusiveNamespaces
xmlns="/2001/10/xml-exc-c14n#" PrefixList="gpnp orcl xsi"/></ds:Transform></ds:Transforms><ds:DigestMethod
Algorithm="/2000/09/xmldsig#sha1"/><ds:DigestValue>jifUhk40NCZKYHu9E2 s9wHZpt+M=</ds:DigestValue></ds:Reference></ds:SignedInfo><ds:SignatureValue>OxCHW6vb O+hmX6HnEL6KO1t5gJNv2uBP3406XaLPKc3265v+m29znkwTXXo1erFFr/FeP3Da2wit3vkcckGT4U quuLJ1nEfmDBAAkfJIFYfDoWF6RwDLj9VW8jK1fO8lSjlb2DGrkBE9KdB5llz+uFzUSzdgtY0x1bwL9hM 9KOg=</ds:SignatureValue></ds:Signature></gpnp:GPnP-Profile>
Success.
其中重要的2条记录:
<orcl:CSS-Profile id="css" DiscoveryString="+asm" LeaseDuration="400"/>
==》css voting disk指向+ASM
<orcl:ASM-Profile id="asm" DiscoveryString="/dev/asm*" SPFile="+OCRVOTE/s1-11g-cluster/asmparameterfile/registry.253.824566899"/>
==》该记录表达了ASM的DiscoveryString=”/dev/asm*”,即ASM实例启动时会去寻找的设备路径,SPFILE记录了ASM Parameter FILE的ALIAS
但是请注意虽然GPNP记录了ASM Parameter FILE的ALIAS,但这不代表ASM直接能访问到该SPFILE,在实际Diskgroup被Mount之前光知道一个ASM ALIAS是没有用的。
我们来看一下+OCRVOTE/s1-11g-cluster/asmparameterfile/registry.253.824566899这个SPFILE 在ASM中所处的位置:
[grid@s1-11g ~]$ sqlplus "/ as sysasm"
SQL*Plus: Release 11.2.0.3.0 Production on Fri Oct 18 13:38:04 2013
Copyright (c) 1982, 2011, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Real Application Clusters and Automatic Storage Management options
set linesize 140 pagesize 1400
col "FILE NAME" format a40
set head on
select NAME "FILE NAME",
AU_KFFXP "AU NUMBER",
NUMBER_KFFXP "FILE NUMBER",
DISK_KFFXP "DISK NUMBER"
from x$kffxp, v$asm_alias
where GROUP_KFFXP = GROUP_NUMBER
and NUMBER_KFFXP = FILE_NUMBER
and name in ('REGISTRY.253.824566899')
order by DISK_KFFXP,AU_KFFXP;
FILE NAME AU NUMBER FILE NUMBER DISK NUMBER
---------------------------------------- ---------- ----------- -----------
REGISTRY.253.824566899 59 253 1 REGISTRY.253.824566899 59 253 2
SQL> col path for a50
SQL> select disk_number,path from v$asm_disk where disk_number in (1,2) and GROUP_NUMBER=2;
DISK_NUMBER PATH
----------- --------------------------------------------------
1 /dev/asm-nocr2
2 /dev/asm-nocr1
可以看到该ASM SPFILE共有2份镜像(redundancy=high),分别保留在/dev/asm-nocr2的AU=59和/dev/asm-nocr1 AU=59
我们利用kfed命令分别检查这三个ASM DISK的header:
[grid@s1-11g ~]$ kfed read /dev/asm-nocr2|grep spfile
kfdhdb.spfile: 59 ; 0x0f4: 0x0000003b
[grid@s1-11g ~]$ kfed read /dev/asm-nocr1|grep spfile
kfdhdb.spfile: 59 ; 0x0f4: 0x0000003b
可以看到ASM disk header的kfdhdb.spfile指向ASM SPFILE在这个DISK上的AU NUMBER即其位置,ASM实例在启动时只需要通过GPNP PROFILE中的DiscoveryString找到合适的设备路径,并读取其ASM disk header即可以找到kfdhdb.spfile这个位置属性,从而在没有MOUNT DISKGROUP的情况下读取ASM SPFILE,并成功启动ASM,这也就解决了鸡生蛋、蛋生鸡的难题。
这也是我们在后台日志中看到的gpnp启动:
2013-08-27 14:22:41.603
[gpnpd(10544)]CRS-2328:GPNPD started on node s1-11g.
2013-08-27 14:22:44.580
[cssd(10608)]CRS-1713:CSSD daemon is started in clustered mode
2013-08-27 14:22:46.573
[ohasd(9248)]CRS-2767:Resource state recovery not attempted for 'ora.diskmon' as its target
state is OFFLINE
2013-08-27 14:24:10.235
[cssd(10608)]CRS-1707:Lease acquisition for node s1-11g number 1 completed
2013-08-27 14:24:11.934
[cssd(10608)]CRS-1605:CSSD voting file is online: /dev/asm-ocr_vote; details in /oracle/grid/log/s1-11g/cssd/ocssd.log.
2013-08-27 14:24:11.962
[cssd(10608)]CRS-1605:CSSD voting file is online: /dev/asm-nocr2; details in /oracle/grid/log/s1-11g/cssd/ocssd.log.
2013-08-27 14:24:11.986
[cssd(10608)]CRS-1605:CSSD voting file is online: /dev/asm-nocr1; details in /oracle/grid/log/s1-11g/cssd/ocssd.log.。