MINI MINI MANI MO

Path : /opt/oracle/product/18c/dbhomeXE/md/admin/
File Upload :
Current File : //opt/oracle/product/18c/dbhomeXE/md/admin/sdordfsa_rm.sql

Rem
Rem $Header: sdo/admin/sdordfsa_rm.sql /main/14 2017/07/05 11:00:13 rjanders Exp $
Rem
Rem sdordfsa_rm.sql
Rem
Rem Copyright (c) 2008, 2017, Oracle and/or its affiliates. 
Rem All rights reserved.
Rem
Rem    NAME
Rem      sdordfsa_rm.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    BEGIN SQL_FILE_METADATA
Rem    SQL_SOURCE_FILE: sdo/admin/sdordfsa_rm.sql
Rem    SQL_SHIPPED_FILE: md/admin/sdordfsa_rm.sql
Rem    SQL_PHASE: DOWNGRADE
Rem    SQL_STARTUP_MODE: NORMAL
Rem    SQL_IGNORABLE_ERRORS: NONE
Rem    SQL_CALLING_FILE: NONE
Rem    END SQL_FILE_METADATA
Rem
Rem    MODIFIED   (MM/DD/YY)
Rem    rjanders    05/10/17 - #26037683: Raise 'when other' exceptions
Rem    rjanders    04/27/17 - Correct "SQL_PHASE" metadata values
Rem    rjanders    03/23/17 - #25437999: Remove 'when others then NULL'
Rem                           handlers
Rem    rjanders    03/09/17 - Add missing SQL_FILE_METADATA information
Rem    rjanders    03/15/13 - #16473696: Start/End _ORACLE_SCRIPT
Rem                           initialization
Rem    sdas        11/22/10 - XbranchMerge sdas_ng_11.2.0.2.0_11.2.0.3.0 from
Rem                           st_sdo_11.2.0
Rem    sdas        11/22/10 - XbranchMerge sdas_ng_11.2.0.2.0 from
Rem    matperry    08/26/10 - drop sem_rdfsa_const and sem_rdfsa_const_internal
Rem                           packages
Rem    vkolovsk    07/29/10 - XbranchMerge
Rem                           vkolovsk_rdf_ols_set_triple_label_11.2.0.2.0 from
Rem                           st_sdo_11.2.0
Rem    vkolovsk    05/12/10 - drop the sem_ols packages as well
Rem    matperry    05/26/09 - remove WHENEVER SQLERROR EXIT
Rem    matperry    05/12/09 - remove connect as sysdba
Rem    ayalaman    01/28/09 - dml vpd policy for RDF
Rem    sdas        07/28/08 - RDF OLS
Rem    sdas        07/28/08 - Created
Rem

Rem ********************************************************************
Rem #16473696: Indicate Oracle-Supplied object
@@?/rdbms/admin/sqlsessstart.sql
Rem ********************************************************************

--WHENEVER SQLERROR EXIT;

declare
  hasplcy number; 
  table_not_found exception;
  pragma exception_init(table_not_found, -00942);
begin
  select count(*) into hasplcy from sys.dba_policies where 
     object_owner = 'MDSYS' and object_name in 
       ('RDF_LINK$','RDF_SECVALUE$'); 
  if (hasplcy > 0) then 
    raise_application_error(-20000, 'RDF-OLS policy in use : '||
        'Remove OLS policy before uninstalling RDF-OLS support');
  end if; 

  begin
    EXECUTE IMMEDIATE 'select count(*) from mdsys.RDFVPD_POLICIES$' 
       into hasplcy; 
    if (hasplcy > 0) then 
      raise_application_error(-20000, 'RDF-VPD policy exists : '||
        'Drop all VPD policies before uninstalling RDF-VPD support '); 
    end if; 
  exception
    when table_not_found then NULL;
    when others then
      SYS.DBMS_SYSTEM.KSDWRT(SYS.DBMS_SYSTEM.TRACE_FILE,
                             'EXCEPTION[sdordfsa_rm.sql(' || $$PLSQL_LINE || ')1]: ' || SQLERRM); -- RAISE;
  end; 
end;
/

WHENEVER SQLERROR CONTINUE; 

alter session set current_schema = MDSYS; 

declare
  dumvr VARCHAR2(20);  
begin
  begin
    select value into dumvr from mdsys.rdf_parameter
        where namespace = 'COMPONENT' and attribute = 'RDFOLS';
    if (dumvr = 'ENABLED') then
     execute immediate 'begin mdsys.sem_rdfsa_dr.drop_secureaccess_objs(''TRUE''); end;'; 
    end if;
    exception
      when others then
        SYS.DBMS_SYSTEM.KSDWRT(SYS.DBMS_SYSTEM.TRACE_FILE,
                               'EXCEPTION[sdordfsa_rm.sql(' || $$PLSQL_LINE || ')2]: ' || SQLERRM); -- RAISE;
  end;

  begin
    select value into dumvr from mdsys.rdf_parameter
       where namespace = 'COMPONENT' and attribute = 'RDFVPD';
    if (dumvr = 'ENABLED') then
      execute immediate 'begin mdsys.sem_rdfsa_dr.cleanup_vpd_objects; end;'; 
    end if;
  exception
    when no_data_found then NULL;
    when others then
    SYS.DBMS_SYSTEM.KSDWRT(SYS.DBMS_SYSTEM.TRACE_FILE,
                           'EXCEPTION[sdordfsa_rm.sql(' || $$PLSQL_LINE || ')3]: ' || SQLERRM); -- RAISE;
  end;
end;
/

declare
  package_not_found exception;
  pragma exception_init(package_not_found, -04043);
begin
  execute immediate 'drop package mdsys.sem_ols'; 
  exception
    when package_not_found then NULL;
    when others then
      SYS.DBMS_SYSTEM.KSDWRT(SYS.DBMS_SYSTEM.TRACE_FILE,
                             'EXCEPTION[sdordfsa_rm.sql(' || $$PLSQL_LINE || ')4]: ' || SQLERRM); -- RAISE;
end;
/

declare
  synonym_not_found exception;
  pragma exception_init(synonym_not_found, -01432);
begin
  execute immediate 'drop public synonym sem_ols'; 
  exception
    when synonym_not_found then NULL;
    when others then
      SYS.DBMS_SYSTEM.KSDWRT(SYS.DBMS_SYSTEM.TRACE_FILE,
                             'EXCEPTION[sdordfsa_rm.sql(' || $$PLSQL_LINE || ')5]: ' || SQLERRM); -- RAISE;
end;
/

declare
  package_not_found exception;
  pragma exception_init(package_not_found, -04043);
begin
  execute immediate 'drop package mdsys.sem_ols_dr'; 
  exception
    when package_not_found then NULL;
    when others then
      SYS.DBMS_SYSTEM.KSDWRT(SYS.DBMS_SYSTEM.TRACE_FILE,
                             'EXCEPTION[sdordfsa_rm.sql(' || $$PLSQL_LINE || ')6]: ' || SQLERRM); -- RAISE;
end;
/

declare
  package_not_found exception;
  pragma exception_init(package_not_found, -04043);
begin
  execute immediate 'drop package mdsys.sem_rdfsa'; 
  exception
    when package_not_found then NULL;
    when others then
      SYS.DBMS_SYSTEM.KSDWRT(SYS.DBMS_SYSTEM.TRACE_FILE,
                             'EXCEPTION[sdordfsa_rm.sql(' || $$PLSQL_LINE || ')7]: ' || SQLERRM); -- RAISE;
end;
/

declare
  synonym_not_found exception;
  pragma exception_init(synonym_not_found, -01432);
begin
  execute immediate 'drop public synonym sem_rdfsa'; 
  exception
    when synonym_not_found then NULL;
    when others then
      SYS.DBMS_SYSTEM.KSDWRT(SYS.DBMS_SYSTEM.TRACE_FILE,
                             'EXCEPTION[sdordfsa_rm.sql(' || $$PLSQL_LINE || ')8]: ' || SQLERRM); -- RAISE;
end;
/

declare
  package_not_found exception;
  pragma exception_init(package_not_found, -04043);
begin
  execute immediate 'drop package mdsys.sem_rdfsa_dr'; 
  exception
    when package_not_found then NULL;
    when others then
      SYS.DBMS_SYSTEM.KSDWRT(SYS.DBMS_SYSTEM.TRACE_FILE,
                             'EXCEPTION[sdordfsa_rm.sql(' || $$PLSQL_LINE || ')9]: ' || SQLERRM); -- RAISE;
end;
/

declare
  package_not_found exception;
  pragma exception_init(package_not_found, -04043);
begin
  execute immediate 'drop package mdsys.sem_rdfsa_priv'; 
  exception
    when package_not_found then NULL;
    when others then
        SYS.DBMS_SYSTEM.KSDWRT(SYS.DBMS_SYSTEM.TRACE_FILE,
                               'EXCEPTION[sdordfsa_rm.sql(' || $$PLSQL_LINE || ')10]: ' || SQLERRM); -- RAISE;
end;
/

declare
  package_not_found exception;
  pragma exception_init(package_not_found, -04043);
begin
  execute immediate 'drop package mdsys.rdf$lbaclab'; 
  exception
    when package_not_found then NULL;
    when others then
      SYS.DBMS_SYSTEM.KSDWRT(SYS.DBMS_SYSTEM.TRACE_FILE,
                             'EXCEPTION[sdordfsa_rm.sql(' || $$PLSQL_LINE || ')11]: ' || SQLERRM); -- RAISE;
end;
/

declare
  package_not_found exception;
  pragma exception_init(package_not_found, -04043);
begin
  execute immediate 'drop package mdsys.sem_rdfsa_const'; 
  exception
    when package_not_found then NULL;
    when others then
      SYS.DBMS_SYSTEM.KSDWRT(SYS.DBMS_SYSTEM.TRACE_FILE,
                             'EXCEPTION[sdordfsa_rm.sql(' || $$PLSQL_LINE || ')12]: ' || SQLERRM); -- RAISE;
end;
/

declare
  package_not_found exception;
  pragma exception_init(package_not_found, -04043);
begin
  execute immediate 'drop package mdsys.sem_rdfsa_const_internal'; 
  exception
    when package_not_found then NULL;
    when others then
      SYS.DBMS_SYSTEM.KSDWRT(SYS.DBMS_SYSTEM.TRACE_FILE,
                             'EXCEPTION[sdordfsa_rm.sql(' || $$PLSQL_LINE || ')13]: ' || SQLERRM); -- RAISE;
end;
/

declare
  object_not_found exception;
  pragma exception_init(object_not_found, -04043);
begin
  execute immediate 'drop type mdsys.rdf$domsalabel'; 
  exception
    when object_not_found then NULL;
    when others then
      SYS.DBMS_SYSTEM.KSDWRT(SYS.DBMS_SYSTEM.TRACE_FILE,
                             'EXCEPTION[sdordfsa_rm.sql(' || $$PLSQL_LINE || ')14]: ' || SQLERRM); -- RAISE;
end;
/

declare
  object_not_found exception;
  pragma exception_init(object_not_found, -04043);
begin
  execute immediate 'drop function mdsys.RDFSA_DOMLBL'; 
  exception
    when object_not_found then NULL;
    when others then
      SYS.DBMS_SYSTEM.KSDWRT(SYS.DBMS_SYSTEM.TRACE_FILE,
                             'EXCEPTION[sdordfsa_rm.sql(' || $$PLSQL_LINE || ')15]: ' || SQLERRM); -- RAISE;
end;
/

declare
  object_not_found exception;
  pragma exception_init(object_not_found, -04043);
begin
  execute immediate 'drop procedure mdsys.RDF$GRANT_OLS_PRIVS';
  exception
    when object_not_found then NULL;
    when others then
      SYS.DBMS_SYSTEM.KSDWRT(SYS.DBMS_SYSTEM.TRACE_FILE,
                             'EXCEPTION[sdordfsa_rm.sql(' || $$PLSQL_LINE || ')16]: ' || SQLERRM); -- RAISE;
end;
/

-- Dummy type implementation: actual type body will be installed when OLS 
-- is enabled for RDF using sdordfsa.sql 
create or replace type body mdsys.rdfsa_resource as
  constructor function rdfsa_resource (res_id VARCHAR2, res_type number)
                                            return self as result is
  begin
    null;
  end;

  constructor function rdfsa_resource (res_id VARCHAR2, res_type number,
            res_label number) return self as result is
  begin
    null;
  end;

  constructor function rdfsa_resource (res_id VARCHAR2, res_type number,
            res_labels mdsys.int_array) return self as result is
  begin
    null;
  end;

  member function getResource return VARCHAR2 is
  begin
    null;
  end;

  member function getLabelCount return number is
  begin
    null;
  end;

  member function getLabel(idx number default 1) return number is
  begin
    null;
  end;
end;
/

show errors;

-- dummy implementation for label gen -- 
create or replace type body mdsys.rdfsa_labelgen is

  final member procedure setDepResources(useres number) is
  begin
    null;
  end;

  final static function findDominatingOf(labels MDSYS.INT_ARRAY)
       return number is
  begin
    null;
  end;

  member function getNumericLabel (subject   rdfsa_resource,
                                   predicate rdfsa_resource,
                                   object    rdfsa_resource,
                                   rule      rdfsa_resource,
                                   anteced   rdfsa_resource)
       return number is
  begin
    null;
  end;
end;
/

create or replace package body sem_rdfsa_ir as

   procedure create_entailment (
              index_name_in    VARCHAR2,
              models_in        RDF_MODELS,
              rulebases_in     RDF_RULEBASES,
              passes           NUMBER default 0,
              inf_components_in  VARCHAR2 default null,
              options          VARCHAR2 default null,
              delta_in         mdsys.rdf_models default null,
              label_gen        RDFSA_LABELGEN default null) is
   begin
     -- actual implementation loaded with RDFSA install -- 
     MDERR.RAISE_MD_ERROR('MD','SDO',-13199,
          'RDF Secure Access (OLS/VPD) option not installed');
   end create_entailment;

   procedure bulk_load_from_staging_table (
              model_name       VARCHAR2,
              table_owner      VARCHAR2,
              table_name       VARCHAR2,
              flags            VARCHAR2 default null,
              debug            PLS_INTEGER default null,
              start_comment  IN  varchar2 default NULL,
              end_comment    IN  varchar2 default NULL) is
   begin
     -- actual implementation loaded with RDFSA install -- 
     MDERR.RAISE_MD_ERROR('MD','SDO',-13199,
          'RDF Secure Access (OLS/VPD) option not installed');
   end bulk_load_from_staging_table;

end sem_rdfsa_ir;
/

show errors; 

begin
  EXECUTE IMMEDIATE 
   'delete from mdsys.rdf_parameter where namespace = :1 and 
         attribute = :2 ' USING 'COMPONENT','RDFOLS';
  EXECUTE IMMEDIATE
   'delete from mdsys.rdf_parameter where namespace = :1 and 
         attribute = :2 ' USING 'COMPONENT','RDFVPD';
  commit; 
end;
/

alter session set current_schema = SYS; 

Rem ********************************************************************
Rem #16473696: Indicate Oracle-Supplied object
@?/rdbms/admin/sqlsessend.sql
Rem ********************************************************************


OHA YOOOO