Rem
Rem $Header: emcore/source/oracle/sysman/emdrep/sql/core/11.2.0.1/system/system_ng_types.sql rbali_oneoff_updated/1 2025/03/14 06:41:13 rbali Exp $
Rem
Rem system_ng_types.sql
Rem
Rem Copyright (c) 2010, 2025, Oracle and/or its affiliates. 
Rem All rights reserved.

Rem BEGIN EMRU_FILE_METADATA
Rem EMRU_SOURCE_FILE:emcore/source/oracle/sysman/emdrep/sql/core/11.2.0.1/system/system_ng_types.sql
Rem EMRU_UNIX_DELIVERABLES:
Rem emcore/source/oracle/sysman/emdrep/sql/core/11.2.0.1/system/system_ng_types.sql

Rem EMRU_FILE_POSTINSTALL:<!!! enter the view based location of the executable file. If there is NONE leave as-is !!!>
Rem EMRU_GENERIC_FLAG:NONE
Rem END EMRU_FILE_METADATA

Rem
Rem    NAME
Rem      system_ng_types.sql - <one-line expansion of the name>
Rem
Rem    DESCRIPTION
Rem      <short description of component this file declares/defines>
Rem
Rem    NOTES
Rem      <other useful comments, qualifications, etc.>
Rem
Rem    MODIFIED   (MM/DD/YY)
Rem    gbafna      01/07/25 - make synonyms noneditionable
Rem    rnadidar    02/11/15 - cut over to EBR
Rem    sparyha     07/08/11 - Create type - array of em_system_event_obj
Rem    gan         05/07/10 - add AQ
Rem    gan         03/02/10 - Created
Rem

CREATE OR REPLACE TYPE MGMT_SYSTEM_RULE_PROP IS OBJECT
(
  property_name VARCHAR2(256),
  property_value VARCHAR2(256)
);
/
show errors;

CREATE OR REPLACE TYPE MGMT_SYSTEM_RULE_PROP_LIST 
    IS TABLE OF MGMT_SYSTEM_RULE_PROP;
/

CREATE OR REPLACE TYPE MGMT_SYSTEM_PATH_SEG IS OBJECT
(
  source_type VARCHAR2(256),
  assoc_type  VARCHAR2(256),
  destination_type VARCHAR2(256),
  is_required NUMBER(1),   -- only needed for definition rule
  is_for_availability NUMBER(1),
  pull_sub_system NUMBER(1), -- whether pull in the members of       destination if the destination is a system
  properties  MGMT_SYSTEM_RULE_PROP_LIST -- only needed for availability
);
/
show errors;

CREATE OR REPLACE TYPE MGMT_SYSTEM_PATH
  IS TABLE OF MGMT_SYSTEM_PATH_SEG;
/
 
  
CREATE OR REPLACE TYPE MGMT_SYSTEM_PATH_LIST 
  IS TABLE OF MGMT_SYSTEM_PATH;
/

CREATE OR REPLACE TYPE MGMT_SYSTEM_TYPE_ALIAS_OBJ IS OBJECT
(
   type_alias VARCHAR2(256),
   me_types MGMT_MEDIUM_STRING_TABLE
);
/
show errors;

CREATE OR REPLACE TYPE MGMT_SYSTEM_TYPE_ALIAS_LIST
   IS TABLE OF MGMT_SYSTEM_TYPE_ALIAS_OBJ;
/
show errors;
  

Rem 
Rem object to represent the event which requires system sync-up
Rem EVENT_CODE : 0 for system creation
Rem              1 for association addition
Rem              2 for association deletion
Rem              3 for association property change
Rem SOURCE_ME : guid for source ME, when EVENT code is 1,2,3. When EVENT 
Rem             code is 0, it is the guid for the system
Rem DEST_ME   : guid for destination ME when code is 1,2,3. Not used when
Rem             code is 0

ALTER SESSION SET CURRENT_SCHEMA=SYSMAN_TYPES;

CREATE OR REPLACE TYPE em_system_event_obj IS OBJECT
(
   event_code NUMBER(1),
   source_me  RAW(16),
   assoc_type VARCHAR2(256),
   dest_me    RAW(16)
);
/

grant execute on em_system_event_obj to sysman;

create or replace noneditionable synonym SYSMAN.em_system_event_obj for em_system_event_obj;


ALTER SESSION SET CURRENT_SCHEMA=SYSMAN;

CREATE OR REPLACE TYPE em_system_event_list IS
  TABLE OF em_system_event_obj;
/
show errors;

Rem create AQ
BEGIN
  DBMS_AQADM.CREATE_QUEUE_TABLE(
      queue_table => '&EM_REPOS_USER'||'.EM_SYSTEM_EVENT_QTABLE',
      sort_list => 'PRIORITY,ENQ_TIME',
      queue_payload_type=>'&EM_REPOS_USER'||'_TYPES.EM_SYSTEM_EVENT_OBJ');
  DBMS_AQADM.CREATE_QUEUE(
      queue_name=>'&EM_REPOS_USER'||'.EM_SYSTEM_EVENT_Q',
      queue_table=>'&EM_REPOS_USER'||'.EM_SYSTEM_EVENT_QTABLE',
      max_retries=>10,
      retry_delay=>0,
      retention_time=>0);
  DBMS_AQADM.START_QUEUE(queue_name=>'&EM_REPOS_USER'||'.EM_SYSTEM_EVENT_Q');
  COMMIT;
END;
/
show errors;



