Hi,
" i cant obtain machine name or osuser"
http://www.dba-oracle.com/art_builder_prop...or_auditing.htm select
sid,
serial#,
status,
username,
osuser,
machine,
process,
program
from
v$session
where
audsid=userenv('sessionid')
and
osuser = 'ASPNET';
Will the dbms_application_info package get you the session numbers?
http://www.dba-oracle.com/job_scheduling/k...ng_sessions.htmThis is related:
http://www.freelists.org/archives/oracle-l...6/msg01025.htmlJava app using connection pooling. Want to trace a user action.
The ability to turn 10046 tracing off/on would be included in the code, as
would calls to DBMS_APPLICATION_INFO to identify the session. Would the code
need to initiate tracing (and DBMS_APPLICATION_INFO) each time one of the
connections is grabbed?
I implemented your requirements while developing an application
some years ago.
Here are some implmentation details:
1)I wrapped the connectionpool class and the calls for
getting/releasing the connections were made trough the wrapper, this
means that in the wrapper I can enable tracing while leasing the
connection and disable while releasing it.
2)the ability to turn off/on the tracing was dictated by two factors:
the trace level of the class wrapper itself (very easy to do if you
use log4J or similar that gives automatically the trace level for the
class) and an optional parameter passed to wrapper while leasing the
connection.
Here is some java pseudocode
//inside a servlet o something else
Connection conn=pool.getConnection(clientid,enableTrace);
//client id serves the purpose of identifing the beginning
//and the end of this program in the trace file
//enableTrace is a boolean parameter indicating whether or not activate trace
try {
...
//use the connection
...
} finally {
pool.releaseConnection(conn);//disable trace
}
inside the pool class there is something similar to:
public Connection getConnection(String clientId,boolean enableTrace) {
if (logger.isDebugEnabled() || enableTrace) {
//execute sql to enable trace and set the clientId through a SQL o
PL/SQL call
}
//eventually fills a map with connId,clientId
...
}
public Connection releaseConnection(Connection conn) {
//get form the map the clientId
//execute sql or pl/sql to mark the end of the session trace
//stop the trace only if logger.isDebugEnabled() is false
}
...
}