oracle 11g RAC 常用命令整理分享

1)、检查集群状态:

  [grid@rac02 ~]$ crsctl check cluster

  crs-4537: cluster ready services is online

  crs-4529: cluster synchronization services is online

  crs-4533: event manager is online

2)、所有 oracle 实例 —(数据库状态):

  [grid@rac02 ~]$ srvctl status database -d racdb

  instance racdb1 is running on node rac01

  instance racdb2 is running on node rac02

3)、检查单个实例状态:

  [grid@rac02 ~]$ srvctl status instance -d racdb -i racdb1

  instance racdb1 is running on node rac01

4)、节点应用程序状态:

  [grid@rac02 ~]$ srvctl status nodeapps

  vip rac01-vip is enabled

  vip rac01-vip is running on node: rac01

  vip rac02-vip is enabled

  vip rac02-vip is running on node: rac02

  network is enabled

  network is running on node: rac01

  network is running on node: rac02

  gsd is disabled

  gsd is not running on node: rac01

  gsd is not running on node: rac02

  ons is enabled

  ons daemon is running on node: rac01

  ons daemon is running on node: rac02

  eons is enabled

  eons daemon is running on node: rac01

  eons daemon is running on node: rac02

5)、列出所有的配置数据库:

  [grid@rac02 ~]$ srvctl config database

  racdb

6)、数据库配置:

  [grid@rac02 ~]$ srvctl config database -d racdb -a

  database unique name: racdb

  database name: racdb

  oracle home: /u01/app/oracle/product/11.2.0/dbhome_1

  oracle user: oracle

  spfile: +racdb_data/racdb/spfileracdb.ora

  domain: xzxj.edu.cn

  start options: open

  stop options: immediate

  database role: primary

  management policy: automatic

  server pools: racdb

  database instances: racdb1,racdb2

  disk groups: racdb_data,fra

  services:

  database is enabled

  database is administrator managed

7)、asm状态以及asm配置:

  [grid@rac02 ~]$ srvctl status asm

  asm is running on rac01,rac02

  [grid@rac02 ~]$ srvctl config asm -a

  asm home: /u01/app/11.2.0/grid

  asm listener: listener

  asm is enabled.

8)、tns监听器状态以及配置:

  [grid@rac02 ~]$ srvctl status listener

  listener listener is enabled

  listener listener is running on node(s): rac01,rac02

  [grid@rac02 ~]$ srvctl config listener -a

  name: listener

  network: 1, owner: grid

  home: <crs home>

  /u01/app/11.2.0/grid on node(s) rac02,rac01

  end points: tcp:1521

9)、scan状态以及配置:

  [grid@rac02 ~]$ srvctl status scan

  scan vip scan1 is enabled

  scan vip scan1 is running on node rac02

  [grid@rac02 ~]$ srvctl config scan

  scan name: rac-scan.xzxj.edu.cn, network: 1/192.168.1.0/255.255.255.0/eth0

  scan vip name: scan1, ip: /rac-scan.xzxj.edu.cn/192.168.1.55

10)、vip各个节点的状态以及配置:

  [grid@rac02 ~]$ srvctl status vip -n rac01

  vip rac01-vip is enabled

  vip rac01-vip is running on node: rac01

  [grid@rac02 ~]$ srvctl status vip -n rac02

  vip rac02-vip is enabled

  vip rac02-vip is running on node: rac02

  [grid@rac02 ~]$ srvctl config vip -n rac01

  vip exists.:rac01

  vip exists.: /rac01-vip/192.168.1.53/255.255.255.0/eth0

  [grid@rac02 ~]$ srvctl config vip -n rac02

  vip exists.:rac02

  vip exists.: /rac02-vip/192.168.1.54/255.255.255.0/eth0

11)、节点应用程序配置 —(vip、gsd、ons、监听器)

  [grid@rac02 ~]$ srvctl config nodeapps -a -g -s -l

  -l option has been deprecated and will be ignored.

  vip exists.:rac01

  vip exists.: /rac01-vip/192.168.1.53/255.255.255.0/eth0

  vip exists.:rac02

  vip exists.: /rac02-vip/192.168.1.54/255.255.255.0/eth0

  gsd exists.

  ons daemon exists. local port 6100, remote port 6200

  name: listener

  network: 1, owner: grid

  home: <crs home>

  /u01/app/11.2.0/grid on node(s) rac02,rac01

  end points: tcp:1521

12)、验证所有集群节点间的时钟同步:

  [grid@rac02 ~]$ cluvfy comp clocksync -verbose

  verifying clock synchronization across the cluster nodes

  checking if clusterware is installed on all nodes…

  check of clusterware install passed

  checking if ctss resource is running on all nodes…

  check: ctss resource running on all nodes

  node name status

  ———————————— ————————

  rac02 passed

  result: ctss resource check passed

  querying ctss for time offset on all nodes…

  result: query of ctss for time offset passed

  check ctss state started…

  check: ctss state

  node name state

  ———————————— ————————

  rac02 active

  ctss is in active state. proceeding with check of clock time offsets on all nodes…

  reference time offset limit: 1000.0 msecs

  check: reference time offset

  node name time offset status

  ———— ———————— ————————

  rac02 0.0 passed

  time offset is within the specified limits on the following set of nodes:

  ”[rac02]”

  result: check of clock time offsets passed

  oracle cluster time synchronization services check passed

  verification of clock synchronization across the cluster nodes was successful.

13)、集群中所有正在运行的实例 — (sql):

  select inst_id , instance_number inst_no , instance_name inst_name , parallel , status ,

database_status db_status , active_state state , host_name host from gv$instance order by inst_id;

14)、所有数据库文件及它们所在的 asm 磁盘组 — (sql):

15)、asm 磁盘卷:

16)、启动和停止集群:

  以下操作需用root用户执行。

  (1)、在本地服务器上停止oracle clusterware 系统:

  [root@rac01 ~]# /u01/app/11.2.0/grid/bin/crsctl stop cluster

 
注:在运行“crsctl stop cluster”命令之后,如果 oracle clusterware 管理的

资源中有任何一个还在运行,则整个命令失败。使用 -f 选项无条件地停止所有资源并

停止 oracle clusterware 系统。

  另请注意,可通过指定 -all 选项在集群中所有服务器上停止 oracle clusterware

系统。如下所示,在rac01和rac02上停止oracle clusterware系统:

  [root@rac02 ~]# /u01/app/11.2.0/grid/bin/crsctl stop cluster –all

  在本地服务器上启动oralce clusterware系统:

  [root@rac01 ~]# /u01/app/11.2.0/grid/bin/crsctl start cluster

  注:可通过指定 -all 选项在集群中所有服务器上启动 oracle clusterware 系统。

  [root@rac02 ~]# /u01/app/11.2.0/grid/bin/crsctl start cluster –all

  还可以通过列出服务器(各服务器之间以空格分隔)在集群中一个或多个指定的

服务器上启动 oracle clusterware 系统:

  [root@rac01 ~]# /u01/app/11.2.0/grid/bin/crsctl start cluster -n rac01 rac02

  使用 srvctl 启动/停止所有实例:

  [oracle@rac01 ~]#srvctl stop database -d racdb

  [oracle@rac01 ~]#srvctl start database -d racdb

(0)
上一篇 2022年3月22日
下一篇 2022年3月22日

相关推荐