DBMS_NETMON

DBMS_NETMON package provides a set of functions and procedures to set up network monitoring service and show statistics of network actions.

DBMS_NETMON Overview

You can use the functions and procedures contained in the DBMS_NETMON package to configure network services and monitor network statistics.

The NMON service has three categories of services:

Each category has two types:

Each service category and service type can be represented by a numeric value or by a constant provided in the DBMS_NETMON package.

DBMS_NETMON Security Model

The DBMS_NETMON package consists of a number of networking related subprograms.

Oracle Database installs this package in the SYS schema. The EXECUTE privilege is granted to users with the DBA role and should not be extended to general users.

DBMS_NETMON Constants

The DBMS_NETMON package defines various constants for specifying parameter values.

NMON has three categories of services starting in release 26ai:

Table 1 DBMS_NETMON

Name Type Value Description
ALL_SERVICES BINARY_INTEGER 0 Represents all services.
SYSTEM_SERVICE BINARY_INTEGER 1 Represents the system service.
IPIF_SERVICE BINARY_INTEGER 2 Represents the IPIF service.
FLOW_SERVICE BINARY_INTEGER 3 Represents the flow service.

Table 2 DBMS_NETMON Constants-Service Type

Name Type Value Description
EVENTS_AND_STATS_TYPE SERVICE_TYPE 0 Represents both events service and statistics service.
EVENTS_TYPE SERVICE_TYPE 1 Represents the events service.
STATS_TYPE SERVICE_TYPE 2 Represents the statistics service.

Summary of DBMS_NETMON Subprograms

This table lists the DBMS_NETMON subprograms and briefly describes them.

Table 3 DBMS_NETMON Package

Subprogram Description
CONFIG_CLIENT Enables or disables the client which is on a specific service.
CONFIG_SERVICE Enables or disables the specified service.
DUMP_HISTORICAL_STATS Dumps the last N seconds of historical statistics to the NMON trace file or all historical statistics if 0 is specified.
SHOW_CLIENT_STATUS Returns the status of the specified client.
SHOW_SERVICE_STATUS Returns the status of all NMON services.

CONFIG_CLIENT Procedure

The CONFIG_CLIENT procedure enables or disables the client which is on a specific service.

Syntax

DBMS_NETMON.CONFIG_CLIENT ( client_id      IN BINARY_INTEGER DEFAULT NULL,
                            service_cat    IN BINARY_INTEGER,
                            service_type   IN BINARY_INTEGER,
                            enable_svc     IN BOOLEAN,
                            stats_interval IN BINARY_INTEGER DEFAULT 0 );

Parameters

Table 4 CONFIG_CLIENT Procedure

Parameter Description
client_id Specifies the ID of the client to be configured. The default is NULL indicating all clients.
service_cat The services to configure for the client.
service_type The events or statistics to configure for the client.
enable_svc Boolean value indicating whether to enable or disable the specified category and type.
stats_interval The statistics interval specified in deciseconds.

Usage Notes

If you specify NULL for the CLIENT_ID, the configuration will apply to all clients.

Examples

The following example illustrates how to disable events for all clients:

SQL> execute dbms_netmon.config_client(null, dbms_netmon.all_services, dbms_netmon.events_type, FALSE, 0);

The following example illustrates how to enable the IPIF service for client 2 with a 4 minute interval:

SQL> execute (2, dbms_netmon.ipif_service, dbms_netmon.stats_type, TRUE, 2400);

CONFIG_SERVICE Procedure

The CONFIG_SERVICE procedure enables or disables the specified service.

Syntax

DBMS_NETMON.CONFIG_SERVICE ( service_cat    IN BINARY_INTEGER,
                             service_type   IN BINARY_INTEGER,
                             enable_svc     IN boolean );

Parameters

Table 5 CONFIG_SERVICE Procedure

Parameter Description
service_cat The services to enable or disable.
service_type The events or statistics to configure for the service.
enable_svc Boolean value indicating whether to enable or disable the specified category and type.

Usage Notes

Only the flow service offers configuration options at the PDB level. All other services are exclusively managed by CDB administrators.

Examples

The following example illustrates how to disable events for the IPIF service:

SQL> execute dbms_netmon.config_service(dbms_netmon.ipif_service, dbms_netmon.events_type, FALSE);

DUMP_HISTORICAL_STATS Procedure

The DUMP_HISTORICAL_STATS procedure dumps the last N seconds of historical statistics to the NMON trace file or all historical statistics if 0 is specified.

Syntax

DBMS_NETMON.DUMP_HISTORICAL_STATS ( last_second IN BINARY INTEGER DEFAULT 0 );

Parameters

Table 6 DUMP_HISTORICAL_STATS

Parameter Description
last_second The number of seconds of historical statistics to dump. The default is 0 indicating all historical statistics.

Examples

The following example illustrates how to dump historical statistics for the past hour to the NMON trace file:

SQL> execute dbms_netmon.dump_historical_stats(3600);

SHOW_CLIENT_STATUS Function

The SHOW_CLIENT_STATUS function returns the status of the specified client.

Syntax

DBMS_NETMON.SHOW_CLIENT_STATUS( client_id    IN BINARY_INTEGER DEFAULT NULL,
                                service_cat  IN BINARY_INTEGER );

Parameters

Table 7 SHOW_CLIENT_STATUS Function

Parameter Description
client_id Specifies the ID of the client. The default is NULL indicating all clients.
service_cat The service category.

Usage Notes

The SHOW_CLIENT_STATUS function returns a CLOB containing a list of JSONs as follows:

[{"Id":Client's id,"Name":"Client's name","Event":0 or 1,"Stats":0 or 1,"Interval":Number}]

Examples

The following example illustrates how to show the status of all IPIF clients within an anonymous PL/SQL block:

set serveroutput on;
DECLARE
  client_status VARCHAR2;
BEGIN
  SELECT dbms_netmon.show_client_status(null, dbms_netmon.ipif_service) INTO client_status;
  dbms_output.put_line(client_status);
END;
/

SHOW_SERVICE_STATUS Function

The SHOW_SERVICE_STATUS function returns the status of all NMON services at the CDB level.

Syntax

DBMS_NETMON.SHOW_SERVICE_STATUS( client_id    IN BINARY_INTEGER DEFAULT NULL,
                                 service_cat  IN BINARY_INTEGER );

Parameters

Table 8 SHOW_SERVICE_STATUS Function

Parameter Description
client_id The client id. The default is NULL, meaning all clients.
service_cat The services category. The default is all services.

Usage Notes

The SHOW_CLIENT_STATUS function returns a VARCHAR2 containing a list of JSONs as follows:

[{"Service":"Service Name","Type":"Event or Stats","Enabled":0 or 1}]

Examples

The following example illustrates how to sshow the status of the system service within an anonymous PL/SQL block:

set serveroutput on;
DECLARE
  v_service_status VARCHAR2;
BEGIN
  SELECT dbms_netmon.show_service_status(dbms_netmon.system_service) INTO v_service_status;
  dbms_output.put_line(v_service_status);
END;
/