本文转载:http://hi.baidu.com/linuxocp/blog/item/3c09acb769969ed036d3cab4.html

glogin.sql与srvctl
2011-12-29 15:54

  今天打开虚拟机中rac的一个节点,等了好久crs依旧没有

把数据库启动好,于是尝试手动启动,但是在启动instance

时出现下面的一串错误:

 

[oracle@node1 admin]$ srvctl start instance -d racdb -i racdb1

PRKP-1001 : 在节点 node1 上启动实例 racdb1 时出错

node1:ora.node1.ASM1.asm:

node1:ora.node1.ASM1.asm:SQL*Plus: Release 10.2.0.1.0 - Production on Thu Dec 29                                                                                                  14:47:31 2011

node1:ora.node1.ASM1.asm:

node1:ora.node1.ASM1.asm:Copyright (c) 1982, 2005, Oracle.  All rights reserved.

node1:ora.node1.ASM1.asm:

node1:ora.node1.ASM1.asm:Enter user-name:

node1:ora.node1.ASM1.asm:Connected to:

node1:ora.node1.ASM1.asm:Oracle Database 10g Enterprise Edition Release 10.2.0.1                                                                                                 .0 - 64bit Production

node1:ora.node1.ASM1.asm:With the Partitioning, Real Application Clusters, OLAP                                                                                                  and Data Mining options

node1:ora.node1.ASM1.asm:

node1:ora.node1.ASM1.asm:from global_name

node1:ora.node1.ASM1.asm:     *

node1:ora.node1.ASM1.asm:ERROR at line 2:

node1:ora.node1.ASM1.asm:ORA-01219: database not open: queries allowed on fixed                                                                                                  tables/views only

node1:ora.node1.ASM1.asm:

node1:ora.node1.ASM1.asm:

node1:ora.node1.ASM1.asm:Enter value for gname: shutdown immediate>Disconnected                                                                                                  from Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bit Productio                                                                                                 n

node1:ora.node1.ASM1.asm:With the Partitioning, Real Application Clusters, OLAP                                                                                                  and Data Mining options

node1:ora.node1.ASM1.asm:

node1:ora.node1.ASM1.asm:

node1:ora.node1.ASM1.asm:SQL*Plus: Release 10.2.0.1.0 - Production on Thu Dec 29                                                                                                  14:47:33 2011

node1:ora.node1.ASM1.asm:

node1:ora.node1.ASM1.asm:Copyright (c) 1982, 2005, Oracle.  All rights reserved.

node1:ora.node1.ASM1.asm:

node1:ora.node1.ASM1.asm:Enter user-name:

node1:ora.node1.ASM1.asm:Connected to:

node1:ora.node1.ASM1.asm:Oracle Database 10g Enterprise Edition Release 10.2.0.1                                                                                                 .0 - 64bit Production

node1:ora.node1.ASM1.asm:With the Partitioning, Real Application Clusters, OLAP                                                                                                  and Data Mining options

node1:ora.node1.ASM1.asm:

node1:ora.node1.ASM1.asm:from global_name

node1:ora.node1.ASM1.asm:     *

node1:ora.node1.ASM1.asm:ERROR at line 2:

node1:ora.node1.ASM1.asm:ORA-01219: database not open: queries allowed on fixed                                                                                                  tables/views only

node1:ora.node1.ASM1.asm:

node1:ora.node1.ASM1.asm:

node1:ora.node1.ASM1.asm:Enter value for gname: shutdown abort>Disconnected from                                                                                                  Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bit Production

node1:ora.node1.ASM1.asm:With the Partitioning, Real Application Clusters, OLAP                                                                                                  and Data Mining options

node1:ora.node1.ASM1.asm:

CRS-0215: Could not start resource 'ora.racdb.racdb1.inst'.

 

  从上面信息中我看到了gname,而这个东西是我在glogin.sql中加入了下面一段东西:

 

col global_name new_value gname;

select lower(user)||'@'||lower(regexp_substr(global_name,'[[:alpha:]]{1,}')) as global_name

from global_name;

set sqlprompt '&gname>';

 

  看过tom书的都知道这段是干吗的,就不多说了。

 

  于是在glogin.sql中去掉了这段内容,再次启动,OK!

 

  所以使用rac的同志要注意glogin.sql与srvctl的关系了,其实srvctl命令最终还是被解释成

sql*plus命令去执行,而sql*plus的配置文件就是glogin.sql,所以它的改变当然会对srvctl。

 

 

  RAC关闭与启动顺序:

 

cd $CRS_HOME/bin

./srvctl stop instance -d racdb -i racdb1

./srvctl stop asm -n node1

./srvctl stop nodeapps -n node1

 su - root: crsctl stop crs

 

 

启动:

su - root:  crsctl start crs

./srvctl start nodeapps -n node1

./srvctl start instance -d racdb -i racdb1

 

crsd日志目录:

 

/opt/ora10g/product/10.2.0/crs_1/log/node1/crsd