Rem
Rem $Header: empp/source/oracle/sysman/emdrep/sql/pp/latest/paf/paf_post_creation_102042.sql /st_empp_10.2.0.4.2db11.2/2 2009/05/14 23:15:57 rahgupta Exp $
Rem
Rem paf_post_creation_102042.sql
Rem
Rem Copyright (c) 2008, 2009, Oracle and/or its affiliates. 
Rem All rights reserved. 
Rem
Rem    NAME
Rem      paf_post_creation_102042.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    rahgupta    10/27/08 - Created
Rem

-- Register paf notification rule and pl/sql device.
BEGIN
  MGMT_PAF_NOTIF.UNREG_NOTIF;
EXCEPTION WHEN OTHERS THEN NULL;

END;
/

@&EM_SQL_ROOT/pp/latest/paf/paf_job_delete.sql

DECLARE
  l_mode VARCHAR2(32);
  l_inst_count NUMBER(5);
  l_count NUMBER(2);
BEGIN

  select component_mode into l_mode
  from mgmt_versions
  where upper(component_name) = 'CORE';

  select count(*) into l_inst_count 
  from mgmt_paf_instances i, mgmt_paf_states s 
  where i.instance_guid = s.instance_guid 
    and s.state_type = 0 
    and s.status not in ( 5, 8 );

  select count(*) into l_count 
  from mgmt_parameters 
  where parameter_name = 'em.paf.daemon.enable';

  if ( l_count = 0 and l_inst_count = 0 and l_mode = 'SYSAUX' )
  THEN
    INSERT INTO MGMT_PARAMETERS VALUES ( 'em.paf.daemon.enable', 'false' , '' , 1);
  END IF;

END;
/