Components of a Global Application Context
A global application context uses a package to manage its attributes and middle-tier application to manage the client session ID.
-
The global application context. You use the
CREATE CONTEXTSQL statement to create the global application context, and include theACCESSED GLOBALLYclause in the statement. This statement names the application context and associates it with a PL/SQL procedure that is designed to set the application data context data. The global application context is created and stored in the database schema of the security administrator who creates it. -
A PL/SQL package to set the attributes. The package must contain a procedure that uses the
DBMS_SESSION.SET_CONTEXTprocedure to set the global application context. TheSET_CONTEXTprocedure provides parameters that enable you to create a global application context that fits any of the three user situations described in this section. You create, store, and run the PL/SQL package on the database server. Typically, it belongs in the schema of the security administrator who created it. -
A middle-tier application to get and set the client session ID. For nondatabase users, which require a client session ID to be authenticated, you can use the Oracle Call Interface (OCI) calls in the middle-tier application to retrieve and set their session data. You can also use the
DBMS_SESSION.SET_IDENTIFIERprocedure to set the client session ID. An advantage of creating a client session ID to store the nondatabase user’s name is that you can query theCLIENT_IDcolumn ofDBA_AUDIT_TRAIL,DBA_FGA_AUDIT_TRAIL, andDBA_COMMON_AUDIT_TRAILdata dictionary views to audit this user’s activity.Note: Be aware that the
DBMS_APPLICATION_INFO.SET_CLIENT_INFOsetting can overwrite the value.