MINI MINI MANI MO
Rem
Rem $Header: sdo/admin/seme122.sql /main/2 2017/05/03 12:18:33 rjanders Exp $
Rem
Rem seme122.sql
Rem
Rem Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
Rem
Rem NAME
Rem seme122.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/seme122.sql
Rem SQL_SHIPPED_FILE: md/admin/seme122.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 04/27/17 - Correct "SQL_PHASE" metadata values
Rem matperry 03/07/17 - Created
Rem
@@?/rdbms/admin/sqlsessstart.sql
-----------------------------------------------------------------------------------------------
-- The "e" script reverts the component's data dictionary back from release NNN+1 to release --
-- NNN. Since the cmpdbdwg.sql script calls the script for the downgrade release, these --
-- scripts are stacked in the reverse order. They are called in the context of the NEW --
-- server, before the RDBMS itself is downgraded. Set the version to the release version --
-- (3 digits), not a patch version, in the dbms_registry.downgraded procedure invocation. --
-----------------------------------------------------------------------------------------------
-- drop package and type bodies for a cleaner downgrade
prompt calling semremovbdy ...
@@semremovbdy.sql
prompt ... done calling semremovbdy
alter session set current_schema=MDSYS;
set define on;
-- make sure we do the downgrade without errors --
whenever sqlerror continue;
-- First mark that we are downgrading --
begin
EXECUTE IMMEDIATE '
UPDATE MDSYS.RDF_PARAMETER
SET description = :1
WHERE namespace = :2 and
attribute = :3'
USING 'DOWNGRADING','MDSYS','SEM_VERSION';
EXCEPTION WHEN OTHERS THEN
SYS.DBMS_SYSTEM.KSDWRT(SYS.DBMS_SYSTEM.TRACE_FILE,
'SEM_INSTALL: seme122: set downgrade in rdf_parameter: '||SQLERRM);
end;
/
declare
sem_exists number := 0;
begin
-- if semantics doesn't exist we need a dummy sdo_sem_downgrade package
select count(*) into sem_exists
from SYS.all_objects
where owner = 'MDSYS' and object_name = 'SDO_RDF_TRIPLE_S';
if (sem_exists = 0) then
begin
execute immediate '
create or replace package mdsys.sdo_sem_downgrade_utl as
function data_122plus_exists(notify_level in integer)
return boolean;
end sdo_sem_downgrade_utl;';
exception when others then
SYS.DBMS_SYSTEM.KSDWRT(SYS.DBMS_SYSTEM.TRACE_FILE,
'SEM_INSTALL: seme121: sdo_sem_downgrade_utl: '||SQLERRM);
end;
end if;
end;
/
show errors;
-- The only new storage-related changes are in-memory virtual columns used
-- with in-memory virtual models. We will prevent downgrade if such virtual
-- models exist. After user drops these, then RDF_LINK$ definition will return
-- to the way it was in 12.2.0.1, so we don't need to modify anything during
-- downgrade from 12.2.0.2 to 12.2.0.1.
-- Check data compatibility with 12.2.0.1 --
declare
sem_exists number := 0;
begin
select count(*) into sem_exists
from SYS.all_objects
where owner = 'MDSYS' and object_name = 'SDO_RDF_TRIPLE_S';
if (sem_exists > 0) then
if (mdsys.sdo_sem_downgrade_utl.data_122plus_exists(0)) then
SYS.DBMS_SYSTEM.KSDWRT(SYS.DBMS_SYSTEM.TRACE_FILE,
'Semantics data is not compatible with version 12.2.0.1.0. Not downgrading to Release 12.1.');
raise_application_error(-20000,
'Semantics data is not compatible with version 12.2.0.1.0');
end if;
end if;
end;
/
show errors;
-- DROP packages, views, and classes that were added in the new release
-- DROP force any new types, operators, and indextypes;
-- ALTER OPERATOR and INDEXTYPE back to their prior release bindings and properties
-- UPDATE new columns to values appropriate for the old release and for when the database is re-upgraded
-- Undo any modifications that were made to user objects during the upgrade.
-- Drop new tables
alter session set current_schema=SYS;
@?/rdbms/admin/sqlsessend.sql
OHA YOOOO