联系:手机/微信(+86 17813235971) QQ(107644445)
标题:How to Get the Contents of an Spfile on ASM when ASM/GRID is down
作者:惜分飞©版权所有[未经本人同意,不得以任何形式转载,否则有进一步追究法律责任的权利.]
在11g中asm的spfile文件是存放在asm中的,如果asm不能正常启动是否可以获得其spfile信息.这里通过gpnptool来获得spfile文件信息,给大家提供了在11gr2的rac是怎么利用asm 中的spfile启动asm的思路
asm spfile信息
[grid@rac1 ~]$ sqlplus / as sysdba SQL*Plus: Release 11.2.0.3.0 Production on Fri Dec 21 01:41:31 2012 Copyright (c) 1982, 2011, Oracle. All rights reserved. Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - Production With the Real Application Clusters and Automatic Storage Management options SQL> create pfile='/tmp/pfile' from spfile; File created. SQL> !more /tmp/pfile +ASM1.__oracle_base='/u01/app/gridbase'#ORACLE_BASE set from in memory value +ASM2.asm_diskgroups='XIFENFEI'#Manual Mount +ASM1.asm_diskgroups='XIFENFEI'#Manual Mount *.asm_diskstring='/dev/oracleasm/disks/*' *.asm_power_limit=1 *.diagnostic_dest='/u01/app/gridbase' *.instance_type='asm' *.large_pool_size=12M *.remote_login_passwordfile='EXCLUSIVE'
关闭集群(asm已关闭)
[root@rac1 ~]# crsctl stop crs [root@rac1 ~]# ps -ef|grep pmon root 8768 6372 0 02:53 pts/1 00:00:00 grep pmon [root@rac1 ~]# crsctl stat res CRS-4535: Cannot communicate with Cluster Ready Services CRS-4000: Command Status failed, or completed with errors.
gpnptool命令获取asm disk信息
[root@rac1 ~]# gpnptool get -o- <?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="4" ClusterUId="885339054e904f1dbfa646b41d7a0edb" ClusterName="rac-cluster" PALocation=""> <gpnp:Network-Profile> <gpnp:HostNetwork id="gen" HostName="*"> <gpnp:Network id="net1" IP="192.168.1.0" Adapter="eth0" Use="public"/> <gpnp:Network id="net2" IP="10.10.1.0" Adapter="eth1" Use="cluster_interconnect"/> </gpnp:HostNetwork> </gpnp:Network-Profile> <orcl:CSS-Profile id="css" DiscoveryString="+asm" LeaseDuration="400"/> --重点关注信息(asm disk 信息) <orcl:ASM-Profile id="asm" DiscoveryString="/dev/oracleasm/disks/*" SPFile="+DATA/rac-cluster/asmparameterfile/registry.253.776955291"/> <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>T2Q3r+5sER2Rp0VfeqzYh461f2s=</ds:DigestValue> </ds:Reference> </ds:SignedInfo> <ds:SignatureValue> LwcQEtlsPGfywzdYJrOqiTp4cZNFGB/S9Ts8OCvYOGf/Z8HDT2yN5p2nCuxArUfW+KzaPzPHHihpRVaTcAY31nJ2Rcf2vMqYp4e++shliQXC8mg 1oGxQGifkjZwA4pTTEK5MBmr4FTZnR3VArZjjVfJdsmOMfyH4YeSMU5HPjdA= </ds:SignatureValue> </ds:Signature> </gpnp:GPnP-Profile> Success. Error CLSGPNP_NO_DAEMON getting profile.
获得asm spfile信息
通过kfed找磁盘中的kfdhdb.sp|ausize来获得asm spfile相关信息
[root@rac1 ~]# ls /dev/oracleasm/disks/ VOL1 VOL2 VOL3 VOL4 [root@rac1 ~]# kfed dev=/dev/oracleasm/disks/VOL1 op=READ | egrep "kfdhdb.sp|ausize" kfdhdb.ausize: 1048576 ; 0x0bc: 0x00100000 kfdhdb.spfile: 22 ; 0x0f4: 0x00000016 kfdhdb.spfflg: 1 ; 0x0f8: 0x00000001 [root@rac1 ~]# kfed dev=/dev/oracleasm/disks/VOL2 op=READ | egrep "kfdhdb.sp|ausize" kfdhdb.ausize: 1048576 ; 0x0bc: 0x00100000 kfdhdb.spfile: 0 ; 0x0f4: 0x00000000 kfdhdb.spfflg: 0 ; 0x0f8: 0x00000000 [root@rac1 ~]# kfed dev=/dev/oracleasm/disks/VOL3 op=READ | egrep "kfdhdb.sp|ausize" kfdhdb.ausize: 1048576 ; 0x0bc: 0x00100000 kfdhdb.spfile: 0 ; 0x0f4: 0x00000000 kfdhdb.spfflg: 0 ; 0x0f8: 0x00000000 [root@rac1 ~]# kfed dev=/dev/oracleasm/disks/VOL4 op=READ | egrep "kfdhdb.sp|ausize" kfdhdb.ausize: 1048576 ; 0x0bc: 0x00100000 kfdhdb.spfile: 0 ; 0x0f4: 0x00000000 kfdhdb.spfflg: 0 ; 0x0f8: 0x00000000
这里可以看出来asm spfile信息在磁盘VOL1中,spfile从第22个au开始,1个au(1M).
获得asm spfile 内容
[root@rac1 ~]# dd if=/dev/oracleasm/disks/VOL1 bs=1M skip=22 count=1 > /tmp/spfile 1+0 records in 1+0 records out 1048576 bytes (1.0 MB) copied, 1.47474 seconds, 711 kB/s [root@rac1 ~]# strings /tmp/spfile +ASM1.__oracle_base='/u01/app/gridbase'#ORACLE_BASE set from in memory value +ASM2.asm_diskgroups='XIFENFEI'#Manual Mount +ASM1.asm_diskgroups='XIFENFEI'#Manual Mount *.asm_diskstring='/dev/oracleasm/disks/*' *.asm_power_limit=1 *.diagnostic_dest='/u01/app/gridbase' *.instance_type='asm' *.large_pool_size=12M *.remote_login_passwordfile='EXCLUSIVE'
通过对比发现,在asm实例未正常启动的情况下,也可以通过其他方面来获得asm spfile文件.本实验只是对于spfile在asm中位置的定位(大家去猜测11gr2的rac是怎么利用asm 中的spfile启动asm的思路),实际生产环境中请勿模仿,gpnptool命令有较大风险