Oracle Clusterware的命令集可以分为以下4种:
- 节点层:osnodes
- 网络层:oifcfg
- 集群层:crsctl, ocrcheck,ocrdump,ocrconfig
- 应用层:srvctl,onsctl,crs_stat
节点层:
管理节点层的命令为:olsnode。
[oracle@node1 bin]$ ./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 [oracle@node1 bin]$
-n显示每个节点编号
-p显示每个节点用于private interconnect网卡名称
-i显示每个node vip
-g:打印日志信息
-v:打印详细信息
使用示例:
显示每个节点的ID: [oracle@node1 bin]$ ./olsnodes -n node1 1 node2 2 [oracle@node1 bin]$ 显示用于private interconnect网卡名称: [oracle@node1 bin]$ ./olsnodes -n -p node1 1 rac1-priv node2 2 rac2-priv [oracle@node1 bin]$ 显示每个节点的vip: [oracle@node1 bin]$ ./olsnodes -n -p -i node1 1 rac1-priv rac1-vip node2 2 rac2-priv rac2-vip [oracle@node1 bin]$
网络层:
网络层由各个节点的网络组件组成,包括2个物理网卡和3个IP 地址。对这一层管理时用到的命令是:oifcfg。此命令用来定义和修改Oracle集群需要的网卡属性,这些属性包括网卡的网段地址,子网掩码,接口类型等。 要想正确的使用这个命令,必须先知道Oracle是如何定义网络接口的,Oracle的每个网络接口包括名称,网段地址,接口类型3个属性。
oifcfg 命令的格式:interface_name/subnet:interface_type
这些属性中没有IP地址,但接口类型有两种,public和private,前者说明接口用于外部通信,用于Oracle Net和VIP 地址,而后者说明接口用于私有网络。
接口的配置方式分为两类:global 和node-specific。 前者说明集群所有节点的配置信息相同,也就是说所有节点的配置是对称的;而后者意味着这个节点的配置和其他节点配置不同,是非对称的。
oifcfg命令有以下4个子命令,每个命令可以有不同参数:
- Iflist:显示网口列表
- Getif: 获得单个网口信息
- Setif:配置单个网口
- Delif:删除网口
1 [oracle@node1 bin]$ ./oifcfg -help 2 3 Name: 4 oifcfg - Oracle Interface Configuration Tool. 5 6 Usage: oifcfg iflist [-p [-n]] 7 oifcfg setif {-node <nodename> | -global} {<if_name>/<subnet>:<if_type>}... 8 oifcfg getif [-node <nodename> | -global] [ -if <if_name>[/<subnet>] [-type <if_type>] ] 9 oifcfg delif [-node <nodename> | -global] [<if_name>[/<subnet>]] 10 oifcfg [-help] 11 12 <nodename> - name of the host, as known to a communications network 13 <if_name> - name by which the interface is configured in the system 14 <subnet> - subnet address of the interface 15 <if_type> - type of the interface { cluster_interconnect | public | storage }
使用示例:
显示网口列表: [oracle@node1 bin]$ ./oifcfg iflist eth0 192.168.2.0 eth1 10.0.0.0 获得网口信息(名称,网段地址,接口类型3个属性): [oracle@node1 bin]$ ./oifcfg getif eth0 192.168.2.0 global public eth1 10.0.0.0 global cluster_interconnect 注:eth0接口的网段地址是192.168.2.0,网卡类型是public,也就是用于oracle net和vip;配置类型global说明所有节点的eth0网卡都属于192.168.2.0网段并都是public类型。 查看public 类型的网卡: [oracle@node1 bin]$ ./oifcfg getif -type public eth0 192.168.2.0 global public 查看cluster_interconnect 类型的网卡: [oracle@node1 bin]$ ./oifcfg getif -type cluster_interconnect eth1 10.0.0.0 global cluster_interconnect 添加接口配置 [root@raw1 bin]# ./oifcfg setif -global eth0/192.168.1.119:public [root@raw1 bin]# ./oifcfg setif -global eth1/10.85.10.119:cluster_interconnect 删除接口配置 [root@raw1 bin]# ./oifcfg delif -global
--整理自《大话 oracle rac》