dbTalk Databases Forums  

DBMS_MONITOR

comp.databases.oracle.server comp.databases.oracle.server


Discuss DBMS_MONITOR in the comp.databases.oracle.server forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Mladen Gogala
 
Posts: n/a

Default DBMS_MONITOR - 12-22-2011 , 04:02 PM






It seems that DBMS_MONITOR doesn't operate using the standard event
mechanism. When I enabled trace in a session using DBMS_MONITOR, the
eventdump didn't show anything. When an explicit "alter session set
events" statement was issued, eventdump detected it without problem:

SQL> oradebug setospid 4645
Oracle pid: 30, Unix process pid: 4645, image: oracle@medo (TNS V1-V3)
SQL> oradebug eventdump session
sql_trace level=12
SQL>


Question: what mechanism does DBMS_MONITOR use for tracing sessions?
--
http://mgogala.byethost5.com

Reply With Quote
  #2  
Old   
Charles Hooper
 
Posts: n/a

Default Re: DBMS_MONITOR - 12-23-2011 , 12:57 PM






On Dec 22, 5:02*pm, Mladen Gogala <gogala.mla... (AT) gmail (DOT) com> wrote:
Quote:
It seems that DBMS_MONITOR doesn't operate using the standard event
mechanism. When I enabled trace in a session using DBMS_MONITOR, the
eventdump didn't show anything. When an explicit "alter session set
events" statement was issued, eventdump detected it without problem:

SQL> oradebug setospid 4645
Oracle pid: 30, Unix process pid: 4645, image: oracle@medo (TNS V1-V3)
SQL> oradebug eventdump session
sql_trace level=12
SQL

Question: what mechanism does DBMS_MONITOR use for tracing sessions?
I believe that the session with the trace enabled through DBMS_MONITOR
must execute at least one SQL statement after tracing is enabled for
the session, before ORADEBUG will report that the trace is enabled.

An example with 2 sessions (Session 2 connected as SYS):
In Session 1, execute the following SQL statement to pick up the SID,
SERIAL# and PID for Session 1, along with the settings that indicate
whether or not a 10046 trace at level 1, 4, 8, or 12 is enabled:
SELECT
S.SID,
S.SERIAL#,
P.PID,
S.SQL_TRACE,
S.SQL_TRACE_WAITS,
S.SQL_TRACE_BINDS
FROM
V$SESSION S,
V$PROCESS P
WHERE
S.SID=(SELECT SID FROM V$MYSTAT WHERE ROWNUM=1)
AND S.PADDR=P.ADDR;

SID SERIAL# PID SQL_TRAC SQL_T SQL_T
--- ---------- ---------- -------- ----- -----
130 3 20 DISABLED FALSE FALSE

--

In Session 2, enable a 10046 trace foe the session at level 12, and
dump the events for Session 1:
EXEC
DBMS_MONITOR.SESSION_TRACE_ENABLE(SESSION_ID=>130, SERIAL_NUM=>3,WAITS=>TRUE,BINDS=>TRUE)

ORADEBUG SETORAPID 20

Oracle pid: 20, Windows thread id: 13756, image: ORACLE.EXE (SHAD)

ORADEBUG EVENTDUMP session
Statement processed.

Notice in the above that nothing was output by the ORADEBUG EVENTDUMP
session command.

In Session 1, let's execute the same SQL statement as was executed
earlier:
SELECT
S.SID,
S.SERIAL#,
P.PID,
S.SQL_TRACE,
S.SQL_TRACE_WAITS,
S.SQL_TRACE_BINDS
FROM
V$SESSION S,
V$PROCESS P
WHERE
S.SID=(SELECT SID FROM V$MYSTAT WHERE ROWNUM=1)
AND S.PADDR=P.ADDR;

SID SERIAL# PID SQL_TRAC SQL_T SQL_T
--- ---------- ---------- -------- ----- -----
130 3 20 ENABLED TRUE TRUE

Notice in the above output that a 10046 trace at level 12 is enabled
for the session.

In Session 2, let's check again which events are enabled for Session
1:
ORADEBUG EVENTDUMP session
sql_trace level=12

Notice in the above output that ORADEBUG now indicates that a 10046
trace at level 12 is enabled for Session 1, because a SQL statement
was executed in Session 1 after the trace was enabled.

Charles Hooper
http://hoopercharles.wordpress.com/
IT Manager/Oracle DBA
K&M Machine-Fabricating, Inc.

Reply With Quote
  #3  
Old   
Mladen Gogala
 
Posts: n/a

Default Re: DBMS_MONITOR - 12-23-2011 , 02:44 PM



On Fri, 23 Dec 2011 10:57:43 -0800, Charles Hooper wrote:

Quote:
I believe that the session with the trace enabled through DBMS_MONITOR
must execute at least one SQL statement after tracing is enabled for the
session, before ORADEBUG will report that the trace is enabled.
Confirmed. Charles you're great!



--
http://mgogala.byethost5.com

Reply With Quote
  #4  
Old   
Mladen Gogala
 
Posts: n/a

Default Re: DBMS_MONITOR - 12-23-2011 , 07:02 PM



On Fri, 23 Dec 2011 10:57:43 -0800, Charles Hooper wrote:


Quote:
I believe that the session with the trace enabled through DBMS_MONITOR
must execute at least one SQL statement after tracing is enabled for the
session, before ORADEBUG will report that the trace is enabled.
I figured out what's happening. I was convinced that DBMS_MONITOR sets a
flag in the UGA, but it doesn't do that. It sends a message to the
affected process, which will set the flag itself, the next time it is
activated . This is an example of what Jonathan calls "AST". DBMS_MONITOR
uses the same mechanism as Unix signal delivery: it queues the message,
probably incurring the famous "rdbms ipc messsage" wait, and the process
will set its own flags on the next activation. The next activation will
come when a SQL statement is submitted. OK, now I understand the
mechanism.




--
http://mgogala.byethost5.com

Reply With Quote
  #5  
Old   
Mark D Powell
 
Posts: n/a

Default Re: DBMS_MONITOR - 12-28-2011 , 09:44 AM



On Dec 23, 3:44*pm, Mladen Gogala <gogala.mla... (AT) gmail (DOT) com> wrote:
Quote:
On Fri, 23 Dec 2011 10:57:43 -0800, Charles Hooper wrote:
I believe that the session with the trace enabled through DBMS_MONITOR
must execute at least one SQL statement after tracing is enabled for the
session, before ORADEBUG will report that the trace is enabled.

Confirmed. Charles you're great!

--http://mgogala.byethost5.com
Yes, good job Charles.

I have seen problem posts related to dbms_monitor not tracing in the
past but when replies were "it works for me" type replies. Next time
I see such a post I will have to keep this behavior in mind.

-- Mark D Powlel --

Reply With Quote
  #6  
Old   
joel garry
 
Posts: n/a

Default Re: DBMS_MONITOR - 12-28-2011 , 11:28 AM



On Dec 28, 7:44*am, Mark D Powell <Mark.Powe... (AT) hp (DOT) com> wrote:
Quote:
On Dec 23, 3:44*pm, Mladen Gogala <gogala.mla... (AT) gmail (DOT) com> wrote:

On Fri, 23 Dec 2011 10:57:43 -0800, Charles Hooper wrote:
I believe that the session with the trace enabled through DBMS_MONITOR
must execute at least one SQL statement after tracing is enabled for the
session, before ORADEBUG will report that the trace is enabled.

Confirmed. Charles you're great!

--http://mgogala.byethost5.com

Yes, good job Charles.

I have seen problem posts related to dbms_monitor not tracing in the
past but when replies were "it works for me" type replies. *Next time
I see such a post I will have to keep this behavior in mind.

-- Mark D Powlel --
I thought oradebug had the same behavior (of not generating a trace
file until something happens)? Perhaps I'm misunderstanding/
misremembering since I haven't used it for a while, but that was my
thought at the first post - I was thinking it was ironic, because I
thought I saw that while following some post Mladen had made a while
back about how to use oradebug. But my memory is capricious at the
best of times.

jg
--
@home.com is bogus.
http://www.signonsandiego.com/news/2...e-recognition/

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.