文章作者 100test 发表时间 2008:04:02 14:23:51
来源 100Test.Com百考试题网
系统CPU高度消耗,系统运行缓慢
OS:Sun Solaris8 Oracle:Oracle9203 |
◆首先我们通过Top命令来查看:
$ top load averages: 1.61, 1.28, 1.25 HSWAPJSDB 10:50:44 172 processes: 160 sleeping, 1 running, 3 zombie, 6 stopped, 2 on cpu CPU states: % idle, % user, % kernel, % iowait, % swap Memory: 4.0G real, 1.4G free, 1.9G swap in use, 8.9G swap free PID USERNAME THR PR NCE SIZE RES STATE TIME FLTS CPU COMMAND 20521 oracle 1 40 0 1.8G 1.7G run 6:37 0 47.77% oracle 20845 oracle 1 40 0 1.8G 1.7G cpu02 0:41 0 40.98% oracle 20847 oracle 1 58 0 1.8G 1.7G sleep 0:00 0 0.84% oracle 20780 oracle 1 48 0 1.8G 1.7G sleep 0:02 0 0.83% oracle 15828 oracle 1 58 0 1.8G 1.7G sleep 0:58 0 0.53% oracle 20867 root 1 58 0 4384K 2560K sleep 0:00 0 0.29% sshd2 20493 oracle 1 58 0 1.8G 1.7G sleep 0:03 0 0.29% oracle 20887 oracle 1 48 0 1.8G 1.7G sleep 0:00 0 0.13% oracle 20851 oracle 1 58 0 1.8G 1.7G sleep 0:00 0 0.10% oracle 20483 oracle 1 48 0 1.8G 1.7G sleep 0:00 0 0.09% oracle 20875 oracle 1 45 0 1064K 896K sleep 0:00 0 0.07% sh 20794 oracle 1 58 0 1.8G 1.7G sleep 0:00 0 0.06% oracle 20842 jiankong 1 52 2 1224K 896K sleep 0:00 0 0.05% sadc 20888 oracle 1 55 0 1712K 1272K cpu00 0:00 0 0.05% top 19954 oracle 1 58 0 1.8G 1.7G sleep 84:25 0 0.04% oracle |
注释:现在你可以发现在进程列表里,存在两个高CPU耗用的Oracle进程,他们分别消耗了47.77%和40.98%的CPU资源。
◆下一步找到存在问题的进程信息,以此确认它们是两个远程连接的用户进程。
$ ps -ef|grep 20521 oracle 20909 20875 0 10:50:53 pts/10 0:00 grep 20521 oracle 20521 1 47 10:43:59 ? 6:45 oraclejshs (LOCAL=NO) $ ps -ef|grep 20845 oracle 20845 1 44 10:50:00 ? 0:55 oraclejshs (LOCAL=NO) oracle 20918 20875 0 10:50:59 pts/10 0:00 grep 20845 |
◆下面我们再来看一下getsql.sql脚本
SELECT /* ORDERED */ sql_text FROM v$sqltext a WHERE (a.hash_value, a.address) IN ( SELECT DECODE (sql_hash_value, 0, prev_hash_value, sql_hash_value ), DECODE (sql_hash_value, 0, prev_sql_addr, sql_address) FROM v$session b WHERE b.paddr = (SELECT addr FROM v$process c WHERE c.spid = &.pid |