Q Processes take more and more memory and does not release the memory.
pga_aggregate_limit=0 allows pga to grow unlimited hence the Q processes can consume all server memory.
Temporary workaround is to reset the AQ slaves so that it is not necessary to shutdown/startup the db instance
show parameter aq_tm_processes
--Reset AQ slaves:
connect / as sysdba
alter system set aq_tm_processes=0 scope=memory sid='*' ;
--delete AQ SESSIONS
SELECT 'ALTER SYSTEM KILL SESSION ' || CHR(39) || SID || ',' || SERIAL# || CHR(39) || ' IMMEDIATE;'
FROM V$SESSION
WHERE TYPE = 'BACKGROUND' AND MODULE = 'Streams' AND ACTION LIKE 'EMON%' AND EVENT = 'EMON slave idle wait'
ORDER BY SID, SERIAL#;
--Start back AQ slaves:
connect / as sysdba
alter system set aq_tm_processes=1 scope=memory sid='*';
Queries to Monitor Q Processes.
--PGA Memory Stat
SELECT name, round(((value/1000)/1024),2) as value_mb, round((((value/1000)/1024)/1024),2) as value_gb FROM V$PGASTAT;
--Find the Q Processes
SELECT SID,SERIAL#,OSUSER,PROCESS,MACHINE,PROGRAM,TYPE,MODULE,ACTION,EVENT
FROM V$SESSION
WHERE TYPE = 'BACKGROUND' AND MODULE = 'Streams' AND ACTION LIKE 'EMON%' AND EVENT = 'EMON slave idle wait'
ORDER BY SID, SERIAL#;
--ALTER SYSTEM KILL SESSION 'sid,serial#' IMMEDIATE;
SELECT 'ALTER SYSTEM KILL SESSION ' || CHR(39) || SID || ',' || SERIAL# || CHR(39) || ' IMMEDIATE;'
FROM V$SESSION
WHERE TYPE = 'BACKGROUND' AND MODULE = 'Streams' AND ACTION LIKE 'EMON%' AND EVENT = 'EMON slave idle wait'
ORDER BY SID, SERIAL#;
--03-memory-usage-in-details.sql - Q Processes
select
to_char(ssn.sid, '999999') as session_id,
ssn.serial# as session_serial,
nvl(ssn.username, nvl(bgp.name, 'background'))
|| '::'
|| nvl(lower(ssn.machine), ins.host_name) as process_name,
to_char(prc.spid, '999999999') as pid_thread,
to_char((se1.value / 1024) / 1024, '999g999g990d00') as current_size_mb,
to_char((se2.value / 1024) / 1024, '999g999g990d00') as maximum_size_mb
from
v$statname stat1,
v$statname stat2,
v$session ssn,
v$sesstat se1,
v$sesstat se2,
v$bgprocess bgp,
v$process prc,
v$instance ins
where
stat1.name = 'session pga memory'
and stat2.name = 'session pga memory max'
and se1.sid = ssn.sid
and se2.sid = ssn.sid
and se2.statistic# = stat2.statistic#
and se1.statistic# = stat1.statistic#
and ssn.paddr = bgp.paddr (+)
and ssn.paddr = prc.addr (+)
and ssn.sid in (
select sid
from v$session
--where username = 'MY_USERNAME' -- your user/schema name
where type = 'BACKGROUND' and module = 'Streams' and action like 'EMON%' and event = 'EMON slave idle wait'
)
order by
maximum_size_mb desc;
Check also that AQ_SRVNTFN_TABLE_1 is set to dequeue. It is possible that DEQUEUE_ENABLED is set to NO.
AQ_SRVNTFN_TABLE_1
ENQUEUE_ENABLE=YES
DEQUEUE_ENABLED=NO
confirm the status of the queue:
-- Workaround to apply on all CDB and PDB
select ENQUEUE_ENABLED, DEQUEUE_ENABLED from dba_queues where NAME = 'AQ_SRVNTFN_TABLE_Q_1';
select owner, name, queue_table, ENQUEUE_ENABLED, DEQUEUE_ENABLED
from dba_queues where name = 'AQ_SRVNTFN_TABLE_Q_1' and owner='SYS';
exec dbms_aqadm.stop_queue( 'AQ_SRVNTFN_TABLE_Q_1', true , true );
exec dbms_aqadm.start_queue( 'AQ_SRVNTFN_TABLE_Q_1' , true, true );