Guenadi N Jilevski's Oracle BLOG

Oracle RAC, DG, EBS, DR and HA DBA BLOG

Listing active contexts in Oracle

Listing active contexts in Oracle

— Listing active contexts
CREATE OR REPLACE PROCEDURE listContext AS
list DBMS_SESSION.APPCTXTABTYP;
cnt NUMBER;
BEGIN
DBMS_OUTPUT.PUT_LINE(‘USERENV nls_territory = ‘||SYS_CONTEXT(‘userenv’,’nls_territory’));
DBMS_OUTPUT.PUT_LINE(‘USERENV nls_currency = ‘||SYS_CONTEXT(‘userenv’,’nls_currency’));
DBMS_OUTPUT.PUT_LINE(‘USERENV nls_calendar = ‘||SYS_CONTEXT(‘userenv’,’nls_calendar’));
DBMS_OUTPUT.PUT_LINE(‘USERENV nls_date_format = ‘||SYS_CONTEXT(‘userenv’,’nls_date_format’));
DBMS_OUTPUT.PUT_LINE(‘USERENV nls_date_language = ‘||SYS_CONTEXT(‘userenv’,’nls_date_language’));
DBMS_OUTPUT.PUT_LINE(‘USERENV nls_sort = ‘||SYS_CONTEXT(‘userenv’,’nls_sort’));
DBMS_OUTPUT.PUT_LINE(‘USERENV session_user = ‘||SYS_CONTEXT(‘userenv’,’session_user’));
DBMS_OUTPUT.PUT_LINE(‘USERENV current_user = ‘||SYS_CONTEXT(‘userenv’,’current_user’));
DBMS_OUTPUT.PUT_LINE(‘USERENV current_schema = ‘||SYS_CONTEXT(‘userenv’,’current_schema’));
DBMS_OUTPUT.PUT_LINE(‘USERENV current_schemaid = ‘||SYS_CONTEXT(‘userenv’,’current_schemaid’));
DBMS_OUTPUT.PUT_LINE(‘USERENV session_userid = ‘||SYS_CONTEXT(‘userenv’,’session_userid’));
DBMS_OUTPUT.PUT_LINE(‘USERENV currend_userid = ‘||SYS_CONTEXT(‘userenv’,’current_userid’));
— Listing user defined namespaces
DBMS_SESSION.LIST_CONTEXT(list, cnt);
FOR i IN 1..cnt LOOP
DBMS_OUTPUT.PUT_LINE(list(i).namespace||’  ‘||list(i).attribute||’ = ‘||list(i).value);
END LOOP;
END;
/

January 13, 2010 Posted by | oracle | 2 Comments