MINI MINI MANI MO
Rem
Rem $Header: sdo/admin/catmdh.sql /main/8 2017/10/23 11:09:27 rjanders Exp $
Rem
Rem catmdh.sql
Rem
Rem Copyright (c) 2014, 2017, Oracle and/or its affiliates.
Rem All rights reserved.
Rem
Rem NAME
Rem catmdh.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/catmdh.sql
Rem SQL_SHIPPED_FILE: md/admin/catmdh.sql
Rem SQL_PHASE: CATMDH
Rem SQL_STARTUP_MODE: NORMAL
Rem SQL_IGNORABLE_ERRORS: NONE
Rem SQL_CALLING_FILE: sdo/admin/catmd.sql
Rem END SQL_FILE_METADATA
Rem
Rem MODIFIED (MM/DD/YY)
Rem rjanders 10/20/17 - #26890827: Check temp tablespace freespace
Rem rjanders 06/30/17 - Add SYS/MDSYS prefixes
Rem rjanders 05/10/17 - #26037683: Raise 'when other' exceptions
Rem rjanders 03/23/17 - #25437999: Remove 'when others then NULL'
Rem handlers
Rem sravada 02/01/17 - set status for loading/upgrading
Rem czechar 08/14/15 - adding SQL file metadata
Rem rjanders 01/02/15 - long identifier project phase 1
Rem sravada 12/31/14 - Created
Rem
Rem ********************************************************************
Rem #16473696: Indicate Oracle-Supplied object
@@?/rdbms/admin/sqlsessstart.sql
Rem ********************************************************************
Rem Load the SDO component validation routine
@@sdovalid.sql
declare
already_exists exception;
pragma exception_init(already_exists, -01920);
begin
begin
execute immediate
' create user MDSYS identified by MDSYS ACCOUNT LOCK PASSWORD EXPIRE ';
exception
when already_exists then NULL;
when others then
SYS.DBMS_SYSTEM.KSDWRT(SYS.DBMS_SYSTEM.TRACE_FILE,
'EXCEPTION[catmdh.sql(' || $$PLSQL_LINE || ')1]: ' || SQLERRM); RAISE;
end;
end;
/
REM change the session to set the current schema
Alter session set current_schema=MDSYS;
declare
already_exists exception;
pragma exception_init(already_exists, -01920);
begin
begin
execute immediate
' create user MDDATA identified by MDDATA ';
exception
when already_exists then NULL;
when others then
SYS.DBMS_SYSTEM.KSDWRT(SYS.DBMS_SYSTEM.TRACE_FILE,
'EXCEPTION[catmdh.sql(' || $$PLSQL_LINE || ')2]: ' || SQLERRM); RAISE;
end;
end;
/
grant connect, resource to MDDATA;
alter user mddata account lock;
@@mdprivs.sql
declare
begin
begin
execute immediate ' Alter user MDSYS default tablespace SYSAUX ';
exception
when others then
SYS.DBMS_SYSTEM.KSDWRT(SYS.DBMS_SYSTEM.TRACE_FILE,
'EXCEPTION[catmdh.sql(' || $$PLSQL_LINE || ')3]: ' || SQLERRM); RAISE;
end;
end;
/
REM Add component registry entry to mark sdo loading
REM if the status is not UPGRADING then this is first install
declare
cnt number;
begin
select count(*) into cnt from sys.dba_registry where comp_id='SDO'
and status = 'UPGRADING';
if (cnt=0) then
dbms_registry.loading('SDO','Spatial','validate_sdo','MDSYS', dbms_registry.schema_list_t('MDSYS', 'MDDATA'));
end if;
end;
/
declare
begin
begin
dbms_registry.set_required_comps('SDO',dbms_registry.comp_depend_list_t('JAVAVM','XDB','ORDIM'));
exception
when others then
SYS.DBMS_SYSTEM.KSDWRT(SYS.DBMS_SYSTEM.TRACE_FILE,
'EXCEPTION[catmdh.sql(' || $$PLSQL_LINE || ')4]: ' || SQLERRM); RAISE;
end;
end;
/
-- Choose the temporary tablespace with the largest size
set serveroutput on
declare
stmt varchar2(4000);
tblspc varchar2(260);
begin
stmt := 'select property_value from sys.database_properties ' ||
'where property_name = ''DEFAULT_TEMP_TABLESPACE'' ';
begin
execute immediate stmt into tblspc;
if ( (tblspc is not NULL) and (tblspc <> 'SYSAUX') )
then
dbms_output.put_line('Changing default temporary tablespace to ' || tblspc);
stmt := 'alter user MDSYS temporary tablespace ' || tblspc;
begin
execute immediate stmt;
exception
when others then
dbms_output.put_line('Cannot change default temporary tablespace');
dbms_output.put_line('ERROR=' || SQLERRM);
end;
end if;
exception
when no_data_found then
dbms_output.put_line('Cannot determine default temporary tablespace');
when others then
SYS.DBMS_SYSTEM.KSDWRT(SYS.DBMS_SYSTEM.TRACE_FILE,
'EXCEPTION[catmdh.sql(' || $$PLSQL_LINE || ')5]: ' || SQLERRM);
RAISE;
end;
end;
/
set serveroutput off
Rem ********************************************************************
Rem #16473696: Indicate Oracle-Supplied object
@@?/rdbms/admin/sqlsessend.sql
Rem ********************************************************************
OHA YOOOO