OracleRAC管理 之 集群状态&信息查看
--by 王磊/菜小小~
============================================================
参看集群状态
[11:34:11oracle@node1 ~]crs_stat -t
Name Type Target State Host
------------------------------------------------------------
ora.dba.db application ONLINE ONLINE node2
ora....l1.inst application ONLINE ONLINE node1
ora....l2.inst application ONLINE ONLINE node2
ora.dba.rac.cs application ONLINE ONLINE node2
ora....ll1.srv application ONLINE ONLINE node1
ora....ll2.srv application ONLINE ONLINE node2
ora....SM1.asm application ONLINE ONLINE node1
ora....E1.lsnr application ONLINE ONLINE node1
ora.node1.gsd application ONLINE ONLINE node1
ora.node1.ons application ONLINE ONLINE node1
ora.node1.vip application ONLINE ONLINE node1
ora....SM2.asm application ONLINE ONLINE node2
ora....E2.lsnr application ONLINE ONLINE node2
ora.node2.gsd application ONLINE ONLINE node2
ora.node2.ons application ONLINE ONLINE node2
ora.node2.vip application ONLINE ONLINE node2
查看集群资源信息
[12:59:42oracle@node2 ~]srvctl config database -d dba -a
node1 null1 /u01/app/oracle/product/10.2.0/db_1
node2 null2 /u01/app/oracle/product/10.2.0/db_1
DB_NAME: dba
ORACLE_HOME: /u01/app/oracle/product/10.2.0/db_1
SPFILE: +DATA/dba/spfilenull.ora
DOMAIN: wang.com
DB_ROLE: null
START_OPTIONS: null
POLICY: AUTOMATIC
ENABLE FLAG: DB ENABLED
查看连接信息
[13:01:55oracle@node2 ~]srvctl config database -d dba -t
Example client-side TNS entry for service rac:
rac = (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=db_vip)(PORT=dedicated_port))(CONNECT_DATA=(SERVICE_NAME=rac.wang.com)(FAILOVER_MODE=(TYPE=SELECT)(METHOD=BASIC))))
Example client-side TNS entry for service name:
name = (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=db_vip)(PORT=dedicated_port))(CONNECT_DATA=(SERVICE_NAME=name.wang.com)(FAILOVER_MODE=(TYPE=SELECT)(METHOD=BASIC))))
查看服务信息
[13:02:20oracle@node2 ~]srvctl config service -d dba -a
rac PREF: null2 null1 AVAIL: TAF: basic
name PREF: null2 null1 AVAIL: TAF: basic
[13:02:45oracle@node2 ~]srvctl config service -d dba -s rac
rac PREF: null2 null1 AVAIL:
[13:03:01oracle@node2 ~]srvctl config service -d dba -s rac -a
rac PREF: null2 null1 AVAIL: TAF: basic
查看ASM信息
[13:05:41oracle@node2 ~]srvctl config asm -n node1
+ASM1 /u01/app/oracle/product/10.2.0/db_1
[13:05:44oracle@node2 ~]
[13:05:53oracle@node2 ~]srvctl config asm -n node2
+ASM2 /u01/app/oracle/product/10.2.0/db_1
[13:05:56oracle@node2 ~]
查看监听信息
[13:05:57oracle@node2 ~]srvctl config listener -n node2
node2 LISTENER_NODE2
[13:06:15oracle@node2 ~]
[13:06:16oracle@node2 ~]srvctl config listener -n node1
node1 LISTENER_NODE1
查看数据库状态
[13:08:40oracle@node2 ~]srvctl status database -d dba
Instance null1 is running on node node1
Instance null2 is running on node node2
[13:08:43oracle@node2 ~]srvctl status database -d dba -v
Instance null1 is running on node node1 with online services rac name
Instance null2 is running on node node2 with online services rac name
查看监听状态
[13:09:27oracle@node2 ~]srvctl status instance -d dba -i null1,null2
Instance null1 is running on node node1
Instance null2 is running on node node2
[13:09:40oracle@node2 ~]srvctl status instance -d dba -i null1,null2 -v
Instance null1 is running on node node1 with online services rac name
Instance null2 is running on node node2 with online services rac name
查看节点应用状态
[13:10:29oracle@node2 ~]srvctl status nodeapps -n node1
VIP is running on node: node1
GSD is running on node: node1
Listener is running on node: node1
ONS daemon is running on node: node1
[13:11:44oracle@node2 ~]srvctl status nodeapps -n node2
VIP is running on node: node2
GSD is running on node: node2
Listener is running on node: node2
ONS daemon is running on node: node2
查看节点ASM状态
[13:11:47oracle@node2 ~]srvctl status asm -n node1
ASM instance +ASM1 is running on node node1.
[13:12:26oracle@node2 ~]srvctl status asm -n node2
ASM instance +ASM2 is running on node node2.
测试TAF
设定服务TAF模式为BASIC
RAC =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = node1-vip)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = node2-vip)(PORT = 1521))
(LOAD_BALANCE = yes)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = rac.wang.com)
(FAILOVER_MODE =
(TYPE = SELECT)
(METHOD = BASIC)
(RETRIES = 180)
(DELAY = 5)
)
)
)
查看集群状态
[11:55:50oracle@node2 dbs]crs_stat -t
Name Type Target State Host
------------------------------------------------------------
ora.dba.db application ONLINE ONLINE node2
ora....name.cs application ONLINE ONLINE node2
ora....ll1.srv application ONLINE ONLINE node1
ora....ll2.srv application ONLINE ONLINE node2
ora....l1.inst application ONLINE ONLINE node1
ora....l2.inst application ONLINE ONLINE node2
ora.dba.rac.cs application ONLINE ONLINE node2
ora....ll1.srv application ONLINE ONLINE node1
ora....ll2.srv application ONLINE ONLINE node2
ora....SM1.asm application ONLINE ONLINE node1
ora....E1.lsnr application ONLINE ONLINE node1
ora.node1.gsd application ONLINE ONLINE node1
ora.node1.ons application ONLINE ONLINE node1
ora.node1.vip application ONLINE ONLINE node1
ora....SM2.asm application ONLINE ONLINE node2
ora....E2.lsnr application ONLINE ONLINE node2
ora.node2.gsd application ONLINE ONLINE node2
ora.node2.ons application ONLINE ONLINE node2
ora.node2.vip application ONLINE ONLINE node2
连接数据库进行长事务查询
[11:59:41oracle@node1 ~]sqlplus sys/oracle@rac as sysdba
SQL*Plus: Release 10.2.0.1.0 - Production on Thu May 27 11:59:56 2010
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bit Production
With the Partitioning, Real Application Clusters, OLAP and Data Mining options
SYS@NODE2:null2>show parameter service_name
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
service_names string dba.wang.com, rac, name
SYS@NODE2:null2>
SYS@NODE2:null2>show parameter db_name;
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
db_name string dba
SYS@NODE2:null2>
SYS@NODE2:null2>show parameter instance_name;
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
instance_name string null2
SYS@NODE2:null2>select * from dba_objects;
在事务执行过程中关闭当前所连接的实例
[12:00:47oracle@node2 admin]srvctl stop instance -i null2 -d dba -o abort
可观察到该长事务中断若干秒后继续查询
2005-10-22 21:50:51 2005-10-22 21:51:00 2005-10-22:21:50:51 VALID N N N
观察集群状态
[oracle@node1 ~]$ crs_stat -t
Name Type Target State Host
------------------------------------------------------------
ora.dba.db application ONLINE ONLINE node2
ora....name.cs application ONLINE ONLINE node2
ora....ll1.srv application ONLINE ONLINE node1
ora....ll2.srv application ONLINE OFFLINE
ora....l1.inst application ONLINE ONLINE node1
ora....l2.inst application OFFLINE OFFLINE
ora.dba.rac.cs application ONLINE ONLINE node2
ora....ll1.srv application ONLINE ONLINE node1
ora....ll2.srv application ONLINE OFFLINE
ora....SM1.asm application ONLINE ONLINE node1
ora....E1.lsnr application ONLINE ONLINE node1
ora.node1.gsd application ONLINE ONLINE node1
ora.node1.ons application ONLINE ONLINE node1
ora.node1.vip application ONLINE ONLINE node1
ora....SM2.asm application ONLINE ONLINE node2
ora....E2.lsnr application ONLINE ONLINE node2
ora.node2.gsd application ONLINE ONLINE node2
ora.node2.ons application ONLINE ONLINE node2
ora.node2.vip application ONLINE ONLINE node2