linux
分类: Oracle
2015-04-16 11:11:46
1.检查系统 top命令显示系统 load averages: 99.90, 117.54, 125.71
观察cpu使用率不高。 iowait 高!
2.检查进程数量
ps -ef|grep oracle|wc -l 显示进程数量大概在150左右
3.检查数据库
查询v$session_wait获取各进程等待事件
SQL> select sid,event,p1,p1text from v$session_wait;
SID EVENT P1 P1TEXT
----- --------------------------------------------------
124 latch free 1.6144E+10 address
1 pmon timer 300 duration
2 rdbms ipc message 300 timeout
3 rdbms ipc message 300 timeout
11 rdbms ipc message 30000 timeout
6 rdbms ipc message 180000 timeout
4 rdbms ipc message 300 timeout
134 rdbms ipc message 6000 timeout
147 rdbms ipc message 6000 timeout
275 rdbms ipc message 17995 timeout
274 rdbms ipc message 6000 timeout
SQL> select event,count(*) from v$session_event group by event order by count(*) desc ;
SQL*Net message from client 156
SQL*Net message to client 156
db file sequential read 250
latch free
49
1log file sync
30
db file scattered read 25
buffer busy waits 23
log file switch completion 17
SQL*Net more data to client 16
发现数据库系统有 大量 sequential read 事件。
select sid,event from v$session_wait where event in ('file sequential read ')
得到等待事件的 id
然后通过id 获得sql 语句。
SELECT sql_text FROM v$sqltext a WHERE a.hash_value = (SELECT sql_hash_value
FROM v$session b WHERE b.SID = '&sid') ORDER BY piece ASC
使用该应用用户连接,检查该语句的执行计划:
SQL> set autotrace trace explain
检查表的索引:
SQL> select index_name,column_name from user_ind_columns where table_name ='HS_INFO';
检查该表,存在以下索引:
SQL> select index_name,index_type from user_indexes where table_name='HS_INFO'; |
检查索引键值:
SQL> select index_name,column_name from user_ind_columns where table_name ='HS_INFO';
决定创建新的索引以消除全表扫描
SQL> create index hs_info_NUMCATALOGGUID on hs_info(NUMCATALOGGUID); Index created.