今天一应用在运行存储过程,长时间没有结束,相比正常时的运行,慢了很多,后经分析,需要调整存储过程中的相关SQL语句,不过,等更新编辑后,重新编译,等待了十分钟都没响应,hang,急需处理。
首先查看了alert日志正常,hanganalyze分析
16:47:46 SQL> oradebug setmypid
Statement processed.
16:47:50 SQL> oradebug hanganalyze 3
Hang Analysis in/oracle/admin/hsbfina/udump/hsbfina_ora_19792.trc
16:47:55 SQL> exit
查询trace文件如下:
*** SERVICE NAME:(SYS$USERS) 2014-01-2316:47:55.658
*** SESSION ID:(89.29794) 2014-01-2316:47:55.658
*** 2014-01-23 16:47:55.658
==============
HANG ANALYSIS:
==============
Open chains found:
Chain 1 :
<0/129/64355/0xc1d3528/28810/db file sequential read>
--<0/83/41350/0xc1d0588/19678/library cache pin>
Other chains found:
Chain 2 :
<0/89/29794/0xf1f4048/19792/No Wait>
16:51:05 SQL> selectspid from v$process a,v$session b where a.addr=b.paddr and b.status ='KILLED';
SPID
------------
28810
16:51:07 SQL> exit
Disconnected from Oracle Database 10gEnterprise Edition Release 10.2.0.1.0 - 64bit Production
With the Partitioning, OLAP and Data Miningoptions
rx8640_2FTP数据库:/oracle>ps -ef|grep 28810
oracle 28810 1 17 13:13:04? 85:48 oraclehsbfina (LOCAL=NO)
oracle 20266 19778 1 16:51:24pts/tf 0:00 grep 28810
查询该killed session在做update操作回滚;
select sum(bytes/1048576),status,tablespace_name from dba_undo_extents group by status, tablespace_name;
SUM(BYTES/1048576) STATUS TABLESPACE_NAME
1 1630.25 EXPIRED UNDOTBS1
2 15036.125 ACTIVE UNDOTBS1
3 20.125 UNEXPIRED UNDOTBS1
查询该update语句的相关表情况:
select * from dba_segments where segment_name='FACT_FTP_ZFJXPG'; --分区表(按天分区,近3年数据,每个几百兆到几十KB不等)
确认后系统层kill该killed进程:
rx8640_2FTP数据库:/oracle> kill -9 28810
然后,再次编译存储过程,瞬间通过,应用程序也在更新SQL后,运行速度正常。