首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫

Oracle 11g RAC 管理常用命令完整指南

     編輯:Oracle 資料庫相關知識

叢集狀態檢查

使用 crsctl check cluster 可快速確認叢集核心服務是否正常運行:

[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

資料庫實例狀態查詢

查看所有實例

[grid@rac02 ~]$ srvctl status database -d racdb
Instance racdb1 is running on node rac01
Instance racdb2 is running on node rac02

查看單一實例

[grid@rac02 ~]$ srvctl status instance -d racdb -i racdb1
Instance racdb1 is running on node rac01

節點應用程式狀態

檢查 VIP、網路、GSD、ONS、eONS 等節點級資源:

[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

資料庫配置資訊

列出已配置資料庫

[grid@rac02 ~]$ srvctl config database
racdb

詳細配置參數

[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

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.

監聽器狀態與配置

[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: /u01/app/11.2.0/grid on node(s) rac02,rac01
End points: TCP:1521

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

VIP 狀態與配置

單節點 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

VIP 詳細配置

[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

節點應用程式完整配置

[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: /u01/app/11.2.0/grid on node(s) rac02,rac01
End points: TCP:1521

叢集時間同步驗證

[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.

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;

查詢資料庫檔案與 ASM 磁碟組對應

(此處原文缺失具體 SQL,建議參考 v$datafile 與 v$asm_diskgroup 聯查)

叢集啟動與停止操作

注意:以下操作需以 root 身分執行。

停止叢集

# 單節點停止
[root@rac01 ~]# /u01/app/11.2.0/grid/bin/crsctl stop cluster

# 強制停止所有資源
[root@rac01 ~]# /u01/app/11.2.0/grid/bin/crsctl stop cluster -f

# 所有節點停止
[root@rac02 ~]# /u01/app/11.2.0/grid/bin/crsctl stop cluster -all

啟動叢集

# 單節點啟動
[root@rac01 ~]# /u01/app/11.2.0/grid/bin/crsctl start cluster

# 所有節點啟動
[root@rac02 ~]# /u01/app/11.2.0/grid/bin/crsctl start cluster -all

# 指定節點啟動
[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
  1. 上一篇文章:
  2. 下一篇文章:
Copyright © 程式碼之家 All Rights Reserved