We need to monitor all SQL-s coming from a certain Application Server to an Oracle DB.
For this, we are running the following query:
SELECT
h.sample_time,
u.username,
h.program,
h.module,
h.machine,
s.sql_text
FROM
DBA_HIST_ACTIVE_SESS_HISTORY h,
DBA_USERS u,
DBA_HIST_SQLTEXT s
WHERE sample_time >= SYSDATE - 0.1
AND h.user_id = u.user_id
AND h.sql_id = s.sql_iD
AND u.USERNAME = '<app_server_name>'
AND h.MACHINE = ('<app_schema_name>')
ORDER BY h.sample_time
Problem with this:
Missing OS User of the Application Server machine.
Could not find anything about OS User on views DBA_HIST_ACTIVE_SESS_HISTORY and DBA_HIST_SQLTEXT. (Meanwhile there is a column OSUSER on view V$SESSION - the non-history version of DBA_HIST_ACTIVE_SESS_HISTORY)
I took a look on columns of DBA %HIST% views:
select t.owner, t.table_name, t.column_name, t.data_type,
t.data_precision, t.data_scale
from dba_tab_cols t
where t.owner = 'SYS'
and t.table_name like '%DBA_HIST%'
and t.column_name like '%OS%'
order by t.table_name, t.COLUMN_NAME
but could not find anything related to OS User info.
Any idea of how I can have the OS User data on my first query ?
best regards
Altin