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

  1. rem 
  2. rem $Header: sql.bsq 7020200.1 95/02/15 18:33:32 cli Generic<base> $ sql.bsq 
  3. rem 
  4. create tablespace SYSTEM datafile "D_DBFN" 
  5.   default storage (initial 10K next 10K) online
  6. /
  7. create rollback segment SYSTEM tablespace SYSTEM
  8.   storage (initial 50K next 50K)
  9. /
  10. create cluster c_obj# (obj# number)
  11.   pctfree 5 size 800                           /* don't waste too much space */
  12.   /* A table of 32 cols, 2 index, 2 col per index requires about 2K.
  13.    * A table of 10 cols, 2 index, 2 col per index requires about 750.
  14.    */
  15.   storage (initial 120K)              /* avoid space management during IOR I */
  16. /
  17. create index i_obj# on cluster c_obj#
  18. /
  19. create table tab$                                             /* table table */
  20. ( obj#             number not null,                            /* object number */
  21.   ts#        number not null,                        /* tablespace number */
  22.   file#        number not null,               /* segment header file number */
  23.   block#    number not null,              /* segment header block number */
  24.   clu#          number,      /* cluster object number, NULL if not clustered */
  25.   tab#        number,    /* table number in cluster, NULL if not clustered */
  26.   cols          number not null,            /* number of columns */
  27.   clucols       number,/* number of clustered columns, NULL if not clustered */
  28.   pctfree$      number not null, /* minimum free space percentage in a block */
  29.   pctused$      number not null, /* minimum used space percentage in a block */
  30.   initrans      number not null,            /* initial number of transaction */
  31.   maxtrans      number not null,            /* maximum number of transaction */
  32.   modified      number not null,                               /* dirty bit: */
  33.                 /* 0 = unmodified since last backup, 1 = modified since then */
  34.   audit$    varchar2("S_OPFL") not null,             /* auditing options */
  35.   rowcnt        number,                                    /* number of rows */
  36.   blkcnt        number,                                  /* number of blocks */
  37.   empcnt        number,                            /* number of empty blocks */
  38.   avgspc        number,                      /* average available free space */
  39.   chncnt        number,                            /* number of chained rows */
  40.   avgrln        number,                                /* average row length */
  41.   spare1        number,           /* parallel (0 = no, 1 = yes, >1 = degree) */
  42.   spare2        number)          /* cache (0 = no, 1 = yes, >1 = partitions) */
  43. cluster c_obj#(obj#)
  44. /  
  45. create table clu$                        /* cluster table */
  46. ( obj#         number not null,                            /* object number */
  47.   ts#        number not null,                        /* tablespace number */
  48.   file#        number not null,               /* segment header file number */
  49.   block#    number not null,              /* segment header block number */
  50.   cols          number not null,            /* number of columns */
  51.   pctfree$      number not null, /* minimum free space percentage in a block */
  52.   pctused$      number not null, /* minimum used space percentage in a block */
  53.   initrans      number not null,            /* initial number of transaction */
  54.   maxtrans      number not null,            /* maximum number of transaction */
  55.   size$         number,
  56.        /* if b-tree, estimated number of bytes for each cluster key and rows */
  57.   hashfunc      varchar2("M_IDEN"),        /* if hashed, function identifier */
  58.  
  59.   /* Some of the spare columns may give the initial # bytes in the hash table
  60.    * and the # hash keys per block.  These are user-specified parameters.
  61.    * For extendible hash tables, two columns might include the # bits
  62.    * currently be used in the hash function and the number of the next
  63.    * bucket to split.
  64.    * Some spare columns may be used for hash table statistics
  65.    * such as # distinct keys, # distinct values of first key column, and
  66.    * average # blocks per key.  Some spare columns  may give the number of
  67.    * the cluster table for which the cluster key is unique or indicate
  68.    * whether the cluster is normal or referential.
  69.    * We can encode multiple pieces of info in a single column.
  70.    */
  71.   hashkeys      number,                                    /* hash key count */
  72.   func          number, /* function: 0 (key is function), 1 (system default) */
  73.   extind        number,             /* extent index value of fixed hash area */
  74.   spare4        number,                          /* the average chain length */
  75.   spare5        number,           /* parallel (0 = no, 1 = yes, >1 = degree) */
  76.   spare6        number,          /* cache (0 = no, 1 = yes, >1 = partitions) */
  77.   spare7        number,
  78.   spare8        number,
  79.   spare9        number
  80. )
  81. cluster c_obj#(obj#)
  82. /
  83. create cluster c_ts#(ts# number)           /* use entire block for each ts# */
  84. /
  85. create index i_ts# on cluster c_ts#
  86. /
  87. create cluster c_file#_block#(segfile# number, segblock# number) 
  88.   size 225    /* cluster key ~ 25, sizeof(seg$) ~ 50, 5 * sizeof(uet$) ~ 150 */
  89.   storage (initial 20K)               /* avoid space management during IOR I */
  90. /
  91. create index i_file#_block# on cluster c_file#_block#
  92. /
  93. create cluster c_user#(user# number) 
  94.   size  315 /* cluster key ~ 20, sizeof(user$) ~ 170, 5 * sizeof(tsq$) ~ 125 */
  95. /
  96. create index i_user# on cluster c_user#
  97. /
  98. create table fet$                                       /* free extent table */
  99. ( ts#           number not null,        /* tablespace containing free extent */
  100.   file#         number not null,              /* file containing free extent */
  101.   block#        number not null,              /* starting dba of free extent */
  102.   length        number not null)          /* length in blocks of free extent */
  103. cluster c_ts#(ts#)
  104. /
  105. create table uet$                                       /* used extent table */
  106. ( segfile#      number not null,               /* segment header file number */
  107.   segblock#     number not null,              /* segment header block number */
  108.   ext#          number not null,         /* extent number within the segment */
  109.   ts#           number not null,        /* tablespace containing this extent */
  110.   file#         number not null,              /* file containing this extent */
  111.   block#        number not null,              /* starting dba of this extent */
  112.   length        number not null)          /* length in blocks of this extent */
  113. cluster c_file#_block#(segfile#, segblock#)
  114. /
  115. create table seg$                                           /* segment table */
  116. ( file#         number not null,               /* segment header file number */
  117.   block#        number not null,              /* segment header block number */
  118.   type          number not null,                /* segment type (see KTS.H): */
  119.    /* 1 = UNDO, 2 = SAVE UNDO, 3 = TEMPORARY, 4 = CACHE, 5 = DATA, 6 = INDEX */
  120.   ts#           number not null,       /* tablespace containing this segment */
  121.   blocks        number not null,       /* blocks allocated to segment so far */
  122.   extents       number not null,      /* extents allocated to segment so far */
  123.   iniexts       number not null,                      /* initial extent size */
  124.   minexts       number not null,                /* minimum number of extents */
  125.   maxexts       number not null,                /* maximum number of extents */
  126.   extsize       number not null,                 /* initial next extent size */
  127.   extpct        number not null,                    /* percent size increase */
  128.   user#         number not null,               /* user who owns this segment */
  129.   lists            number,                        /* freelists for this segment */
  130.   groups        number)                  /* freelist groups for this segment */
  131. cluster c_file#_block#(file#, block#)
  132. /
  133. create table undo$                                     /* undo segment table */
  134. ( us#           number not null,                      /* undo segment number */
  135.   name          varchar2("M_IDEN") not null,    /* name of this undo segment */
  136.   user#         number not null,      /* owner: 0 = SYS(PRIVATE), 1 = PUBLIC */
  137.   file#         number not null,               /* segment header file number */
  138.   block#        number not null,              /* segment header block number */
  139.   scnbas        number,           /* highest commit time in rollback segment */
  140.   scnwrp        number,              /* scnbas - scn base, scnwrp - scn wrap */
  141.   xactsqn       number,               /* highest transaction sequence number */
  142.   undosqn       number,                /* highest undo block sequence number */
  143.   inst#         number,    /* parallel server instance that owns the segment */
  144.   status$       number not null)              /* segment status (see KTS.H): */
  145.   /* 1 = INVALID, 2 = AVAILABLE, 3 = IN USE, 4 = OFFLINE, 5 = NEED RECOVERY, 
  146.    * 6 = PARTLY AVAILABLE (contains in-doubt txs) 
  147.    */
  148. /
  149. create table ts$                                         /* tablespace table */
  150. ( ts#           number not null,             /* tablespace identifier number */
  151.   name          varchar2("M_IDEN") not null,           /* name of tablespace */
  152.   owner#        number not null,                      /* owner of tablespace */
  153.   online$       number not null,                      /* status (see KTT.H): */
  154.                                      /* 1 = ONLINE, 2 = OFFLINE, 3 = INVALID */
  155.   undofile#     number,  /* undo_off segment file number (status is OFFLINE) */
  156.   undoblock#    number,               /* undo_off segment header file number */
  157.   blocksize     number not null,                   /* size of block in bytes */
  158.   inc#          number not null,             /* incarnation number of extent */
  159.   scnwrp    number,     /* clean offline scn - zero if not offline clean */
  160.   scnbas        number,              /* scnbas - scn base, scnwrp - scn wrap */
  161.   dflminext     number not null,       /*  default minimum number of extents */
  162.   dflmaxext     number not null,        /* default maximum number of extents */
  163.   dflinit       number not null,              /* default initial extent size */
  164.   dflincr       number not null,                 /* default next extent size */
  165.   dflextpct     number not null)     /* default percent extent size increase */
  166. cluster c_ts#(ts#)
  167. /
  168. create table file$                                             /* file table */
  169. ( file#         number not null,                   /* file identifier number */
  170.   status$       number not null,                      /* status (see KTS.H): */
  171.                                                /* 1 = INVALID, 2 = AVAILABLE */
  172.   blocks        number not null,                   /* size of file in blocks */
  173.   ts#           number not null)                /* tablespace that owns file */
  174. /
  175. create table obj$                                            /* object table */
  176. ( obj#          number not null,                            /* object number */
  177.   owner#        number not null,                        /* owner user number */
  178.   name        varchar2("M_IDEN") not null,              /* object name */
  179.   namespace     number not null,         /* namespace of object (see KQD.H): */
  180.        /* 1 = TABLE/PROCEDURE, 2 = BODY, 3 = TRIGGER, 4 = INDEX, 5 = CLUSTER */
  181.   type          number not null,                 /* object type (see KQD.H): */
  182.   /* 1 = INDEX, 2 = TABLE, 3 = CLUSTER, 4 = VIEW, 5 = SYNONYM, 6 = SEQUENCE, */
  183.              /* 7 = PROCEDURE, 8 = FUNCTION, 9 = PACKAGE, 10 = NON-EXISTENT, */
  184.                                           /* 11 = PACKAGE BODY, 12 = TRIGGER */
  185.   ctime        date not null,                       /* object creation time */
  186.   mtime        date not null,                      /* DDL modification time */
  187.   stime        date not null,          /* specification timestamp (version) */
  188.   status        number not null,            /* status of object (see KQD.H): */
  189.                                      /* 1 = VALID/AUTHORIZED WITHOUT ERRORS, */
  190.                           /* 2 = VALID/AUTHORIZED WITH AUTHORIZATION ERRORS, */
  191.                             /* 3 = VALID/AUTHORIZED WITH COMPILATION ERRORS, */
  192.                          /* 4 = VALID/UNAUTHORIZED, 5 = INVALID/UNAUTHORIZED */
  193.   remoteowner   varchar2("M_IDEN"),    /* remote owner name (remote object) */
  194.   linkname      varchar2("M_XDBI"))            /* link name (remote object) */
  195. /
  196. create table ind$                                             /* index table */
  197. ( obj#          number not null,                /* object number */
  198.   ts#        number not null,                        /* tablespace number */
  199.   file#        number not null,               /* segment header file number */
  200.   block#    number not null,              /* segment header block number */
  201.   bo#        number not null,          /* object number of base table */
  202.   cols          number not null,            /* number of columns */
  203.   pctfree$      number not null, /* minimum free space percentage in a block */
  204.   initrans      number not null,            /* initial number of transaction */
  205.   maxtrans      number not null,            /* maximum number of transaction */
  206.   compress$     number not null,       /* 0 = not compressed, 1 = compressed */
  207.   unique$       number not null,               /* 0 = not unique, 1 = unique */
  208.                                             /* future: 2 = ansi-style unique */
  209.   /* The following spare columns may be used for index statistics such
  210.    * as # btree levels, # btree leaf blocks, # distinct keys, 
  211.    * # distinct values of first key column, average # leaf blocks per key,
  212.    * clustering info, and # blocks in index segment.
  213.    */
  214.   blevel        number,                                       /* btree level */
  215.   leafcnt       number,                                  /* # of leaf blocks */
  216.   distkey       number,                                   /* # distinct keys */
  217.   lblkkey       number,                          /* avg # of leaf blocks/key */
  218.   dblkkey       number,                          /* avg # of data blocks/key */
  219.   clufac        number,                                 /* clustering factor */
  220.   spare7        number,                                  /* truncation count */
  221.   spare8        number
  222. )
  223. cluster c_obj#(bo#)
  224. /
  225. create table icol$                                     /* index column table */
  226. ( obj#          number not null,                      /* index object number */
  227.   bo#           number not null,               /* base object number */
  228.   col#          number not null,                            /* column number */
  229.   pos#          number not null,        /* column position number as created */
  230.   segcol#       number not null,         /* column number in segment */
  231.   segcollength  number not null,             /* length of the segment column */
  232.   offset        number not null)                         /* offset of column */
  233. cluster c_obj#(bo#)
  234. /
  235. create table col$                                            /* column table */
  236. ( obj#          number not null,             /* object number of base object */
  237.   col#        number not null,                 /* column number as created */
  238.   segcol#    number not null,         /* column number in segment */
  239.   segcollength  number not null,             /* length of the segment column */
  240.   offset        number not null,                         /* offset of column */
  241.   name        varchar2("M_IDEN") not null,           /* name of column */
  242.   type#          number  not null,              /* data type of column */
  243.   length    number  not null,        /* length of column in bytes */
  244.   fixedstorage  number  not null,                /* 0 = not fixed, 1 = fixed */
  245.   precision     number,                                         /* precision */
  246.   scale         number,                                             /* scale */
  247.   null$         number not null,                     /* 0 = NULLs permitted, */
  248.                                                 /* > 0 = no NULLs permitted  */
  249.   distcnt       number,                              /* # of distinct values */
  250.   lowval        raw(32),/* lowest value of column (second lowest if default) */
  251.   hival         raw(32),
  252.                       /* highest value of column (second highest if default) */
  253.   deflength     number,              /* default value expression text length */
  254.   default$      long,                       /* default value expression text */
  255.   /* The spares may be used as the column's NLS character set, 
  256.    * the number of distinct column values, and the column's domain.
  257.    */
  258.   spare2        number,                                     /* density value */
  259.   spare3        number
  260. )
  261. cluster c_obj#(obj#)
  262. /
  263. create table user$                                             /* user table */
  264. ( user#        number not null,                   /* user identifier number */
  265.   name            varchar2("M_IDEN") not null,             /* name of user */
  266.   type          number not null,                       /* 0 = role, 1 = user */
  267.   password    varchar2("M_IDEN"),               /* encrypted password */
  268.   datats#         number not null, /* default tablespace for permanent objects */
  269.   tempts#         number not null,  /* default tablespace for temporary tables */
  270.   ctime         date not null,                 /* user account creation time */
  271.   ptime         date,                            /* password expiration time */
  272.   resource$     number not null,                        /* resource profile# */
  273.   audit$    varchar2("S_OPFL"),                     /* user audit options */
  274.   defrole       number not null,                  /* default role indicator: */
  275.                /* 0 = no roles, 1 = all roles granted, 2 = roles in defrole$ */
  276.   spare1        number,                               /* reserved for future */
  277.   spare2        number)                               /* reserved for future */
  278. cluster c_user#(user#)
  279. /
  280. create table con$                                        /* constraint table */
  281. ( owner#        number not null,                        /* owner user number */
  282.   name          varchar2("M_IDEN") not null,              /* constraint name */
  283.   con#          number not null,                        /* constraint number */
  284.   spare1        number
  285. )
  286. /
  287. create cluster c_cobj# (obj# number)
  288.   pctfree 0 pctused 50
  289.   /* space for: update cdef$ set condition = 'col IS NOT NULL' at // */
  290.   size 300
  291.   storage (initial 50K)               /* avoid space management during IOR I */
  292. /
  293. create index i_cobj# on cluster c_cobj#
  294. /
  295. create table cdef$                            /* constraint definition table */
  296. ( con#          number not null,                        /* constraint number */
  297.   obj#          number not null,         /* object number of base table/view */
  298.   cols          number,                   /* number of columns in constraint */
  299.   type          number not null,                         /* constraint type: */
  300.                             /* 1 = table check, 2 = primary key, 3 = unique, */
  301.                                          /* 4 = referential, 5 = view check, */
  302.                      /* 6 = special for replication logging hook */
  303.                /* 7 - table check constraint associated with column NOT NULL */
  304.   robj#         number,                 /* object number of referenced table */
  305.   rcon#         number,           /* constraint number of referenced columns */
  306.   rrules        varchar2(3),         /* future: use this columns for pendant */
  307.   match         number,                /* referential constraint match type: */
  308.                                                  /* null = FULL, 1 = PARTIAL */
  309.         /* this column can also store information for other constraint types */
  310.   refact        number,                               /* referential action: */
  311.               /* null = RESTRICT, 1 = CASCADE, 2 = SET NULL, 3 = SET DEFAULT */
  312.   enabled        number,          /* is constraint enabled? NULL if disabled */
  313.   condlength    number,                 /* table check condition text length */
  314.   condition     long,                          /* table check condition text */
  315.   spare1        number
  316. )
  317. cluster c_cobj#(obj#)
  318. /
  319. create table ccol$                                /* constraint column table */
  320. ( con#          number not null,                        /* constraint number */
  321.   obj#        number not null,               /* base object number */
  322.   col#          number not null,                            /* column number */
  323.   pos#          number,                 /* column position number as created */
  324.   spare1        number
  325. )
  326. cluster c_cobj#(obj#)
  327. /
  328. create index i_tab1 on tab$(clu#)
  329. /
  330. create unique index i_undo1 on undo$(us#)
  331. /
  332. create unique index i_obj1 on obj$(obj#)
  333. /
  334. create unique index i_obj2 on obj$(owner#, name, namespace,
  335. remoteowner, linkname)
  336. /
  337. create unique index i_ind1 on ind$(obj#)
  338. /
  339. create index i_icol1 on icol$(obj#)
  340. /
  341. create unique index i_file1 on file$(file#)
  342. /
  343. create unique index i_user1 on user$(name)
  344. /
  345. create unique index i_col1 on col$(obj#, name)
  346.   storage (initial 30k)
  347. /
  348. create unique index i_col2 on col$(obj#, col#)
  349.   storage (initial 30k)
  350. /
  351. create unique index i_con1 on con$(owner#, name)
  352. /
  353. create unique index i_con2 on con$(con#)
  354. /
  355. create unique index i_cdef1 on cdef$(con#)
  356. /
  357. create index i_cdef2 on cdef$(obj#)
  358. /
  359. create index i_cdef3 on cdef$(robj#)
  360. /
  361. create unique index i_ccol1 on ccol$(con#, col#)
  362. /
  363. create table bootstrap$
  364. ( line#         number not null,                       /* statement order id */
  365.   obj#          number not null,                            /* object number */
  366.   sql_text      varchar2("M_VCSZ") not null)                    /* statement */
  367.   storage (initial 50K)            /* to avoid space management during IOR I */
  368. //                                            /* "//" required for bootstrap */
  369. create table tsq$                                  /* tablespace quota table */
  370. ( ts#           number not null,                        /* tablespace number */
  371.   user#         number not null,                              /* user number */
  372.   grantor#      number not null,                               /* grantor id */
  373.   blocks        number not null,         /* number of blocks charged to user */
  374.   maxblocks     number,     /* user's maximum number of blocks, NULL if none */
  375.   priv1         number not null,            /* reserved for future privilege */
  376.   priv2         number not null,            /* reserved for future privilege */
  377.   priv3         number not null)            /* reserved for future privilege */
  378. cluster c_user# (user#)
  379. /
  380. create table syn$                                           /* synonym table */
  381. ( obj#          number not null,                /* object number */
  382.   node        varchar2("M_XDBI"),               /* node of object */
  383.   owner     varchar2("M_IDEN"),                          /* object owner */
  384.   name        varchar2("M_IDEN") not null)              /* object name */
  385. /
  386. create table view$                                             /* view table */
  387. ( obj#          number not null,                /* object number */
  388.   audit$    varchar2("S_OPFL") not null,         /* auditing options */
  389.   cols          number not null,            /* number of columns */
  390.   textlength    number,                      /* length of view text */
  391.   text          long)                        /* view text */
  392. /
  393. create table seq$
  394. ( obj#            number not null,                            /* object number */
  395.   increment$    number not null,            /* the sequence number increment */
  396.   minvalue      number,                         /* minimum value of sequence */
  397.   maxvalue      number,                         /* maximum value of sequence */
  398.   cycle         number not null,                      /* 0 = FALSE, 1 = TRUE */
  399.   order$        number not null,                      /* 0 = FALSE, 1 = TRUE */
  400.   cache         number not null,                 /* how many to cache in sga */
  401.   highwater     number not null,                     /* disk high water mark */
  402.   audit$    varchar2("S_OPFL") not null)             /* auditing options */
  403. /
  404. create table procedure$                          /* procedure table */
  405. ( obj#          number not null,                /* object number */
  406.   audit$    varchar2("S_OPFL") not null,         /* auditing options */
  407.   storagesize   number,                /* storage size of procedure */
  408.   options       number)                               /* compile options */
  409. /
  410. create table argument$                     /* procedure argument description */
  411. ( obj#           number not null,                           /* object number */
  412.   procedure$     varchar2("M_IDEN"), /* procedure name (if within a package) */
  413.   overload#      number not null,
  414.                 /* 0 = not overloaded, n = unique id of overloaded procedure */
  415.   position       number not null,  /* argument position (0 for return value) */
  416.   sequence#      number not null,
  417.   level#         number not null,
  418.   argument       varchar2("M_IDEN"),/* argument name (null for return value) */
  419.   type           number not null,                           /* argument type */
  420.   default#       number,   /* null = no default value, 1 = has default value */
  421.   in_out         number,                   /* null = IN, 1 = OUT, 2 = IN/OUT */
  422.   length         number,                                      /* data length */
  423.   precision      number,                                /* numeric precision */
  424.   scale          number,                                    /* numeric scale */
  425.   radix          number,                                    /* numeric radix */
  426.   deflength      number,             /* default value expression text length */
  427.   default$       long)                      /* default value expression text */
  428. /
  429. create table source$                             /* source table */
  430. ( obj#          number not null,                /* object number */
  431.   line          number not null,                  /* line number */
  432.   source        varchar2("M_VCSZ"))                           /* source line */
  433. /
  434. create table idl_ub1$                            /* idl table for ub1 pieces */
  435. ( obj#          number not null,                            /* object number */
  436.   part          number not null,
  437.          /* part: 0 = diana, 1 = portable pcode, 2 = machine-dependent pcode */
  438.   version       number,                                    /* version number */
  439.   piece#        number not null,                             /* piece number */
  440.   length        number not null,                             /* piece length */
  441.   piece         long raw not null)                              /* ub1 piece */
  442. /
  443. create table idl_char$                          /* idl table for char pieces */
  444. ( obj#          number not null,                            /* object number */
  445.   part          number not null,
  446.          /* part: 0 = diana, 1 = portable pcode, 2 = machine-dependent pcode */
  447.   version       number,                                    /* version number */
  448.   piece#        number not null,                             /* piece number */
  449.   length        number not null,                             /* piece length */
  450.   piece         long not null)                                 /* char piece */
  451. /
  452. create table idl_ub2$                            /* idl table for ub2 pieces */
  453. ( obj#          number not null,                            /* object number */
  454.   part          number not null,
  455.          /* part: 0 = diana, 1 = portable pcode, 2 = machine-dependent pcode */
  456.   version       number,                                    /* version number */
  457.   piece#        number not null,                             /* piece number */
  458.   length        number not null,                             /* piece length */
  459.   piece         long ub2 not null)                              /* ub2 piece */
  460. /
  461. create table idl_sb4$                            /* idl table for sb4 pieces */
  462. ( obj#          number not null,                            /* object number */
  463.   part          number not null,
  464.          /* part: 0 = diana, 1 = portable pcode, 2 = machine-dependent pcode */
  465.   version       number,                                    /* version number */
  466.   piece#        number not null,                             /* piece number */
  467.   length        number not null,                             /* piece length */
  468.   piece         long sb4 not null)                              /* sb4 piece */
  469. /
  470. create table error$                                           /* error table */
  471. ( obj#          number not null,                            /* object number */
  472.   sequence      number default 0 not null,
  473.                                   /* sequence number (for ordering purposes) */
  474.   line          number not null,                       /* source line number */
  475.   position      number not null,                  /* position in source line */
  476.   textlength    number not null,                 /* length of the error text */
  477.   text          varchar2("M_VCSZ") not null)                   /* error text */
  478. /
  479. create table trigger$                            /* trigger table */
  480. ( obj#        number not null,                /* object number */
  481.   type          number not null,                            /* trigger type: */
  482.         /*  0 = BEFORE TABLE, 1 = BEFORE ROW, 2 = AFTER TABLE, 3 = AFTER ROW */
  483.   update$       number not null,                   /* fire on update */
  484.   insert$       number not null,               /* fire on insert */
  485.   delete$       number not null,               /* fire on delete */
  486.   baseobject     number not null,                       /* triggering object */
  487.   refoldname    varchar2("M_IDEN"),             /* old referencing name */
  488.   refnewname    varchar2("M_IDEN"),             /* new referencing name */
  489.   definition    varchar2("M_VCSZ"),               /* trigger definition */
  490.   whenclause    varchar2("M_VCSZ"),                   /* text of when clause */
  491.   action        long,                                  /* action to fire */
  492.   actionsize    number,                      /* size of action text */
  493.   enabled       number)                /* 0 = DISABLED, 1 = ENABLED */
  494. /
  495. create table triggercol$
  496. ( obj#        number not null,                /* object number */
  497.   col#          number not null,                /* column number */
  498.   type          number not null,                /* type of column reference: */
  499.       /* 2 = OLD IN-ARG, 3 = NEW IN-ARG, 5 = NEW OUT-VAR, 7 = NEW IN/OUT-VAR */
  500.   position      number)                      /* position in trigger */
  501. /
  502. create table objauth$                /* table authorization table */
  503. ( obj#        number not null,                /* object number */
  504.   grantor#    number not null,                      /* grantor user number */
  505.   grantee#    number not null,                      /* grantee user number */
  506.   privilege#     number not null,                   /* table privilege number */
  507.   sequence#    number not null,             /* unique grant sequence */
  508.   parent        rowid,                                             /* parent */
  509.   option$    number,                     /* null = none, 1 = grant option */
  510.   col#          number)     /* null = table level, column id if column grant */
  511. /
  512. create table sysauth$                          /* system authorization table */
  513. ( grantee#     number not null,          /* grantee number (user# or role#) */
  514.   privilege#     number not null,                      /* role or privilege # */
  515.   sequence#    number not null,             /* unique grant sequence */
  516.   option$    number)                     /* null = none, 1 = admin option */
  517. /
  518. create table objpriv$                       /* privileges granted to objects */
  519. ( obj#          number not null,                            /* object number */
  520.   privilege#     number not null)                         /* privilege number */
  521. /
  522. create table defrole$                                  /* default role table */
  523. ( user#        number not null,                   /* user id */
  524.   role#        number not null)                /* default role id */
  525. /
  526. create table profile$                                    /* resource profile */
  527. ( profile#    number not null,   /* user$.resource$ and profname$.profile# */
  528.   resource#    number not null,                          /* resource number */
  529.   type        number not null,  /* 0 = kernel resource, else tool resource */
  530.   limit        number not null)                           /* resource limit */
  531. /
  532. create table profname$                /* mapping of profile# to profile name */
  533. ( profile#    number not null,
  534.   name        varchar2("M_IDEN") not null)
  535. /
  536. create table dependency$                                 /* dependency table */
  537. ( d_obj#        number not null,                  /* dependent object number */
  538.   d_timestamp   date not null,   /* dependent object specification timestamp */
  539.   order#        number not null,                             /* order number */
  540.   p_obj#        number not null,             /* parent object number */
  541.   p_timestamp   date not null)      /* parent object specification timestamp */
  542. /
  543. create table access$                             /* access table */
  544. ( d_obj#        number not null,              /* dependent object number */
  545.   order#        number not null,                  /* dependency order number */
  546.   columns       raw("M_BVCO"),                /* list of cols for this entry */
  547.   types         number not null)                             /* access types */
  548. /
  549. /* K_MLS change */
  550. create table lab$
  551. ( lab#          mlslabel not null,         /* internal database label number */
  552.   olab          raw(255),                   /* operating system label number */
  553.   alias         varchar2("M_IDEN"))                  /* alias for label name */
  554. /
  555. create table aud$                    /* audit trail table */
  556. ( sessionid     number not null,
  557.   entryid    number not null,
  558.   statement    number not null,
  559.   timestamp    date not null,
  560.   userid    varchar2("M_IDEN"),
  561.   userhost    varchar2("M_HOST"),
  562.   terminal    varchar2("M_TERM"),
  563.   action    number not null,
  564.   returncode    number not null,
  565.   obj$creator    varchar2("M_IDEN"),
  566.   obj$name    varchar2("M_XDBI"),
  567.   auth$privileges varchar2("S_PRFL"),
  568.   auth$grantee    varchar2("M_IDEN"),
  569.   new$owner     varchar2("M_IDEN"),
  570.   new$name    varchar2("M_XDBI"),
  571.   ses$actions    varchar2("S_ACFL"),
  572.   ses$tid    number,
  573.   logoff$lread    number,
  574.   logoff$pread    number,
  575.   logoff$lwrite number,
  576.   logoff$dead    number,
  577.   logoff$time    date,
  578.   comment$text    varchar2("M_VCSZ"),
  579.   spare1        varchar2(255),
  580.   spare2        number,
  581.   obj$label     raw(255),                                   /* K_MLS changes */
  582.   ses$label     raw(255),
  583.   priv$used     number)
  584. /
  585. create table link$                             /* remote database link table */
  586. ( owner#        number not null,                        /* owner user number */
  587.   name          varchar2("M_XDBI") not null,                  /* link name */
  588.   ctime            date not null,                              /* creation time */
  589.   host            varchar2("M_HOST"),    /* optional driver string for connect */
  590.   userid        varchar2("M_IDEN"),             /* optional user to logon as */
  591.   password      varchar2("M_IDEN"))                    /* password for logon */
  592. /
  593. create table props$
  594. ( name          varchar2("M_IDEN") not null,                /* property name */
  595.   value$        varchar2("M_VCSZ"),                        /* property value */
  596.   comment$      varchar2("M_VCSZ"))               /* description of property */
  597. /
  598. create table com$                                           /* comment table */
  599. ( obj#          number not null,                            /* object number */
  600.   col#          number,               /* column number (NULL if for object) */
  601.   comment$    varchar2("M_VCSZ"))           /* user-specified description */
  602. /
  603. create table resource_cost$
  604. ( resource#    number not null,                         /* 2, 4, 6, 7, 8, 9 */
  605.   cost        number not null)                                     /* >= 0 */
  606. /
  607. insert into resource_cost$ values (0, 0)                         /* not used */
  608. /
  609. insert into resource_cost$ values (1, 0)                /* sessions_per_user */
  610. /
  611. insert into resource_cost$ values (2, 0)                  /* cpu_per_session */
  612. /
  613. insert into resource_cost$ values (3, 0)                         /* not used */
  614. /
  615. insert into resource_cost$ values (4, 0)        /* logical_reads_per_session */
  616. /
  617. insert into resource_cost$ values (5, 0)                         /* not used */
  618. /
  619. insert into resource_cost$ values (6, 0)                         /* not used */
  620. /
  621. insert into resource_cost$ values (7, 0)                     /* connect_time */
  622. /
  623. insert into resource_cost$ values (8, 0)                      /* private_sga */
  624. /
  625. insert into resource_cost$ values (9, 0)                         /* not used */
  626. /
  627. insert into props$ 
  628. values('DICT.BASE', '2', 'dictionary base tables version #')
  629. /
  630. create unique index i_view1 on view$(obj#)
  631. /
  632. create unique index i_syn1 on syn$(obj#)
  633. /
  634. create unique index i_seq1 on seq$(obj#)
  635. /
  636. create unique index i_objauth1 on 
  637.   objauth$(obj#, grantor#, grantee#, privilege#, col#)
  638. /
  639. create index i_objauth2 on objauth$(grantee#, obj#, col#)
  640. /
  641. create unique index i_sysauth1 on sysauth$(grantee#, privilege#)
  642. /
  643. create unique index i_defrole1 on defrole$(user#, role#)
  644. /
  645. create index i_aud1 on aud$(sessionid, ses$tid)
  646. /
  647. create index i_link1 on link$(owner#, name)
  648. /
  649. create unique index i_com1 on com$(obj#, col#)
  650. /
  651. create unique index i_procedure1 on procedure$(obj#)
  652. /
  653. create unique index i_argument1 on 
  654.   argument$(obj#, procedure$, overload#, sequence#)
  655. /
  656. create unique index i_source1 on source$(obj#, line)
  657. /
  658. create unique index i_idl_ub11 on idl_ub1$(obj#, part, version, piece#)
  659. /
  660. create unique index i_idl_char1 on idl_char$(obj#, part, version, piece#)
  661. /
  662. create unique index i_idl_ub21 on idl_ub2$(obj#, part, version, piece#)
  663. /
  664. create unique index i_idl_sb41 on idl_sb4$(obj#, part, version, piece#)
  665. /
  666. create index i_error1 on error$(obj#, sequence)
  667. /
  668. create unique index i_dependency1 on dependency$(d_obj#, d_timestamp, order#)
  669. /
  670. create index i_access1 on access$(d_obj#)
  671. /
  672. create index i_dependency2 on dependency$(p_obj#, p_timestamp)
  673. /
  674. create index i_trigger1 on trigger$(baseobject)
  675. /                                             
  676. create unique index i_trigger2 on trigger$(obj#)
  677. /
  678. create index i_triggercol on triggercol$(obj#, col#, type, position)
  679. /
  680. create unique index i_profname on profname$(name)
  681. /
  682. create index i_profile on profile$(profile#)
  683. /
  684. /* K_MLS sequence */
  685. create sequence label_translation   /* sequence for translation cache (lab$) */
  686.   increment by 1
  687.   start with 3
  688.   minvalue 3
  689.   nomaxvalue
  690.   cache 20
  691.   order
  692.   nocycle
  693. /
  694. create sequence object_grant                 /* object grant sequence number */
  695.   start with 1
  696.   increment by 1
  697.   minvalue 1
  698.   nomaxvalue
  699.   cache 20
  700.   order
  701.   nocycle
  702. /
  703. create sequence system_grant                 /* system grant sequence number */
  704.   start with 1
  705.   increment by 1
  706.   minvalue 1
  707.   nomaxvalue
  708.   cache 20
  709.   order
  710.   nocycle
  711. /
  712. create sequence profnum$                   /* profile number sequence number */
  713.   increment by 1
  714.   start with 0                              /* profile# for DEFAULT always 0 */
  715.   minvalue 0
  716.   nocache                                           /* don't want to reuse 0 */
  717. /
  718. create profile "DEFAULT" limit            /* default value, always present */
  719.   composite_limit        unlimited                   /* service units */
  720.   sessions_per_user        unlimited              /* logins per user id */
  721.   cpu_per_session        unlimited            /* cpu usage in minutes */
  722.   cpu_per_call            unlimited        /* max cpu minutes per call */
  723.   logical_reads_per_session    unlimited
  724.   logical_reads_per_call    unlimited
  725.   idle_time            unlimited
  726.   connect_time             unlimited
  727.   private_sga            unlimited      /* valid only with TP-monitor */
  728. /
  729. create table incexp                      /* incremental export support table */
  730. ( owner#        number not null,                                 /* owner id */
  731.   name          varchar2("M_IDEN") not null,                  /* object name */
  732.   type            number(1) not null,                           /* object type */
  733.   ctime            date,                      /* time of last cumulative export */
  734.   itime            date not null,            /* time of last incremental export */
  735.   expid         number(3) not null)                             /* export id */
  736. /
  737. create unique index i_incexp on incexp(owner#, name, type)
  738. /
  739.  
  740. Rem The following users and roles are automatically created during
  741. Rem CREATE DATABASE.
  742. create user sys identified by change_on_install
  743. /
  744. create role public
  745. /
  746. create role connect
  747. /
  748. grant create session,alter session,create synonym,create view,
  749.  create database link,create table,create cluster,create sequence to connect
  750. /
  751. create role resource
  752. /
  753. grant create table,create cluster,create sequence,create trigger,
  754.  create procedure to resource
  755. /
  756. create role dba
  757. /
  758. grant all privileges to dba with admin option
  759. /
  760. create user system identified by manager
  761. /
  762. grant dba to system with admin option
  763. /
  764. grant all on incexp to system
  765. /
  766. create table incvid                    /* incremental valid identifier table */
  767. ( expid         number(3) not null)               /* id of last valid export */
  768. /
  769. insert into incvid(expid) values (0)
  770. /
  771. grant all on incvid to system
  772. /
  773. create table incfil                         /* incremental file export table */
  774. ( expid         number(3) not null,                             /* export id */
  775.   exptype       varchar2(1) not null,                        /* export type: */
  776.                             /* X - complete, I - incremental, C - cumulative */
  777.   expfile       varchar2(100) not null,                  /* export file name */
  778.   expdate       date not null,                                /* export date */
  779.   expuser       varchar2("M_IDEN") not null)            /* user doing export */
  780. /
  781. grant all on incfil to system
  782. /
  783. create table "_default_auditing_options_"   /* default auditing option table */
  784. ( a             varchar2(1))                              /* auditing option */
  785. /
  786. create sequence audses$                               /* auditing session id */
  787.   start with 1
  788.   increment by 1
  789.   minvalue 1
  790.   maxvalue 2E9                                     /* maxvalue fits in a ub4 */
  791.   cycle
  792.   cache 20
  793.   noorder
  794. /
  795. create table audit$                                 /* auditing option table */
  796. ( user#        number not null,                   /* user identifier number */
  797.   option#       number not null,                   /* auditing option number */
  798.   success       number,                                 /* audit on success? */
  799.   failure       number)                                 /* audit on failure? */
  800.                /* null = no audit, 1 = audit by session, 2 = audit by access */
  801. /
  802. create unique index i_audit on audit$(user#, option#)
  803.                        /* this index is more for uniqueness than performance */
  804. /
  805. create table pending_trans$        /* pending or "indoubt" transactions */
  806. ( local_tran_id      varchar2("M_LTID") not null, /* print form of kxid (local) */
  807.   global_tran_fmt integer not null,               /* global tran format code */
  808.   global_oracle_id  varchar2("M_GTID"),                      /* Oracle k2gti */
  809.   global_foreign_id raw("M_GTID"),                       /* non-Oracle k2gti */
  810.   tran_comment      varchar2("M_XCMT"),             /* commit/rollback comment */
  811.   state          varchar2(16) not null,       /* see k2.h: k2sta (tx state) */
  812.   status          varchar2(1) not null,                   /* Pending, Damage */
  813.   heuristic_dflt  varchar2(1),                  /* advice: Commit/Rollback/? */
  814.   session_vector  raw(4) not null,              /* bit map of pending sess's */
  815.   reco_vector      raw(4) not null,             /* map of sess's rdy for reco */
  816.   fail_time      date not null,                            /* time inserted */
  817.   heuristic_time  date,                        /* time of heuristic decision */
  818.   reco_time      date not null,               /* last time tried (exp.b.o.) */
  819.   top_db_user     varchar2("M_IDEN"),        /* top level DB session created */
  820.   top_os_user     varchar2("M_UNML"),              /* top level OS user name */
  821.   top_os_host      varchar2("M_HOST"),         /* top level user OS host name */
  822.   top_os_terminal varchar2("M_TERM"),            /* top level OS terminal id */
  823.   global_commit#  varchar2(16) )              /* global system commit number */
  824. /
  825. create unique index i_pending_trans1 on pending_trans$(local_tran_id)
  826.   /* this index is not for performance, but rather to ensure uniqueness */
  827. /
  828. create table pending_sessions$                  /* child of pending_trans$ */
  829. ( local_tran_id   varchar2("M_LTID") not null,                /* 1:n w/ parent */
  830.   session_id      smallint not null,
  831.   branch_id      raw("M_GBID") not null,                        /* of local */
  832.   interface      varchar2(1) not null,             /* C=commit/confirm, P=prep */
  833.   parent_dbid      varchar2("M_IDBI"),             /* null string->top level */
  834.   parent_db      varchar2("M_XDBI"),      /* global name of parent database */
  835.   db_userid      integer not null)                 /* creator of DB session */
  836. /
  837. create table pending_sub_sessions$           /* child of pending_sessions$ */
  838. ( local_tran_id   varchar2("M_LTID") not null,    /* w/session_id,1:n w/parent */
  839.   session_id      smallint not null,                             /* of local */
  840.   sub_session_id  smallint not null, /* session,sub_session is remote branch */
  841.   interface      varchar2(1) not null,         /* C=hold commit, N=no hold */
  842.   dbid          varchar2("M_IDBI") not null,            /* of remote */
  843.   link_owner      integer not null,              /* owner of dblink */
  844.   dblink      varchar2("M_XDBI") not null)
  845. /
  846. create cluster c_mlog# (master varchar2("M_IDEN"),
  847.                         mowner varchar2("M_IDEN"))
  848. /
  849. create index i_mlog# on cluster c_mlog#
  850. /
  851. create table mlog$          /* list of local master tables used by snapshots */
  852. ( mowner          varchar2("M_IDEN") not null,            /* owner of master */
  853.   master          varchar2("M_IDEN") not null,             /* name of master */
  854.   oldest          date,                                /* maximum age of log */
  855.   oscn            number,                                   /* scn of oldest */
  856.   youngest        date,                     /* most recent snaptime assigned */
  857.   yscn            number,                                 /* scn of youngest */
  858.   log             varchar2("M_IDEN") not null,                /* name of log */
  859.   trig            varchar2("M_IDEN") not null)  /* trigger on master for log */
  860. cluster c_mlog# (master, mowner)
  861. /
  862. create table slog$                     /* list of snapshots on local masters */
  863. ( mowner          varchar2("M_IDEN") not null,            /* owner of master */
  864.   master          varchar2("M_IDEN") not null,             /* name of master */
  865.   snapshot        date,                               /* identifies snapshot */
  866.   sscn            number,                                 /* scn of snapshot */
  867.   snaptime        date               not null,        /* when last refreshed */
  868.   tscn            number)                                 /* scn of snaptime */
  869. cluster c_mlog# (master, mowner)
  870. /
  871. create index i_slog1 on slog$(snaptime)
  872. /
  873. create table snap$                                /* list of local snapshots */
  874. ( sowner          varchar2("M_IDEN") not null,          /* owner of snapshot */
  875.   vname           varchar2("M_IDEN") not null,      /* name of snapshot view */
  876.   tname           varchar2("M_IDEN") not null,     /* name of snapshot table */
  877.   mview           varchar2("M_IDEN") not null, /* view snapshot is made from */
  878.   mowner          varchar2("M_IDEN"),                     /* owner of master */
  879.   master          varchar2("M_IDEN"),                      /* name of master */
  880.   mlink           varchar2("M_XDBI"),        /* database link to master site */
  881.   can_use_log     varchar2(1),                                     /* unused */
  882.   snapshot        date,       /* used by the master to identify the snapshot */
  883.   sscn            number,                                 /* scn of snapshot */
  884.   snaptime        date,             /* when this snapshot was last refreshed */
  885.   tscn            number,                                 /* scn of snaptime */
  886.   error#          number,          /* last error caused by automatic refresh */
  887.   auto_fast       varchar2(1),        /* date function for automatic refresh */
  888.   auto_fun        varchar2("M_DATF"),             /* obsolete, 7.1 and above */
  889.   auto_date       date,                           /* obsolete, 7.1 and above */
  890.   refgroup        number,                                          /* unused */
  891.   ustrg           varchar2("M_IDEN"),     /* trigger for updatable snapshots */
  892.   uslog           varchar2("M_IDEN"),         /* log for updatable snapshots */
  893.   field1          number,                                  /* for future use */
  894.   field2          varchar2("M_IDEN"),                      /* for future use */
  895.   flag            number,                     /* 0x01, can use master log    */
  896.                                               /* 0x02, snapshot is updatable */
  897.   query_txt       long)                /* query which this view instantiates */
  898. /
  899. create unique index i_snap1 on snap$(vname, sowner)
  900. /
  901. rem 
  902. rem  Job Queue
  903. rem
  904. create sequence jobseq
  905.   start with 1
  906.   increment by 1
  907.   minvalue 1
  908.   maxvalue 999999999                        /* should be less than MAXSB4VAL */
  909.   cache 20
  910.   noorder
  911.   cycle
  912. /
  913. create table job$
  914. ( job             number not null,                  /* identifier of the job */
  915.   lowner          varchar2("M_IDEN") not null,             /* logged in user */
  916.   powner          varchar2("M_IDEN") not null,                   /* security */
  917.   cowner          varchar2("M_IDEN") not null,                    /* parsing */
  918.   last_date       date,                      /* when this job last succeeded */
  919.   this_date       date,    /* when the current execute started, usually null */
  920.   next_date       date not null,             /* when to execute the job next */
  921.   total           number default 0 not null, /* total time spent on this job */
  922.   interval        varchar2("M_DATF") not null,/* function for next next_date */
  923.   failures        number,           /* number of failures since last success */
  924.   flag            number default 0 not null,     /* 0x01, this job is broken */
  925.   what            varchar2("M_VCSZ"),        /* PL/SQL text, what is the job */
  926.   nlsenv          varchar2("M_VCSZ"),                      /* nls parameters */
  927.   env             raw(32),                    /* other environment variables */
  928.   cur_ses_label   mlslabel,      /* current session label for trusted oracle */
  929.   clearance_hi    mlslabel,             /* clearance high for trusted oracle */
  930.   clearance_lo    mlslabel,              /* clearance low for trusted oracle */
  931.   charenv         varchar2("M_VCSZ"),                            /* not used */
  932.   field1          number default 0)                              /* not used */
  933. /
  934. create unique index i_job_job on job$ (job)
  935. /
  936. create index i_job_next on job$ (next_date)
  937. /
  938. rem
  939. rem  Refresh Groups
  940. rem
  941. create sequence rgroupseq
  942.   start with 1
  943.   increment by 1
  944.   minvalue 1
  945.   maxvalue 999999999                        /* should be less than MAXSB4VAL */
  946.   cache 20
  947.   noorder
  948.   cycle
  949. /
  950. create cluster c_rg#
  951. ( refgroup        number)                            /* refresh group number */
  952. /
  953. create index i_rg# on cluster c_rg#
  954. /
  955. create table rgroup$
  956. ( refgroup        number,                         /* number of refresh group */
  957.   owner           varchar2("M_IDEN") not null,     /* owner of refresh group */
  958.   name            varchar2("M_IDEN") not null,      /* name of refresh group */
  959.   flag            number default 0,        /* 0x01, destroy group when empty */
  960.                                                  /* 0x02, do not push queues */
  961.                                                /* 0x04, refresh after errors */
  962.   rollback_seg    varchar2("M_IDEN"),             /* rollback segment to use */
  963.   field1          number default 0,
  964.   job             number not null)  /* job in job$ for refreshing this group */
  965. cluster c_rg# (refgroup)
  966. /
  967. create unique index i_rgroup on rgroup$ (owner, name)
  968. /
  969. create unique index i_rgref on rgroup$ (refgroup)
  970. /
  971. create index i_rgjob on rgroup$ (job)
  972. /
  973. create table rgchild$
  974. ( owner           varchar2("M_IDEN") not null,             /* owner of child */
  975.   name            varchar2("M_IDEN") not null,              /* name of child */
  976.   type            varchar2("M_IDEN") default 'SNAPSHOT',   /* type of object */
  977.   field1          number default 0,
  978.   refgroup        number)                   /* refresh group the child is in */
  979. cluster c_rg# (refgroup)
  980. /
  981. create unique index i_rgchild on rgchild$ (owner, name, type)
  982. /
  983. rem
  984. rem  Drop User Cascade
  985. rem
  986. create table duc$
  987. ( owner           varchar2("M_IDEN") not null,            /* procedure owner */
  988.   pack            varchar2("M_IDEN") not null,          /* procedure package */
  989.   proc            varchar2("M_IDEN") not null,             /* procedure name */
  990.   field1          number default 0,
  991.   operation       number not null,                    /* 1=drop user cascade */
  992.   seq             number not null,            /* for ordering the procedures */
  993.   com             varchar2(80))       /* comment on what this routine is for */
  994. /
  995. create unique index i_duc on duc$ (owner,pack,proc,operation)
  996. /
  997. rem
  998. rem  Histograms
  999. rem
  1000. create cluster hist$
  1001. ( obj#            number,                                   /* object number */
  1002.   col#            number)                                   /* column number */
  1003.   pctfree 5 size 200
  1004. /
  1005. create index i_hist$ on cluster hist$
  1006. /
  1007. create table histogram$                                   /* histogram table */
  1008. ( obj#            number not null,                          /* object number */
  1009.   col#            number not null,                          /* column number */
  1010.   bucket          number not null,                          /* bucket number */
  1011.   endpoint        number not null,                  /* endpoint hashed value */
  1012.   endpointr       raw(32))                             /* endpoint raw value */
  1013. cluster hist$(obj#, col#)
  1014. /
  1015. create table dual                   /* pl/sql's standard pckg requires dual. */
  1016.   (dummy varchar2(1))    /* note, the optimizer knows sys.dual is single row */
  1017.   storage (initial 1)
  1018. /
  1019. insert into dual values('X')
  1020. /
  1021. create public synonym dual for dual
  1022. /
  1023. grant select on dual to public with grant option
  1024. /
  1025. rem Dual and this sequence are required by the parallel query option.
  1026. create sequence ora_tq_base$
  1027.   start with 1
  1028.   increment by 1
  1029.   nominvalue
  1030.   nomaxvalue
  1031.   nocache
  1032.   noorder
  1033.   nocycle
  1034. /
  1035.  
  1036. rem
  1037. rem  FAMILY "PRIVILEGE MAP"
  1038. rem  Tables for mapping privilege numbers to privilege names.
  1039. rem
  1040. rem  SYSTEM_PRIVILEGE_MAP maps a system privilege  number
  1041. rem  to the name.
  1042. rem
  1043. drop table SYSTEM_PRIVILEGE_MAP
  1044. /
  1045. create table SYSTEM_PRIVILEGE_MAP (
  1046.         PRIVILEGE       number not null,
  1047.         NAME            varchar2(40) not null)
  1048. /
  1049. comment on table SYSTEM_PRIVILEGE_MAP is
  1050. 'Description table for privilege type codes.  Maps privilege  type numbers to type names'
  1051. /
  1052. comment on column SYSTEM_PRIVILEGE_MAP.PRIVILEGE is
  1053. 'Numeric privilege type code'
  1054. /
  1055. comment on column SYSTEM_PRIVILEGE_MAP.NAME is
  1056. 'Name of the type of privilege'
  1057. /
  1058. insert into SYSTEM_PRIVILEGE_MAP values (-3, 'ALTER SYSTEM');
  1059. insert into SYSTEM_PRIVILEGE_MAP values (-4, 'AUDIT SYSTEM');
  1060. insert into SYSTEM_PRIVILEGE_MAP values (-5, 'CREATE SESSION');
  1061. insert into SYSTEM_PRIVILEGE_MAP values (-6, 'ALTER SESSION');
  1062. insert into SYSTEM_PRIVILEGE_MAP values (-7, 'RESTRICTED SESSION');
  1063. insert into SYSTEM_PRIVILEGE_MAP values (-10, 'CREATE TABLESPACE');
  1064. insert into SYSTEM_PRIVILEGE_MAP values (-11, 'ALTER TABLESPACE');
  1065. insert into SYSTEM_PRIVILEGE_MAP values (-12, 'MANAGE TABLESPACE');
  1066. insert into SYSTEM_PRIVILEGE_MAP values (-13, 'DROP TABLESPACE');
  1067. insert into SYSTEM_PRIVILEGE_MAP values (-15, 'UNLIMITED TABLESPACE');
  1068. insert into SYSTEM_PRIVILEGE_MAP values (-20, 'CREATE USER');
  1069. insert into SYSTEM_PRIVILEGE_MAP values (-21, 'BECOME USER');
  1070. insert into SYSTEM_PRIVILEGE_MAP values (-22, 'ALTER USER');
  1071. insert into SYSTEM_PRIVILEGE_MAP values (-23, 'DROP USER');
  1072. insert into SYSTEM_PRIVILEGE_MAP values (-30, 'CREATE ROLLBACK SEGMENT');
  1073. insert into SYSTEM_PRIVILEGE_MAP values (-31, 'ALTER ROLLBACK SEGMENT');
  1074. insert into SYSTEM_PRIVILEGE_MAP values (-32, 'DROP ROLLBACK SEGMENT');
  1075. insert into SYSTEM_PRIVILEGE_MAP values (-40, 'CREATE TABLE');
  1076. insert into SYSTEM_PRIVILEGE_MAP values (-41, 'CREATE ANY TABLE');
  1077. insert into SYSTEM_PRIVILEGE_MAP values (-42, 'ALTER ANY TABLE');
  1078. insert into SYSTEM_PRIVILEGE_MAP values (-43, 'BACKUP ANY TABLE');
  1079. insert into SYSTEM_PRIVILEGE_MAP values (-44, 'DROP ANY TABLE');
  1080. insert into SYSTEM_PRIVILEGE_MAP values (-45, 'LOCK ANY TABLE');
  1081. insert into SYSTEM_PRIVILEGE_MAP values (-46, 'COMMENT ANY TABLE');
  1082. insert into SYSTEM_PRIVILEGE_MAP values (-47, 'SELECT ANY TABLE');
  1083. insert into SYSTEM_PRIVILEGE_MAP values (-48, 'INSERT ANY TABLE');
  1084. insert into SYSTEM_PRIVILEGE_MAP values (-49, 'UPDATE ANY TABLE');
  1085. insert into SYSTEM_PRIVILEGE_MAP values (-50, 'DELETE ANY TABLE');
  1086. insert into SYSTEM_PRIVILEGE_MAP values (-60, 'CREATE CLUSTER');
  1087. insert into SYSTEM_PRIVILEGE_MAP values (-61, 'CREATE ANY CLUSTER');
  1088. insert into SYSTEM_PRIVILEGE_MAP values (-62, 'ALTER ANY CLUSTER');
  1089. insert into SYSTEM_PRIVILEGE_MAP values (-63, 'DROP ANY CLUSTER');
  1090. insert into SYSTEM_PRIVILEGE_MAP values (-71, 'CREATE ANY INDEX');
  1091. insert into SYSTEM_PRIVILEGE_MAP values (-72, 'ALTER ANY INDEX');
  1092. insert into SYSTEM_PRIVILEGE_MAP values (-73, 'DROP ANY INDEX');
  1093. insert into SYSTEM_PRIVILEGE_MAP values (-80, 'CREATE SYNONYM');
  1094. insert into SYSTEM_PRIVILEGE_MAP values (-81, 'CREATE ANY SYNONYM');
  1095. insert into SYSTEM_PRIVILEGE_MAP values (-82, 'DROP ANY SYNONYM');
  1096. insert into SYSTEM_PRIVILEGE_MAP values (-83, 'SYSDBA');
  1097. insert into SYSTEM_PRIVILEGE_MAP values (-84, 'SYSOPER');
  1098. insert into SYSTEM_PRIVILEGE_MAP values (-85, 'CREATE PUBLIC SYNONYM');
  1099. insert into SYSTEM_PRIVILEGE_MAP values (-86, 'DROP PUBLIC SYNONYM');
  1100. insert into SYSTEM_PRIVILEGE_MAP values (-90, 'CREATE VIEW');
  1101. insert into SYSTEM_PRIVILEGE_MAP values (-91, 'CREATE ANY VIEW');
  1102. insert into SYSTEM_PRIVILEGE_MAP values (-92, 'DROP ANY VIEW');
  1103. insert into SYSTEM_PRIVILEGE_MAP values (-105, 'CREATE SEQUENCE');
  1104. insert into SYSTEM_PRIVILEGE_MAP values (-106, 'CREATE ANY SEQUENCE');
  1105. insert into SYSTEM_PRIVILEGE_MAP values (-107, 'ALTER ANY SEQUENCE');
  1106. insert into SYSTEM_PRIVILEGE_MAP values (-108, 'DROP ANY SEQUENCE');
  1107. insert into SYSTEM_PRIVILEGE_MAP values (-109, 'SELECT ANY SEQUENCE');
  1108. insert into SYSTEM_PRIVILEGE_MAP values (-115, 'CREATE DATABASE LINK');
  1109. insert into SYSTEM_PRIVILEGE_MAP values (-120, 'CREATE PUBLIC DATABASE LINK');
  1110. insert into SYSTEM_PRIVILEGE_MAP values (-121, 'DROP PUBLIC DATABASE LINK');
  1111. insert into SYSTEM_PRIVILEGE_MAP values (-125, 'CREATE ROLE');
  1112. insert into SYSTEM_PRIVILEGE_MAP values (-126, 'DROP ANY ROLE');
  1113. insert into SYSTEM_PRIVILEGE_MAP values (-127, 'GRANT ANY ROLE');
  1114. insert into SYSTEM_PRIVILEGE_MAP values (-128, 'ALTER ANY ROLE');
  1115. insert into SYSTEM_PRIVILEGE_MAP values (-130, 'AUDIT ANY');
  1116. insert into SYSTEM_PRIVILEGE_MAP values (-135, 'ALTER DATABASE');
  1117. insert into SYSTEM_PRIVILEGE_MAP values (-138, 'FORCE TRANSACTION');
  1118. insert into SYSTEM_PRIVILEGE_MAP values (-139, 'FORCE ANY TRANSACTION');
  1119. insert into SYSTEM_PRIVILEGE_MAP values (-140, 'CREATE PROCEDURE');
  1120. insert into SYSTEM_PRIVILEGE_MAP values (-141, 'CREATE ANY PROCEDURE');
  1121. insert into SYSTEM_PRIVILEGE_MAP values (-142, 'ALTER ANY PROCEDURE');
  1122. insert into SYSTEM_PRIVILEGE_MAP values (-143, 'DROP ANY PROCEDURE');
  1123. insert into SYSTEM_PRIVILEGE_MAP values (-144, 'EXECUTE ANY PROCEDURE');
  1124. insert into SYSTEM_PRIVILEGE_MAP values (-151, 'CREATE TRIGGER');
  1125. insert into SYSTEM_PRIVILEGE_MAP values (-152, 'CREATE ANY TRIGGER');
  1126. insert into SYSTEM_PRIVILEGE_MAP values (-153, 'ALTER ANY TRIGGER');
  1127. insert into SYSTEM_PRIVILEGE_MAP values (-154, 'DROP ANY TRIGGER');
  1128. insert into SYSTEM_PRIVILEGE_MAP values (-160, 'CREATE PROFILE');
  1129. insert into SYSTEM_PRIVILEGE_MAP values (-161, 'ALTER PROFILE');
  1130. insert into SYSTEM_PRIVILEGE_MAP values (-162, 'DROP PROFILE');
  1131. insert into SYSTEM_PRIVILEGE_MAP values (-163, 'ALTER RESOURCE COST');
  1132. insert into SYSTEM_PRIVILEGE_MAP values (-165, 'ANALYZE ANY');
  1133. insert into SYSTEM_PRIVILEGE_MAP values (-167, 'GRANT ANY PRIVILEGE');
  1134. insert into SYSTEM_PRIVILEGE_MAP values (-172, 'CREATE SNAPSHOT');
  1135. insert into SYSTEM_PRIVILEGE_MAP values (-173, 'CREATE ANY SNAPSHOT');
  1136. insert into SYSTEM_PRIVILEGE_MAP values (-174, 'ALTER ANY SNAPSHOT');
  1137. insert into SYSTEM_PRIVILEGE_MAP values (-175, 'DROP ANY SNAPSHOT');
  1138. insert into SYSTEM_PRIVILEGE_MAP values (-197, 'WRITEDOWN');
  1139. insert into SYSTEM_PRIVILEGE_MAP values (-198, 'READUP');
  1140. insert into SYSTEM_PRIVILEGE_MAP values (-199, 'WRITEUP')
  1141. /
  1142. create unique index I_SYSTEM_PRIVILEGE_MAP
  1143.         on SYSTEM_PRIVILEGE_MAP (PRIVILEGE, NAME)
  1144. /
  1145. drop public synonym SYSTEM_PRIVILEGE_MAP
  1146. /
  1147. create public synonym SYSTEM_PRIVILEGE_MAP for SYSTEM_PRIVILEGE_MAP
  1148. /
  1149. grant select on SYSTEM_PRIVILEGE_MAP to public with grant option
  1150. /
  1151. rem
  1152. rem  TABLE_PRIVILEGE_MAP maps a table privilege (auditing option) number
  1153. rem  to the name.
  1154. rem
  1155. drop table TABLE_PRIVILEGE_MAP
  1156. /
  1157. create table TABLE_PRIVILEGE_MAP (
  1158.         PRIVILEGE       number not null,
  1159.         NAME            varchar2(40) not null)
  1160. /
  1161. comment on table TABLE_PRIVILEGE_MAP is
  1162. 'Description table for privilege (auditing option) type codes.  Maps privilege (auditing option) type numbers to type names'
  1163. /
  1164. comment on column TABLE_PRIVILEGE_MAP.PRIVILEGE is
  1165. 'Numeric privilege (auditing option) type code'
  1166. /
  1167. comment on column TABLE_PRIVILEGE_MAP.NAME is
  1168. 'Name of the type of privilege (auditing option)'
  1169. /
  1170. insert into TABLE_PRIVILEGE_MAP values (0, 'ALTER');
  1171. insert into TABLE_PRIVILEGE_MAP values (1, 'AUDIT');
  1172. insert into TABLE_PRIVILEGE_MAP values (2, 'COMMENT');
  1173. insert into TABLE_PRIVILEGE_MAP values (3, 'DELETE');
  1174. insert into TABLE_PRIVILEGE_MAP values (4, 'GRANT');
  1175. insert into TABLE_PRIVILEGE_MAP values (5, 'INDEX');
  1176. insert into TABLE_PRIVILEGE_MAP values (6, 'INSERT');
  1177. insert into TABLE_PRIVILEGE_MAP values (7, 'LOCK');
  1178. insert into TABLE_PRIVILEGE_MAP values (8, 'RENAME');
  1179. insert into TABLE_PRIVILEGE_MAP values (9, 'SELECT');
  1180. insert into TABLE_PRIVILEGE_MAP values (10, 'UPDATE');
  1181. insert into TABLE_PRIVILEGE_MAP values (11, 'REFERENCES');
  1182. insert into TABLE_PRIVILEGE_MAP values (12, 'EXECUTE')
  1183. /
  1184. create unique index I_TABLE_PRIVILEGE_MAP
  1185.         on TABLE_PRIVILEGE_MAP (PRIVILEGE, NAME)
  1186. /
  1187. drop public synonym TABLE_PRIVILEGE_MAP
  1188. /
  1189. create public synonym TABLE_PRIVILEGE_MAP for TABLE_PRIVILEGE_MAP
  1190. /
  1191. grant select on TABLE_PRIVILEGE_MAP to public with grant option
  1192. /
  1193. rem
  1194. rem  FAMILY "OPTION MAP"
  1195. rem    Tables for mapping auditing option numbers to auditing 
  1196. rem  the name.
  1197. rem
  1198. rem  STMT_AUDIT_OPTION_MAP maps a auditing option number to the name.
  1199. rem
  1200. drop table STMT_AUDIT_OPTION_MAP
  1201. /
  1202. create table STMT_AUDIT_OPTION_MAP (
  1203.     OPTION#            number not null,
  1204.     NAME            varchar2(40) not null)
  1205. /
  1206. comment on table STMT_AUDIT_OPTION_MAP is
  1207. 'Description table for auditing option type codes.  Maps auditing option type numbers to type names'
  1208. /
  1209. comment on column STMT_AUDIT_OPTION_MAP.OPTION# is
  1210. 'Numeric auditing option type code'
  1211. /
  1212. comment on column STMT_AUDIT_OPTION_MAP.NAME is
  1213. 'Name of the type of auditing option'
  1214. /
  1215. insert into STMT_AUDIT_OPTION_MAP values (  3, 'ALTER SYSTEM');
  1216. insert into STMT_AUDIT_OPTION_MAP values (  4, 'SYSTEM AUDIT');
  1217. insert into STMT_AUDIT_OPTION_MAP values (  5, 'CREATE SESSION');
  1218. insert into STMT_AUDIT_OPTION_MAP values (  6, 'ALTER SESSION');
  1219. insert into STMT_AUDIT_OPTION_MAP values (  7, 'RESTRICTED SESSION');
  1220. insert into STMT_AUDIT_OPTION_MAP values (  8, 'TABLE');
  1221. insert into STMT_AUDIT_OPTION_MAP values (  9, 'CLUSTER');
  1222. insert into STMT_AUDIT_OPTION_MAP values ( 10, 'CREATE TABLESPACE');
  1223. insert into STMT_AUDIT_OPTION_MAP values ( 11, 'ALTER TABLESPACE');
  1224. insert into STMT_AUDIT_OPTION_MAP values ( 12, 'MANAGE TABLESPACE');
  1225. insert into STMT_AUDIT_OPTION_MAP values ( 13, 'DROP TABLESPACE');
  1226. insert into STMT_AUDIT_OPTION_MAP values ( 14, 'TABLESPACE');
  1227. insert into STMT_AUDIT_OPTION_MAP values ( 15, 'UNLIMITED TABLESPACE');
  1228. insert into STMT_AUDIT_OPTION_MAP values ( 16, 'USER');
  1229. insert into STMT_AUDIT_OPTION_MAP values ( 17, 'ROLLBACK SEGMENT');
  1230. insert into STMT_AUDIT_OPTION_MAP values ( 19, 'INDEX');
  1231. insert into STMT_AUDIT_OPTION_MAP values ( 20, 'CREATE USER');
  1232. insert into STMT_AUDIT_OPTION_MAP values ( 21, 'BECOME USER');
  1233. insert into STMT_AUDIT_OPTION_MAP values ( 22, 'ALTER USER');
  1234. insert into STMT_AUDIT_OPTION_MAP values ( 23, 'DROP USER');
  1235. insert into STMT_AUDIT_OPTION_MAP values ( 24, 'SYNONYM');
  1236. insert into STMT_AUDIT_OPTION_MAP values ( 25, 'PUBLIC SYNONYM');
  1237. insert into STMT_AUDIT_OPTION_MAP values ( 26, 'VIEW');
  1238. insert into STMT_AUDIT_OPTION_MAP values ( 27, 'SEQUENCE');
  1239. insert into STMT_AUDIT_OPTION_MAP values ( 28, 'DATABASE LINK');
  1240. insert into STMT_AUDIT_OPTION_MAP values ( 29, 'PUBLIC DATABASE LINK');
  1241. insert into STMT_AUDIT_OPTION_MAP values ( 30, 'CREATE ROLLBACK SEGMENT');
  1242. insert into STMT_AUDIT_OPTION_MAP values ( 31, 'ALTER ROLLBACK SEGMENT');
  1243. insert into STMT_AUDIT_OPTION_MAP values ( 32, 'DROP ROLLBACK SEGMENT');
  1244. insert into STMT_AUDIT_OPTION_MAP values ( 33, 'ROLE');
  1245. insert into STMT_AUDIT_OPTION_MAP values ( 35, 'PROCEDURE');
  1246. insert into STMT_AUDIT_OPTION_MAP values ( 36, 'TRIGGER');
  1247. insert into STMT_AUDIT_OPTION_MAP values ( 37, 'PROFILE');
  1248. insert into STMT_AUDIT_OPTION_MAP values ( 40, 'CREATE TABLE');
  1249. insert into STMT_AUDIT_OPTION_MAP values ( 41, 'CREATE ANY TABLE');
  1250. insert into STMT_AUDIT_OPTION_MAP values ( 42, 'ALTER ANY TABLE');
  1251. insert into STMT_AUDIT_OPTION_MAP values ( 43, 'BACKUP ANY TABLE');
  1252. insert into STMT_AUDIT_OPTION_MAP values ( 44, 'DROP ANY TABLE');
  1253. insert into STMT_AUDIT_OPTION_MAP values ( 45, 'LOCK ANY TABLE');
  1254. insert into STMT_AUDIT_OPTION_MAP values ( 46, 'COMMENT ANY TABLE');
  1255. insert into STMT_AUDIT_OPTION_MAP values ( 47, 'SELECT ANY TABLE');
  1256. insert into STMT_AUDIT_OPTION_MAP values ( 48, 'INSERT ANY TABLE');
  1257. insert into STMT_AUDIT_OPTION_MAP values ( 49, 'UPDATE ANY TABLE');
  1258. insert into STMT_AUDIT_OPTION_MAP values ( 50, 'DELETE ANY TABLE');
  1259. insert into STMT_AUDIT_OPTION_MAP values ( 60, 'CREATE CLUSTER');
  1260. insert into STMT_AUDIT_OPTION_MAP values ( 61, 'CREATE ANY CLUSTER');
  1261. insert into STMT_AUDIT_OPTION_MAP values ( 62, 'ALTER ANY CLUSTER');
  1262. insert into STMT_AUDIT_OPTION_MAP values ( 63, 'DROP ANY CLUSTER');
  1263. insert into STMT_AUDIT_OPTION_MAP values ( 71, 'CREATE ANY INDEX');
  1264. insert into STMT_AUDIT_OPTION_MAP values ( 72, 'ALTER ANY INDEX');
  1265. insert into STMT_AUDIT_OPTION_MAP values ( 73, 'DROP ANY INDEX');
  1266. insert into STMT_AUDIT_OPTION_MAP values ( 80, 'CREATE SYNONYM');
  1267. insert into STMT_AUDIT_OPTION_MAP values ( 81, 'CREATE ANY SYNONYM');
  1268. insert into STMT_AUDIT_OPTION_MAP values ( 82, 'DROP ANY SYNONYM');
  1269. insert into STMT_AUDIT_OPTION_MAP values ( 83, 'SYSDBA');
  1270. insert into STMT_AUDIT_OPTION_MAP values ( 84, 'SYSOPER');
  1271. insert into STMT_AUDIT_OPTION_MAP values ( 85, 'CREATE PUBLIC SYNONYM');
  1272. insert into STMT_AUDIT_OPTION_MAP values ( 86, 'DROP PUBLIC SYNONYM');
  1273. insert into STMT_AUDIT_OPTION_MAP values ( 90, 'CREATE VIEW');
  1274. insert into STMT_AUDIT_OPTION_MAP values ( 91, 'CREATE ANY VIEW');
  1275. insert into STMT_AUDIT_OPTION_MAP values ( 92, 'DROP ANY VIEW');
  1276. insert into STMT_AUDIT_OPTION_MAP values (105, 'CREATE SEQUENCE');
  1277. insert into STMT_AUDIT_OPTION_MAP values (106, 'CREATE ANY SEQUENCE');
  1278. insert into STMT_AUDIT_OPTION_MAP values (107, 'ALTER ANY SEQUENCE');
  1279. insert into STMT_AUDIT_OPTION_MAP values (108, 'DROP ANY SEQUENCE');
  1280. insert into STMT_AUDIT_OPTION_MAP values (109, 'SELECT ANY SEQUENCE');
  1281. insert into STMT_AUDIT_OPTION_MAP values (111, 'GRANT SEQUENCE');
  1282. insert into STMT_AUDIT_OPTION_MAP values (115, 'CREATE DATABASE LINK');
  1283. insert into STMT_AUDIT_OPTION_MAP values (120, 'CREATE PUBLIC DATABASE LINK');
  1284. insert into STMT_AUDIT_OPTION_MAP values (121, 'DROP PUBLIC DATABASE LINK');
  1285. insert into STMT_AUDIT_OPTION_MAP values (125, 'CREATE ROLE');
  1286. insert into STMT_AUDIT_OPTION_MAP values (126, 'DROP ANY ROLE');
  1287. insert into STMT_AUDIT_OPTION_MAP values (127, 'GRANT ANY ROLE');
  1288. insert into STMT_AUDIT_OPTION_MAP values (128, 'ALTER ANY ROLE');
  1289. insert into STMT_AUDIT_OPTION_MAP values (130, 'AUDIT ANY');
  1290. insert into STMT_AUDIT_OPTION_MAP values (131, 'SYSTEM GRANT');
  1291. insert into STMT_AUDIT_OPTION_MAP values (135, 'ALTER DATABASE');
  1292. insert into STMT_AUDIT_OPTION_MAP values (138, 'FORCE TRANSACTION');
  1293. insert into STMT_AUDIT_OPTION_MAP values (139, 'FORCE ANY TRANSACTION');
  1294. insert into STMT_AUDIT_OPTION_MAP values (140, 'CREATE PROCEDURE');
  1295. insert into STMT_AUDIT_OPTION_MAP values (141, 'CREATE ANY PROCEDURE');
  1296. insert into STMT_AUDIT_OPTION_MAP values (142, 'ALTER ANY PROCEDURE');
  1297. insert into STMT_AUDIT_OPTION_MAP values (143, 'DROP ANY PROCEDURE');
  1298. insert into STMT_AUDIT_OPTION_MAP values (144, 'EXECUTE ANY PROCEDURE');
  1299. insert into STMT_AUDIT_OPTION_MAP values (146, 'EXECUTE PROCEDURE');
  1300. insert into STMT_AUDIT_OPTION_MAP values (147, 'GRANT PROCEDURE');
  1301. insert into STMT_AUDIT_OPTION_MAP values (151, 'CREATE TRIGGER');
  1302. insert into STMT_AUDIT_OPTION_MAP values (152, 'CREATE ANY TRIGGER');
  1303. insert into STMT_AUDIT_OPTION_MAP values (153, 'ALTER ANY TRIGGER');
  1304. insert into STMT_AUDIT_OPTION_MAP values (154, 'DROP ANY TRIGGER');
  1305. insert into STMT_AUDIT_OPTION_MAP values (160, 'CREATE PROFILE');
  1306. insert into STMT_AUDIT_OPTION_MAP values (161, 'ALTER PROFILE');
  1307. insert into STMT_AUDIT_OPTION_MAP values (162, 'DROP PROFILE');
  1308. insert into STMT_AUDIT_OPTION_MAP values (163, 'ALTER RESOURCE COST');
  1309. insert into STMT_AUDIT_OPTION_MAP values (165, 'ANALYZE ANY');
  1310. insert into STMT_AUDIT_OPTION_MAP values (167, 'GRANT ANY PRIVILEGE');
  1311. insert into STMT_AUDIT_OPTION_MAP values (172, 'CREATE SNAPSHOT');
  1312. insert into STMT_AUDIT_OPTION_MAP values (173, 'CREATE ANY SNAPSHOT');
  1313. insert into STMT_AUDIT_OPTION_MAP values (174, 'ALTER ANY SNAPSHOT');
  1314. insert into STMT_AUDIT_OPTION_MAP values (175, 'DROP ANY SNAPSHOT');
  1315. insert into STMT_AUDIT_OPTION_MAP values (197, 'WRITEDOWN');
  1316. insert into STMT_AUDIT_OPTION_MAP values (198, 'READUP');
  1317. insert into STMT_AUDIT_OPTION_MAP values (199, 'WRITEUP');
  1318. insert into STMT_AUDIT_OPTION_MAP values ( 77, 'NOT EXISTS');
  1319. insert into STMT_AUDIT_OPTION_MAP values ( 87, 'EXISTS');
  1320. insert into STMT_AUDIT_OPTION_MAP values ( 54, 'ALTER TABLE');
  1321. insert into STMT_AUDIT_OPTION_MAP values ( 57, 'LOCK TABLE');
  1322. insert into STMT_AUDIT_OPTION_MAP values ( 58, 'COMMENT TABLE');
  1323. insert into STMT_AUDIT_OPTION_MAP values ( 65, 'SELECT TABLE');
  1324. insert into STMT_AUDIT_OPTION_MAP values ( 66, 'INSERT TABLE');
  1325. insert into STMT_AUDIT_OPTION_MAP values ( 67, 'UPDATE TABLE');
  1326. insert into STMT_AUDIT_OPTION_MAP values ( 68, 'DELETE TABLE');
  1327. insert into STMT_AUDIT_OPTION_MAP values ( 69, 'GRANT TABLE');
  1328. insert into STMT_AUDIT_OPTION_MAP values (103, 'ALTER SEQUENCE');
  1329. insert into STMT_AUDIT_OPTION_MAP values (104, 'SELECT SEQUENCE')
  1330. /
  1331. create unique index I_STMT_AUDIT_OPTION_MAP
  1332.         on STMT_AUDIT_OPTION_MAP (OPTION#, NAME)
  1333. /
  1334. drop public synonym STMT_AUDIT_OPTION_MAP
  1335. /
  1336. create public synonym  STMT_AUDIT_OPTION_MAP for STMT_AUDIT_OPTION_MAP
  1337. /
  1338. grant select on STMT_AUDIT_OPTION_MAP to public
  1339. /
  1340. remark
  1341. remark FAMILY "RESOURCE PROFILES"
  1342. remark
  1343. create table RESOURCE_MAP (
  1344.     RESOURCE#    number not null,
  1345.     NAME        varchar2(32) not null)
  1346. /
  1347. comment on table RESOURCE_MAP is
  1348. 'Description table for resources.  Maps resource name to number'
  1349. /
  1350. comment on column RESOURCE_MAP.RESOURCE# is
  1351. 'Numeric resource code'
  1352. /
  1353. comment on column RESOURCE_MAP.NAME is
  1354. 'Name of resource'
  1355. /
  1356. insert into resource_map values ( 0, 'COMPOSITE_LIMIT' );
  1357. insert into resource_map values ( 1, 'SESSIONS_PER_USER' );
  1358. insert into resource_map values ( 2, 'CPU_PER_SESSION' );
  1359. insert into resource_map values ( 3, 'CPU_PER_CALL' );
  1360. insert into resource_map values ( 4, 'LOGICAL_READS_PER_SESSION' );
  1361. insert into resource_map values ( 5, 'LOGICAL_READS_PER_CALL' );
  1362. insert into resource_map values ( 6, 'IDLE_TIME' );
  1363. insert into resource_map values ( 7, 'CONNECT_TIME' );
  1364. insert into resource_map values ( 8, 'PRIVATE_SGA' )
  1365. /
  1366. create role exp_full_database
  1367. /
  1368. create role imp_full_database
  1369. /
  1370. create table expact$
  1371. ( owner varchar2("M_IDEN") not null,                       /* owner of table */
  1372.   name  varchar2("M_IDEN") not null,                        /* name of table */
  1373.   func_schema varchar2("M_IDEN") not null,       /* schema func is run under */
  1374.   func_package  varchar2("M_IDEN") not null,                 /* package name */
  1375.   func_proc  varchar2("M_IDEN") not null,                  /* procedure name */
  1376.   code  number not null,                            /* PRETABLE OR POSTTABLE */
  1377.   callorder number)
  1378. /
  1379.