MINI MINI MANI MO
Rem
Rem $Header: sdo/admin/sdogra.sql /main/8 2017/05/26 16:34:18 rjanders Exp $
Rem
Rem sdogra.sql
Rem
Rem Copyright (c) 2006, 2017, Oracle and/or its affiliates.
Rem All rights reserved.
Rem
Rem NAME
Rem sdogra.sql - create sdo_geor_admin package for GeoRaster
Rem
Rem DESCRIPTION
Rem admin functions and procedures
Rem
Rem NOTES
Rem <other useful comments, qualifications, etc.>
Rem BEGIN SQL_FILE_METADATA
Rem SQL_SOURCE_FILE: sdo/admin/sdogra.sql
Rem SQL_SHIPPED_FILE: md/admin/sdogra.sql
Rem SQL_PHASE: SDOGRA
Rem SQL_STARTUP_MODE: NORMAL
Rem SQL_IGNORABLE_ERRORS: NONE
Rem SQL_CALLING_FILE: sdo/admin/catmdsdop2.sql
Rem
Rem MODIFIED (MM/DD/YY)
Rem rjanders 05/10/17 - #26037683: Raise 'when other' exceptions
Rem rjanders 03/23/17 - #25437999: Remove 'when others then NULL'
Rem handlers
Rem zzhang 09/09/15 - add SQL file metadata
Rem rjanders 03/15/13 - #16473696: Start/End _ORACLE_SCRIPT
Rem initialization
Rem wexu 07/23/08 - bug 7197832 - revoke exec priv during upgrade
Rem zzhang 04/18/06 - Created
Rem
Rem ********************************************************************
Rem This package must not be modified by the customer. Doing so
Rem could cause internal errors.
Rem ********************************************************************
Rem ********************************************************************
Rem #16473696: Indicate Oracle-Supplied object
@@?/rdbms/admin/sqlsessstart.sql
Rem ********************************************************************
-- bug 7197832: revoke public execute privilege with grant option
-- this is necessary for upgrade cases
DECLARE
package_not_found exception;
pragma exception_init(package_not_found, -04042);
BEGIN
BEGIN
EXECUTE IMMEDIATE 'REVOKE EXECUTE ON MDSYS.SDO_GEOR_ADMIN FROM PUBLIC';
EXCEPTION
WHEN package_not_found THEN NULL;
WHEN OTHERS THEN
SYS.DBMS_SYSTEM.KSDWRT(SYS.DBMS_SYSTEM.TRACE_FILE,
'EXCEPTION[sdogra.sql(' || $$PLSQL_LINE || ')1]: ' || SQLERRM); RAISE;
END;
END;
/
CREATE OR REPLACE PACKAGE MDSYS.SDO_GEOR_ADMIN AUTHID CURRENT_USER AS
-- ---------------------------------------------------------------------
-- procedure to create DML triggers on a georaster table
-- ---------------------------------------------------------------------
PROCEDURE createDMLTrigger
(
tableName varchar2,
columnName varchar2
);
-- ---------------------------------------------------------------------
-- NAME
-- listRegisteredRDT
--
-- DESCRIPTION
-- This function lists all registereded RDT names in the table
-- mdsys.sdo_geor_sysdata_table
--
-- ARGUMENTS
-- None.
--
-- NOTES
-- This function should be run by any end user.
--
-- ---------------------------------------------------------------------
Function listRegisteredRDT return mdsys.sdo_string2_arrayset DETERMINISTIC PARALLEL_ENABLE;
-- ---------------------------------------------------------------------
-- NAME
-- isRDTNameUnique
--
-- DESCRIPTION
-- This function is used to check if the specific RDT name is unique
-- in the table mdsys.sdo_geor_sysdata_table
--
-- ARGUMENTS
-- rdtName.
--
-- NOTES
-- This function should be run by any end user.
--
-- ---------------------------------------------------------------------
Function isRDTNameUnique(rdtName VARCHAR2) return VARCHAR2 DETERMINISTIC PARALLEL_ENABLE;
-- ---------------------------------------------------------------------
-- NAME
-- getUniqueRDTName
--
-- DESCRIPTION
-- This function returns an unique RDT name.
--
-- ARGUMENTS
-- None.
--
-- NOTES
-- This function should be run by any end user.
--
-- ---------------------------------------------------------------------
Function getUniqueRDTName return VARCHAR2 DETERMINISTIC PARALLEL_ENABLE;
-- ---------------------------------------------------------------------
-- NAME
-- listGeoRasterTables
--
-- DESCRIPTION
-- For user mdsys: this function lists all GeoRaster tables defined in
-- the database.
-- output format is:
-- SCHEMA TABLE
-- For other users: this function lists all GeoRaster tables defined in
-- the current schema.
-- output format is:
-- TABLE
--
-- ARGUMENTS
-- None.
--
-- NOTES
-- This function should be run by any end user.
--
-- ---------------------------------------------------------------------
Function listGeoRasterTables return MDSYS.sdo_string2_arrayset DETERMINISTIC PARALLEL_ENABLE;
-- ---------------------------------------------------------------------
-- NAME
-- listGeoRasterColumns
--
-- DESCRIPTION
-- For user mdsys: this function lists all GeoRaster columns defined in
-- the database.
-- output format is:
-- SCHEMA TABLE COLUMN STATUS
-- Note: STATUS is used to indicate if a DML trigger is created on this
-- GeoRaster column or not.
-- For other users: this function lists all GeoRaster columnss defined in
-- the current schema.
-- output format is:
-- TABLE COLUMN STATUS
-- Note: STATUS is used to indicate if a DML trigger is created on this
-- GeoRaster column or not.
--
-- ARGUMENTS
-- None.
--
-- NOTES
-- This function should be run by any end user.
--
-- ---------------------------------------------------------------------
Function listGeoRasterColumns return MDSYS.sdo_string2_arrayset DETERMINISTIC PARALLEL_ENABLE;
-- ---------------------------------------------------------------------
-- NAME
-- registerGeoRasterColumns
--
-- DESCRIPTION
-- For user mdsys: this procedure creates dml triggers for all GeoRaster
-- columns defined in the database.
-- For other users:this procedure creates dml triggers for all GeoRaster
-- columns defined in current schema.
--
--
-- ARGUMENTS
-- None.
--
-- NOTES
-- This procedure should be run by any end user.
--
-- ---------------------------------------------------------------------
Procedure registerGeoRasterColumns;
-- ---------------------------------------------------------------------
-- NAME
-- listGeoRasterObjects
--
-- DESCRIPTION
-- For user mdsys: this function lists all GeoRaster objects defined in
-- the database.
-- output format is:
-- SCHEMA TABLE COLUMN RDT RID STATUS
-- Note: STATUS is used to indicate if this georaster object is
-- registered in the mdsys.sdo_geor_sysdata_table or not.
-- For other users: this function lists all GeoRaster objects defined in
-- the current schema.
-- output foramt is:
-- TABLE COLUMN RDT RID STATUS
-- Note: STATUS is used to indicate if this georaster object is
-- registered in the mdsys.sdo_geor_sysdata_table or not.
--
-- ARGUMENTS
-- None.
--
-- NOTES
-- This function should be run by any end user.
--
-- ---------------------------------------------------------------------
Function listGeoRasterObjects return MDSYS.sdo_string2_arrayset DETERMINISTIC PARALLEL_ENABLE;
-- ---------------------------------------------------------------------
-- NAME
-- registerGeoRasterObjects
--
-- DESCRIPTION
-- For user mdsys: this procedure registers all GeoRaster objects defined
-- in the database.
-- For other users:this procedure registers all GeoRaster objects defined
-- in current schema.
--
-- ARGUMENTS
-- None.
--
-- NOTES
-- This procedure should be run by any end user.
--
-- ---------------------------------------------------------------------
Procedure registerGeoRasterObjects;
-- ---------------------------------------------------------------------
-- NAME
-- listRDT
--
-- DESCRIPTION
-- For user mdsys: this function lists all RDT tables defined in
-- the database,which include registered and
-- unregistered RDTs in the mdsys.sdo_geor_sysdata_table.
-- output format is:
-- SCHEMA TABLE
-- For other users: this function lists all RDT tables defined in
-- the current schema,,which include registered and
-- unregistered RDTs in the mdsys.sdo_geor_sysdata_table.
-- output foramt is:
-- TABLE
--
-- ARGUMENTS
-- None.
--
-- NOTES
-- This function should be run by any end user.
--
-- ---------------------------------------------------------------------
Function listRDT return MDSYS.sdo_string2_arrayset DETERMINISTIC PARALLEL_ENABLE;
-- ---------------------------------------------------------------------
-- NAME
-- listUnregisteredRDT
--
-- DESCRIPTION
-- For user mdsys: this function lists all unregistered RDT tables
-- defined in the database.
-- output format is:
-- SCHEMA TABLE
-- For other users: this function lists all unregistered RDT tables
-- defined in the current schema.
-- output foramt is:
-- TABLE
--
-- ARGUMENTS
-- None.
--
-- NOTES
-- This function should be run by any end user.
--
-- ---------------------------------------------------------------------
Function listUnregisteredRDT return MDSYS.sdo_string2_arrayset DETERMINISTIC PARALLEL_ENABLE;
-- ---------------------------------------------------------------------
-- NAME
-- checkSysdataEntries
--
-- DESCRIPTION
-- For user mdsys: this function checks all sysdata entries in the
-- database, and prints out a report.
-- the following is a list of invalid cases
-- 1)RDT name isn't unique
-- 2)GeoRaster table doesn't exist
-- 3)GeoRaster column doesn't exist
-- 4)GeoRaster object doesn't exist
-- 5)Non-empty or Non-blank GeoRaster object, but
-- RDT doesn't exist
-- 6)Duplicate GeoRaster objects(RDT+RID non-unique)
--
-- For other users: this function checks all sysdata entries related to
-- the current schema, and prints out a report.
--
-- ARGUMENTS
-- None.
--
-- NOTES
-- This function should be run by any end user.
--
-- ---------------------------------------------------------------------
Function checkSysdataEntries return MDSYS.sdo_string2_array DETERMINISTIC PARALLEL_ENABLE;
-- ---------------------------------------------------------------------
-- NAME
-- maintainSysdataEntries
--
-- DESCRIPTION
-- For user mdsys: this function maintains all sysdata entries in the
-- database, and make them valid.
-- the following is a list of actions to invalid cases
-- 1)RDT name isn't unique : rename non-unique RDT
-- 2)GeoRaster table doesn't exist : remove entry
-- 3)GeoRaster column doesn't exist : remove entry
-- 4)GeoRaster object doesn't exist : remove entry
-- 5)Non-empty or Non-blank GeoRaster object, but
-- RDT doesn't exist : remove entry
-- 6)Duplicate GeoRaster objects(RDT+RID non-unique):remove entry .
--
-- For other users: this function maintains all sysdata entries related to
-- the current schema.
-- 1)RDT name isn't unique : no action
-- 2)GeoRaster table doesn't exist : remove entry
-- 3)GeoRaster column doesn't exist : remove entry
-- 4)GeoRaster object doesn't exist : remove entry
-- 5)Non-empty or Non-blank GeoRaster object, but
-- RDT doesn't exist : remove entry
-- 6)Duplicate GeoRaster objects(RDT+RID non-unique):remove entry .
--
-- ARGUMENTS
-- None.
--
-- NOTES
-- This function should be run by any end user.
--
-- ---------------------------------------------------------------------
Function maintainSysdataEntries return MDSYS.sdo_string2_array DETERMINISTIC PARALLEL_ENABLE;
-- ---------------------------------------------------------------------
-- NAME
-- isUpgradeNeeded
--
-- DESCRIPTION
-- For user mdsys: this function checks whole database,and prints
-- out a report about validation of whole GeoRaster
-- inforstrcture/data
-- the following is a list of invalid cases
-- 1)RDT name isn't unique
-- 2)GeoRaster table doesn't exist
-- 3)GeoRaster column doesn't exist
-- 4)Non-empty or Non-blank GeoRaster object, but
-- RDT doesn't exist
-- 5)Duplicate GeoRaster objects(RDT+RID non-unique)
-- 6)Non-registered GeoRaster columns
-- 7)Non-unique RDT(Non-registered) table
-- 8)Non-registered GeoRaster objects
-- 9)Non-registered RDT table
--
-- For other users: this function checks whole schema,and prints
-- out a report about validation of whole GeoRaster
-- inforstrcture/data
--
-- ARGUMENTS
-- None.
--
-- NOTES
-- This function should be run by any end user.
--
-- ---------------------------------------------------------------------
Function isUpgradeNeeded return MDSYS.sdo_string2_array DETERMINISTIC PARALLEL_ENABLE;
-- ---------------------------------------------------------------------
-- NAME
-- upgradeGeoRaster
--
-- DESCRIPTION
-- For user mdsys: this function maintains whole GeoRaster
-- infrastucture/data on the database level
--
-- For other users: this function maintains whole GeoRaster
-- infrastucture/data in schema level
--
-- ARGUMENTS
-- None.
--
-- NOTES
-- This function should be run by any end user.
--
-- ---------------------------------------------------------------------
Function upgradeGeoRaster return MDSYS.sdo_string2_array DETERMINISTIC PARALLEL_ENABLE;
-- ---------------------------------------------------------------------
-- NAME
-- listDanglingRasterData
--
-- DESCRIPTION
-- For user mdsys: this function lists all dangling data
-- on the database level
--
-- For other users: this function lists dangling data
-- in schema level
--
-- ARGUMENTS
-- None.
--
-- NOTES
-- This function should be run by any end user.
--
-- ---------------------------------------------------------------------
Function listDanglingRasterData return MDSYS.sdo_string2_arrayset DETERMINISTIC PARALLEL_ENABLE;
END SDO_GEOR_ADMIN;
/
show errors;
Rem ********************************************************************
Rem #16473696: Indicate Oracle-Supplied object
@?/rdbms/admin/sqlsessend.sql
Rem ********************************************************************
OHA YOOOO