ORACLE set autotrace

來源:互聯網
上載者:User
set autotrace off  
set autotrace on  
set autotrace traceonly  
 
set autotrace on explain  
set autotrace on statistics  
set autotrace on explain statistics   
 
set autotrace traceonly explain  
set autotrace traceonly statistics  
set autotrace traceonly explain statistics  
 
set autotrace off explain  
set autotrace off statistics  
set autotrace off explain statistics 
set autotrace off
set autotrace on
set autotrace traceonly

set autotrace on explain
set autotrace on statistics
set autotrace on explain statistics

set autotrace traceonly explain
set autotrace traceonly statistics
set autotrace traceonly explain statistics

set autotrace off explain
set autotrace off statistics
set autotrace off explain statistics

設定autotrace允許顯示DML語句的一些統計資訊和/或查詢計劃。

set autotrace on: 為語句顯示統計資訊和執行計畫。

set autotrace on explain: 只顯示執行計畫。

set autotrace on statistics: 只顯示統計資訊。

set autotrace traceonly: 顯示執行計畫和統計資訊,但是列印查詢結果。

set autotrace off: 關閉autotrace

如果用statistics選項開啟autotrace,那麼將顯示下面的統計資訊:

recursive calls
db block gets
consistent gets
physical reads
redo size
bytes sent via SQL*Net to client
bytes received via SQL*Net from client
SQL*Net roundtrips to/from client
sorts (memory)
sorts (disk)
前置條件

autotrace的執行計畫特性需要建立一個plan_table表,可以用指令碼

$ORACLE_HOME/rdbms/admin/utlxplan.sql 建立

統計特性需要使用者具有v_$sesstat, v_$statname 和 v_$session表上的查詢許可權。

Oracle安裝時附帶的$ORACLE_HOME/sqlplus/admin/plustrce.sql 會安裝plustrace角色,plustrace角色被授予了這些查詢許可權。如果plustrace角色被授予使用者,那麼他就可以具有開啟autotrace的許可權。或者你也可以把plustrace角色授予public。

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.