home *** CD-ROM | disk | FTP | other *** search
/ Winzipper / Winzipper_ISO.iso / programming / oracle7 7.2 / DB / UTIL72 / CAT7103.SQL < prev    next >
Encoding:
Text File  |  1995-05-09  |  9.0 KB  |  240 lines

  1. rem 
  2. rem $Header: cat7103.sql 7020100.1 94/09/23 22:13:13 cli Generic<base> $ 
  3. rem 
  4. Rem  Copyright (c) 1992 by Oracle Corporation 
  5. Rem    NAME
  6. Rem      cat7103.sql - upgrade Oracle RDBMS from version 7.1.2 to 7.1.3
  7. Rem    DESCRIPTION
  8. Rem 
  9. Rem    NOTES
  10. Rem      Run this as INTERNAL.  Run it before installing catalog or pl/sql.
  11. Rem      It is safe to run it on 7.1.2.
  12. Rem    MODIFIED   (MM/DD/YY)
  13. Rem     wmaimone   04/08/94 -  merge changes from branch 1.1.710.1
  14. Rem     wmaimone   03/18/94 -  Branch_for_patch
  15. Rem     wmaimone   03/18/94 -  rename from cat70103 (mod log preserved)
  16. Rem     wmaimone   03/16/94 -  fixup audit tables
  17. Rem     vraghuna   03/04/94 -  modify insertion into props table
  18. Rem     thayes     03/03/94 -  New syns for compat seg
  19. Rem     ltung      02/24/94 -  replace _TABLES and _CLUSTERS views
  20. Rem     ltung      02/24/94 -  preserve CACHEing in tab$, clu$
  21. Rem     cozbutun   02/10/94 -  fix the last change
  22. Rem     vraghuna   02/10/94 -  add new row into props
  23. Rem     cozbutun   02/10/94 -  change the index i_triggercol1
  24. Rem     vraghuna   02/07/94 -  add expver for versioning support
  25. Rem     rjenkins   02/07/94 -  adding unique index on rgroup
  26. Rem     rjenkins   02/02/94 -  replace M IDEN with 30
  27. Rem     vraghuna   01/31/94 -  bug 191751 - add expact
  28. Rem     agupta     01/20/94 -  192948 - make *_extent in *_segments byte-based
  29. Rem     rjenkins   01/13/94 -  adding rollback seg col to rgroup$
  30. Rem     jcohen     01/04/94 - #(192450) add v$option table
  31. Rem     jcohen     12/20/93 - #(191673) fix number fmt for user_tables,cluster
  32. Rem     rjenkins   12/20/93 -  Branch_for_patch
  33. Rem     rjenkins   12/17/93 -  Creation
  34.  
  35. rem 
  36. rem  Job Queue
  37. rem
  38. drop table job$ cascade constraints
  39. /
  40. drop sequence jobseq
  41. /
  42. create sequence jobseq
  43.   start with 1
  44.   increment by 1
  45.   minvalue 1
  46.   maxvalue 999999999                        /* should be less than MAXSB4VAL */
  47.   cache 20
  48.   noorder
  49.   cycle
  50. /
  51. create table job$
  52. ( job             number not null,                  /* identifier of the job */
  53.   lowner          varchar2(30) not null,             /* logged in user */
  54.   powner          varchar2(30) not null,                   /* security */
  55.   cowner          varchar2(30) not null,                    /* parsing */
  56.   last_date       date,                      /* when this job last succeeded */
  57.   this_date       date,    /* when the current execute started, usually null */
  58.   next_date       date not null,             /* when to execute the job next */
  59.   total           number default 0 not null, /* total time spent on this job */
  60.   interval        varchar2(200) not null,/* function for next next_date */
  61.   failures        number,           /* number of failures since last success */
  62.   flag            number default 0 not null,     /* 0x01, this job is broken */
  63.   what            varchar2(2000),        /* PL/SQL text, what is the job */
  64.   nlsenv          varchar2(2000),                      /* nls parameters */
  65.   env             raw(32),                    /* other environment variables */
  66.   cur_ses_label   mlslabel,      /* current session label for trusted oracle */
  67.   clearance_hi    mlslabel,             /* clearance high for trusted oracle */
  68.   clearance_lo    mlslabel,              /* clearance low for trusted oracle */
  69.   charenv         varchar2(2000),                            /* not used */
  70.   field1          number default 0)                              /* not used */
  71. /
  72. create unique index i_job_job on job$ (job)
  73. /
  74. create index i_job_next on job$ (next_date)
  75. /
  76. rem
  77. rem  Refresh Groups
  78. rem
  79. drop table rgchild$ cascade constraints
  80. /
  81. drop table rgroup$ cascade constraints
  82. /
  83. drop cluster c_rg# including tables cascade constraints
  84. /
  85. drop sequence rgroupseq
  86. /
  87. create sequence rgroupseq
  88.   start with 1
  89.   increment by 1
  90.   minvalue 1
  91.   maxvalue 999999999                        /* should be less than MAXSB4VAL */
  92.   cache 20
  93.   noorder
  94.   cycle
  95. /
  96. create cluster c_rg#
  97. ( refgroup        number)                            /* refresh group number */
  98. /
  99. create index i_rg# on cluster c_rg#
  100. /
  101. create table rgroup$
  102. ( refgroup        number,                         /* number of refresh group */
  103.   owner           varchar2(30) not null,     /* owner of refresh group */
  104.   name            varchar2(30) not null,      /* name of refresh group */
  105.   flag            number default 0,        /* 0x01, destroy group when empty */
  106.                                                  /* 0x02, do not push queues */
  107.                                                /* 0x04, refresh after errors */
  108.   rollback_seg    varchar2(30),                   /* rollback segment to use */
  109.   field1          number default 0,
  110.   job             number not null)  /* job in job$ for refreshing this group */
  111. cluster c_rg# (refgroup)
  112. /
  113. create unique index i_rgroup on rgroup$ (owner, name)
  114. /
  115. create unique index i_rgref on rgroup$ (refgroup)
  116. /
  117. create index i_rgjob on rgroup$ (job)
  118. /
  119. create table rgchild$
  120. ( owner           varchar2(30) not null,             /* owner of child */
  121.   name            varchar2(30) not null,              /* name of child */
  122.   type            varchar2(30) default 'SNAPSHOT',   /* type of object */
  123.   field1          number default 0,
  124.   refgroup        number)                   /* refresh group the child is in */
  125. cluster c_rg# (refgroup)
  126. /
  127. create unique index i_rgchild on rgchild$ (owner, name, type)
  128. /
  129. rem
  130. rem  Drop User Cascade
  131. rem
  132. drop table duc$ cascade constraints
  133. /
  134. create table duc$
  135. ( owner           varchar2(30) not null,            /* procedure owner */
  136.   pack            varchar2(30) not null,          /* procedure package */
  137.   proc            varchar2(30) not null,             /* procedure name */
  138.   field1          number default 0,
  139.   operation       number not null,                    /* 1=drop user cascade */
  140.   seq             number not null,            /* for ordering the procedures */
  141.   com             varchar2(80))       /* comment on what this routine is for */
  142. /
  143. create unique index i_duc on duc$ (owner,pack,proc,operation)
  144. /
  145. rem
  146. rem  Create refresh groups & jobs for all existing snapshots
  147. rem
  148. insert into rgroup$ (refgroup, owner, name, flag, job)
  149.   select rownum, sowner, vname, 1, rownum from snap$
  150.   where auto_date is not null or auto_fun is not null
  151. /
  152. insert into rgchild$ (owner, name, refgroup)
  153.   select owner, name, refgroup from rgroup$
  154. /
  155. insert into job$ (job, lowner, powner, cowner, 
  156.                   next_date, 
  157.                   interval, 
  158.                   what, 
  159.                   nlsenv, env)
  160.   select r.refgroup, r.owner, r.owner, r.owner,
  161.          nvl(s.auto_date,to_date('4000-01-01','YYYY-MM-DD')),
  162.          nvl(s.auto_fun,'null'),
  163.          'dbms_refresh.refresh(''"'||r.owner||'"."'||r.name||'"'');',
  164.          'SQL_TRACE=FALSE', hextoraw('0102000000000000')
  165.     from snap$ s, rgroup$ r 
  166.     where r.owner = s.sowner and r.name = s.vname;
  167. /
  168. rem
  169. rem  maintain CACHE attribute for tables and clusters
  170. rem
  171. update tab$ set spare2 = 65536 where spare2 > 0
  172. /
  173. update clu$ set spare6 = 65536 where spare6 > 0
  174. /
  175.  
  176. Rem
  177. Rem expact table for Export actions
  178. Rem
  179. drop table expact$
  180. /
  181. create table expact$
  182. ( owner varchar2(30) not null,                             /* owner of table */
  183.   name  varchar2(30) not null,                              /* name of table */
  184.   func_schema varchar2(30) not null,             /* schema func is run under */
  185.   func_package  varchar2(30) not null,                       /* package name */
  186.   func_proc  varchar2(30) not null,                        /* procedure name */
  187.   code  number not null,                            /* PRETABLE OR POSTTABLE */
  188.   callorder number)
  189. /
  190. Rem
  191. Rem The index i_triggercol1 on triggercol$ changed (If you run this file
  192. Rem on a 7.1.3 or later database, the following 2 statements may fail. That
  193. Rem is not a problem.
  194. Rem
  195. create index i_triggercol on triggercol$(obj#, col#, type, position)
  196. /
  197. drop index i_triggercol1
  198. /
  199.  
  200. Rem
  201. Rem  Fix audit option map
  202.  
  203. delete stmt_audit_option_map
  204. where 
  205.  option# in (18,34,53,55,56,70,100,145,170,171)
  206.  or option# between 176 and 193
  207. /
  208. update stmt_audit_option_map set name = 'CREATE SNAPSHOT' where option#=172
  209. /
  210. update stmt_audit_option_map set name = 'WRITEDOWN' where option#=197
  211. /
  212. update stmt_audit_option_map set name = 'READUP' where option#=198
  213. /
  214. insert into STMT_AUDIT_OPTION_MAP values ( 83, 'SYSDBA')
  215. /
  216. insert into STMT_AUDIT_OPTION_MAP values ( 84, 'SYSOPER')
  217. /
  218. insert into STMT_AUDIT_OPTION_MAP values (135, 'ALTER DATABASE')
  219. /
  220. insert into STMT_AUDIT_OPTION_MAP values (138, 'FORCE TRANSACTION')
  221. /
  222. insert into STMT_AUDIT_OPTION_MAP values (139, 'FORCE ANY TRANSACTION')
  223. /
  224. insert into STMT_AUDIT_OPTION_MAP values (167, 'GRANT ANY PRIVILEGE')
  225. /
  226. drop index i_objauth2
  227. /
  228. create index i_objauth2 on objauth$(grantee#, obj#, col#)
  229. /
  230.  
  231.  
  232. Rem
  233. Rem Add versioning support for export
  234. Rem
  235. insert into props$ 
  236. select 'EXPORT_VIEWS_VERSION', '1', 'Export views revision #' from dual
  237. where not exists
  238.   (select 'x' from props$ where name = 'EXPORT_VIEWS_VERSION')
  239. /
  240.