oracle 11g RAC 常用命令整理分享
更新時(shí)間:2012年11月15日 16:27:45 作者:
很多朋友會(huì)經(jīng)常用到oracle 11g RAC的命令,今天我也用到了,同時(shí)也整理了一些常用的命令,以備不時(shí)之需
1)、檢查集群狀態(tài):
[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 實(shí)例 —(數(shù)據(jù)庫(kù)狀態(tài)):
[grid@rac02 ~]$ srvctl status database -d racdb
Instance racdb1 is running on node rac01
Instance racdb2 is running on node rac02
3)、檢查單個(gè)實(shí)例狀態(tài):
[grid@rac02 ~]$ srvctl status instance -d racdb -i racdb1
Instance racdb1 is running on node rac01
4)、節(jié)點(diǎn)應(yīng)用程序狀態(tài):
[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)、列出所有的配置數(shù)據(jù)庫(kù):
[grid@rac02 ~]$ srvctl config database
racdb
6)、數(shù)據(jù)庫(kù)配置:
[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狀態(tài)以及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監(jiān)聽(tīng)器狀態(tài)以及配置:
[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狀態(tài)以及配置:
[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各個(gè)節(jié)點(diǎn)的狀態(tài)以及配置:
[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)、節(jié)點(diǎn)應(yīng)用程序配置 —(VIP、GSD、ONS、監(jiān)聽(tīng)器)
[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)、驗(yàn)證所有集群節(jié)點(diǎn)間的時(shí)鐘同步:
[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)、集群中所有正在運(yùn)行的實(shí)例 — (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)、所有數(shù)據(jù)庫(kù)文件及它們所在的 ASM 磁盤(pán)組 — (SQL):
15)、ASM 磁盤(pán)卷:
16)、啟動(dòng)和停止集群:
以下操作需用root用戶執(zhí)行。
(1)、在本地服務(wù)器上停止Oracle Clusterware 系統(tǒng):
[root@rac01 ~]# /u01/app/11.2.0/grid/bin/crsctl stop cluster
注:在運(yùn)行“crsctl stop cluster”命令之后,如果 Oracle Clusterware 管理的
資源中有任何一個(gè)還在運(yùn)行,則整個(gè)命令失敗。使用 -f 選項(xiàng)無(wú)條件地停止所有資源并
停止 Oracle Clusterware 系統(tǒng)。
另請(qǐng)注意,可通過(guò)指定 -all 選項(xiàng)在集群中所有服務(wù)器上停止 Oracle Clusterware
系統(tǒng)。如下所示,在rac01和rac02上停止oracle clusterware系統(tǒng):
[root@rac02 ~]# /u01/app/11.2.0/grid/bin/crsctl stop cluster –all
在本地服務(wù)器上啟動(dòng)oralce clusterware系統(tǒng):
[root@rac01 ~]# /u01/app/11.2.0/grid/bin/crsctl start cluster
注:可通過(guò)指定 -all 選項(xiàng)在集群中所有服務(wù)器上啟動(dòng) Oracle Clusterware 系統(tǒng)。
[root@rac02 ~]# /u01/app/11.2.0/grid/bin/crsctl start cluster –all
還可以通過(guò)列出服務(wù)器(各服務(wù)器之間以空格分隔)在集群中一個(gè)或多個(gè)指定的
服務(wù)器上啟動(dòng) Oracle Clusterware 系統(tǒng):
[root@rac01 ~]# /u01/app/11.2.0/grid/bin/crsctl start cluster -n rac01 rac02
使用 SRVCTL 啟動(dòng)/停止所有實(shí)例:
[oracle@rac01 ~]#srvctl stop database -d racdb
[oracle@rac01 ~]#srvctl start database -d racdb
[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 實(shí)例 —(數(shù)據(jù)庫(kù)狀態(tài)):
[grid@rac02 ~]$ srvctl status database -d racdb
Instance racdb1 is running on node rac01
Instance racdb2 is running on node rac02
3)、檢查單個(gè)實(shí)例狀態(tài):
[grid@rac02 ~]$ srvctl status instance -d racdb -i racdb1
Instance racdb1 is running on node rac01
4)、節(jié)點(diǎn)應(yīng)用程序狀態(tài):
[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)、列出所有的配置數(shù)據(jù)庫(kù):
[grid@rac02 ~]$ srvctl config database
racdb
6)、數(shù)據(jù)庫(kù)配置:
[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狀態(tài)以及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監(jiān)聽(tīng)器狀態(tài)以及配置:
[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狀態(tài)以及配置:
[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各個(gè)節(jié)點(diǎn)的狀態(tài)以及配置:
[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)、節(jié)點(diǎn)應(yīng)用程序配置 —(VIP、GSD、ONS、監(jiān)聽(tīng)器)
[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)、驗(yàn)證所有集群節(jié)點(diǎn)間的時(shí)鐘同步:
[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)、集群中所有正在運(yùn)行的實(shí)例 — (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)、所有數(shù)據(jù)庫(kù)文件及它們所在的 ASM 磁盤(pán)組 — (SQL):
15)、ASM 磁盤(pán)卷:
16)、啟動(dòng)和停止集群:
以下操作需用root用戶執(zhí)行。
(1)、在本地服務(wù)器上停止Oracle Clusterware 系統(tǒng):
[root@rac01 ~]# /u01/app/11.2.0/grid/bin/crsctl stop cluster
注:在運(yùn)行“crsctl stop cluster”命令之后,如果 Oracle Clusterware 管理的
資源中有任何一個(gè)還在運(yùn)行,則整個(gè)命令失敗。使用 -f 選項(xiàng)無(wú)條件地停止所有資源并
停止 Oracle Clusterware 系統(tǒng)。
另請(qǐng)注意,可通過(guò)指定 -all 選項(xiàng)在集群中所有服務(wù)器上停止 Oracle Clusterware
系統(tǒng)。如下所示,在rac01和rac02上停止oracle clusterware系統(tǒng):
[root@rac02 ~]# /u01/app/11.2.0/grid/bin/crsctl stop cluster –all
在本地服務(wù)器上啟動(dòng)oralce clusterware系統(tǒng):
[root@rac01 ~]# /u01/app/11.2.0/grid/bin/crsctl start cluster
注:可通過(guò)指定 -all 選項(xiàng)在集群中所有服務(wù)器上啟動(dòng) Oracle Clusterware 系統(tǒng)。
[root@rac02 ~]# /u01/app/11.2.0/grid/bin/crsctl start cluster –all
還可以通過(guò)列出服務(wù)器(各服務(wù)器之間以空格分隔)在集群中一個(gè)或多個(gè)指定的
服務(wù)器上啟動(dòng) Oracle Clusterware 系統(tǒng):
[root@rac01 ~]# /u01/app/11.2.0/grid/bin/crsctl start cluster -n rac01 rac02
使用 SRVCTL 啟動(dòng)/停止所有實(shí)例:
[oracle@rac01 ~]#srvctl stop database -d racdb
[oracle@rac01 ~]#srvctl start database -d racdb
相關(guān)文章
Maven中央倉(cāng)庫(kù)正式成為Oracle官方JDBC驅(qū)動(dòng)程序組件分發(fā)中心(推薦)
這篇文章主要介紹了Maven中央倉(cāng)庫(kù)正式成為Oracle官方JDBC驅(qū)動(dòng)程序組件分發(fā)中心,本文給大家介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友可以參考下2020-07-07
Oracle數(shù)據(jù)庫(kù)集復(fù)制方法淺議
Oracle數(shù)據(jù)庫(kù)集復(fù)制方法淺議...2007-03-03
Oracle數(shù)據(jù)庫(kù)創(chuàng)建dblink的過(guò)程及其用法實(shí)例詳解
這篇文章主要給大家介紹了Oracle數(shù)據(jù)庫(kù)創(chuàng)建dblink的過(guò)程及其用法的相關(guān)資料,dblink是Oracle數(shù)據(jù)庫(kù)中用于連接不同數(shù)據(jù)庫(kù)實(shí)例的機(jī)制,允許用戶在一個(gè)數(shù)據(jù)庫(kù)實(shí)例中直接查詢或操作另一個(gè)數(shù)據(jù)庫(kù)實(shí)例中的數(shù)據(jù),需要的朋友可以參考下2024-12-12
Oracle數(shù)據(jù)庫(kù)常見(jiàn)字段類型大全以及超詳細(xì)解析
在Oracle數(shù)據(jù)庫(kù)中查詢特定表的字段個(gè)數(shù)通常需要使用SQL語(yǔ)句來(lái)完成,這篇文章主要介紹了Oracle數(shù)據(jù)庫(kù)常見(jiàn)字段類型大全以及超詳細(xì)解析,文中通過(guò)代碼介紹的非常詳細(xì),需要的朋友可以參考下2025-04-04
Oracle配置dblink訪問(wèn)PostgreSQL的操作方法
本文給大家介紹下Oracle配置dblink訪問(wèn)PostgreSQL的操作方法,通過(guò)dblink訪問(wèn)PostgreSQL的詳細(xì)過(guò)程,對(duì)Oracle?dblink訪問(wèn)PostgreSQL相關(guān)知識(shí)感興趣的朋友一起看看吧2022-03-03
Oracle?數(shù)據(jù)庫(kù)層級(jí)遍歷查詢功能的實(shí)現(xiàn)
這篇文章主要介紹了Oracle?數(shù)據(jù)庫(kù)層級(jí)遍歷查詢,本文給大家介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友可以參考下2022-07-07
Oracle解決ORA-01034:?ORACLE?not?available問(wèn)題的辦法
這篇文章主要給大家介紹了關(guān)于Oracle解決ORA-01034:?ORACLE?not?available問(wèn)題的辦法,今天連接oracle出現(xiàn)如下錯(cuò)誤,在網(wǎng)查了相關(guān)資料說(shuō)出現(xiàn)ora-01034錯(cuò)誤的原因是因?yàn)閿?shù)據(jù)庫(kù)的控制文件沒(méi)有加在startup mount后,需要的朋友可以參考下2024-02-02

