0

EMON 进程 和 WAIT FOR EMON TO PROCESS NTFNS 等待事件

eygle 2019-09-12
966

有朋友在墨天轮的提问区,提出一个问题,EMON 进程是什么,为什么阻塞了其他进程,并且消耗了很高的资源。

EMONWait.jpg


在数据库的等待事件中,你可能看到:wait for EMON to process ntfns 。这里的 ntfns ,让人很容易想到 ntfs ,但是,它没有这个意思。


首先 EMON 进程是 事件监控进程,以大量子进程形式存在 EMNC 进程是协调进程,Ennn 是从属进程。

V$EMON 记录了所有子进程(Slave Process)的使用情况。在操作系统的进程名称类似 e001 ,e002 这样。

文档记录其作用是:执行数据库事件管理和通知 (Performs database event management and notifications)。


两段说明:

EMNC coordinates event management and notification activity in the database, including Streams Event Notifications, Continuous Query Notifications, and Fast Application Notifications.

Ennn The database event management and notification load is distributed among the EMON slave processes. These processes work on the system notifications in parallel, offering a capability to process a larger volume of notifications, a faster response time, and a lower shared memory use for staging notifications.


在 11.2.0.4 到 12.1.0.2版本遇到这个问题,可能是因为一个BUG。可以参考 MOS 文档中的描述:

Users Blocked and Waiting on 'Wait for EMON to Process Ntfns' When Using DCN (文档 ID 1257264.1)
   

SYMPTOMS

Sessions getting blocked by a Database Change Notification (DCN) subscriber on wait event “Wait for EMON to process ntfns”.

CHANGES

Implemented Database Change Notification (DCN) through JDBC clients.

CAUSE

The issue occurs only with regular notifications. When the rate of enqueue is faster than the rate at which the EMON can process, the channel gets filled and enqueuer will be waiting for the channel to get freed by EMON. 

As such notifications do not spill and when the buffer is full, flow control kicks off and prevents EMON to send new notifications until there is more buffer to process pending notifications. This blocks other sessions doing DMLs against subscribed table on 'Wait for EMON to process ntfns'. 


SOLUTION

This is an expected behavior and Enhancement Request 9735536 has been logged to provide an interface to identify and remove the slow DCN client through the view v$subscr_registration_stats.

It provides additional data statistics on v$subscr_registration_stats in order to identify a potential slow DCN using regular notifications.

This enhancement is available for database release 12.1 and via back-port for previous supported releases. See Doc ID 9735536.8 for more details.

Once the enhancement patch is in place or if using a database version that contains such enhancement already, you need to enable the feature by setting two underscore parameters:

       Important: The database should be bounced in order for the parameters change to take in place as these are not dynamic ones.

 

i. The _client_enable_auto_unregister (default value is FALSE), you need to set to TRUE, for example:

conn / as sysdba
alter system set "_client_enable_auto_unregister" = TRUE scope=spfile sid='*';

 Note: The "_client_enable_auto_unregister" parameter is not required if patched database is 11.2.0.3 or lower. It is activated by default. The user will correctly get error ORA-02065: "illegal option for ALTER SYSTEM", if trying to set it.

 

 ii. And _emon_send_timeout (default value is 10000 milliseconds). You will change this only if you need EMON to check in an interval other than every 10 seconds, for example, to define once a minute:

alter system set "_emon_send_timeout" = 60000 scope=spfile sid='*';

 

 After the bounce you can check the changes are correct using this query:

set line 100
col Parameter for a50
col "Session Value" for a20
col "Instance Value" for a20

SELECT a.ksppinm "Parameter",b.ksppstvl "Session Value",c.ksppstvl "Instance Value" FROM x$ksppi a, x$ksppcv b, x$ksppsv c WHERE a.indx = b.indx AND a.indx = c.indx AND a.ksppinm in ( '_client_enable_auto_unregister', '_emon_send_timeout' )
/

 


最后修改时间:2019-09-12 18:18:19
「喜欢文章,快来给作者赞赏墨值吧」
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

评论