HANA - Session

Sap Hana Architecture

Management

Kill

ALTER SYSTEM CANCEL SESSION '<M_CONNECTIONS.LOGICAL_CONNECTION_ID>';

Example of procedure to implement a simple timeout

DROP PROCEDURE cancel_session_above_timeout;
CREATE PROCEDURE cancel_session_above_timeout (p_timeout INTEGER) LANGUAGE SQLSCRIPT 
AS 
BEGIN  
	
	DECLARE CURSOR c_cursor1 (l_timeout INTEGER) FOR
		select 
			logical_connection_id,
			seconds_between(start_time,now()) seconds_since_start_time
		from 
			M_CONNECTIONS
		where
			client_host = 'applicationHost' 
			and connection_status = 'RUNNING'
			and seconds_between(start_time,now()) > :l_timeout;
	
	FOR cur_row AS c_cursor1(p_timeout) 
	DO
		EXEC 'ALTER SYSTEM CANCEL SESSION ''' || cur_row.logical_connection_id || '''';
                EXEC 'INSERT INTO message_box VALUES (''The running time (' || cur_row.seconds_since_start_time || ') of the connection (' || cur_row.logical_connection_id || ') was above the timeout limit of (' || p_timeout || ' sec) and was canceled'', CURRENT_TIMESTAMP)';
        END FOR;
	
END;

Context

Session Context

SET SESSION 'APPLICATION' = 'Nico';
SET SESSION 'APPLICATIONUSER'= 'Nico';
SET SESSION 'APPLICATIONVERSION' = '10.8';
SET SESSION 'APPLICATIONACTION' = 'myAction';
SET SESSION 'APPLICATIONSOURCE' = 'mySource';
SELECT * FROM M_SESSION_CONTEXT WHERE connection_id=current_connection;
  • application name = name of the application
  • application user name = name of the application user (usually the user logged into the application)

Example:

select 
	connection_id,
	max(case when key = 'APPLICATION' then value end) as application,
	max(case when key = 'APPLICATIONUSER' then value end ) as applicationuser,
	max(case when key = 'APPLICATIONCOMPONENT' then value end) as applicationcomponent,
	max(case when key = 'APPLICATIONCOMPONENTTYPE' then value end) as applicationcomponenttype,
	max(case when key = 'APPLICATIONCOMPONENTVERSION' then value end) as applicationcomponentversion,
	max(case when key = 'APPLICATIONSOURCE' then value end) as applicationsource,
	max(case when key = 'CLIENT' then value end) as client
from M_SESSION_CONTEXT 
group by connection_id

Documentation / Reference





Discover More
Sap Hana Architecture
HANA - Client

Log: The SAP HANA client installation is logged by the system. There are two log files written during installation stored at /var/tmp/hdb_client_ 23930132393013 - FAQ: SAP HANA Clients viewer/e7e79e15f5284474b965872bf0fa3d63/2.0.01/en-US/c5b4095bbb571014a683e2ce02eb5fb7.htmlSAP...
Sap Hana Architecture
HANA - Workload Class

Workload class permits to limit also the parallelism. They represent individual and named sets of resource properties statement thread limit = max #of parallel threads to execute a statement statement...
Hana Max Concurrency
Hana - Parallel Query

Two thread pools control the parallelism of statement execution. SQLExecutors: Front End SQL receiver, execute OLTP query, delegate OLAP query to Job executor and JobExecutors: Execute parallel, complex...
Sap Hana Studio Connection System
SAP HANA - Connection

Most of the connection inside the SAP landscape are made with JDBC. See JDBC connection parameters See also: The connection parameters for a premise system with Studio where: instance number...
Sap Hana Architecture
Sap HANA - Monitoring (Metrics)

Sap HANA - Monitoring (Metrics)



Share this page:
Follow us:
Task Runner