管理oracle 11g RAC 常用命令

531968912發表於2016-01-27
1)、檢查叢集狀態:

  [grid@rac02 ~]$ crsctl check clusterITPUB個人空間"s8{ Y(\ Y V-j
  CRS-4537: Cluster Ready Services is onlineITPUB個人空間7`${E v9xvsv
  CRS-4529: Cluster Synchronization Services is onlineITPUB個人空間&V*DMk"h h%@
  CRS-4533: Event Manager is online

2)、所有 例項 —(狀態):
M#vxUV:K-?"e-XM0  [grid@rac02 ~]$ srvctl status database -d racdbITPUB個人空間mrE hV8Q
  Instance racdb1 is running on node rac01
1FH t+TJ{L:fE0  Instance racdb2 is running on node rac02

3)、檢查單個例項狀態:ITPUB個人空間;nxDN8jyv ]
  [grid@rac02 ~]$ srvctl status instance -d racdb -i racdb1ITPUB個人空間$FY'I*e#y3G
  Instance racdb1 is running on node rac01

4)、節點應用程式狀態:ITPUB個人空間%x:yT?%Pz
  [grid@rac02 ~]$ srvctl status nodeappsITPUB個人空間5w!t k%rWz z
  VIP rac01-vip is enabled
!] v$vNCf5VE"MlX0  VIP rac01-vip is running on node: rac01ITPUB個人空間`!FmF VP#`Dy Xj0{
  VIP rac02-vip is enabled
A ~8R&m%NJS;N0  VIP rac02-vip is running on node: rac02ITPUB個人空間Nb4i ng']
  Network is enabledITPUB個人空間B8j:@bf4n1{
  Network is running on node: rac01ITPUB個人空間C~Jw8RG-]8T
  Network is running on node: rac02
Dq9D,r/ov2O*d2oo c,s0  GSD is disabled
)~m~7h:wt T&^0  GSD is not running on node: rac01
v~;h2]*WES0  GSD is not running on node: rac02
s*nJ_#e2i$x0  ONS is enabled
&[1bS{ w#u(Z0  ONS daemon is running on node: rac01ITPUB個人空間-K2V k7y;V&oN&?
  ONS daemon is running on node: rac02ITPUB個人空間iw7}5o[D*Nvg%|q
  eONS is enabledITPUB個人空間 g9N:ZK2yN
  eONS daemon is running on node: rac01
7RDDxDK-d0  eONS daemon is running on node: rac02

5)、列出所有的配置資料庫:ITPUB個人空間o+z3v-G(]~*l
  [grid@rac02 ~]$ srvctl config database
O2h zEJ^0  racdb

6)、資料庫配置:
+C5x.y+L#T(g| s {`8|0G0  [grid@rac02 ~]$ srvctl config database -d racdb -a
p f.eC8{2h0  Database unique name: racdbITPUB個人空間2i+K#l6d#BXI7p?
  Database name: racdb
(D4Z^.si'F0  Oracle home: /u01/app/oracle/product/11.2.0/dbhome_1
v{zi\ ^)Ur0  Oracle user: oracleITPUB個人空間6A2zf \Cv9K'g
  Spfile: +RACDB_DATA/racdb/spfileracdb.oraITPUB個人空間LEI/d B6k/lu3LV
  Domain: xzxj.edu.cnITPUB個人空間n#Wd{} n/gi u Q
  Start options: open
/C^/}Im8gv;zH0  Stop options: immediateITPUB個人空間*byT?7T,\B'g
  Database role: PRIMARY
])w]!f*^{0  Management policy: AUTOMATICITPUB個人空間)G`p;pR
   pools: racdb
A+L],s%J0  Database instances: racdb1,racdb2ITPUB個人空間(`X.Pc m%sW){ TP
  Disk Groups: RACDB_DATA,FRAITPUB個人空間'p^&QM,^D8T
  Services:ITPUB個人空間KR;kt(?5`*A
  Database is enabledITPUB個人空間eb*z5dJ,@(u
  Database is administrator managed

7)、ASM狀態以及ASM配置:

  [grid@rac02 ~]$ srvctl status asmITPUB個人空間f K_ |+p)X#dJ:{U
  ASM is running on rac01,rac02ITPUB個人空間S!M7DNjhh0x{h!oS
  [grid@rac02 ~]$ srvctl config asm -aITPUB個人空間8i GO%]#DJ0X*ll6_
  ASM home: /u01/app/11.2.0/gridITPUB個人空間_4U8MQL] p.{G'Aq
  ASM listener: LISTENER
In f~b@ ga1]{0  ASM is enabled.

8)、TNS監聽器狀態以及配置:
NF9sw fE*b0  [grid@rac02 ~]$ srvctl status listener
Z@*}.U~-qE0  Listener LISTENER is enabled
6a,`}$l{ K T0  Listener LISTENER is running on node(s): rac01,rac02
` @;Uey0  [grid@rac02 ~]$ srvctl config listener -aITPUB個人空間3@rh]i1cE
  Name: LISTENER
3Q@r3`uyd0  Network: 1, Owner: gridITPUB個人空間4fE*az4A/u#`|
  Home: <CRS home>
@+ez%ESB3p0  /u01/app/11.2.0/grid on node(s) rac02,rac01
v$MP;S%RN*D$Y0  End points: TCP:1521

9)、SCAN狀態以及配置:
Qce4{ u0  [grid@rac02 ~]$ srvctl status scanITPUB個人空間Y-TN!|$T;oYIv
  SCAN VIP scan1 is enabled
V5G'V5[*\q[0  SCAN VIP scan1 is running on node rac02
/Np8Lsi~%w0  [grid@rac02 ~]$ srvctl config scanITPUB個人空間oT4S#p0pj$nM*\$x
  SCAN name: rac-scan.xzxj.edu.cn, Network: 1/192.168.1.0/255.255.255.0/eth0
-sA{bZ.U3U4yg0  SCAN VIP name: scan1, IP: /rac-scan.xzxj.edu.cn/192.168.1.55

10)、VIP各個節點的狀態以及配置:ITPUB個人空間 G1oeQd
  [grid@rac02 ~]$ srvctl status vip -n rac01
XlP;nf+P%IZ;O0  VIP rac01-vip is enabled
.j:BB5bL0  VIP rac01-vip is running on node: rac01ITPUB個人空間!w kl"HG+z
  [grid@rac02 ~]$ srvctl status vip -n rac02
)QD*Pu9T9jz*m0  VIP rac02-vip is enabled
n g,B.k,F0  VIP rac02-vip is running on node: rac02ITPUB個人空間+z2r&@R*oU
  [grid@rac02 ~]$ srvctl config vip -n rac01ITPUB個人空間%{$E-u n2U8F3N4y
  VIP exists.:rac01
`Yt"l/M1K8l$p0  VIP exists.: /rac01-vip/192.168.1.53/255.255.255.0/eth0
/S7l6]'bi`(nD*s!^(X0  [grid@rac02 ~]$ srvctl config vip -n rac02
3v U#T"sn(b1N0  VIP exists.:rac02
M/olA*Y%v3{AY%Zn)t0  VIP exists.: /rac02-vip/192.168.1.54/255.255.255.0/eth0

ITPUB個人空間W|8Y1QJ~fO~4U
11)、節點應用程式配置 —(VIP、GSD、ONS、監聽器)

  [grid@rac02 ~]$ srvctl config nodeapps -a -g -s -lITPUB個人空間$bPg's&z6|
  -l option has been deprecated and will be ignored.
!i;x+V&WG;k0  VIP exists.:rac01ITPUB個人空間r!ioNr,Li^(O
  VIP exists.: /rac01-vip/192.168.1.53/255.255.255.0/eth0ITPUB個人空間(E8W0^d,T!o!Mu n
  VIP exists.:rac02
6C+T.X,jY0  VIP exists.: /rac02-vip/192.168.1.54/255.255.255.0/eth0
vG8x:[(DTA0  GSD exists.
"Pw/h1]S@;^kX}0  ONS daemon exists. Local port 6100, remote port 6200ITPUB個人空間)])z1d"G W
  Name: LISTENER
*\F#h'h k#k0  Network: 1, Owner: grid
2Fr#NE/Q5dRed^0  Home: <CRS home>
z%?.Tt[0  /u01/app/11.2.0/grid on node(s) rac02,rac01ITPUB個人空間j1S(\Nz,Jy
  End points: TCP:1521

12)、驗證所有叢集節點間的時鐘同步:
Qw`m$YQg*~4r0  [grid@rac02 ~]$ cluvfy comp clocksync -verbose
B6] yw,gG6x!i0  Verifying Clock Synchronization across the cluster nodes
7CJ&CPvZ5Tl X0  Checking if Clusterware is installed on all nodes...
Qbv+DF*m0  Check of Clusterware install passedITPUB個人空間#fQ;A8E#lsv
  Checking if CTSS Resource is running on all nodes...
U*B7}_{_0w4R{8C0  Check: CTSS Resource running on all nodesITPUB個人空間n_6s|2u@-M7I'D
  Node Name StatusITPUB個人空間 GM;}8TOC}8O
  ------------------------------------ ------------------------
:B`?i@HtZ4US0  rac02 passedITPUB個人空間U9j.utE3V
  Result: CTSS resource check passed
?1t+HD9F*_0  Querying CTSS for time offset on all nodes...
ODC%Nj|S0  Result: Query of CTSS for time offset passed
(]\#d3RP'HD0Wr0  Check CTSS state started...
n|y'Yd*~i,r;A0  Check: CTSS state
IDsB,j)z#a5l(n*l0  Node Name StateITPUB個人空間!n@8M-H0TM| o
  ------------------------------------ ------------------------ITPUB個人空間-{L'YXy
  rac02 Active
*iPq"x-w/D6g\#z| [0  CTSS is in Active state. Proceeding with check of clock time offsets on all nodes...ITPUB個人空間xmA9Mbd1G[2~0q%]0bY
  Reference Time Offset Limit: 1000.0 msecs
7@wPZQb#P0  Check: Reference Time OffsetITPUB個人空間{~\OEe
  Node Name Time Offset Status
] }R5`F0  ------------ ------------------------ ------------------------
O6u6Wa{ItYh0  rac02 0.0 passed
2[eA0U(yBm0  Time offset is within the specified limits on the following set of nodes:
M"}\nb2pL3e!Eg0  "[rac02]"ITPUB個人空間P1Vt*O$C6H-r
  Result: Check of clock time offsets passedITPUB個人空間o/sj"U7\(R@6KR
  Oracle Cluster Time Synchronization Services check passed
kBKc [gV1dF0  Verification of Clock Synchronization across the cluster nodes was successful.

13)、叢集中所有正在執行的例項 — ():

  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使用者執行。ITPUB個人空間7fR[7r$gp+y@5{
  (1)、在本地上停止Oracle Clusterware 系統:ITPUB個人空間bL/\ {o6fc
  [root@rac01 ~]# /u01/app/11.2.0/grid/bin/crsctl stop cluster


]7`ye'W m'r(f0 注:在執行“crsctl stop cluster”命令之後,如果 Oracle Clusterware 的ITPUB個人空間(M2~V _w
資源中有任何一個還在執行,則整個命令失敗。使用 -f 選項無條件地停止所有資源並
Z Q9wngZlJR0停止 Oracle Clusterware 系統。

  另請注意,可透過指定 -all 選項在叢集中所有伺服器上停止 Oracle ClusterwareITPUB個人空間%]%w]e c7a(q
系統。如下所示,在rac01和rac02上停止oracle clusterware系統:ITPUB個人空間6Yzq1F @!s&S'l6`b3^'H
  [root@rac02 ~]# /u01/app/11.2.0/grid/bin/crsctl stop cluster –all

  在本地伺服器上啟動oralce clusterware系統:ITPUB個人空間'}6}f1e5Vp@%kz(Y;~
  [root@rac01 ~]# /u01/app/11.2.0/grid/bin/crsctl start cluster

  注:可透過指定 -all 選項在叢集中所有伺服器上啟動 Oracle Clusterware 系統。
qisG#oq{*FQeu{0  [root@rac02 ~]# /u01/app/11.2.0/grid/bin/crsctl start cluster –all
`B*Z8S\T*EoD$|0  還可以透過列出伺服器(各伺服器之間以空格分隔)在叢集中一個或多個指定的
$e"|n@!yWsl.KFu]"K0 伺服器上啟動 Oracle Clusterware 系統:ITPUB個人空間I+~Jor
  [root@rac01 ~]# /u01/app/11.2.0/grid/bin/crsctl start cluster -n rac01 rac02

  使用 SRVCTL 啟動/停止所有例項:
!_:z;f#eRn)ng0  [oracle@rac01 ~]#srvctl stop database -d racdb
t4mu \4]0`/~0  [oracle@rac01 ~]#srvctl start database -d racdb


來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/25462274/viewspace-1983152/,如需轉載,請註明出處,否則將追究法律責任。

相關文章