RAC中关于"Immediate Kill Session#" bug记录

联系:手机/微信(+86 17813235971) QQ(107644445)

标题:RAC中关于"Immediate Kill Session#" bug记录

作者:惜分飞©版权所有[未经本人同意,不得以任何形式转载,否则有进一步追究法律责任的权利.]

今天在rac的一个节点上发现很多Immediate Kill Session#的错误,分析记录如下
1.alert日志内容

Sun Jan  1 02:12:28 2012
ALTER SYSTEM SET service_names='' SCOPE=MEMORY SID='ora9i1';
Sun Jan  1 02:12:28 2012
Immediate Kill Session#: 496, Serial#: 51199
Immediate Kill Session: sess: 0x406bfa26b78  OS pid: 12900
Immediate Kill Session#: 497, Serial#: 38504
Immediate Kill Session: sess: 0x406bfa280e0  OS pid: 12496
Immediate Kill Session#: 499, Serial#: 45296
Immediate Kill Session: sess: 0x406bfa2abb0  OS pid: 12467
Immediate Kill Session#: 502, Serial#: 18910
Immediate Kill Session: sess: 0x406bfa2ebe8  OS pid: 28887
Immediate Kill Session#: 503, Serial#: 26631
Immediate Kill Session: sess: 0x406bfa30150  OS pid: 20749
Immediate Kill Session#: 508, Serial#: 63586
Immediate Kill Session: sess: 0x406bfa36c58  OS pid: 27614
Immediate Kill Session#: 512, Serial#: 43388
Immediate Kill Session: sess: 0x406bfa3c1f8  OS pid: 4021
Immediate Kill Session#: 516, Serial#: 33975
Immediate Kill Session: sess: 0x406bfa41798  OS pid: 18481
Immediate Kill Session#: 517, Serial#: 24240
Immediate Kill Session: sess: 0x406bfa42d00  OS pid: 823
Immediate Kill Session#: 526, Serial#: 59767
Immediate Kill Session: sess: 0x406bfa4eda8  OS pid: 12529
Immediate Kill Session#: 527, Serial#: 45765
Immediate Kill Session: sess: 0x406bfa50310  OS pid: 6059
……………………
Sun Jan  1 02:22:29 2012
ALTER SYSTEM SET service_names='ora9i' SCOPE=MEMORY SID='ora9i1';

2.数据库配置
2.1)A节点相关配置

SQL> select instance_name from v$instance;
INSTANCE_NAME
----------------
ora9i1
SQL> select * from v$version;
BANNER
----------------------------------------------------------------
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bi
PL/SQL Release 10.2.0.4.0 - Production
CORE    10.2.0.4.0      Production
TNS for Linux IA64: Version 10.2.0.4.0 - Production
NLSRTL Version 10.2.0.4.0 - Production
SQL> show parameter name;
NAME                                 TYPE       VALUE
------------------------------------ ---------- --------------------
db_file_name_convert                 string
db_name                              string     ora9i
db_unique_name                       string     ora9i
global_names                         boolean    FALSE
instance_name                        string     ora9i1
lock_name_space                      string
log_file_name_convert                string
service_names                        string     ora9i

2.2)B节点相关配置

SQL>  select instance_name from v$instance;
INSTANCE_NAME
----------------
ora9i2
SQL>  select * from v$version;
BANNER
----------------------------------------------------------------
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bi
PL/SQL Release 10.2.0.4.0 - Production
CORE    10.2.0.4.0      Production
TNS for Linux IA64: Version 10.2.0.4.0 - Production
NLSRTL Version 10.2.0.4.0 - Production
SQL> show parameter name;
NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
db_file_name_convert                 string
db_name                              string      ora9i
db_unique_name                       string      ora9i
global_names                         boolean     FALSE
instance_name                        string      ora9i2
lock_name_space                      string
log_file_name_convert                string
service_names                        string      SYS$SYS.KUPC$C_2_2012010601100
                                                 6.ORA9I, ora9i, SYS$SYS.KUPC$S
                                                 _2_20120106011006.ORA9I

3.查看MOS,寻找解决方案
3.1)产生该问题原因

This is caused by unpublished Bug 6955040 ALL THE SESSIONS LOST CONNECTION AFTER KILLING CRSD.BIN.
The problem is when CRSD is killed or crashed and restarted,
CRSD will run resource check action but CRS resource status will not be available at that time.
Then in instance check action,
it fails to get the preferred node VIP resource status and considered the preferred node VIP resource is not running.
Therefore, instance check action will remove the default database service name
and disconnect sessions connected using default database service name.
This causes messages "ALTER SYSTEM" and "Immediate Kill Session" printed in alert log.

3.2)解决方案

1) The fix is included in 10.2.0.5 patchset and 11.1.0.7 patchset.
    Apply the patchset once they are available.
OR
2) Configure a service name other than the default one (same as db_name),
and get user to use the non-default service name for connection.

rac中的spfile探讨

联系:手机/微信(+86 17813235971) QQ(107644445)

标题:rac中的spfile探讨

作者:惜分飞©版权所有[未经本人同意,不得以任何形式转载,否则有进一步追究法律责任的权利.]

今天朋友的的rac,因为被同事做数据库升级,分别在两个节点的本地创建了spfile,然后使用这个spfile启动了数据库,因为他不是非常懂oracle,所以向我求救,我改他的建议是:
1、利用备份的原来的pfile文件创建在asm中的spfile,规则是:+ASM/SID/spfileSID
2、dbs目录下创建一个本地的initsid.ora,然后在里面加一个spfile=’+ASM pfile path’(两个节点同样操作,注意sid不同)
3、分别重启数据库
出现该问题的原因分析:
做数据库升级的朋友的同事也不懂rac的spfile的相关规则,应该是在重启数据库的时候,提示spfile不存在,然后自己手工创建利用pfile创建的spfile到dbs下面,然后朋友十一后检测数据库,发现spfile都放置在本地了。
1、通常读取参数文件顺序
我们知道,如果不指定参数文件,oracle是按照这个顺序查找文件来启动数据库的:
spfileSID.ora
spfile.ora
initSID.ora
init.ora
如果这些文件都没有找到,启动会失败。

2、RAC中关于spfile的启动探讨

[rac@cent1 dbs]$ echo $ORACLE_SID
RACDB1
[rac@cent1 dbs]$ touch spfileRACDB1.ora  <==手工创建一个空白的spfile
[rac@cent1 dbs]$ sqlplus / as sysdba
SQL*Plus: Release 10.2.0.4.0 - Production on Thu Apr 29 13:45:50 2010
Copyright (c) 1982, 2007, Oracle.  All Rights Reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - Production
With the Partitioning, Real Application Clusters, OLAP, Data Mining
and Real Application Testing options
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup
ORA-27091: unable to queue I/O  <== 用sqlplus启动数据库时会报错
ORA-27069: attempt to do I/O beyond the range of the file
Additional information: 1
Additional information: 1
SQL>
SQL> exit
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - Production
With the Partitioning, Real Application Clusters, OLAP, Data Mining
and Real Application Testing options
[rac@cent1 dbs]$ crs_stat -t
Name           Type           Target    State     Host
------------------------------------------------------------
ora....B1.inst application    OFFLINE   OFFLINE
ora....B2.inst application    ONLINE    ONLINE    cent2
ora.RACDB.db   application    ONLINE    ONLINE    cent1
ora....SM1.asm application    ONLINE    ONLINE    cent1
ora....T1.lsnr application    ONLINE    ONLINE    cent1
ora.cent1.gsd  application    ONLINE    ONLINE    cent1
ora.cent1.ons  application    ONLINE    ONLINE    cent1
ora.cent1.vip  application    ONLINE    ONLINE    cent1
ora....SM2.asm application    ONLINE    ONLINE    cent2
ora....T2.lsnr application    ONLINE    ONLINE    cent2
ora.cent2.gsd  application    ONLINE    ONLINE    cent2
ora.cent2.ons  application    ONLINE    ONLINE    cent2
ora.cent2.vip  application    ONLINE    ONLINE    cent2
[rac@cent1 dbs]$ srvctl start instance -i racdb1 -d racdb  <== 用srvctl启动成功
[rac@cent1 dbs]$ sqlplus / as sysdba
SQL*Plus: Release 10.2.0.4.0 - Production on Thu Apr 29 13:47:25 2010
Copyright (c) 1982, 2007, Oracle.  All Rights Reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - Production
With the Partitioning, Real Application Clusters, OLAP, Data Mining
and Real Application Testing options
SQL> select instance_name, status from v$instance;
INSTANCE_NAME    STATUS
---------------- ------------
RACDB1           OPEN
--说明srvctl不是用那个顺序去查找参数文件

3、查看srvctl读取spfile位置

[rac@cent1 dbs]$ srvctl config database -d racdb -a
cent1 RACDB1 /rac/product/10.2.0/db
cent2 RACDB2 /rac/product/10.2.0/db
DB_NAME: RACDB
ORACLE_HOME: /rac/product/10.2.0/db
SPFILE: +DATA/RACDB/spfileRACDB.ora
DOMAIN: WORLD
DB_ROLE: null
START_OPTIONS: null
POLICY:  AUTOMATIC
ENABLE FLAG: DB ENABLED

4、修改CRS中关于spfile位置

[rac@cent1 dbs]$ srvctl modify database -d racdb -p ' +DATA/RACDB/spfileRACDB1.ora'

RAC负载均衡配置

联系:手机/微信(+86 17813235971) QQ(107644445)

标题:RAC负载均衡配置

作者:惜分飞©版权所有[未经本人同意,不得以任何形式转载,否则有进一步追究法律责任的权利.]

1、客户端均衡(Client-Side LB)
工作原理:当客户端发起连接时,会从地址列表中随机选取一个,再使用随机算法把连接请求分散到各个实例。
存在缺点:
1.1)分配连接时没有考虑每个节点的真实负载,最后分配不过不一定是平衡
1.2)随机算法需要长时间片,如果在短时间内同时发起多个连接,这些连接有可能被分配到一个节点上
1.3)有些情况下,连接可能被分配到故障节点上
配置方法:在tns中添加LOAD_BALANCE = YES条目
2、服务器端均衡(Server-Side LB)
工作原理:
2.1)该均衡实现是依赖于Listener收集的负载信息。在数据库运行过程中,PMON后台进程会收集数系统的负载信息,然后登记到Listener中。
2.2)PMON进程不仅会向本地的Listener注册,也会想其他节点上的Listener注册,但到底向何处注册,是由Remote_Listeners和Local_Listener这两个参数决定。Local_Listener不用设置,而Remote_Listeners需要设置,参数值有一个tnsnames项。
2.3)当收到客户端连接请求时,就会把连接转给负载最小的节点,这个节点可能是自己,也可能是其他节点,也就是Listener会转发客户端的连接请求。
配置方法:

SQL> show parameter listener;
NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
local_listener                       string
remote_listener                      string      LISTENERS_DEVDB
tnsnames.ora
LISTENERS_DEVDB =
  (ADDRESS_LIST =
    (ADDRESS = (PROTOCOL = TCP)(HOST = rac1-vip)(PORT = 1521))
    (ADDRESS = (PROTOCOL = TCP)(HOST = rac2-vip)(PORT = 1521))
  )
listener.ora(除掉SID_LIST_LISTENER_NAME项)
LISTENER_RAC1 =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = TCP)(HOST = rac1-vip)(PORT = 1521)(IP = FIRST))
      (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.11)(PORT = 1521)(IP = FIRST))
    )
  )

3、两者联合使用
Server-Side LB和Client-Side LB不是互斥的,两者可以一起工作,这个时候客户端的连接请求会先从地址列表中随机选择一个地址,然后向该地址的Listener发送请求;Listener接到请求后,根据各个节点负载情况从中挑选出最合适的节点转发连接请求。

RAC Failover三种方式

联系:手机/微信(+86 17813235971) QQ(107644445)

标题:RAC Failover三种方式

作者:惜分飞©版权所有[未经本人同意,不得以任何形式转载,否则有进一步追究法律责任的权利.]

1、Client-Side Connect Time Failover
1.1)在用户端tnsname中配置了多个地址,用户发起连接请求时,会先尝试连接地址表中的第一个地址,如果这个连接尝试失败,则继续尝试使用第二个地址,直至连接成功或者遍历了所有的地址。
1.2)这种Failover的特点是:在建立连接那一时刻起作用,一旦连接建立之后,节点出现故障都不会作处理,从而客户端的表现就是会话断开,用户程序必须重新建立连接。
启用该方法:在客户端tnsname.ora中添加FAILOVER=ON条目,因为这个参数默认值就是为NO,所以即使客户端不加该条目,也有这种Failover功能。

XFF_F =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.21)(PORT = 1521))
    (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.22)(PORT = 1521))
    (LOAD_BALANCE = yes)
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = devdb)
    )
  )

2、TAF(Transparent Application Failover)
2.1)在连接建立以后、应用系统运行过程中,如果某个实例发生故障,连接到这个实例上的用户会被自动迁移到其他的健康的实例上。对于应用程序而言,这个迁移过程是透明的,不需要用户的介入,当然在迁移过程中,未提交的事物会回滚。
2.2)与Client-Side Connect Time Failover比较起来,就是多了FAILOVER_MODE这一配置项,该配置项包含4个子项目
2.2.1)METHOD:可选值有BASIC和PRECONNECT
BASIC是指在感知到节点故障时才创建到其他实例的连接
PRECONNECT是在最初建立连接时就同时建立到所有实例的连接,当发生故障时,立刻就可以切换到其他链路上。
2.2.2)TYPE:可选值有SESSION和SELECT
两者的区别在于对select语句的处理,select表示如果发生故障迁移,正在执行的select语句将在新的节点上继续返回后续结果集;而session表示重新执行该select查询返回全部的结果。
2.2.3)DELAY表示重试间隔时间
2.2.4)RETRIES表示重试次数

XFF_T =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.21)(PORT = 1521))
    (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.22)(PORT = 1521))
    (LOAD_BALANCE = yes)
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = devdb)
      (FAILOVER_MODE =
        (TYPE = SELECT)
        (METHOD = BASIC)
        (RETRIES = 180)
        (DELAY = 5)
      )
    )
  )

3、Server-Side TAF
3.1)Server-Side TAF具有TAF的所有特点
3.2)这种TAF是在服务器上配置,不需要在客户端进行相关配置,如果修改一个参数,不需要在所有的tns上修改,而只要修改服务器中的service即可
用户有两种角色可以选择
PREFERRED:首选实例,会优先选择拥有这个角色的实例提供服务
AVAILABLE:后备实例,当PREFERRED实例不可用时,才会转到AVAILABLE实例上

XFF_RAC =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.21)(PORT = 1521))
    (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.22)(PORT = 1521))
    (LOAD_BALANCE = yes)
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = XFF)
    )
  )

集群服务启动与关闭(10g)

联系:手机/微信(+86 17813235971) QQ(107644445)

标题:集群服务启动与关闭(10g)

作者:惜分飞©版权所有[未经本人同意,不得以任何形式转载,否则有进一步追究法律责任的权利.]

一、crs开启和关闭
关闭crs
/etc/init.d/init.crs stop
开启crs
/etc/init.d/init.crs start
二、启动和关闭所有的集群服务
关闭
./crs_stop -all
启动
./crs_start -all
三、分步操作crs服务
1、关闭集群
srvctl stop service -d -s
srvctl stop database -d
srvctl stop asm -n
srvctl stop asm -n
srvctl stop nodeapps -n
srvctl stop nodeapps -n
2、关闭集群
srvctl start nodeapps -n
srvctl start nodeapps -n
srvctl start asm -n
srvctl start asm -n
srvctl start database -d
srvctl start service -d -s
3、测试
3.1)关闭
srvctl stop service -d devdb -s XFF
srvctl stop instance -d devdb -i devdb1,devdb2 -o immediate
(srvctl stop database -d devdb -o immediate)
srvctl stop asm -n rac1
srvctl stop asm -n rac2
srvctl stop nodeapps -n rac1
srvctl stop nodeapps -n rac2
3.2)启动
srvctl start nodeapps -n rac1
srvctl start nodeapps -n rac2
srvctl start asm -n rac1
srvctl start asm -n rac2
srvctl start database -d devdb
(srvctl start instance -n devdb -i devdb1,devdb2)
srvctl start service -d devdb -s XFF

RAC维护命令

联系:手机/微信(+86 17813235971) QQ(107644445)

标题:RAC维护命令

作者:惜分飞©版权所有[未经本人同意,不得以任何形式转载,否则有进一步追究法律责任的权利.]

一、节点层(olsnodes)
rac1-> olsnodes -help
Usage: olsnodes [-n] [-p] [-i] [<node> | -l] [-g] [-v]
where
-n print node number with the node name
-p print private interconnect name with the node name
-i print virtual IP name with the node name
<node> print information for the specified node
-l print information for the local node
-g turn on logging
-v run in verbose mode
rac1-> olsnodes -p -n -i
rac1    1       rac1-priv       rac1-vip
rac2    2       rac2-priv       rac2-vip
二、网络层(oifcfg)
rac1-> oifcfg -help
Name:
oifcfg – Oracle Interface Configuration Tool.
Usage:  oifcfg iflist [-p [-n]]
oifcfg setif {-node <nodename> | -global} {<if_name>/<subnet>:<if_type>}…
oifcfg getif [-node <nodename> | -global] [ -if <if_name>[/<subnet>] [-type <if_type>] ]
oifcfg delif [-node <nodename> | -global] [<if_name>[/<subnet>]]
oifcfg [-help]
<nodename> – name of the host, as known to a communications network
<if_name>  – name by which the interface is configured in the system
<subnet>   – subnet address of the interface
<if_type>  – type of the interface { cluster_interconnect | public | storage }
rac1-> oifcfg iflist -n -p
eth0  10.10.10.0  PRIVATE  255.255.255.0
eth1  192.168.1.0  PRIVATE  255.255.255.0
rac1-> oifcfg getif
eth0  10.10.10.0  global  cluster_interconnect
eth1  192.168.1.0  global  public
rac1-> oifcfg getif -node rac1
rac1-> oifcfg getif -global rac1
eth0  10.10.10.0  global  cluster_interconnect
eth1  192.168.1.0  global  public
rac1-> oifcfg getif -type public
eth1  192.168.1.0  global  public
rac1-> oifcfg setif -global tnnel_1@none/10.0.0.0:public
rac1-> oifcfg getif -type public
eth1  192.168.1.0  global  public
tnnel_1@none  10.0.0.0  global  public
rac1-> oifcfg delif -global tnnel_1@none/10.0.0.0
rac1-> oifcfg getif -type public
eth1  192.168.1.0  global  public
三、集群层
1、crsctl
rac1-> crsctl
Usage: crsctl check  crs          – checks the viability of the CRS stack
crsctl check  cssd         – checks the viability of CSS
crsctl check  crsd         – checks the viability of CRS
crsctl check  evmd         – checks the viability of EVM
crsctl set    css <parameter> <value> – sets a parameter override
crsctl get    css <parameter> – gets the value of a CSS parameter
crsctl unset  css <parameter> – sets CSS parameter to its default
crsctl query  css votedisk    – lists the voting disks used by CSS
crsctl add    css votedisk <path> – adds a new voting disk
crsctl delete css votedisk <path> – removes a voting disk
crsctl enable  crs    – enables startup for all CRS daemons
crsctl disable crs    – disables startup for all CRS daemons
crsctl start crs  – starts all CRS daemons.
crsctl stop  crs  – stops all CRS daemons. Stops CRS resources in case of cluster.
crsctl start resources  – starts CRS resources.
crsctl stop resources  – stops  CRS resources.
crsctl debug statedump evm  – dumps state info for evm objects
crsctl debug statedump crs  – dumps state info for crs objects
crsctl debug statedump css  – dumps state info for css objects
crsctl debug log css [module:level]{,module:level} …
– Turns on debugging for CSS
crsctl debug trace css – dumps CSS in-memory tracing cache
crsctl debug log crs [module:level]{,module:level} …
– Turns on debugging for CRS
crsctl debug trace crs – dumps CRS in-memory tracing cache
crsctl debug log evm [module:level]{,module:level} …
– Turns on debugging for EVM
crsctl debug trace evm – dumps EVM in-memory tracing cache
crsctl debug log res <resname:level> turns on debugging for resources
crsctl query crs softwareversion [<nodename>] – lists the version of CRS software installed
crsctl query crs activeversion – lists the CRS software operating version
crsctl lsmodules css – lists the CSS modules that can be used for debugging
crsctl lsmodules crs – lists the CRS modules that can be used for debugging
crsctl lsmodules evm – lists the EVM modules that can be used for debugging
If necesary any of these commands can be run with additional tracing by
adding a “trace” argument at the very front.
Example: crsctl trace check css
root@rac1 bin]# ./crsctl stop  crs
Stopping resources.
Successfully stopped CRS resources
Stopping CSSD.
Shutting down CSS daemon.
Shutdown request successfully issued.
[root@rac1 bin]# ./crsctl query css votedisk
0.     0    /ocfs/clusterware/votingdisk
located 1 votedisk(s).
[root@rac1 bin]# ./crsctl add    css votedisk /ocfs/clusterware/votingdisk02 -force
Now formatting voting disk: /ocfs/clusterware/votingdisk01
successful addition of votedisk /ocfs/clusterware/votingdisk02.
[root@rac2 bin]# ./crsctl add    css votedisk /ocfs/clusterware/votingdisk02 -force
Now formatting voting disk: /ocfs/clusterware/votingdisk02
successful addition of votedisk /ocfs/clusterware/votingdisk02.
[root@rac1 bin]# ./crsctl query css votedisk
0.     0    /ocfs/clusterware/votingdisk
1.     0    /ocfs/clusterware/votingdisk01
2.     0    /ocfs/clusterware/votingdisk02
2、ocrdump
rac2-> ocrdump -help
Name:
ocrdump – Dump contents of Oracle Cluster Registry to a file.
Synopsis:
ocrdump [<filename>|-stdout] [-backupfile <backupfilename>] [-keyname <keyname>] [-xml] [-noheader]
Description:
Default filename is OCRDUMPFILE. Examples are:
prompt> ocrdump
writes cluster registry contents to OCRDUMPFILE in the current directory
prompt> ocrdump MYFILE
writes cluster registry contents to MYFILE in the current directory
prompt> ocrdump -stdout -keyname SYSTEM
writes the subtree of SYSTEM in the cluster registry to stdout
prompt> ocrdump -stdout -xml
writes cluster registry contents to stdout in xml format
Notes:
The header information will be retrieved based on best effort basis.
A log file will be created in
$ORACLE_HOME/log/<hostname>/client/ocrdump_<pid>.log. Make sure
you have file creation privileges in the above directory before
running this tool.
rac2-> ocrdump /tmp/ocr.out -keyname SYSTEM.css -xml
rac2-> ocrdump /tmp/ocr_a.out  -xml
rac2-> ocrdump -stdout -keyname SYSTEM.css -xml|more
3、ocrcheck
rac2-> ocrcheck
Status of Oracle Cluster Registry is as follows :
Version                  :          2
Total space (kbytes)     :     262144
Used space (kbytes)      :       4344
Available space (kbytes) :     257800
ID                       :  582586001
Device/File Name         : /ocfs/clusterware/ocr
Device/File integrity check succeeded
Device/File not configured
Cluster registry integrity check succeeded
4、ocrconfig
rac2-> ocrconfig
Name:
ocrconfig – Configuration tool for Oracle Cluster Registry.
Synopsis:
ocrconfig [option]
option:
-export <filename> [-s online]
– Export cluster register contents to a file
-import <filename>                  – Import cluster registry contents from a file
-upgrade [<user> [<group>]]
– Upgrade cluster registry from previous version
-downgrade [-version <version string>]
– Downgrade cluster registry to the specified version
-backuploc <dirname>                – Configure periodic backup location
-showbackup                         – Show backup information
-restore <filename>                 – Restore from physical backup
-replace ocr|ocrmirror [<filename>] – Add/replace/remove a OCR device/file
-overwrite                          – Overwrite OCR configuration on disk
-repair ocr|ocrmirror <filename>    – Repair local OCR configuration
-help                               – Print out this help information
Note:
A log file will be created in
$ORACLE_HOME/log/<hostname>/client/ocrconfig_<pid>.log. Please ensure
you have file creation privileges in the above directory before
running this tool.
rac2-> ocrconfig -showbackup
rac1     2011/07/29 20:18:22     /u01/app/oracle/product/10.2.0/crs_1/cdata/crs
rac1     2011/07/29 16:18:33     /u01/app/oracle/product/10.2.0/crs_1/cdata/crs
rac1     2011/07/29 16:18:33     /u01/app/oracle/product/10.2.0/crs_1/cdata/crs
rac1     2011/07/29 16:18:33     /u01/app/oracle/product/10.2.0/crs_1/cdata/crs
[root@rac1 bin]# cd /u01/app/oracle/product/10.2.0/crs_1/cdata/crs
[root@rac1 crs]# ll
总用量 16368
-rw-r–r–  1 root root 4554752  7月 29 20:18 backup00.ocr
-rw-r–r–  1 root root 4055040  7月 29 16:18 backup01.ocr
-rw-r–r–  1 root root 4055040  7月 29 16:18 day.ocr
-rw-r–r–  1 root root 4055040  7月 29 16:18 week.ocr
rac2-> ocrconfig -export /tmp/bak_ocr -s online
PROT-20: Insufficient permission to proceed. Require privileged user
[root@rac1 bin]# ./ocrconfig -export /tmp/bak_ocr -s online
[root@rac1 bin]# ll /tmp/bak_ocr
-rw-r–r–  1 root root 98692  7月 30 00:07 /tmp/bak_ocr
四、应用层
1、crs_stat
rac2-> crs_stat -help
Usage:  crs_stat [resource_name […]] [-v] [-l] [-q] [-c cluster_member]
crs_stat [resource_name […]] -t [-v] [-q] [-c cluster_member]
crs_stat -p [resource_name […]] [-q]
crs_stat [-a] application -g
crs_stat [-a] application -r [-c cluster_member]
crs_stat -f [resource_name […]] [-q] [-c cluster_member]
crs_stat -ls [resource_name […]] [-q]
rac2-> crs_stat -t -v
Name           Type           R/RA   F/FT   Target    State     Host
———————————————————————-
ora…..XFF.cs application    0/0    0/1    ONLINE    ONLINE    rac1
ora….db1.srv application    0/0    0/0    ONLINE    ONLINE    rac1
ora.devdb.db   application    0/1    0/1    ONLINE    ONLINE    rac1
ora….b1.inst application    0/5    0/0    ONLINE    ONLINE    rac1
ora….b2.inst application    0/5    0/0    ONLINE    ONLINE    rac2
ora….SM1.asm application    0/5    0/0    ONLINE    ONLINE    rac1
ora….C1.lsnr application    0/5    0/0    ONLINE    ONLINE    rac1
ora.rac1.gsd   application    0/5    0/0    ONLINE    ONLINE    rac1
ora.rac1.ons   application    0/3    0/0    ONLINE    ONLINE    rac1
ora.rac1.vip   application    0/0    0/0    ONLINE    ONLINE    rac1
ora….SM2.asm application    0/5    0/0    ONLINE    ONLINE    rac2
ora….C2.lsnr application    0/5    0/0    ONLINE    ONLINE    rac2
ora.rac2.gsd   application    0/5    0/0    ONLINE    ONLINE    rac2
ora.rac2.ons   application    0/3    0/0    ONLINE    ONLINE    rac2
ora.rac2.vip   application    0/0    0/0    ONLINE    ONLINE    rac2
rac2-> crs_stat -p ora.devdb.db
NAME=ora.devdb.db
TYPE=application
ACTION_SCRIPT=/u01/app/oracle/product/10.2.0/crs_1/bin/racgwrap
ACTIVE_PLACEMENT=0
AUTO_START=1
CHECK_INTERVAL=600
DESCRIPTION=CRS application for the Database
FAILOVER_DELAY=0
FAILURE_INTERVAL=60
FAILURE_THRESHOLD=1
HOSTING_MEMBERS=
OPTIONAL_RESOURCES=
PLACEMENT=balanced
REQUIRED_RESOURCES=
RESTART_ATTEMPTS=1
SCRIPT_TIMEOUT=600
START_TIMEOUT=0
STOP_TIMEOUT=0
UPTIME_THRESHOLD=7d
USR_ORA_ALERT_NAME=
USR_ORA_CHECK_TIMEOUT=0
USR_ORA_CONNECT_STR=/ as sysdba
USR_ORA_DEBUG=0
USR_ORA_DISCONNECT=false
USR_ORA_FLAGS=
USR_ORA_IF=
USR_ORA_INST_NOT_SHUTDOWN=
USR_ORA_LANG=
USR_ORA_NETMASK=
USR_ORA_OPEN_MODE=
USR_ORA_OPI=false
USR_ORA_PFILE=
USR_ORA_PRECONNECT=none
USR_ORA_SRV=
USR_ORA_START_TIMEOUT=0
USR_ORA_STOP_MODE=immediate
USR_ORA_STOP_TIMEOUT=0
USR_ORA_VIP=
2、srvctl
rac2-> srvctl
用法: srvctl <command> <object> [<options>]
命令: enable|disable|start|stop|relocate|status|add|remove|modify|getenv|setenv|unsetenv|config
对象: database|instance|service|nodeapps|asm|listener
有关各个命令和对象的详细帮助, 请使用:
srvctl <command> <object> -h
rac2-> srvctl config database
devdb
rac2-> srvctl config database -d devdb
rac1 devdb1 /u01/app/oracle/product/10.2.0/db_1
rac2 devdb2 /u01/app/oracle/product/10.2.0/db_1
rac2-> srvctl config database -d devdb -a
rac1 devdb1 /u01/app/oracle/product/10.2.0/db_1
rac2 devdb2 /u01/app/oracle/product/10.2.0/db_1
DB_NAME: devdb
ORACLE_HOME: /u01/app/oracle/product/10.2.0/db_1
SPFILE: +DG1/devdb/spfiledevdb.ora
DOMAIN: null
DB_ROLE: null
START_OPTIONS: null
POLICY:  AUTOMATIC
ENABLE FLAG: DB ENABLED
rac2-> srvctl config nodeapps -n rac1
rac1 devdb1 /u01/app/oracle/product/10.2.0/db_1
rac2-> srvctl config nodeapps -h
用法: srvctl config nodeapps -n <node_name> [-a] [-g] [-o] [-s] [-l]
-n <node>           节点名
-a                  显示 TNS 条目
-g                  显示 GSD 配置
-s                  显示 ONS 守护程序配置
-l                  显示监听程序配置
-h                  打印用法
rac2-> srvctl config nodeapps -n rac2 -l
监听程序已存在。
rac2-> srvctl config nodeapps -n rac1 -a
VIP 已存在。: /rac1-vip/192.168.1.21/255.255.255.0/eth0:eth1
rac2-> srvctl config listener -n rac2
rac2 LISTENER_RAC2
rac2-> srvctl config asm -n rac1
+ASM1 /u01/app/oracle/product/10.2.0/db_1
rac2-> srvctl config service -h
用法: srvctl config service -d <name> [-s <service_name>] [-a] [-S <level>]
-d <name>           数据库的唯一名称
-s <service>        服务名
-a                  附加属性
-S <level>          EM 控制台的附加信息
-h                  打印用法
rac2-> srvctl config service -d devdb -a
XFF PREF: devdb1 AVAIL: devdb2 TAF: basic
–设置XFF service 不开机启动
ac2-> srvctl disable service -h
用法: srvctl disable service -d <name> -s “<service_name_list>” [-i <inst_name>]
-d <name>           数据库的唯一名称
-s “<serv,…>”     逗号分隔的服务名
-i <inst>           实例名
-h                  打印用法
rac2-> srvctl disable service -d devdb -s XFF -i devdb1
rac2-> srvctl config service -d devdb -a
XFF PREF: devdb1 AVAIL: devdb2 TAF: basic
在实例 devdb1 上禁用服务 XFF。
rac2-> srvctl enable service -h
用法: srvctl enable service -d <name> -s “<service_name_list>” [-i <inst_name>]
-d <name>           数据库的唯一名称
-s “<serv,…>”     逗号分隔的服务名
-i <inst>           实例名
-h                  打印用法
rac2-> srvctl enable service -d devdb -s XFF -i devdb1
rac2-> srvctl config service -d devdb -a
XFF PREF: devdb1 AVAIL: devdb2 TAF: basic
–添加xff2 service
rac2-> srvctl add service -h
用法: srvctl add service -d <name> -s <service_name> -r “<preferred_list>” [-a “<available_list>”] [-P <TAF_policy>]
-d <name>           数据库的唯一名称
-s <service>        服务名
-r “<pref_list>”    首选实例列表
-a “<avail_list>”   可用实例列表
-P <TAF_policy>     TAF 策略 (NONE, BASIC, 或 PRECONNECT)
用法: srvctl add service -d <name> -s <service_name> -u {-r “<new_pref_inst>” | -a “<new_avail_inst>”}
-d <name>           数据库的唯一名称
-s <service>        服务名
-u                  为服务配置添加一个新实例
-r <new_pref_inst>  新首选实例的名称
-a <new_avail_inst> 新可用实例的名称
-h                  打印用法
rac2-> srvctl add service -d devdb -s xff2 -r devdb2 -a devdb1  -P BASIC
rac2-> srvctl config service -d devdb -a
XFF PREF: devdb1 AVAIL: devdb2 TAF: basic
xff2 PREF: devdb2 AVAIL: devdb1 TAF: BASIC
rac2-> crs_stat -t -v
Name           Type           R/RA   F/FT   Target    State     Host
———————————————————————-
ora…..XFF.cs application    0/0    0/1    ONLINE    ONLINE    rac1
ora….db1.srv application    0/0    0/0    ONLINE    ONLINE    rac2
ora.devdb.db   application    0/1    0/1    ONLINE    ONLINE    rac1
ora….b1.inst application    0/5    0/0    ONLINE    ONLINE    rac1
ora….b2.inst application    0/5    0/0    ONLINE    ONLINE    rac2
ora….xff2.cs application    0/0    0/1    OFFLINE   OFFLINE
ora….db2.srv application    0/0    0/0    OFFLINE   OFFLINE
ora….SM1.asm application    0/5    0/0    ONLINE    ONLINE    rac1
ora….C1.lsnr application    0/5    0/0    ONLINE    ONLINE    rac1
ora.rac1.gsd   application    0/5    0/0    ONLINE    ONLINE    rac1
ora.rac1.ons   application    0/3    0/0    ONLINE    ONLINE    rac1
ora.rac1.vip   application    0/0    0/0    ONLINE    ONLINE    rac1
ora….SM2.asm application    0/5    0/0    ONLINE    ONLINE    rac2
ora….C2.lsnr application    0/5    0/0    ONLINE    ONLINE    rac2
ora.rac2.gsd   application    0/5    0/0    ONLINE    ONLINE    rac2
ora.rac2.ons   application    0/3    0/0    ONLINE    ONLINE    rac2
ora.rac2.vip   application    0/0    0/0    ONLINE    ONLINE    rac2
–设置xff2 service 开机自启动
rac2->  srvctl enable service -d devdb -s xff2 -i devdb1
rac2->  srvctl enable service -d devdb -s xff2 -i devdb2
–启动xff2 service
rac2-> srvctl start service -d devdb -s xff2 -i devdb1
rac2-> crs_stat -t
Name           Type           Target    State     Host
————————————————————
ora…..XFF.cs application    ONLINE    ONLINE    rac1
ora….db1.srv application    ONLINE    ONLINE    rac2
ora.devdb.db   application    ONLINE    ONLINE    rac1
ora….b1.inst application    ONLINE    ONLINE    rac1
ora….b2.inst application    ONLINE    ONLINE    rac2
ora….xff2.cs application    ONLINE    ONLINE    rac2
ora….db2.srv application    ONLINE    ONLINE    rac1
ora….SM1.asm application    ONLINE    ONLINE    rac1
ora….C1.lsnr application    ONLINE    ONLINE    rac1
ora.rac1.gsd   application    ONLINE    ONLINE    rac1
ora.rac1.ons   application    ONLINE    ONLINE    rac1
ora.rac1.vip   application    ONLINE    ONLINE    rac1
ora….SM2.asm application    ONLINE    ONLINE    rac2
ora….C2.lsnr application    ONLINE    ONLINE    rac2
ora.rac2.gsd   application    ONLINE    ONLINE    rac2
ora.rac2.ons   application    ONLINE    ONLINE    rac2
ora.rac2.vip   application    ONLINE    ONLINE    rac2
rac2-> srvctl status  service -d devdb -v
服务 XFF 正在实例 devdb2 上运行
服务 xff2 正在实例 devdb1 上运行
–停用xff2 service
rac2-> srvctl stop service -d devdb -s xff2 -i devdb1
rac2-> crs_stat -t
Name           Type           Target    State     Host
————————————————————
ora…..XFF.cs application    ONLINE    ONLINE    rac1
ora….db1.srv application    ONLINE    ONLINE    rac2
ora.devdb.db   application    ONLINE    ONLINE    rac1
ora….b1.inst application    ONLINE    ONLINE    rac1
ora….b2.inst application    ONLINE    ONLINE    rac2
ora….xff2.cs application    ONLINE    ONLINE    rac2
ora….db2.srv application    OFFLINE   OFFLINE
ora….SM1.asm application    ONLINE    ONLINE    rac1
ora….C1.lsnr application    ONLINE    ONLINE    rac1
ora.rac1.gsd   application    ONLINE    ONLINE    rac1
ora.rac1.ons   application    ONLINE    ONLINE    rac1
ora.rac1.vip   application    ONLINE    ONLINE    rac1
ora….SM2.asm application    ONLINE    ONLINE    rac2
ora….C2.lsnr application    ONLINE    ONLINE    rac2
ora.rac2.gsd   application    ONLINE    ONLINE    rac2
ora.rac2.ons   application    ONLINE    ONLINE    rac2
ora.rac2.vip   application    ONLINE    ONLINE    rac2
rac2-> srvctl status  service -d devdb -v
服务 XFF 正在实例 devdb2 上运行
服务 xff2 未运行。
–删除xff2 service
rac2-> srvctl remove service -h
用法: srvctl remove service -d <name> -s <service_name> [-i <inst_name>] [-f]
-d <name>           数据库的唯一名称
-s <service>        服务名
-i <inst>           实例名
-f                  强制删除
-h                  打印用法
rac2-> srvctl remove service -d devdb -s xff2
xff2 PREF: devdb2 AVAIL: devdb1
是否从数据库 devdb 中删除服务 xff2? (y/[n]) y
rac2-> crs_stat -t
Name           Type           Target    State     Host
————————————————————
ora…..XFF.cs application    ONLINE    ONLINE    rac1
ora….db1.srv application    ONLINE    ONLINE    rac2
ora.devdb.db   application    ONLINE    ONLINE    rac1
ora….b1.inst application    ONLINE    ONLINE    rac1
ora….b2.inst application    ONLINE    ONLINE    rac2
ora….SM1.asm application    ONLINE    ONLINE    rac1
ora….C1.lsnr application    ONLINE    ONLINE    rac1
ora.rac1.gsd   application    ONLINE    ONLINE    rac1
ora.rac1.ons   application    ONLINE    ONLINE    rac1
ora.rac1.vip   application    ONLINE    ONLINE    rac1
ora….SM2.asm application    ONLINE    ONLINE    rac2
ora….C2.lsnr application    ONLINE    ONLINE    rac2
ora.rac2.gsd   application    ONLINE    ONLINE    rac2
ora.rac2.ons   application    ONLINE    ONLINE    rac2
ora.rac2.vip   application    ONLINE    ONLINE    rac2
注意使用-h或者help帮助功能

Oracle 10g RAC相关进程

联系:手机/微信(+86 17813235971) QQ(107644445)

标题:Oracle 10g RAC相关进程

作者:惜分飞©版权所有[未经本人同意,不得以任何形式转载,否则有进一步追究法律责任的权利.]

Oracle Clusterware进程
OCSSD
该进程是Clusterware最关键进程,如果出现异常,会导致系统重启,该进程提供的服务为CSS(Cluster Synchronization Service)服务。CSS服务是通过多种心跳机制来实现实时监控集群的健康状态,提供脑裂保护等基础集群服务功能。CSS服务有两种心跳机制:一种是通过私有网络的Network Heartbeat,另一种是通过Voting Disk的Disk Heartbeat
CRSD
CRSD是实现“高可用(HA)”的主要进程,它所提供的服务叫做CRS(Cluster Ready Service)服务。该进程对Oracle Clusterware中的资源进行监控,并在这些资源运行异常时进行干预,包括关闭、重启进程或者转移服务。
EVMD
该进程负责发布CRS产生的各种事件(Event)
RACGIMON
该进程负责检查数据库的健康状态,负责Service的启动、停止、故障转移(Failover)。这个进程会建立到数据库的持久连接,定期检查SGA中的特定信息,该信息由PMON进程定时更新
OPROCD
该进程也叫做Process Monitor Daemon。如果在非Linux平台上,并且没有使用第三方的集群软件,会看到这个进程。实现“IO隔离”功能,在Liunx平台上,是利用hangcheck-timer模块来实现“IO隔离”功能
Oracle Instance进程
LMSn
负责数据块在实例间的传递,对应的服务叫作GCS(Global Cache Service),这个进程的数量是通过参数GCS_SERVER_PROCESSES控制,缺省值是2个,取值范围为0至9
LMD
负责在多个实例间协调数据库的访问顺序,保证数据的一致性访问,对应的服务是GES(Global Enqueue Service)
LCK
负责Non-Cache Fusion资源的同步访问,每个实例只有一个LCK进程
LMON
各个实例的LMON进程进行定期通信,以检查集群中各节点的健康状态,当某个节点出现故障时,负责集群重构、GRD恢复等操作,它提供的服务叫作 Cluster Group Services(CGS)
DIAG
监控实例的健康状态,并在实例运行出现错误时收集诊断数据记录到Alert.log日志中
GSD
负责从客户端工具接收命令,为用户提供管理接口

Oracle RAC10g UNKNOWN解决

联系:手机/微信(+86 17813235971) QQ(107644445)

标题:Oracle RAC10g UNKNOWN解决

作者:惜分飞©版权所有[未经本人同意,不得以任何形式转载,否则有进一步追究法律责任的权利.]

1、表现出来的现象
rac2-> crs_stat -t
Name Type Target State Host
————————————————————
ora.rac1.gsd application ONLINE UNKNOWN rac1
ora.rac1.ons application ONLINE UNKNOWN rac1
ora.rac1.vip application ONLINE UNKNOWN rac1
ora.rac2.gsd application ONLINE UNKNOWN rac2
ora.rac2.ons application ONLINE UNKNOWN rac2
ora.rac2.vip application ONLINE UNKNOWN rac1
可以各种原因导致服务呈现unknown 状态,比如两个节点时间差太多,比如1分钟,可能导致这个异常
2、解决方法
因为UNKNOWN不能正常的被启动或者关闭(crs_start -all/crs_stop -all),所以解决方法有两种:
2.1)先禁用crs服务,后启用crs服务(root用户,两个节点上都要执行)
/etc/init.d/init.crs stop
/etc/init.d/init.crs start
2.2)单个服务关闭,后启动(oracle用户,一个节点上执行)
crs_stop ora.rac2.gsd(crs_stop -f ora.rac2.gsd强制关闭)
crs_start ora.rac2.gsd(crs_start -f ora.rac2.gsd强制开启)
该方法有变通,如一个个关闭服务,然后使用crs_start -all开启所有服务器

crs 10.2.0.1 bug(公网ip为私有ip时)

联系:手机/微信(+86 17813235971) QQ(107644445)

标题:crs 10.2.0.1 bug(公网ip为私有ip时)

作者:惜分飞©版权所有[未经本人同意,不得以任何形式转载,否则有进一步追究法律责任的权利.]

当crs10.2.0.1公用网卡IP段使用10、172、192段(非路由网段)的时候
1、会出现以下两种情况:
1)最后检查时出现如下错误
Checking existence of VIP node application (required)
Check failed.
Check failed on nodes:
rac1,rac2
2)在rac2上执行root.sh脚本最后
Expecting the CRS daemons to be up within 600 seconds.
CSS is active on these nodes.
rac1
rac2
CSS is active on all nodes.
Waiting for the Oracle CRSD and EVMD to start
Waiting for the Oracle CRSD and EVMD to start
……
Timed out waiting for the CRS stack to start.
2、解决方法:
在root.sh在第二个节点执行完之后,以 root 用户身份在第二个节点上手动调用 VIPCA
# /u01/app/oracle/product/10.2.0/crs_1/bin/vipca
配置虚拟ip

Oracle 10g RAC之配置时间同步(NTP)

联系:手机/微信(+86 17813235971) QQ(107644445)

标题:Oracle 10g RAC之配置时间同步(NTP)

作者:惜分飞©版权所有[未经本人同意,不得以任何形式转载,否则有进一步追究法律责任的权利.]

所有节点的时间必须同步,这通常是通过配置NTP服务器实现的。如果用户的网络中已经有一台时间服务器,那么可以所有节点都指向它,否则可以从集群中挑选一个节点作为时间服务器,让其他节点与它同步。下面分别演示这两种方法:
(1)如果公司网络中已经有一台时间服务器
如:192.168.11.10是一台ntp时间服务器
此时NTP服务器的配置文件是/etc/ntp.conf,在每个节点编辑这个文件。
[root@cc-svr-a ~]# vi /etc/ntp.conf
编辑后的内容如下,首选公司的时间服务器。
server 192.168.11.10 prefer
driftfile /var/lib/ntp/drift
broadcastdelay 0.008
(2)如果没有外部时间服务器
这时公司选择集群中某个节点作为时间服务器,NTP服务只需要很少的系统资源。假设选择主节点作为时间服务器,从节点向它同步,其配置方法如下。
编辑主节点的/etc/ntp.conf文件,编辑后的内容如下:
server 127.127.1.0
fudge 127.127.1.0 stratum 11
driftfile /var/lib/ntp/drift
broadcastdelay 0.008
编辑从节点的/etc/ntp.conf文件,编辑后的内容如下:
server 192.168.11.12 prefer #注意192.168.11.12为主节点的IP地址
driftfile /var/lib/ntp/drift
broadcastdelay 0.008
配置完成后,启动NTP服务。
[root@cc-svr-a ~]# /etc/init.d/ntpd start
[root@cc-svr-a ~]# chkconfig –level 345 ntpd on
(3)查看执行情况(主从)
[root@cc-svr-a ~]# ntpq -p
remote refid st t when poll reach delay offset jitter
==============================================================================
*CC-Node-02 LOCAL(0) 12 u 58 64 17 0.226 -22.698 29.261