MINI MINI MANI MO
Rem
Rem $Header: sdo/admin/semu111post.sql /main/9 2017/08/06 16:56:56 anestrad Exp $
Rem
Rem semu111post.sql
Rem
Rem Copyright (c) 2011, 2017, Oracle and/or its affiliates.
Rem All rights reserved.
Rem
Rem NAME
Rem semu111post.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/semu111post.sql
Rem SQL_SHIPPED_FILE: md/admin/semu111post.sql
Rem SQL_PHASE: UPGRADE
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 anestrad 05/18/17 - Add user name to create_rulebase call
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 sravada 01/11/17 - bug 25370681
Rem rjanders 02/01/15 - #20418139: Cannot grant SELECT to PUBLIC
Rem rjanders 03/16/13 - #16473696: Start/End _ORACLE_SCRIPT
Rem initialization
Rem matperry 03/08/11 - Created
Rem
----------------------------------------------------------------------
-- Called after upgrade --
-- Makes any calls to the new codebase to finish upgrading the --
-- semantics installation --
-- calls semu112post so that post processing is "stacked" --
----------------------------------------------------------------------
Rem ********************************************************************
Rem #16473696: Indicate Oracle-Supplied object
@@?/rdbms/admin/sqlsessstart.sql
Rem ********************************************************************
alter session set current_schema=MDSYS;
-- add SKOSCORE rulebase if a network is present --
-- We should do this in semu111.sql but create_rulebase could be invalid,
-- so we are doing it after loading all 11.2 packages
declare
network_exists number;
skos_exists number;
rl_exists number;
begin
-- see if RDF Network is present in DB
SELECT count(*) INTO network_exists FROM SYS.ALL_TABLES
WHERE table_name='RDF_VALUE$' AND owner='MDSYS';
if (network_exists > 0) then
-- create SKOS rulebase if it doesn't already exist --
skos_exists := 0;
begin
execute immediate 'select count(*) from mdsys.rdf_rulebase$
where name=''SKOSCORE''' into skos_exists;
exception
when others then
SYS.DBMS_SYSTEM.KSDWRT(SYS.DBMS_SYSTEM.TRACE_FILE,
'EXCEPTION[semu111post.sqlAFM' || '(' || $$PLSQL_LINE || ')1]: ' || SQLERRM); -- RAISE;
end;
if (skos_exists = 0) then
mdsys.rdf_apis_internal.create_rulebase(SYS_CONTEXT('USERENV', 'CURRENT_USER'),'SKOSCORE');
begin
execute immediate
'update mdsys.rdf_rulebase$ set owner=
(select owner from mdsys.rdf_rulebase$ where name=''RDFS'')
where name=''SKOSCORE''';
exception
when others then
SYS.DBMS_SYSTEM.KSDWRT(SYS.DBMS_SYSTEM.TRACE_FILE,
'EXCEPTION[semu111post.sqlAFM' || '(' || $$PLSQL_LINE || ')2]: ' || SQLERRM); -- RAISE;
end;
begin
EXECUTE IMMEDIATE 'GRANT READ ON "SEMR_SKOSCORE" TO PUBLIC';
exception
when others then
SYS.DBMS_SYSTEM.KSDWRT(SYS.DBMS_SYSTEM.TRACE_FILE,
'EXCEPTION[semu111post.sqlAFM' || '(' || $$PLSQL_LINE || ')3]: ' || SQLERRM); -- RAISE;
end;
begin
EXECUTE IMMEDIATE 'GRANT READ ON "RDFR_SKOSCORE" TO PUBLIC';
exception
when others then
SYS.DBMS_SYSTEM.KSDWRT(SYS.DBMS_SYSTEM.TRACE_FILE,
'EXCEPTION[semu111post.sqlAFM' || '(' || $$PLSQL_LINE || ')4]: ' || SQLERRM); -- RAISE;
end;
end if;
--create RL rulebase if it doesn't already exist (same code as for SKOS, refactor this)
rl_exists := 0;
begin
execute immediate 'select count(*) from mdsys.rdf_rulebase$
where name=''OWL2RL''' into rl_exists;
exception
when others then
SYS.DBMS_SYSTEM.KSDWRT(SYS.DBMS_SYSTEM.TRACE_FILE,
'EXCEPTION[semu111post.sqlAFM' || '(' || $$PLSQL_LINE || ')5]: ' || SQLERRM); -- RAISE;
end;
if (rl_exists = 0) then
mdsys.rdf_apis_internal.create_rulebase(SYS_CONTEXT('USERENV', 'CURRENT_USER'),'OWL2RL');
begin
execute immediate
'update mdsys.rdf_rulebase$ set owner=
(select owner from mdsys.rdf_rulebase$ where name=''RDFS'')
where name=''OWL2RL''';
exception
when others then
SYS.DBMS_SYSTEM.KSDWRT(SYS.DBMS_SYSTEM.TRACE_FILE,
'EXCEPTION[semu111post.sqlAFM' || '(' || $$PLSQL_LINE || ')6]: ' || SQLERRM); -- RAISE;
end;
begin
EXECUTE IMMEDIATE 'GRANT READ ON "SEMR_OWL2RL" TO PUBLIC';
exception
when others then
SYS.DBMS_SYSTEM.KSDWRT(SYS.DBMS_SYSTEM.TRACE_FILE,
'EXCEPTION[semu111post.sqlAFM' || '(' || $$PLSQL_LINE || ')7]: ' || SQLERRM); -- RAISE;
end;
begin
EXECUTE IMMEDIATE 'GRANT READ ON "RDFR_OWL2RL" TO PUBLIC';
exception
when others then
SYS.DBMS_SYSTEM.KSDWRT(SYS.DBMS_SYSTEM.TRACE_FILE,
'EXCEPTION[semu111post.sqlAFM' || '(' || $$PLSQL_LINE || ')8]: ' || SQLERRM); -- RAISE;
end;
end if;
commit;
end if;
end;
/
show errors;
-- call semu112post --
@@ semu112post.sql
Rem ********************************************************************
Rem #16473696: Indicate Oracle-Supplied object
@@?/rdbms/admin/sqlsessend.sql
Rem ********************************************************************
OHA YOOOO