Oracle DBMS_SESSION Version 21c |
---|
General Information | ||||||||||||||||||||||||||||||||||||||||||||||
Library Note |
|
|||||||||||||||||||||||||||||||||||||||||||||
Purpose | Try dbms_session.reset_package. This call will reset all packages variables to their defaults (and will close and flush all cached cursors and free other resources, too, but it will not reset system contexts and it will not cause package initialization part to be re-executed when package is next accessed). Note that no explicit default for a package variable defaults it to NULL. | |||||||||||||||||||||||||||||||||||||||||||||
AUTHID | CURRENT_USER | |||||||||||||||||||||||||||||||||||||||||||||
Constants |
|
|||||||||||||||||||||||||||||||||||||||||||||
Data Types | TYPE AppCtxRecTyp IS RECORD ( |
|||||||||||||||||||||||||||||||||||||||||||||
Dependencies |
|
|||||||||||||||||||||||||||||||||||||||||||||
Documented | Yes | |||||||||||||||||||||||||||||||||||||||||||||
Exceptions |
|
|||||||||||||||||||||||||||||||||||||||||||||
First Available | 7.3.4 | |||||||||||||||||||||||||||||||||||||||||||||
Security Model | Owned by SYS with EXECUTE granted to AUDSYS, DVSYS, PUBLIC, SYSRAC | |||||||||||||||||||||||||||||||||||||||||||||
Source | {ORACLE_HOME}/rdbms/admin/dbmssess.sql | |||||||||||||||||||||||||||||||||||||||||||||
Subprograms |
|
|||||||||||||||||||||||||||||||||||||||||||||
CLEAR_ALL_CONTEXT | ||||||||||||||||||||||||||||||||||||||||||||||
Removes all contexts | dbms_session.clear_all_context(namespace IN VARCHAR2); |
|||||||||||||||||||||||||||||||||||||||||||||
exec dbms_session.clear_all_context('SC_TEST'); |
||||||||||||||||||||||||||||||||||||||||||||||
CLEAR_CONTEXT | ||||||||||||||||||||||||||||||||||||||||||||||
Removes a context | dbms_session.clear_context( |
|||||||||||||||||||||||||||||||||||||||||||||
see SET_CONTEXT Demo Below |
||||||||||||||||||||||||||||||||||||||||||||||
CLEAR_IDENTIFIER | ||||||||||||||||||||||||||||||||||||||||||||||
Removes the set_client_id in the session | dbms_session.clear_identifier; |
|||||||||||||||||||||||||||||||||||||||||||||
exec dbms_session.clear_identifier; |
||||||||||||||||||||||||||||||||||||||||||||||
CLOSE_DATABASE_LINK | ||||||||||||||||||||||||||||||||||||||||||||||
Closes an open database link | dbms_session.close_database_link(dblink IN VARCHAR2); equivalent to: ALTER SESSION CLOSE DATABASE LINK <name>; |
|||||||||||||||||||||||||||||||||||||||||||||
exec dbms_session.close_database_link('TEST_LINK'); |
||||||||||||||||||||||||||||||||||||||||||||||
CURRENT_IS_ROLE_ENABLED | ||||||||||||||||||||||||||||||||||||||||||||||
Returns TRUE if the named role is currently enabled | dbms_session.current_is_role_enabled(rolename IN VARCHAR2) |
|||||||||||||||||||||||||||||||||||||||||||||
See SET_ROLE demo below |
||||||||||||||||||||||||||||||||||||||||||||||
FREE_UNUSED_USER_MEMORY | ||||||||||||||||||||||||||||||||||||||||||||||
Reclaims unused memory after performing operations requiring large amounts of memory (more than 100K) | dbms_session.free_unused_user_memory; |
|||||||||||||||||||||||||||||||||||||||||||||
CREATE OR REPLACE PACKAGE foobar AUTHID DEFINER AS |
||||||||||||||||||||||||||||||||||||||||||||||
GET_PACKAGE_MEMORY_UTILIZATION | ||||||||||||||||||||||||||||||||||||||||||||||
This procedure describes static package memory usage. The output collections describe memory usage in each instantiated package. Overload 1 |
dbms_session.get_package_memory_utilization( |
|||||||||||||||||||||||||||||||||||||||||||||
set serveroutput on |
||||||||||||||||||||||||||||||||||||||||||||||
Overload 2 | dbms_session.get_package_memory_utilization( |
|||||||||||||||||||||||||||||||||||||||||||||
TBD | ||||||||||||||||||||||||||||||||||||||||||||||
IS_ROLE_ENABLED | ||||||||||||||||||||||||||||||||||||||||||||||
Determines if the named role is enabled for this session | dbms_session.is_role_enabled(rolename IN VARCHAR2) RETURN BOOLEAN; |
|||||||||||||||||||||||||||||||||||||||||||||
Deprecated as of 19.2 see replacement functions in this package |
||||||||||||||||||||||||||||||||||||||||||||||
IS_SESSION_ALIVE | ||||||||||||||||||||||||||||||||||||||||||||||
Determines if the specified session is active | dbms_session.is_session_alive(uniqueid IN VARCHAR2) RETURN BOOLEAN; |
|||||||||||||||||||||||||||||||||||||||||||||
conn uwclass/uwclass @pdbdev |
||||||||||||||||||||||||||||||||||||||||||||||
LIST_CONTEXT | ||||||||||||||||||||||||||||||||||||||||||||||
Returns a list of active namespaces and contexts for the current session | dbms_session.list_context(list OUT AppCtxTabTyp, lsize OUT NUMBER); |
|||||||||||||||||||||||||||||||||||||||||||||
See SET_CONTEXT Demo Below |
||||||||||||||||||||||||||||||||||||||||||||||
MODIFY_PACKAGE_STATE | ||||||||||||||||||||||||||||||||||||||||||||||
Alters the session state of PL/SQL program units that are active in the session freeing memory resources. | dbms_session.modify_package_state(action_flags IN PLS_INTEGER); |
|||||||||||||||||||||||||||||||||||||||||||||
exec dbms_session.modify_package_state(2); |
||||||||||||||||||||||||||||||||||||||||||||||
RESET_PACKAGE | ||||||||||||||||||||||||||||||||||||||||||||||
Deinstantiates all packages in the current session | dbms_session.reset_package; |
|||||||||||||||||||||||||||||||||||||||||||||
exec dbms_session.reset_package; |
||||||||||||||||||||||||||||||||||||||||||||||
SESSION_IS_ROLE_ENABLED | ||||||||||||||||||||||||||||||||||||||||||||||
Returns TRUE if the named role is enabled at the session level | dbms_session.session_is_role_enabled(rolename IN VARCHAR2) RETURN BOOLEAN; |
|||||||||||||||||||||||||||||||||||||||||||||
See SET_ROLE demo below |
||||||||||||||||||||||||||||||||||||||||||||||
SESSION_TRACE_DISABLE | ||||||||||||||||||||||||||||||||||||||||||||||
Disable SQL trace for the session | dbms_session.session_trace_disable; |
|||||||||||||||||||||||||||||||||||||||||||||
exec dbms_session.session_trace_disable; |
||||||||||||||||||||||||||||||||||||||||||||||
SESSION_TRACE_ENABLE | ||||||||||||||||||||||||||||||||||||||||||||||
Enables SQL trace for the session | dbms_session.session_trace_enable(
|
|||||||||||||||||||||||||||||||||||||||||||||
exec dbms_session.session_trace_enable; |
||||||||||||||||||||||||||||||||||||||||||||||
SET_CLOSE_CACHED_OPEN_CURSORS | ||||||||||||||||||||||||||||||||||||||||||||||
Turns close_cached_open_cursors on or off | dbms_session.set_close_cached_open_cursors(close_cursors IN BOOLEAN); -- equivalent to: ALTER SESSION SET CLOSE_CACHED_OPEN_CURSORS |
|||||||||||||||||||||||||||||||||||||||||||||
exec dbms_session.set_close_cached_open_cursors(TRUE); |
||||||||||||||||||||||||||||||||||||||||||||||
SET_CONTEXT | ||||||||||||||||||||||||||||||||||||||||||||||
Sets a context within a session | dbms_session.set_context( |
|||||||||||||||||||||||||||||||||||||||||||||
conn sys@pdbdev as sysdba |
||||||||||||||||||||||||||||||||||||||||||||||
SET_CURRENT_SCHEMA_DEFERRED | ||||||||||||||||||||||||||||||||||||||||||||||
Set the current schema of the session to a schema specified in the call. The switch takes effect at the end of the current client call. | dbms_session.set_current_schema_deferred(schema_name IN VARCHAR2); |
|||||||||||||||||||||||||||||||||||||||||||||
exec dbms_session.set_current_schema_deferred('SCOTT'); |
||||||||||||||||||||||||||||||||||||||||||||||
SET_EDITION_DEFERRED | ||||||||||||||||||||||||||||||||||||||||||||||
Requests a switch to the specified edition at the end of the current client call | dbms_session.set_edition_deferred(edition IN VARCHAR2); |
|||||||||||||||||||||||||||||||||||||||||||||
SELECT * |
||||||||||||||||||||||||||||||||||||||||||||||
SET_IDENTIFIER | ||||||||||||||||||||||||||||||||||||||||||||||
Sets the client ID in the session | dbms_session.set_identifier(client_id IN VARCHAR2); |
|||||||||||||||||||||||||||||||||||||||||||||
/* internal services SYS$BACKGROUND is used by background processes only SYS$USERS is the default for user sessions not associated with other services */ set linesize 160 col client_identifier format a25 col client_id format a20 col event format a25 col service_name format a25 col module format a25 SELECT sid, client_identifier, service_name, module FROM gv_$session; CREATE OR REPLACE TRIGGER logon_trigger AFTER LOGON ON DATABASE DECLARE uid VARCHAR2(64); BEGIN SELECT ora_login_user ||':'||SYS_CONTEXT('USERENV','OS_USER') INTO uid FROM dual; dbms_session.set_identifier(uid); END logon_trigger; / SELECT sid, client_identifier, service_name, module, action FROM gv$session WHERE service_name <> 'SYS$BACKGROUND'; -- session 2 log on exec dbms_application_info.set_module('Battelle', 'Lecture'); -- session 1 SELECT sid, client_identifier, service_name, module, action FROM gv_$session; -- ASH SELECT session_id, client_id, event, SUM(wait_time + time_waited) ttl_wait_time FROM gv_$active_session_history WHERE sample_time BETWEEN SYSDATE - 30/1440 AND SYSDATE GROUP BY session_id, client_id, event ORDER BY 2; |
||||||||||||||||||||||||||||||||||||||||||||||
SET_NLS | ||||||||||||||||||||||||||||||||||||||||||||||
Sets national language support (NLS) | dbms_session.set_nls(param IN VARCHAR2, value IN VARCHAR2); |
|||||||||||||||||||||||||||||||||||||||||||||
exec dbms_session.set_nls('nls_date_format','''DD-MON-YYYY'''); |
||||||||||||||||||||||||||||||||||||||||||||||
SET_ROLE | ||||||||||||||||||||||||||||||||||||||||||||||
Enables and disables roles | dbms_session.set_role(role_cmd IN VARCHAR2); |
|||||||||||||||||||||||||||||||||||||||||||||
set serveroutput on |
||||||||||||||||||||||||||||||||||||||||||||||
SET_SQL_TRACE | ||||||||||||||||||||||||||||||||||||||||||||||
Turns tracing on or off | dbms_session.set_sql_trace(sql_trace IN BOOLEAN); -- equivalent to: ALTER SESSION SET SQL_TRACE <ON | OFF>; |
|||||||||||||||||||||||||||||||||||||||||||||
exec dbms_session.set_sql_trace(TRUE); |
||||||||||||||||||||||||||||||||||||||||||||||
SLEEP | ||||||||||||||||||||||||||||||||||||||||||||||
Suspends the session for a given period of time | dbms_session.sleep(seconds IN NUMBER); |
|||||||||||||||||||||||||||||||||||||||||||||
exec dbms_session.sleep(10); |
||||||||||||||||||||||||||||||||||||||||||||||
SWITCH_CURRENT_CONSUMER_GROUP | ||||||||||||||||||||||||||||||||||||||||||||||
Changes the current resource consumer group of a user's current session | dbms_session.switch_current_consumer_group( |
|||||||||||||||||||||||||||||||||||||||||||||
CREATE OR REPLACE PROCEDURE high_priority_task AUTHID DEFINER IS |
||||||||||||||||||||||||||||||||||||||||||||||
UNIQUE_SESSION_ID | ||||||||||||||||||||||||||||||||||||||||||||||
Returns an identifier that is unique for all sessions currently connected to this database | dbms_session.unique_session_id RETURN VARCHAR2; |
|||||||||||||||||||||||||||||||||||||||||||||
See IS_SESSION_ALIVE Demo Above |
||||||||||||||||||||||||||||||||||||||||||||||
USE_DEFAULT_EDITION_ALWAYS | ||||||||||||||||||||||||||||||||||||||||||||||
Toggles the mode that disassociates the session from an edition at the end of every client call. Following each call, and before the next top level call, no edition will be in use by the session. The session will use the reigning database default edition for its next operation. |
dbms_session.use_default_edition_always(mode_on IN BOOLEAN DEFAULT TRUE); |
|||||||||||||||||||||||||||||||||||||||||||||
exec dbms_session.use_default_edition_always(FALSE); |
||||||||||||||||||||||||||||||||||||||||||||||
USE_DEFAULT_EDITION_DEFERRED | ||||||||||||||||||||||||||||||||||||||||||||||
Disassociates the session from its current edition at the end of the current call | dbms_session.use_default_edition_deferred; |
|||||||||||||||||||||||||||||||||||||||||||||
exec dbms_session.use_default_edition_deferred; |
Related Topics |
Built-in Functions |
Built-in Packages |
Database Links |
DBMS_APPLICATION_INFO |
Edition Based Redefinition |
Roles |
SYS_CONTEXT |
What's New In 19c |
What's New In 20c-21c |
This site is maintained by Dan Morgan. Last Updated: | This site is protected by copyright and trademark laws under U.S. and International law. © 1998-2021 Daniel A. Morgan All Rights Reserved | |||||||||
|
||||||||||