cancel
Showing results for 
Search instead for 
Did you mean: 

Finding users running the SQL statement's with _SYS_DEFAULT workload class

danielsapbasis
Explorer
0 Kudos

Hi Experts,

How to find the application user's running SQL statements in default workload class _SYS_DEFAULT?

Below command is not working...

Is there any direct command ?

##############

`sql

SELECT username

FROM dbc.WorkloadRuleV

WHERE WorkloadName = 'SYS_DEFAULT';

#####################

Please let me know.

Thanks in advance

View Entire Topic
Abhishek_Hazra
Active Contributor
0 Kudos

Hi

Please try the following script for finding active sessions :

select b.USER_NAME, a.WORKLOAD_CLASS_NAME, a.STATEMENT_STRING
from M_ACTIVE_STATEMENTS a
inner join M_CONNECTIONS b
on a.host = b.host
and a.port = b.port
and a.connection_id = b.connection_id
where a.WORKLOAD_CLASS_NAME = '_SYS_DEFAULT';
Hope this helps 🙂
Best Regards,
Abhi
danielsapbasis
Explorer
0 Kudos

It shows schema name instead of application username.

Pls correct the script.

Abhishek_Hazra
Active Contributor
0 Kudos

Hi Again,
As you can see the column name in the script yourself, it is not schema name, but user name. But it is database user under which the statements are executed. If you are looking for application user which are executing the statements using database system user you need to set up traces or look into view M_EXECUTED_STATEMENTS, this will give you overview both of application user & database user & statement strings with executed timestamp information. But probably this view would neither give you the possibility to look for active statements nor workload class.