The DBMS_APPLICATION_INFO package registers application modules and actions in the current database session. Use it with Trace and SQL tracing tools to track which modules or transactions are running, monitor their performance, and analyze resource usage by module.
When a module registers with the database, its name and action are recorded in the polar_get_app_info view. System administrators and performance optimization experts can query this view to correlate resource usage with specific modules and transactions.
Subprograms
| Subprogram | Description |
|---|---|
| READ_CLIENT_INFO | Reads the client_info field of the current session |
| READ_MODULE | Reads the module and action fields of the current session |
| SET_ACTION | Sets the name of the action running in the current module |
| SET_CLIENT_INFO | Sets the client_info field of the current session |
| SET_MODULE | Sets the module name to a new module |
READ_CLIENT_INFO
Reads the client_info value that the current session registered via SET_CLIENT_INFO.
Syntax
DBMS_APPLICATION_INFO.READ_CLIENT_INFO (
client_info OUT VARCHAR2);Parameters
| Parameter | Description |
|---|---|
client_info | The client information last set by SET_CLIENT_INFO in the current session. |
READ_MODULE
Reads the module and action values registered in the current session.
Syntax
DBMS_APPLICATION_INFO.READ_MODULE (
module_name OUT VARCHAR2,
action_name OUT VARCHAR2);Parameters
| Parameter | Description |
|---|---|
module_name | The module name last set by SET_MODULE in the current session. |
action_name | The action name last set by SET_MODULE or SET_ACTION in the current session. |
SET_ACTION
Sets the name of the action currently running within the active module.
Syntax
DBMS_APPLICATION_INFO.SET_ACTION (
action_name IN VARCHAR2);Parameters
| Parameter | Description |
|---|---|
action_name | The action name to register. Values longer than 64 bytes are truncated. When the current action is terminated, use the name of the next action to call this stored procedure if the next action exists; if no next action exists, call NULL. |
SET_CLIENT_INFO
Sets additional client application information in the current session.
Syntax
DBMS_APPLICATION_INFO.SET_CLIENT_INFO (
client_info IN VARCHAR2);Parameters
| Parameter | Description |
|---|---|
client_info | Additional information about the client application. |
SET_MODULE
Sets the name of the module currently running and, optionally, its initial action.
Syntax
DBMS_APPLICATION_INFO.SET_MODULE (
module_name IN VARCHAR2,
action_name IN VARCHAR2);Parameters
| Parameter | Description |
|---|---|
module_name | The module name to register. Values longer than 64 bytes are truncated. When the module exits, pass NULL to clear the name. |
action_name | The initial action name within the module. Pass NULL if no action name is needed. Values longer than 64 bytes are truncated. |
Examples
The following examples show how to register application context, then read it back using both the stored procedures and polar_get_app_info.
Query the current session state
SELECT pid, client_info, module, action FROM polar_get_app_info;Register module, action, and client information
EXEC dbms_application_info.set_client_info('client2');
EXEC dbms_application_info.set_module('module2', 'action');
EXEC dbms_application_info.set_action('action2');Query again to confirm the registered values
SELECT pid, client_info, module, action FROM polar_get_app_info;Read registered values using the stored procedures
DECLARE
_client TEXT;
_mod_name TEXT;
_act_name TEXT;
BEGIN
dbms_application_info.read_client_info(_client);
dbms_application_info.read_module(_mod_name, _act_name);
RAISE NOTICE 'client_info is: "%", module value is "%", action value is "%"',
_client, _mod_name, _act_name;
END;