ASM实例的启动过程大概有如下几个步骤:
1)$GRID_HOME/bin/oracle文件被调用,并读取ASM初始化参数文件。
2)根据ASM的初始化参数文件启动ASM实例。
3)本地ASM实例和远程实例进行通信,完成实力层面的重新配置。
4)挂载ASM磁盘组。
11gR2中,OCR/VOTEDISK存放在ASM磁盘组,这也就意味着在GI能够启动的前提是能够顺利启动ASM实例并且能够将相应磁盘组MOUNT起来;而ASM的spfile却放在ASM磁盘组里,这也同样意味着要先启动ASM实例并且能读到参数文件。那如何解决这个问题呢? 11gR2中引入了pgnp profile,用于存放ASM参数文件路径,这允许oracle在ASM实例启动以前读到参数文件。
11gR2的RAC环境中,ASM的参数文件存放于ASM磁盘组里面.ASM实例启动时候,寻找参数文件的顺序如下,直接找到为止:
1. Grid Plug and Play (GPnP) profile
2. spfile+ASM.ora
3. init+ASM.ora
因此,11gR2中可以没有pfile,可以将ASM参数保存在gpnp profile中,在管理上省下了很多工作.
GPnP profile是一个XML文件,在Clusterware中,CSS、GPnP等服务的启动都需要依赖于GPnP profile文件,引导节点加入集群,GPnP profile提供了新节点的配置信息。GPnP profile还指定了整个集群的特性。如果该文件被破坏或丢失,Clusterware将无法正常启动。
在Clusterware启动期间,CSS守护进程使用GPnP profile发现表决文件(参数“DiscoveryString”)。一个不正确的Discovery字符串将阻止CSS守护进程启动,导致整个CRS无法启动。
Oracle不支持手动修改profile.xml文件,直接对它的修改可能导致无法修复的问题,最终导致在所有节点重建Clusterware。
GPnP profile文件保存的是集群的配置信息。默认的保存位置是:
$GRID_HOME/gpnp/$HOSTNAME/profile/peer/profile.xml
$GRID_HOME/gpnp/profile/peer/profile.xml(全局备份)
下面是典型的GPnP profile内容:
<?xml version="1.0" encoding="UTF-8"?>
<gpnp:GPnP-Profile Version="1.0" xmlns="http://www.grid-pnp.org/2005/11/gpnp-profile" xmlns:gpnp="http://www.grid-pnp.org/2005/11/gpnp-profile" xmlns:orcl="http://www.oracle.com/gpnp/2005/11/gpnp-profile" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.grid-pnp.org/2005/11/gpnp-profile gpnp-profile.xsd" ProfileSequence="8" ClusterUId="544e8a6d114c6f1fbfec2667d0bf7c85" ClusterName="vmac-cluster" PALocation="">
<gpnp:Network-Profile>
<gpnp:HostNetwork id="gen" HostName="*">
<gpnp:Network id="net1" IP="192.168.1.0" Adapter="eth1" Use="public"/>
<gpnp:Network id="net2" IP="192.168.1.0" Adapter="eth2" Use="cluster_interconnect"/>
<gpnp:Network id="net3" Adapter="eth2" IP="172.168.1.0" 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*" <span style="background-color: rgb(255, 0, 0);">SPFile="/g01/11ggrid/app/11.2.0/grid/dbs/old_ora.bak"/></span>
<ds:Signature xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
<ds:SignedInfo>
<ds:CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/>
<ds:SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"/>
<ds:Reference URI="">
<ds:Transforms>
<ds:Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"/>
<ds:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#">
<InclusiveNamespaces xmlns="http://www.w3.org/2001/10/xml-exc-c14n#" PrefixList="gpnp orcl xsi"/>
</ds:Transform>
</ds:Transforms>
<ds:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/>
<ds:DigestValue>jkauDoZrfXw8N12JHcb69wPJpyo=</ds:DigestValue>
</ds:Reference>
</ds:SignedInfo>
<ds:SignatureValue>X/G6cdsov/cPqZmmFCOWGIf6AMM4adp31DhC0jqzAFbn2bfdakp7IvRwCNc9vjJ0nGDaukCjQnbdGmWs2DiCBNI2zd1OuoZ3/pCKKo0hR3GHcL73A1sQ++50b0NJTeo+SDIYgwTnsHu+vbjoVBqAEuJlSE5t6EfmBBSZvihhRxE=</ds:SignatureValue>
</ds:Signature>
</gpnp:GPnP-Profile>
通过上面的例子可以看出,GPnP profile保存的是RAC的配置信息,包括集群名称、网络类型信息(public/private)、ASM和CSS的存储信息、安全的数字签名,以及ASM实例的SPFILE文件位置。当集群配置发生变化时,所有节点的该文件会被自动更新。在安装、系统引导或者当使用标准的集群工具更新期间,这些活动包括:oifcfg 改变网络信息、crsctl 改变css设备、ASM额外的存储等,会通过gpdpd进程复制GPnP profile到所有的其他节点。
如果GPnP出现问题,可以使用cluvfy comp gpnp组件验证命令检查在集群中所有节点网格即插即用的完整性。
cluvfy comp gpnp [-n node_list] [-verbose]
————————————————
11gR2RAC环境中,ASM的参数文件支持备份(spbackup),拷贝(spcopy),移动(spmove),查询gpnp profile(spget),设置(spset)等操作
特别需要注意一点,ASM的参数文件最好放在ASM磁组里,同时确保每个集群成员的gpnp都为同一个路径
以简单例子说明,如何将ASM的spfile重新保存至ASM磁盘组
=============================================
准备环境
ASMCMD> ls -l
Type Redund Striped Time Sys Name
ASMPARAMETERFILE UNPROT COARSE DEC 14 15:00:00 Y REGISTRY.253.866303695
N spfileasm.ora => +OCR_VOTE/rac-cluster/ASMPARAMETERFILE/REGISTRY.253.866303695 ----注意这里是链接
ASMCMD> pwd
+OCR_VOTE/rac-cluster/ASMPARAMETERFILE
ASMCMD> spcopy +OCR_VOTE/rac-cluster/ASMPARAMETERFILE/REGISTRY.253.866303695 +OCR_VOTE/rac-cluster/ASMPARAMETERFILE/spcopy.ora
ORA-15056: additional error message
ORA-17502: ksfdcre:4 Failed to create file +OCR_VOTE/rac-cluster/ASMPARAMETERFILE/spcopy.ora
ORA-15268: internal Oracle file +OCR_VOTE.253.1 already exists.
ORA-06512: at line 7 (DBD ERROR: OCIStmtExecute)
ASMCMD> spget
/home/grid/registry.253.839197161 --当前gpnp profile配置。该spfile是用spcopy命令生成的
ASMCMD> spmove REGISTRY.253.866303695 old_ora.bak ---删除默认的SPFILE将导致路径缺失
ASMCMD> ls -l
ASMCMD-8002: entry 'ASMPARAMETERFILE' does not exist in directory '+OCR_VOTE/rac-cluster/'
实例环境就绪,以下是解决办法:
ASMCMD> spget
/home/grid/registry.253.839197161
ASMCMD> spcopy /home/grid/registry.253.839197161 +OCR_VOTE/rac-cluster/ASMPARAMETERFILE/registry.ora --将本地磁盘上的spfile复制至ASM磁盘
ASMCMD> ls -l
Type Redund Striped Time Sys Name
ASMPARAMETERFILE UNPROT COARSE DEC 14 19:00:00 Y REGISTRY.253.866316081
N registry.ora => +OCR_VOTE/rac-cluster/ASMPARAMETERFILE/REGISTRY.253.866316081 --注意这里是链接!!!!
ASMCMD> spset +OCR_VOTE/rac-cluster/ASMPARAMETERFILE/REGISTRY.253.866316081 --更新gpnp profile至链接
ASMCMD> spget
+OCR_VOTE/rac-cluster/ASMPARAMETERFILE/REGISTRY.253.866316081
重启实例生效...
ASMCMD> shutdown --abort
ASM instance shutdown
Connected to an idle instance.
ASMCMD>
ASMCMD>
ASMCMD> startup
ASM instance started
Total System Global Area 1135747072 bytes
Fixed Size 2260728 bytes
Variable Size 1108320520 bytes
ASM Cache 25165824 bytes
ASM diskgroups mounted
ASM diskgroups volume enabled
ASMCMD> lsdg
State Type Rebal Sector Block AU Total_MB Free_MB Req_mir_free_MB Usable_file_MB Offline_disks Voting_files Name
MOUNTED EXTERN N 512 4096 1048576 4094 926 0 926 0 N DATA/
MOUNTED EXTERN N 512 4096 4194304 2032 1592 0 1592 0 Y OCR_VOTE/
ASMCMD> spget
+OCR_VOTE/rac-cluster/ASMPARAMETERFILE/REGISTRY.253.866316081
SQL> show parameter spfile;
NAME TYPE
------------------------------------ ----------------------
VALUE
------------------------------
spfile string
+OCR_VOTE/rac-cluster/asmparameterfile/registry.253.866316081 --证实是通过gpnp profile里spfile启动实例
同样,其他数据库节点需要spset更新spfile路径,重启生效即可,此部分操作省略...
______________________________________________________________________________________
可以通过ASM alter.log来看一下具体ASM启动过程
SQL> show parameter dump; --查看ASM日志所在位置
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
background_core_dump string partial
background_dump_dest string /u01/app/grid/diag/asm/+asm/+A
SM1/trace
[grid@rac1 trace]$ tail -f alert_+ASM1.log
ASM实例被启动,根据gpnp profile中的信息找到了集群的网络信息(主要是集群的私网)
Starting ORACLE instance (normal)
LICENSE_MAX_SESSION = 0
LICENSE_SESSIONS_WARNING = 0
Initial number of CPU is 1
Private Interface 'eth1' configured from GPnP for use as a private interconnect.
[name='eth1', type=1, ip=10.10.10.1, mac=00-0c-29-30-bb-a6, net=10.10.10.0/24, mask=255.255.255.0, use=cluster_interconnect/6]
Public Interface 'eth0' configured from GPnP for use as a public interface.
[name='eth0', type=1, ip=192.168.11.100, mac=00-0c-29-30-bb-9c, net=192.168.11.0/24, mask=255.255.255.0, use=public/1]
可以看到ASM参数文件被发现了
Starting up:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Real Application Clusters and Automatic Storage Management options.
ORACLE_HOME = /u01/app/11.2.0/grid
System name: Linux
Node name: rac1
Release: 2.6.32-358.el6.x86_64
Version: #1 SMP Tue Jan 29 11:47:41 EST 2013
Machine: x86_64
VM name: VMWare Version: 6
Using parameter settings in server-side spfile +FRA/rac-cluster/ASMPARAMETERFILE/REGISTRY.253.1034189293
可以看到ASM实例的参数被读取,使用HAIP和集群中其他的ASM实例进行通讯
System parameters with non-default values:
large_pool_size = 12M
instance_type = "asm"
remote_login_passwordfile= "EXCLUSIVE"
asm_diskstring = "/dev/raw/raw*"
asm_diskgroups = "DATA"
asm_diskgroups = "FRA"
asm_power_limit = 1
diagnostic_dest = "/u01/app/grid"
Cluster communication is configured to use the following interface(s) for this instance
10.10.10.1
cluster interconnect IPC version:Oracle UDP/IP (generic)
ASM实例后台进程被启动
IPC Vendor 1 proto 2
Thu Mar 05 22:53:40 2020
PMON started with pid=2, OS id=6565
Thu Mar 05 22:53:40 2020
PSP0 started with pid=3, OS id=6567
Thu Mar 05 22:53:42 2020
VKTM started with pid=4, OS id=6574 at elevated priority
VKTM running at (1)millisec precision with DBRM quantum (100)ms
Thu Mar 05 22:53:42 2020
GEN0 started with pid=5, OS id=6578
实例级别Reconfiguration结束
List of instances:
1 (myinst: 1)
Global Resource Directory frozen
* allocate domain 0, invalid = TRUE
Communication channels reestablished
Master broadcasted resource hash value bitmaps
Non-local Process blocks cleaned out
LMS 0: 0 GCS shadows cancelled, 0 closed, 0 Xw survived
Set master node info
Submitted all remote-enqueue requests
Dwn-cvts replayed, VALBLKs dubious
All grantable enqueues granted
Post SMON to start 1st pass IR
Submitted all GCS remote-cache requests
Post SMON to start 1st pass IR
Fix write in gcs resources
Reconfiguration complete
ASM实例启动之后开始挂载所发现的所有磁盘组
Thu Mar 05 22:53:46 2020
SQL> ALTER DISKGROUP ALL MOUNT
NOTE: Diskgroups listed in ASM_DISKGROUPS are
DATA
FRA
NOTE: Diskgroup used for Voting files is:
DATA
Diskgroup with spfile:FRA
Diskgroup used for OCR is:ARCHIVE
磁盘组挂载成功
NOTE: cache registered group ARCHIVE number=1 incarn=0xcaca6a74
NOTE: cache began mount (first) of group ARCHIVE number=1 incarn=0xcaca6a74
NOTE: cache registered group DATA number=2 incarn=0xcaca6a75
NOTE: cache began mount (first) of group DATA number=2 incarn=0xcaca6a75
NOTE: cache registered group FRA number=3 incarn=0xcaea6a76
NOTE: cache began mount (first) of group FRA numbe




