Oracle 11g RAC OCR 与 db_unique_name 配置关系 说明
一. 问题一
在做RAC standby 的alert log里发现如下错误:
SUCCESS: diskgroup DATA was mounted
ERROR: failed toestablish dependency between database dave_st and diskgroup resourceora.DATA.dg
SUCCESS: diskgroup FRA was mounted
ERROR: failed toestablish dependency between database dave_st and diskgroup resource ora.FRA.dg
数据库的实例名本来是dave,因为做成RAC standby,所以数据库的db_unique_name 就改成了dave_st。 这个在单实例是没有什么问题,但RAC 的db_unique_name 也会注册到OCR中。
因此对于RAC 的standby,除了要修改数据库的db_unique_name ,还需要修改OCR中,我这里的案例是我原来的RAC 环境已经搭建好的情况,如果是新搭建的环境,就不会出现这种问题了。
二. 问题二
原来的db_unique_name 是dave,后来改成了dave_st。 然后RAC 节点的pfile,就会自动被修改,即使我们修改成dave_st, 在我们使用srvctl start 来启动数据库时,就会自动改成dave,导致不能启动,当然,手工修改之后,在进sqlplus,是可以正常启动,但是用srvctl 检查状态还是未启动。
这也是为什么在RAC 环境下推荐使用srvctl 来启动和关闭数据库,而 不是直接使用sqlplus来操作的原因。
[oracle@rac2 dbs]$ cat initdave2.ora
SPFILE='+DATA/dave/spfiledave.ora' # line added by Agent
这样导致启动时找不到启动文件而报错,如下:
[oracle@rac1 dbs]$ srvctl start database -ddave
PRCR-1079 : Failed to start resourceora.dave.db
CRS-5017: The resource action"ora.dave.db start" encountered the following error:
ORA-01078: failure in processing systemparameters
ORA-01565: error inidentifying file '+DATA/dave/spfiledave.ora'
ORA-17503: ksfdopn:2Failed to open file +DATA/dave/spfiledave.ora
ORA-15056: additional error message
ORA-17503: ksfdopn:2 Failed to open file+DATA/dave/spfiledave.ora
三.解决方法
上面的2个问题,都是因为OCR中数据库的配置出现了问题。
--查看当前配置:
[grid@rac1 ~]$ srvctl config database -ddave
Database unique name:dave
Database name: dave
Oracle home: /u01/app/oracle/11.2.0/db_1
Oracle user: oracle
Spfile:+DATA/dave/spfiledave.ora
Domain:
Start options: open
Stop options: immediate
Database role: PRIMARY
Management policy: AUTOMATIC
Server pools: dave
Database instances:dave1,dave2
Disk Groups: DATA,FRA
Mount point paths:
Services:
Type: RAC
Database is administrator managed
[grid@rac1 ~]$
我们这里将db_unique_name 修改成dave_st. 不过不能直接修改,需要先将数据库remove掉,在修改。
这里要用oracle用户操作,不然可能会出现权限问题,导致数据库不能启动。
[oracle@rac1 ~]$ srvctl remove database -d dave
[oracle@rac1 ~]$ srvctlconfig database -d dave_st
Database unique name:dave_st
Database name: dave
Oracle home: /u01/app/oracle/11.2.0/db_1
Oracle user: oracle
Spfile:
Domain:
Start options: open
Stop options: immediate
Database role: PRIMARY
Management policy: AUTOMATIC
Server pools: dave_st
Database instances:
Disk Groups:
Mount point paths:
Services:
Type: RAC
Database is administrator managed
[oracle@rac1 ~]$
--修改数据库的其他资源:
[oracle@rac1 ~]$ srvctl modify database -d dave_st -a DATA,FRA
[oracle@rac1 ~]$ srvctl add instance -d dave_st -i dave1 -n rac1
[oracle@rac1 ~]$ srvctl add instance -d dave_st -i dave2 -n rac2
[oracle@rac1 ~]$ srvctl modify database -d dave_st -p +DATA/dave_st/spfiledave.ora
最终结果如下:
[oracle@rac1 ~]$ srvctl config database -d dave_st
Database unique name:dave_st
Database name: dave
Oracle home: /u01/app/oracle/11.2.0/db_1
Oracle user: oracle
Spfile:+DATA/dave_st/spfiledave.ora
Domain:
Start options: open
Stop options: immediate
Database role: PRIMARY
Management policy: AUTOMATIC
Server pools: dave_st
Database instances:dave1,dave2
Disk Groups: DATA,FRA
Mount point paths:
Services:
Type: RAC
Database is administrator managed
[oracle@rac1 dbs]$ srvctlstatus database -d dave_st
Instance dave1 is running on node rac1
Instance dave2 is running on node rac2
--验证进程状态:
[grid@rac1 u01]$ crs_stat.sh
Name Target State Host
------------------------------ ------------------- -------
ora.DATA.dg ONLINE ONLINE rac1
ora.FRA.dg ONLINE ONLINE rac1
ora.LISTENER.lsnr ONLINE ONLINE rac1
ora.LISTENER_SCAN1.lsnr ONLINE ONLINE rac1
ora.OCRVOTING.dg ONLINE ONLINE rac1
ora.asm ONLINE ONLINE rac1
ora.cvu OFFLINE OFFLINE
ora.dave_st.db ONLINE ONLINE rac1
ora.gsd OFFLINE OFFLINE
ora.net1.network ONLINE ONLINE rac1
ora.oc4j OFFLINE OFFLINE
ora.ons ONLINE ONLINE rac1
ora.rac1.ASM1.asm ONLINE ONLINE rac1
ora.rac1.LISTENER_RAC1.lsnr ONLINE ONLINE rac1
ora.rac1.gsd OFFLINE OFFLINE
ora.rac1.ons ONLINE ONLINE rac1
ora.rac1.vip ONLINE ONLINE rac1
ora.rac2.ASM2.asm ONLINE ONLINE rac2
ora.rac2.LISTENER_RAC2.lsnr ONLINE ONLINE rac2
ora.rac2.gsd OFFLINE OFFLINE
ora.rac2.ons ONLINE ONLINE rac2
ora.rac2.vip ONLINE ONLINE rac2
ora.registry.acfs ONLINE ONLINE rac1
ora.scan1.vip ONLINE ONLINE rac1
[grid@rac1 u01]$ ls
通过以上实验,也可以看出,OCR中的记录是根据DB_UNIQUE_NAME 来进行判断的。而非DB_NAME。
--------------------------------------------------------------------------------------------
版权所有,文章允许转载,但必须以链接方式注明源地址,否则追究法律责任!
QQ: 251097186
Skype: tianlesoftware
Email: tianlesoftware@gmail.com
Blog: http://blog.csdn.net/tianlesoftware
Weibo: http://weibo.com/tianlesoftware
Twitter: http://twitter.com/tianlesoftware
Facebook: http://www.facebook.com/tianlesoftware
Linkedin: http://cn.linkedin.com/in/tianlesoftware