Oracle 單個表查詢速度極慢處理過程
Oracle 單個表查詢速度極慢處理過程
現象: 今天,接到開發人員報有一個表查詢了半天也沒出結果,表裡大概有幾十條資料
配置: Oracle 10G RAC 、Aix Unix作業系統
處理過程:
我的第一反應資料庫問題不大,因為只有這張表查詢慢,而資料庫裡其它表資料的查詢速度正常,但是按照流程還是先檢視了alert日誌,看了看臨時表空間和系統表空間狀況,結果兩個節點都很正常沒有問題;
然後我就懷疑可能是表鎖的問題
select sid,seq#,event from v$session_wait
SID SEQ# EVENT
729 30819 cursor: pin S wait on X
730 55091 cursor: pin S wait on X
731 64627 cursor: pin S wait on X
733 13616 cursor: pin S wait on X
734 3754 cursor: pin S wait on X
735 49828 cursor: pin S wait on X
736 39022 cursor: pin S wait on X
737 44358 cursor: pin S wait on X
738 17548 cursor: pin S wait on X
739 54959 cursor: pin S wait on X
740 26186 cursor: pin S wait on X
741 4140 cursor: pin S wait on X
743 5668 cursor: pin S wait on X
747 54012 cursor: pin S wait on X
730 55091 cursor: pin S wait on X
731 64627 cursor: pin S wait on X
733 13616 cursor: pin S wait on X
734 3754 cursor: pin S wait on X
735 49828 cursor: pin S wait on X
736 39022 cursor: pin S wait on X
737 44358 cursor: pin S wait on X
738 17548 cursor: pin S wait on X
739 54959 cursor: pin S wait on X
740 26186 cursor: pin S wait on X
741 4140 cursor: pin S wait on X
743 5668 cursor: pin S wait on X
747 54012 cursor: pin S wait on X
看到了很多 cursor: pin S wait on X 事件
然後根據這些SID找到SESSION
select * from v$session where sid in(
'908','923','949','984','1034','1012','1015',
'1049','969','936','950','902','954','905',
'908','923','949','984','1034','1012','1015',
'1049','969','936','950','902','954','905',
'924','929','1018','967','993','920','945','1048')
把這些session殺掉
alter system kill session '902,44335';
alter system kill session '905,45229';
alter system kill session '908,5869';
alter system kill session '920,17125';
alter system kill session '923,43172';
alter system kill session '924,614';
alter system kill session '929,669';
alter system kill session '936,1092';
alter system kill session '945,48687';
alter system kill session '949,61466';
alter system kill session '950,50965';
alter system kill session '954,24688';
alter system kill session '967,61065';
alter system kill session '969,63579';
alter system kill session '984,57651';
alter system kill session '993,65365';
alter system kill session '1012,47090';
alter system kill session '1015,59755';
alter system kill session '1018,52751';
alter system kill session '1034,36331';
alter system kill session '1048,13283';
alter system kill session '1049,58233';
alter system kill session '905,45229';
alter system kill session '908,5869';
alter system kill session '920,17125';
alter system kill session '923,43172';
alter system kill session '924,614';
alter system kill session '929,669';
alter system kill session '936,1092';
alter system kill session '945,48687';
alter system kill session '949,61466';
alter system kill session '950,50965';
alter system kill session '954,24688';
alter system kill session '967,61065';
alter system kill session '969,63579';
alter system kill session '984,57651';
alter system kill session '993,65365';
alter system kill session '1012,47090';
alter system kill session '1015,59755';
alter system kill session '1018,52751';
alter system kill session '1034,36331';
alter system kill session '1048,13283';
alter system kill session '1049,58233';
但是結果並不理想,執行上面語句後去查詢表依然還是長時間不能出來結果,
且在v$session裡查這些session都標記為killed了,然後就想到了到作業系統
級別將這些session程式佔用的資源徹底的給釋放掉,如下
# kill -9 700924
# kill -9 835748
# kill -9 798908
# kill -9 696720
# kill -9 635236
# kill -9 872802
# kill -9 856554
# kill -9 679966
# kill -9 786648
# kill -9 676248
# kill -9 774198
# kill -9 782442
# kill -9 319908
# kill -9 778586
# kill -9 794812
# kill -9 331788
# kill -9 676090
# kill -9 123228
# kill -9 893198
# kill -9 585828
# kill -9 340378
# kill -9 565494
#
# kill -9 835748
# kill -9 798908
# kill -9 696720
# kill -9 635236
# kill -9 872802
# kill -9 856554
# kill -9 679966
# kill -9 786648
# kill -9 676248
# kill -9 774198
# kill -9 782442
# kill -9 319908
# kill -9 778586
# kill -9 794812
# kill -9 331788
# kill -9 676090
# kill -9 123228
# kill -9 893198
# kill -9 585828
# kill -9 340378
# kill -9 565494
#
經kill -9 以後,再去查詢表,結果很快就出來了
現已證實,是此表被鎖住的原因,已經讓開發去查表設計和使用問題了
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/16400082/viewspace-708841/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- ORACLE 查詢語句處理過程(Oracle
- 一個慢查詢報警的簡單處理
- 表空間使用情況查詢慢的處理
- Oracle臨時表 優化查詢速度Oracle優化
- 資料庫變慢的處理過程資料庫
- oracle 死鎖查詢處理Oracle
- Oracle臨時表最佳化查詢速度Oracle
- Oracle臨時表 最佳化查詢速度Oracle
- oracle處理SQL的過程OracleSQL
- Oracle死鎖查詢及處理Oracle
- 請教一個jsp查詢速度慢的問題。JS
- Oracle一個SQL語句的處理過程(轉)OracleSQL
- 一個20秒SQL慢查詢優化的經歷與處理方案SQL優化
- DELETE TABLE資料後,查詢變慢,問題處理delete
- 找出Mysql查詢速度慢的SQL語句MySql
- Oracle一次縮小表空間的處理過程Oracle
- 表死鎖查詢及處理辦法
- oracle 跨庫查詢greenplum慢Oracle
- Oracle釋出一個SQL語句的處理過程OracleSQL
- 分割槽表truncate慢處理
- oracle儲存過程中單引號及字串拼接處理Oracle儲存過程字串
- 單表查詢
- oracle 剩餘表空間查詢慢,解決辦法Oracle
- Oracle日常問題-臨時表過多導致exp速度慢Oracle
- SQL Server查詢速度慢原因及優化方法SQLServer優化
- 慢查詢
- MySQL Case-information_schema檢視查詢慢處理一例MySqlORM
- oracle taf unknown 問題處理過程Oracle
- sql查詢過程表述SQL
- MySQL單表查詢MySql
- MySQL 單表查詢MySql
- WSL2檔案系統處理速度較慢
- undo表空間損壞的處理過程
- OpenCV4影像處理--影像查詢表和顏色表OpenCV
- 分分鐘解決MySQL查詢速度慢與效能差MySql
- SQL Server查詢速度慢的原因及優化方法SQLServer優化
- dba_free_space查詢速度慢問題解決
- Oracle 高水位查詢和處理方法彙總Oracle