oracle中查找執(zhí)行效率低下的SQL_第1頁
oracle中查找執(zhí)行效率低下的SQL_第2頁
oracle中查找執(zhí)行效率低下的SQL_第3頁
oracle中查找執(zhí)行效率低下的SQL_第4頁
oracle中查找執(zhí)行效率低下的SQL_第5頁
全文預覽已結束

下載本文檔

版權說明:本文檔由用戶提供并上傳,收益歸屬內容提供方,若內容存在侵權,請進行舉報或認領

文檔簡介

1、.:.;oracle中查找執(zhí)行效率低下的SQLv$sqltext:存儲的是完好的SQL,SQL被分割v$sqlarea:存儲的SQL 和一些相關的信息,比如累計的執(zhí)行次數,邏輯讀,物理讀等統(tǒng)計信息統(tǒng)計v$sql:內存共享SQL區(qū)域中曾經解析的SQL語句。即時根據sid查找完好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 ascselect a.CPU_TIME,-CPU時間

2、 百萬分之一微秒 a.OPTIMIZER_MODE,-優(yōu)化方式 a.EXECUTIONS,-執(zhí)行次數 a.DISK_READS,-讀盤次數 a.SHARABLE_MEM,-占用shared pool的內存多少 a.BUFFER_GETS,-讀取緩沖區(qū)的次數 aMAND_TYPE,-命令類型(3:select,2:insert;6:update;7delete;47:pl/sql程序單元) a.SQL_TEXT,-Sql語句 a.SHARABLE_MEM, a.PERSISTENT_MEM, a.RUNTIME_MEM, a.PARSE_CALLS, a.DISK_READS, a.DIRECT

3、_WRITES, a.CONCURRENCY_WAIT_TIME, a.USER_IO_WAIT_TIME from SYS.V_$SQLAREA aWHERE PARSING_SCHEMA_NAME = CHEA_FILL-表空間order by a.CPU_TIME desc援用:jenniferok.iteye/blog/700985從V$SQLAREA中查詢最占用資源的查詢select b.username username,a.disk_reads reads,a.executions exec,a.disk_reads/decode(a.executions,0,1,a.execu

4、tions) rds_exec_ratio,a.sql_text Statementfrom v$sqlarea a,dba_users bwhere a.parsing_user_id=b.user_idand a.disk_reads 100000order by a.disk_reads desc;用buffer_gets列來交換disk_reads列可以得到占用最多內存的sql語句的相關信息。v$sql:內存共享SQL區(qū)域中曾經解析的SQL語句。即時列出運用頻率最高的5個查詢:select sql_text,executionsfrom (select sql_text,executi

5、ons,rank() over(order by executions desc) exec_rankfrom v$sql)where exec_rank =5;耗費磁盤讀取最多的sql top5:select disk_reads,sql_textfrom (select sql_text,disk_reads,dense_rank() over(order by disk_reads desc) disk_reads_rankfrom v$sql)where disk_reads_rank =5;找出需求大量緩沖讀取邏輯讀操作的查詢:select buffer_gets,sql_textf

6、rom (select sql_text,buffer_gets,dense_rank() over(order by buffer_gets desc) buffer_gets_rankfrom v$sql)where buffer_gets_rank=5;v$sqlarea字段定義:happyhou.blog.sohu/60494432.htmlSQL_TEXTVARCHAR2(1000)First thousand characters of the SQL text for the current cursorSQL_IDVARCHAR2(13)SQL identifier of th

7、e parent cursor in the library cacheSHARABLE_MEMNUMBERAmount of shared memory used by a cursor. If multiple child cursors exist, then the sum of all shared memory used by all child cursors.PERSISTENT_MEMNUMBERFixed amount of memory used for the lifetime of an open cursor. If multiple child cursors e

8、xist, the fixed sum of memory used for the lifetime of all the child cursors.RUNTIME_MEMNUMBERFixed amount of memory required during execution of a cursor. If multiple child cursors exist, the fixed sum of all memory required during execution of all the child cursors.SORTSNUMBERSum of the number of

9、sorts that were done for all the child cursorsVERSION_COUNTNUMBERNumber of child cursors that are present in the cache under this parentLOADED_VERSIONSNUMBERNumber of child cursors that are present in the cache and have their context heap (KGL heap 6) loadedOPEN_VERSIONSNUMBERThe number of child cur

10、sors that are currently open under this current parentUSERS_OPENINGNUMBERNumber of users that have any of the child cursors openFETCHESNUMBERNumber of fetches associated with the SQL statementEXECUTIONSNUMBERTotal number of executions, totalled over all the child cursorsEND_OF_FETCH_COUNTNUMBERNumbe

11、r of times this cursor was fully executed since the cursor was brought into the library cache. The value of this statistic is not incremented when the cursor is partially executed, either because it failed during the execution or because only the first few rows produced by this cursor are fetched be

12、fore the cursor is closed or re-executed. By definition, the value of the END_OF_FETCH_COUNT column should be less or equal to the value of the EXECUTIONS column.USERS_EXECUTINGNUMBERTotal number of users executing the statement over all child cursorsLOADSNUMBERNumber of times the object was loaded

13、or reloadedFIRST_LOAD_TIMEVARCHAR2(19)Timestamp of the parent creation timeINVALIDATIONSNUMBERTotal number of invalidations over all the child cursorsPARSE_CALLSNUMBERSum of all parse calls to all the child cursors under this parentDISK_READSNUMBERSum of the number of disk reads over all child curso

14、rsDIRECT_WRITESNUMBERSum of the number of direct writes over all child cursorsBUFFER_GETSNUMBERSum of buffer gets over all child cursorsAPPLICATION_WAIT_TIMENUMBERApplication wait timeCONCURRENCY_WAIT_TIMENUMBERConcurrency wait timeCLUSTER_WAIT_TIMENUMBERCluster wait timeUSER_IO_WAIT_TIMENUMBERUser

15、I/O Wait TimePLSQL_EXEC_TIMENUMBERPL/SQL execution timeJAVA_EXEC_TIMENUMBERJava execution timeROWS_PROCESSEDNUMBERTotal number of rows processed on behalf of this SQL statementCOMMAND_TYPENUMBEROracle command type definitionOPTIMIZER_MODEVARCHAR2(25)Mode under which the SQL statement was executedPAR

16、SING_USER_IDNUMBERUser ID of the user that has parsed the very first cursor under this parentPARSING_SCHEMA_IDNUMBERSchema ID that was used to parse this child cursorKEPT_VERSIONSNUMBERNumber of child cursors that have been marked to be kept using the DBMS_SHARED_POOL packageADDRESSRAW(4 | 8)Address

17、 of the handle to the parent for this cursorHASH_VALUENUMBERHash value of the parent statement in the library cacheOLD_HASH_VALUENUMBEROld SQL hash valueMODULEVARCHAR2(64)Contains the name of the module that was executing at the time that the SQL statement was first parsed as set by calling DBMS_APP

18、LICATION_INFO .SET_MODULEMODULE_HASHNUMBERHash value of the module that is named in the MODULE columnACTIONVARCHAR2(64)Contains the name of the action that was executing at the time that the SQL statement was first parsed as set by calling DBMS_APPLICATION_INFO .SET_ACTIONACTION_HASHNUMBERHash value of the action that is n

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯系上傳者。文件的所有權益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網頁內容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
  • 4. 未經權益所有人同意不得將文件中的內容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網僅提供信息存儲空間,僅對用戶上傳內容的表現方式做保護處理,對用戶上傳分享的文檔內容本身不做任何修改或編輯,并不能對任何下載內容負責。
  • 6. 下載文件中如有侵權或不適當內容,請與我們聯系,我們立即糾正。
  • 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

評論

0/150

提交評論