欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  数据库

Oracle 11gR2用gpnp profile存放ASM的spfile路径

程序员文章站 2024-02-01 16:52:52
...

从Oracle 11gR2开始,GI集成了ASM,OCR/VOTEDISK也存放在ASM磁盘组了(11gR2以前需要存放于裸设备中),同时ASM的功能较10g也有很大

从Oracle 11gR2开始,GI集成了ASM,OCR/VOTEDISK也存放在ASM磁盘组了(11gR2以前需要存放于裸设备中),同时ASM的功能较10g也有很大增强。

我们先引入一个问题:
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中,在管理上省下了很多工作.

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;