分公司的資料庫出現效能問題,幫忙協助診斷。
資料庫是Oracle10.2.0.3 Rac環境,不過現在處於單節點工作狀態。當前的問題是頁面訪問很慢,沒有其他進一步的資訊。
根據描述,登陸伺服器後首先使用top檢查了系統健全狀態,結果發現系統並不是很忙:
bash-3.00$ /usr/local/bin/top
load averages: 1.76, 1.63, 1.59; up 19+23:45:48 16:12:20
194 processes: 189 sleeping, 5 on cpu
CPU states: 78.6% idle, 17.5% user, 3.9% kernel, 0.0% iowait, 0.0% swap
Memory:32Gphys mem,8755Mfree mem,31Gswap,31Gfree swap
PID USERNAME LWP PRI NICE SIZE RES STATE TIME CPU COMMAND
1151 oracle 1 1 0 20G 20Gcpu 0:19 27.59% oracle
26096 oracle 11 32 0 20G 20Gsleep 3:07 24.00% oracle
1177 oracle 11 30 0 20G 20Gcpu 2:17 20.57% oracle
1187 oracle 11 44 0 20G 20Gcpu 2:03 18.42% oracle
25298 oracle 11 50 0 20G 20Gsleep 3:06 15.12% oracle
1557 oracle 1 52 0 20G 20Gsleep 1:57 13.64% oracle
27086 oracle 12 52 0 20G 20Gsleep 3:15 10.45% oracle
1175 oracle 1 24 0 20G 20Gsleep 0:19 6.12% oracle
1551 oracle 1 29 0 20G 20Gcpu 1:28 4.56% oracle
27076 oracle 1 100 -20 20G 20Gsleep 14:56 4.02% oracle
27080 oracle 1 100 -20 20G 20Gsleep 14:29 3.20% oracle
27090 oracle 2 59 0 20G 20Gsleep 2:48 2.49% oracle
10672 oracle 1 59 0 3800K 2536K cpu 0:00 0.41% top
27131 oracle 1 59 0 20G 20Gsleep 0:19 0.34% oracle
27123 oracle 11 59 0 20G 20Gsleep 0:59 0.32% oracle
IOWAIT為0,使用者部分只有17.5%,而IDLE達到了將近80%,這種情況應該是系統很輕閑才對。
根據判斷問題和系統壓力沒有關係,問題應該發生在資料庫層面上,而作業系統層面工作正常。
bash-3.00$ sqlplus / as sysdba
SQL*Plus: Release10.2.0.3.0 - Production on星期三9月15 16:12:28 2010
Copyright (c) 1982, 2006, Oracle. All Rights Reserved.
串連到:
Oracle Database10gEnterprise Edition Release10.2.0.3.0 - 64bit Production
With the Partitioning, Real Application Clusters, OLAP and Data Mining options
SQL> select event, count(*)
2 from v$session
3 where username != user
4 group by event
5 having count(*) > 4;
EVENT COUNT(*)
---------------------------------------------------------------- ----------
enq: TX - row lock contention 7
本欄目更多精彩內容:http://www.bianceng.cn/database/Oracle/