The query corresponding to each monitoring element to check the session status is as follows. To monitor only information about a specific session, add the 'id' column of v$session to the WHERE clause.
This shows the number of sessions connected to the Altibase server.
SELECT COUNT(*) TOTAL_SESSION_CNT FROM V$SESSION ; |
The following query can be used in Altibase version 5 or later, but can also be used in Altibase version 4 by deleting or commenting the CLIENT_APP_INFO column.
SELECT A.ID SESSION_ID , A.DB_USERNAME USER_NAME , REPLACE2(REPLACE2(A.COMM_NAME, 'SOCKET-', NULL), '-SERVER', NULL) CLIENT_IP , A.CLIENT_APP_INFO -- Delete it if using Altibase v4 , A.CLIENT_PID , A.SESSION_STATE , DECODE(A.AUTOCOMMIT_FLAG, 1, 'ON', 'OFF') AUTOCOMMIT , DECODE(A.LOGIN_TIME, 0, '-', TO_CHAR(TO_DATE('1970010109', 'YYYYMMDDHH') + A.LOGIN_TIME / (24*60*60), 'YY/MM/DD HH:MI:SS')) LOGIN_TIME , DECODE(A.IDLE_START_TIME, 0, '-', TO_CHAR(TO_DATE('1970010109', 'YYYYMMDDHH') + A.IDLE_START_TIME / (24*60*60), 'YY/MM/DD HH:MI:SS')) IDLE_TIME , NVL(LTRIM(B.QUERY), 'NONE') CURRENT_QUERY FROM V$SESSION A LEFT OUTER JOIN V$STATEMENT B ON A.CURRENT_STMT_ID = B.ID ; |
Column Name | Description | Remarks |
---|---|---|
CLIENT_IP | The ip address of the client application associated with the session | |
CLIENT_PID | The process ID of the client application related to the session can identify the related process in the OS in which the client application runs. | |
CLIENT_APP_INFO | The name of the client application associated with the session | Column added starting from Altibase v5 |
SESSION_STATE | As a string representing the state of the session, there are 7 states: INIT, AUTH, SERVICE READY, SERVICE, END, ROLLBACK, and UNKNOWN | |
IDLE_TIME | The time at which the session started doing nothing, which is the basis for idle_timeout. The unit is Unix time. | |
CURRENT_QUERY | The query that was last performed or currently running in the session |
The column used in the SELECT clause is the same as [SS02] Session Information, so refer to the column description of the query.
SELECT A.ID SESSION_ID , A.DB_USERNAME USER_NAME , REPLACE2(REPLACE2(A.COMM_NAME, 'SOCKET-', NULL), '-SERVER', NULL) CLIENT_IP , A.CLIENT_APP_INFO -- Delete it if using Altibase v4 , A.CLIENT_PID , A.SESSION_STATE , DECODE(A.AUTOCOMMIT_FLAG, 1, 'ON', 'OFF') AUTOCOMMIT , DECODE(A.LOGIN_TIME, 0, '-', TO_CHAR(TO_DATE('1970010109', 'YYYYMMDDHH') + A.LOGIN_TIME / (24*60*60), 'MM/DD HH:MI:SS')) LOGIN_TIME , DECODE(A.IDLE_START_TIME, 0, '-', TO_CHAR(TO_DATE('1970010109', 'YYYYMMDDHH') +A.IDLE_START_TIME / (24*60*60), 'MM/DD HH:MI:SS')) IDLE_TIME , NVL(LTRIM(B.QUERY), 'NONE') CURRENT_QUERY FROM V$SESSION A LEFT OUTER JOIN V$STATEMENT B ON A.CURRENT_STMT_ID = B.ID WHERE A.SYSDBA_FLAG = 1 ; |