Hello Tom,
After the answer from Connor (thanks BTW), I checked out how many processes I have for Oracle and I found 31 ... not sure is too much or not, I wanted also to knew what SQL instructions they run at certain moment, but no SQL appear, even when the process status is ACTIVE ...
SID vary between 1 .. 730+
Modules are (KTSJ, Streams, backup incr datafile, RMAN and DBMS_SCHEDULER)
These having info about Module, SQLText, and Schema Owner, are the less important for this "mystery"
The ones I would like to know what they do and If we can get rid of them, to reduce REDO Entries
but the specific info is null, info such as:
Schema Owner,
Exec_start,
Run_time,
Module,
SQLText,
SQL_ID.
When I searched for the most producers of redo entries, I was always able to identify the SID, Schema, OS_user, and SQL_Text.
that's why I found that some background process are involved.
Going deep, I run this query trying to get more info
Could you please tell me:
1. I'm not founding SQL text, because some of my joins are not correct
2. I'm not searching on the correct SYS Dynamic views
SELECT ses.sid
, ses.serial
, ses.status
, ses.username as schema
, to_char(ses.exec_start, 'dd-mm-yyyy hh24:mi:ss') as exec_start_paris --at time zone 'Europe/Paris'
, ses.Run_Time_Hours
, ses.Run_Time_Minutes
, ses.Run_Time_sec
, ses.os_user
, ses.machine
, ses.module
, ses.sql_text as sql_text
, ses.killer
, ses.sql_id
, ses.seq
FROM ( WITH vs AS
( SELECT rownum rnum
, inst_id
, sid
, serial#
, status
, USERNAME
, machine
, OSUSER
, MODULE
, type
, sql_id
,lockwait
,sql_exec_start
FROM gv$session
)
SELECT VS.INST_ID
, VS.sid
, SERIAL# AS serial
, VS.SQL_ID
, VS.USERNAME AS username
, CAST ( VS.sql_exec_start AS TIMESTAMP ) AS exec_start
, VS.MACHINE AS machine
, VS.OSUSER AS os_user
, LOWER ( VS.STATUS ) AS Status
, vs.module AS Module
, round(T.ELAPSED_TIME / 1000000 / 3600, 2) AS Run_Time_Hours
, round(T.ELAPSED_TIME / 1000000 / 60, 2) AS Run_Time_Minutes
, round(T.ELAPSED_TIME / 1000000 , 2) AS Run_Time_Sec
, T.SQL_FULLTEXT AS sql_text
, 'ALTER SYSTEM KILL SESSION ' || CHR ( 39 ) || TO_CHAR ( VS.sid ) || ', ' || SERIAL# ||', @' || INST_ID || CHR ( 39 ) || 'IMMEDIATE;'
AS killer
, ROW_NUMBER ( ) OVER ( PARTITION BY VS.sid, SERIAL#, VS.SQL_ID ORDER BY VS.sid, SERIAL#, VS.SQL_ID ) AS Seq
FROM vs
LEFT JOIN v$sql t
ON vs.SQL_ID = t.SQL_id
) ses
WHERE ses.seq = 1
AND ses.username in ('SYS', 'oracle')
OR ses.OS_USER = 'oracle'
OR ses.Module = 'DBMS_SCHEDULER'
ORDER BY ses.SID DESC, ses.EXEC_START nulls last ;
Thanks again and best regards :)