<!--StartFragment -->
原文链接:https://www.f2er.com/oracle/209749.html
线上sql抓取分析: 依照硬盘IO排列 SELECT*FROM(SELECTsql_ID,PARSING_USER_ID,EXECUTIONS,SORTS,COMMAND_TYPE,DISK_READSFROMV$sqlAREAWHEREPARSING_USER_ID!=0ORDERBYDISK_READSDESC)WHEREROWNUM<11 依照cpu使用排列 SELECT*FROM(SELECTsql_ID,DISK_READS,cpu_TIMEFROMV$sqlAREAWHEREPARSING_USER_ID!=0ORDERBYcpu_TIMEDESC)WHEREROWNUM<11 依照sqlID查询实际的sql SELECTsql_TEXTFROMV$sqlTEXTWHEREsql_ID='9brygt3kuuz7k'ORDERBYPIECEASC 根据SPID查询sql SELECTa.username,a.machine,a.program,a.sid,a.serial#,a.status,c.piece,c.sql_textFROMv$sessiona,v$processb,v$sqltextcWHEREb.spid='&spid'ANDb.addr=a.paddrANDa.sql_address=c.address(+)ORDERBYc.piece; 根据SPID查询连接信息 SELECTPID,SPID,USERNAME,SERIAL#,PROGRAMFROMV$PROCESSWHEREspid=