DBMS_MONITOR使用 (In 10g, 11g and Above)
SQL> desc dbms_monitor
Element Type
-------------------------- ---------
ALL_MODULES CONSTANT
ALL_ACTIONS CONSTANT
CLIENT_ID_STAT_ENABLE PROCEDURE
CLIENT_ID_STAT_DISABLE PROCEDURE
SERV_MOD_ACT_STAT_ENABLE PROCEDURE
SERV_MOD_ACT_STAT_DISABLE PROCEDURE
CLIENT_ID_TRACE_ENABLE PROCEDURE
CLIENT_ID_TRACE_DISABLE PROCEDURE
SERV_MOD_ACT_TRACE_ENABLE PROCEDURE
SERV_MOD_ACT_TRACE_DISABLE PROCEDURE
SESSION_TRACE_ENABLE PROCEDURE
SESSION_TRACE_DISABLE PROCEDURE
DATABASE_TRACE_ENABLE PROCEDURE
DATABASE_TRACE_DISABLE PROCEDURE
You can query DBA_ENABLED_TRACES to determine what traces are enabled.
Example:
SQL> select trace_type, primary_id, QUALIFIER_ID1, waits, binds
from DBA_ENABLED_TRACES;
TRACE_TYPE PRIMARY_ID QUALIFIER_ID1 WAITS BINDS
---------------------- --------------- ------------------ -------- -------
SERVICE_MODULE SYS$USERS SQL*Plus TRUE FALSE
CLIENT_ID HUGO TRUE FALSE
SERVICE v101_DGB TRUE FALSE
At this database we have three different trace state.
1.) The first row shows that we trace on the server all SQL statements that are executed in SQL*Plus.
2.) We trace all session that are used in a session with the client identifier 'HUGO'
3.) We trace all program that are connected to the database via the service 'v101_DGB'.
In the next section we explain how we enable and disable tracing.
You can use the SESSION_TRACE_ENABLE procedure to enable SQL tracing for a given database session on the local instance.
Syntax
You enable tracing with
dbms_monitor.session_trace_enable(session_id => x, serial_num => y,
waits=>(TRUE|FALSE),binds=>(TRUE|FALSE) );
and disable tracing with
dbms_monitor.session_trace_disable(session_id => x, serial_num => y);
The default of waits is TRUE and the default of binds is FALSE.
Example
To get the session and the serial numbers you can query V$SESSION.
SQL> select serial#, sid , username from v$session;
SERIAL# SID USERNAME
------- ----- --------------
1 131
18 139
3 140
11 143 SCOTT
Than you can start tracing with the command
SQL> execute dbms_monitor.session_trace_enable(143,11);
This tracing state is not persistent across a database shutdown and you see no entry in DBA_ENABLED_TRACES.
SQL> select trace_type, primary_id, QUALIFIER_ID1, waits, binds
from DBA_ENABLED_TRACES;
no rows selected
As disconnect from the session or the following command stop tracing
SQL> execute dbms_monitor.session_trace_disable(143,11);
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/15747463/viewspace-774066/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- Tracing Enhancements Using DBMS_MONITOR (In 10g, 11g and Above)_293661.1
- Using dbms_monitor
- 【dbms包】DBMS_MONITOR
- oracle 10g/11g新名詞Oracle 10g
- 10g 11g 檢視是否DISABLE CRS和10g 11g LOCAL listener的區別
- In 10g/11g,working with ASH and AWR
- New Background Processes Oracle 10g/11gOracle 10g
- Oracle9i,10g,11g 預設使用者統計Oracle
- Tracing Enhancements Using DBMS_MONITOR
- 10G遷移升級到11G使用SPA 分析SQL效能例項SQL
- impdp 10g/11g問題解決
- 瞭解 ignore_above 引數對 Elasticsearch 中磁碟使用的影響Elasticsearch
- Oracle10g新增DBMS_MONITOR包Oracle
- The above mentioned chinese sex pills nutritional vitamins would
- Temperature above threshold臨時處理方案
- 10g資料庫例項使用11g asm錯誤問題處理資料庫ASM
- Oracle 10g 11g密碼策略 使用者口令 大小寫敏感 說明Oracle 10g密碼
- 統計資訊10G和11G區別
- oracle9i、10g、11g區別Oracle
- Oracle 10g/11g 統計資訊相關Oracle 10g
- 10G, 11G 下的 sysdba 及 sysasm 角色ASM
- Upgrading from Oracle Database 10g to 11gOracleDatabase
- 10g、11g記憶體自動管理記憶體
- 11g dmp 匯入10g 解決方案
- 10g,11g sql auto tuning 測試SQL
- Oracle10g新增DBMS_MONITOR包(二)Oracle
- Oracle10g新增DBMS_MONITOR包(一)Oracle
- Keeping the Data Dictionary Cache Hit Ratio at or above 95 Percent
- oracle 10g 與11g統計資訊區別Oracle 10g
- Oracle 10g/11g 升級psu步驟Oracle 10g
- 10g升級到11g密碼問題密碼
- oracle 11g的資料匯入oracle 10gOracle 10g
- oracle監聽檔案listener.ora for 10g/11gOracle
- oracle 11g 中 (oracle 10g) crsctl 的 替換命令Oracle 10g
- 10g,11g中的資料庫克隆安裝資料庫
- 多套Oracle 10g整合遷移到11g的方案Oracle 10g
- BBED在Oracle 10g/11g上安裝筆記Oracle 10g筆記
- Oracle Database 10g/11g補丁(Patchset)下載地址OracleDatabase