Database Reference
In-Depth Information
calls it executes. You'll see more of this later in Part 2. The aim of the type of instrumentation described here is to
provide the database engine with information about the user and/or the application using it. This is necessary since
the database engine has generally little, and often no, information about the relationship between application code,
sessions, and end users. Consider the following common situations:
The database engine doesn't know which part of the application code is executing SQL
statements through a session. For example, the database engine has no clue about which
module, class, or report is running a specific SQL statement through a given session.
When the application connects to the database engine through a pool of connections opened
with a technical user and proxy users aren't utilized, the end-user authentication is usually
performed by the application itself. Therefore, the database engine ignores which end user is
using which session.
For these reasons, the database engine provides the opportunity to dynamically associate the following attributes
to a database session:
Client identifier : This is a string of 64 bytes that identifies a client, albeit not unequivocally.
Client information : This is a string of 64 bytes that describes the client.
Module name : This is a string of 48 bytes that describes the module currently
using the session.
Action name : This is a string of 32 bytes that describes the action being processed.
For sessions opened through database links, only the client identifier is automatically propagated to remote
sessions. therefore, for the other attributes, it's necessary to explicitly set them.
Caution
Their values are externalized through the v$session view and the userenv context. The following example, which
is an excerpt of the output generated by the session_info.sql script, shows how to query them:
SQL> SELECT sys_context('userenv','client_identifier') AS client_identifier,
2 sys_context('userenv','client_info') AS client_info,
3 sys_context('userenv','module') AS module_name,
4 sys_context('userenv','action') AS action_name
5 FROM dual;
CLIENT_IDENTIFIER CLIENT_INFO MODULE_NAME ACTION_NAME
-------------------- ------------ ---------------- ------------------------
helicon.antognini.ch Linux x86_64 session_info.sql test session information
SQL> SELECT client_identifier,
2 client_info,
3 module AS module_name,
4 action AS action_name
5 FROM v$session
6 WHERE sid = sys_context('userenv','sid');
CLIENT_IDENTIFIER CLIENT_INFO MODULE_NAME ACTION_NAME
 
Search WWH ::




Custom Search