This is a discussion on Applications Info within the Database Support forums, part of the Web Development category; Hi all, In ORACLE The DBMS_APPLICATION_INFO package allows programs to add information to the V$SESSION and V$SESSION_LONGOPS views ...
| |||||||
| Register | FAQ | Members List | Calendar | Mark Forums Read |
| |||
| Hi all, In ORACLE The DBMS_APPLICATION_INFO package allows programs to add information to the V$SESSION and V$SESSION_LONGOPS views to make tracking of session activities more accurate. Check it out, Code: DECLARE
v_rindex PLS_INTEGER;
v_slno PLS_INTEGER;
v_totalwork NUMBER;
v_sofar NUMBER;
v_obj PLS_INTEGER;
BEGIN
v_rindex := DBMS_APPLICATION_INFO.set_session_longops_nohint;
v_sofar := 0;
v_totalwork := 10;
WHILE v_sofar < 10 LOOP
-- Do some work
DBMS_LOCK.sleep(5);
v_sofar := v_sofar + 1;
DBMS_APPLICATION_INFO.set_session_longops(rindex => v_rindex,
slno => v_slno,
op_name => 'Batch Load',
target => v_obj,
context => 0,
sofar => v_sofar,
totalwork => v_totalwork,
target_desc => 'BATCH_LOAD_TABLE',
units => 'rows processed');
END LOOP;
END; PL/SQL procedure successfully completed
__________________ -Murali.. |
| Sponsored Links |
| |||
| dbms_application_info package contains several subprogram which are used to setup/retrieve these parameter values. You can obtain list of subprograms of the package using following SQL. Code: SQL> desc dbms_Application_info • READ_CLIENT_INFO • SET_CLIENT_INFO • READ_MODULE • SET_ACTION • SET_MODULE • SET_SESSION_LONGOPS Let us test this using an example. We will start with creating table and test procedure and we will set the module and action in the procedure. Code: CREATE TABLE TEST ( TEST_ID NUMBER(9), TEST_DESC VARCHAR(30), TEST_DATE DATE, UserID VARCHAR(15) ); CREATE OR REPLACE PROCEDURE TEST_PROC AS BEGIN /* Registering Module and Action both */ DBMS_APPLICATION_INFO.SET_MODULE ( module_name => ‘TEST_PROC’, action_name => ‘Adding records’ ); INSERT INTO TEST(TEST_ID,TEST_DESC,TEST_DATE) SELECT ROWNUM, TABLE_NAME, SYSDATE FROM USER_TABLES WHERE ROWNUM < 10; DBMS_APPLICATION_INFO.SET_MODULE(null,null); /* Registering only Action */ DBMS_APPLICATION_INFO.SET_ACTION(action_name => ‘Update Records’); UPDATE TEST SET UserID = USER WHERE TEST_ID < 10; DBMS_APPLICATION_INFO.SET_ACTION(null); END; / Code: SQL> exec test_proc Code: SQL> SELECT Action, Fetches, Executions, Rows_PRocessed 2 FROM v$Sqlarea 3 WHERE Module = ‘TEST_PROC’ 4 OR Action = ‘Update Records’ 5 / ————— ———- ———- ————– Update Records 0 1 4 Adding records 0 1 4 We can retrieve any value we are interested in from v$sqlarea for the module and action parameters. Similarly we can set and retrieve the client_info value using SET_CLIENT_INFO and READ_CLIENT_INFO procedures. It will retrieve value from client_info column of v$session table. This becomes very helpful during performance tuning. By going against v$sqlarea using module and action, we exactly know what procedure or PL/SQL block needs any attention. It also helps us to track resources like cpu time, elapsed time etc, for a specific module.
__________________ S.VinothkumaR Behind me is infinite power, Before me is Endless Possibility, Around me is Boundless Opportunity, Why should I fear! |
| |||
| PL/SQL Packages DBMS_APPLICATION_INFO Record the name of an executing module (or transaction) in the database for later use with Oracle Trace and the SQL trace facility. Subprocedures: SET_MODULE Set the name of the module that is currently running to a new module. SET_ACTION Set the name of the current action within the current module. READ_MODULE Read the values of the module and action fields of the current session. SET_CLIENT_INFO Set the client info field of the session. READ_CLIENT_INFO Read the value of the client_info field of the current session. SET_SESSION_LONGOPS Set a row in the V$SESSION_LONGOP table. |
![]() |
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Languages or Applications? | Pixel | Game Development | 6 | 01-28-2008 06:44 PM |
| Difference between applications and applets | vijayanand | Java Programming | 0 | 09-20-2007 11:18 PM |
| How to write Multithreaded applications using C++? | Sabari | C and C++ Programming | 1 | 07-31-2007 12:30 AM |
| How do I test web-related applications? | devarajan.v | Testing Tools | 1 | 07-26-2007 11:22 PM |
| Unit tests for .Net applications | devarajan.v | Software Testing | 0 | 07-16-2007 08:44 AM |