Oracle DBMS_HA_ALERTS
Version 12.1.0.2

General Information
Library Note Morgan's Library Page Footer
The Library is currently in the process of being upgraded from Oracle Database Version 12.1.0.1 to 12.1.0.2. Demos are being upgraded to reflect the new Container paradigm as well as EBR (Edition Based Redefinition) and may contain references to CDBs, PDBs, and other objects you may not be familiar with such as CDB_OBJECTS_AE: Welcome to 12c.

Interested in Oracle GoldenGate? Check out the IGGOUG,
Purpose This package is an API for Fast Application Notification (FAN) events which are part of RAC, CMAN, and Net Services Listeners.

What is posted here is for informational purposes only and we actively encourage you NOT to use it in any manner as it may do damage, it may violate your license with Oracle, and we thought it a great idea to tell you not to do it for the benefit of all concerned. Thus the following information is here for purely educational purposes: Nothing more.
AUTHID DEFINER
Data Types CREATE OR REPLACE TYPE "SYS"."ALERT_TYPE" AS OBJECT (
timestamp_originating   TIMESTAMP WITH TIME ZONE,
organization_id         VARCHAR2(10),
component_id            VARCHAR2(3),
message_id              NUMBER,
hosting_client_id       VARCHAR2(64),
message_type            VARCHAR2(12),
message_group           VARCHAR2(30),
message_level           NUMBER,
host_id                 VARCHAR2(256),
host_nw_addr            VARCHAR2(256),
module_id               VARCHAR2(50),
process_id              VARCHAR2(128),
user_id                 VARCHAR2(30),
upstream_component_id   VARCHAR2(30),
downstream_component_id VARCHAR2(4),
execution_context_id    VARCHAR2(128),
error_instance_id       VARCHAR2(142),
reason_argument_count   NUMBER,
reason_argument_1       VARCHAR2(513),
reason_argument_2       VARCHAR2(513),
reason_argument_3       VARCHAR2(513),
reason_argument_4       VARCHAR2(513),
reason_argument_5       VARCHAR2(513),
sequence_id             NUMBER,
reason_id               NUMBER,
object_owner            VARCHAR2(30),
object_name             VARCHAR2(513),
subobject_name          VARCHAR2(30),
object_type             VARCHAR2(30),
instance_name           VARCHAR2(16),
instance_number         NUMBER,
scope                   VARCHAR2(10),
advisor_name            VARCHAR2(30),
metric_value            NUMBER,
suggested_action_msg_id NUMBER,
action_argument_count   NUMBER,
action_argument_1       VARCHAR2(30),
action_argument_2       VARCHAR2(30),
action_argument_3       VARCHAR2(30),
action_argument_4       VARCHAR2(30),
action_argument_5       VARCHAR2(30)
pdb_name                VARCHAR2(128));
/
Dependencies
ALERT_TYPE DBMS_HA_ALERT_LIB  
Documented No
First Available 10g
Security Model Owned by SYS with no privileges granted
Source {ORACLE_HOME}/rdbms/admin/dbmshae.sql
Subprograms
 
GET_CARDINALITY
The number of service members that are currently active; included in all UP events dbms_ha_alerts.get_cardinality(alert IN ALERT_TYPE) RETURN BINARY_INTEGER;
conn / as sysdba

show con_name

DECLARE
 x alert_type := alert_type(NULL, NULL, NULL, NULL, NULL, NULL,
    NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
    NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
    NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
    NULL, NULL, NULL, NULL, NULL, 'CDB$ROOT');

 v VARCHAR2(4000);
BEGIN
  x.timestamp_originating := SYSTIMESTAMP;
  x.message_level := 1;
  x.instance_name := 'oradata';
  x.instance_number := 1;
  x.advisor_name := 'Default Advisor';

  v := dbms_ha_alerts.get_cardinality(x);
  dbms_output.put_line('-' || v || '-');
  dbms_output.put_line(x.upstream_component_id);
END;
/
 
GET_DB_DOMAIN
Used by: All events except node down dbms_ha_alerts.get_db_domain(alert IN ALERT_TYPE) RETURN VARCHAR2;
conn / as sysdba

show con_name

DECLARE
 x alert_type := alert_type(NULL, NULL, NULL, NULL, NULL, NULL,
    NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
    NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
    NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
    NULL, NULL, NULL, NULL, NULL, 'CDB$ROOT');

 v VARCHAR2(4000);
BEGIN
  x.timestamp_originating := SYSTIMESTAMP;
  x.message_level := 1;
  x.instance_name := 'oradata';
  x.instance_number := 1;
  x.advisor_name := 'Default Advisor';

  v := dbms_ha_alerts.get_db_domain(x);
  dbms_output.put_line('-' || v || '-');
  dbms_output.put_line(x.upstream_component_id);
END;
/
 
GET_DB_UNIQUE_NAME
The unique database supporting the service dbms_ha_alerts.get_db_unique_name(alert IN ALERT_TYPE) RETURN VARCHAR2;
conn / as sysdba

show con_name

DECLARE
 x alert_type := alert_type(NULL, NULL, NULL, NULL, NULL, NULL,
    NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
    NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
    NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
    NULL, NULL, NULL, NULL, NULL, 'CDB$ROOT');

 v VARCHAR2(4000);
BEGIN
  x.timestamp_originating := SYSTIMESTAMP;
  x.message_level := 1;
  x.instance_name := 'oradata';
  x.instance_number := 1;
  x.advisor_name := 'Default Advisor';

  v := dbms_ha_alerts.get_db_unique_name(x);
  dbms_output.put_line('-' || v || '-');
  dbms_output.put_line(x.upstream_component_id);
END;
/
 
GET_EVENT_TIME
Returns the time at which an event occured dbms_ha_alerts.get_event_time(alert IN ALERT_TYPE)
RETURN TIMESTAMP WITH TIME ZONE;
conn / as sysdba

show con_name

DECLARE
 x alert_type := alert_type(NULL, NULL, NULL, NULL, NULL, NULL,
    NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
    NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
    NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
    NULL, NULL, NULL, NULL, NULL, 'CDB$ROOT');

 v VARCHAR2(4000);
BEGIN
  x.timestamp_originating := SYSTIMESTAMP;
  x.message_level := 1;
  x.instance_name := 'oradata';
  x.instance_number := 1;
  x.advisor_name := 'Default Advisor';

  v := dbms_ha_alerts.get_event_time(x);
  dbms_output.put_line('-' || v || '-');
  dbms_output.put_line(x.upstream_component_id);
END;
/
 
GET_HOST
Used by: Node down, and instance, service member, service preconnect, and ASM instance up/down events dbms_ha_alerts.get_host(alert IN ALERT_TYPE) RETURN VARCHAR2;
conn / as sysdba

show con_name

DECLARE
 x alert_type := alert_type(NULL, NULL, NULL, NULL, NULL, NULL,
    NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
    NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
    NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
    NULL, NULL, NULL, NULL, NULL, 'CDB$ROOT');

 v VARCHAR2(4000);
BEGIN
  x.timestamp_originating := SYSTIMESTAMP;
  x.message_level := 1;
  x.instance_name := 'oradata';
  x.instance_number := 1;
  x.advisor_name := 'Default Advisor';

  v := dbms_ha_alerts.get_host(x);
  dbms_output.put_line('-' || v || '-');
  dbms_output.put_line(x.upstream_component_id);
END;
/
 
GET_INCARNATION
For node DOWN events; the new cluster incarnation dbms_ha_alerts.get_incarnation(alert IN ALERT_TYPE) RETURN VARCHAR2;
conn / as sysdba

show con_name

DECLARE
 x alert_type := alert_type(NULL, NULL, NULL, NULL, NULL, NULL,
    NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
    NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
    NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
    NULL, NULL, NULL, NULL, NULL, 'CDB$ROOT');

 v VARCHAR2(4000);
BEGIN
  x.timestamp_originating := SYSTIMESTAMP;
  x.message_level := 1;
  x.instance_name := 'oradata';
  x.instance_number := 1;
  x.advisor_name := 'Default Advisor';

  v := dbms_ha_alerts.get_incarnation(x);
  dbms_output.put_line('-' || v || '-');
  dbms_output.put_line(x.upstream_component_id);
END;
/
 
GET_INSTANCE
The name of the instance that supports the service dbms_ha_alerts.get_instance(alert IN ALERT_TYPE) RETURN VARCHAR2;
conn / as sysdba

show con_name

DECLARE
 x alert_type := alert_type(NULL, NULL, NULL, NULL, NULL, NULL,
    NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
    NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
    NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
    NULL, NULL, NULL, NULL, NULL, 'CDB$ROOT');

 v VARCHAR2(4000);
BEGIN
  x.timestamp_originating := SYSTIMESTAMP;
  x.message_level := 1;
  x.instance_name := 'oradata';
  x.instance_number := 1;
  x.advisor_name := 'Default Advisor';

  v := dbms_ha_alerts.get_instance(x);
  dbms_output.put_line('-' || v || '-');
  dbms_output.put_line(x.upstream_component_id);
END;
/
 
GET_REASON
Returns Failure, Dependency, User, Autostart, or Restart dbms_ha_alerts.get_reason(alert IN ALERT_TYPE) RETURN VARCHAR2;
conn / as sysdba

show con_name

DECLARE
 x alert_type := alert_type(NULL, NULL, NULL, NULL, NULL, NULL,
    NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
    NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
    NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
    NULL, NULL, NULL, NULL, NULL, 'CDB$ROOT');

 v VARCHAR2(4000);
BEGIN
  x.timestamp_originating := SYSTIMESTAMP;
  x.message_level := 1;
  x.instance_name := 'oradata';
  x.instance_number := 1;
  x.advisor_name := 'Default Advisor';

  v := dbms_ha_alerts.get_reason(x);
  dbms_output.put_line('-' || v || '-');
  dbms_output.put_line(x.upstream_component_id);
END;
/
 
GET_SERVICE
The service name; matches the service in DBA_SERVICES dbms_ha_alerts.get_service(alert IN ALERT_TYPE) RETURN VARCHAR2;
conn / as sysdba

show con_name

DECLARE
 x alert_type := alert_type(NULL, NULL, NULL, NULL, NULL, NULL,
    NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
    NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
    NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
    NULL, NULL, NULL, NULL, NULL, 'CDB$ROOT');

 v VARCHAR2(4000);
BEGIN
  x.timestamp_originating := SYSTIMESTAMP;
  x.message_level := 1;
  x.instance_name := 'oradata';
  x.instance_number := 1;
  x.advisor_name := 'Default Advisor';

  v := dbms_ha_alerts.get_service(x);
  dbms_output.put_line('-' || v || '-');
  dbms_output.put_line(x.upstream_component_id);
END;
/
 
GET_SEVERITY
The severity of the HA alert dbms_ha_alerts.get_severity(alert IN ALERT_TYPE) RETURN BINARY_INTEGER;
conn / as sysdba

show con_name

DECLARE
 x alert_type := alert_type(NULL, NULL, NULL, NULL, NULL, NULL,
    NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
    NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
    NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
    NULL, NULL, NULL, NULL, NULL, 'CDB$ROOT');

 v VARCHAR2(4000);
BEGIN
  x.timestamp_originating := SYSTIMESTAMP;
  x.message_level := 1;
  x.instance_name := 'oradata';
  x.instance_number := 1;
  x.advisor_name := 'Default Advisor';

  v := dbms_ha_alerts.get_severity(x);
  dbms_output.put_line('-' || v || '-');
  dbms_output.put_line(x.upstream_component_id);
END;
/
 
GET_VERSION
Undocumented dbms_ha_alerts.get_version(alert IN ALERT_TYPE) RETURN VARCHAR2;
conn / as sysdba

show con_name

DECLARE
 x alert_type := alert_type(NULL, NULL, NULL, NULL, NULL, NULL,
    NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
    NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
    NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
    NULL, NULL, NULL, NULL, NULL, 'CDB$ROOT');

 v VARCHAR2(4000);
BEGIN
  x.timestamp_originating := SYSTIMESTAMP;
  x.message_level := 1;
  x.instance_name := 'oradata';
  x.instance_number := 1;
  x.advisor_name := 'Default Advisor';

  v := dbms_ha_alerts.get_version(x);
  dbms_output.put_line('-' || v || '-');
  dbms_output.put_line(x.upstream_component_id);
END;
/

Related Topics
DBMS_HA_ALERTS_PRVT
DBMS_SERVER_ALERT
Packages
RAC

Morgan's Library Page Footer
This site is maintained by Dan Morgan. Last Updated: This site is protected by copyright and trademark laws under U.S. and International law. © 1998-2014 Daniel A. Morgan All Rights Reserved