home *** CD-ROM | disk | FTP | other *** search
- create tablespace SYSTEM datafile "D_DBFN"
- default storage (initial 10K next 10K) online
- /
- create rollback segment SYSTEM tablespace SYSTEM
- storage (initial 50K next 50K)
- /
- create cluster c_obj# (obj# number)
- pctfree 5 size 800 /* don't waste too much space */
- /* A table of 32 cols, 2 index, 2 col per index requires about 2K.
- * A table of 10 cols, 2 index, 2 col per index requires about 750.
- */
- storage (initial 120K) /* avoid space mgmt during IORI */
- /
- create index i_obj# on cluster c_obj#
- /
- create table tab$ /* table table */
- ( obj# number not null, /* object number */
- ts# number not null, /* table space number */
- file# number not null, /* segment header file number */
- block# number not null, /* segment header block number */
- clu# number, /* cluster object number, NULL if not clustered */
- tab# number, /* table number in cluster, NULL if not clustered */
- cols number not null, /* number of columns */
- clucols number,/* number of clustered columns, NULL if not clustered */
- pctfree$ number not null, /* minimum free space percentage in a block */
- pctused$ number not null, /* minimum used space percentage in a block */
- initrans number not null, /* initial number of transaction */
- maxtrans number not null, /* maximum number of transaction */
- modified number not null, /* dirty bit: */
- /* 0 = unmodified since last backup, 1 = modified since then */
- audit$ char("S_OPFL") not null, /* auditing options */
- spare1 number,
- spare2 number,
- spare3 number,
- spare4 number)
- /* The spare columns may be used for table's default NLS charset,
- * # rows in table, and # blocks in table's segment. */
- cluster c_obj#(obj#)
- /
- create table clu$ /* cluster table */
- ( obj# number not null, /* object number */
- ts# number not null, /* table space number */
- file# number not null, /* segment header file number */
- block# number not null, /* segment header block number */
- cols number not null, /* number of columns */
- pctfree$ number not null, /* minimum free space percentage in a block */
- pctused$ number not null, /* minimum used space percentage in a block */
- initrans number not null, /* initial number of transaction */
- maxtrans number not null, /* maximum number of transaction */
- size$ number,
- /* if b-tree, estimated # bytes for each cluster key and rows */
- hashfunc char("M_IDEN"), /* if hashed, function identifier, else null */
-
- /* Some of the spare columns may give the initial # bytes in the hash table
- * and the # hash keys per block. These are user-specified parameters.
- * For extendible hash tables, two columns might include the # bits
- * currently be used in the hash function and the number of the next
- * bucket to split.
- * Some spare columns may be used for hash table statistics
- * such as # distinct keys, # distinct values of first key column, and
- * average # blocks per key. Some spare columns may give the number of
- * the cluster table for which the cluster key is unique or indicate
- * whether the cluster is normal or referential.
- * We can encode multiple pieces of info in a single column.
- */
- spare1 number,
- spare2 number,
- spare3 number,
- spare4 number,
- spare5 number,
- spare6 number,
- spare7 number,
- spare8 number,
- spare9 number
- )
-
- cluster c_obj#(obj#)
- /
- create cluster c_ts#(ts# number) /* use entire block for each ts# */
- pctfree 10 pctused 40
- /* leave enough space for inc# in ts$ to grow so that we never have
- * have to split the row (assumed in transaction layer). ts$ can
- * grow from 38 to 58 bytes and fet$ almost never grows.
- */
- /
- create index i_ts# on cluster c_ts#
- /
- create cluster c_file#_block#(segfile# number, segblock# number)
- size 225 /* cluster key ~ 25, sizeof(seg$) ~ 50, 5 * sizeof(uet$) ~ 150 */
- storage (initial 20K) /* avoid space management during IOR I */
- /
- create index i_file#_block# on cluster c_file#_block#
- /
- create cluster c_user#(user# number)
- size 315 /* cluster key ~ 20, sizeof(user$) ~ 170, 5 * sizeof(tsq$) ~ 125 */
- /
- create index i_user# on cluster c_user#
- /
- create table fet$ /* free extent table */
- ( ts# number not null, /* table space containing free extent */
- file# number not null, /* file containing free extent */
- block# number not null, /* starting dba of free extent */
- length number not null) /* length in blocks of free extent */
- cluster c_ts#(ts#)
- /
- create table uet$ /* used extent table */
- ( segfile# number not null, /* segment header file number */
- segblock# number not null, /* segment header block number */
- ext# number not null, /* extent number within the segment */
- ts# number not null, /* table space containing this extent */
- file# number not null, /* file containing this extent */
- block# number not null, /* starting dba of this extent */
- length number not null) /* length in blocks of this extent */
- cluster c_file#_block#(segfile#, segblock#)
- /
- create table seg$ /* segment table */
- ( file# number not null, /* segment header file number */
- block# number not null, /* segment header block number */
- type number not null, /* segment type (see KTS.H): */
- /* 1 = UNDO, 2 = SAVE UNDO, 3 = TEMPORARY, 4 = CACHE, 5 = DATA, 6 = INDEX */
- ts# number not null, /* table space containing this segment */
- blocks number not null, /* blocks allocated to segment so far */
- extents number not null, /* extents allocated to segment so far */
- iniexts number not null, /* initial extent size */
- minexts number not null, /* minimum number of extents */
- maxexts number not null, /* maximum number of extents */
- extsize number not null, /* initial next extent size */
- extpct number not null, /* percent size increase */
- user# number not null) /* user who owns this segment */
- cluster c_file#_block#(file#, block#)
- /
- create table undo$ /* undo segment table */
- ( us# number not null, /* undo segment number */
- name char("M_IDEN") not null, /* name of this undo segment */
- user# number not null, /* owner: 0 = SYS, 1 = PUBLIC */
- file# number not null, /* segment header file number */
- block# number not null, /* segment header block number */
- scnbas number, /* highest commit time in rollback segment */
- scnwrp number, /* scnbas - scn base, scnwrp - scn wrap */
- xactsqn number, /* highest transaction sequence number */
- undosqn number, /* highest undo block sequence number */
- status$ number not null) /* segment status (see KTS.H): */
- /* 1 = INVALID, 2 = AVAILABLE, 3 = INUSE, 4 = OFFLINE 5 = NEED RECOVERY */
- /
- create table ts$ /* table space table */
- ( ts# number not null, /* table space identifier number */
- name char("M_IDEN") not null, /* name of table space */
- owner# number not null, /* owner of tablespace */
- online$ number not null, /* status (see KTT.H): */
- /* 1 = ONLINE, 2 = OFFLINE, 3 = INVALID */
- undofile# number, /* undo_off segment file number (status is OFFLINE) */
- undoblock# number, /* undo_off segment header file number */
- blocksize number not null, /* size of block in bytes */
- inc# number not null, /* incarnation number of extent */
- dflminext number not null, /* default minimum number of extents */
- dflmaxext number not null, /* default maximum number of extents */
- dflinit number not null, /* default initial extent size */
- dflincr number not null, /* default next extent size */
- dflextpct number not null) /* default percent extent size increase */
- cluster c_ts#(ts#)
- /
- create table file$ /* file table */
- ( file# number not null, /* file identifier number */
- status$ number not null, /* status (see KTS.H): */
- /* 1 = INVALID, 2 = AVAILABLE */
- blocks number not null, /* size of file in blocks */
- ts# number not null) /* table space that owns file */
- /
- create table obj$ /* object table */
- ( obj# number not null, /* object number */
- owner# number not null, /* owner user number */
- name char("M_IDEN") not null, /* object name */
- type number not null, /* object type (see KQD.H): */
- /* 1 = INDEX, 2 = TABLE, 3 = CLUSTER, 4 = VIEW, 5 = SYNONYM, 6 = SEQUENCE */
- ctime date not null, /* object creation time */
- mtime date) /* time of latest DDL change */
- /
- create table ind$ /* index table */
- ( obj# number not null, /* object number */
- ts# number not null, /* table space number */
- file# number not null, /* segment header file number */
- block# number not null, /* segment header block number */
- bo# number not null, /* object number of base table */
- cols number not null, /* number of columns */
- pctfree$ number not null, /* minimum free space percentage in a block */
- initrans number not null, /* initial number of transaction */
- maxtrans number not null, /* maximum number of transaction */
- compress$ number not null, /* 0 = not compressed, 1 = compressed */
- unique$ number not null, /* 0 = not unique, 1 = unique */
- /* future: 2 = ansi-style unique */
- /* The following spare columns may be used for index statistics such
- * as # btree levels, # btree leaf blocks, # distinct keys,
- * # distinct values of first key column, average # leaf blocks per key,
- * clustering info, and # blocks in index segment.
- */
- spare1 number,
- spare2 number,
- spare3 number,
- spare4 number,
- spare5 number,
- spare6 number,
- spare7 number
- )
- cluster c_obj#(bo#)
- /
- create table icol$ /* index column table */
- ( obj# number not null, /* index object number */
- bo# number not null, /* base object number */
- col# number not null, /* column number */
- pos# number not null, /* column position number as created */
- segcol# number not null, /* column number in segment */
- segcollength number not null, /* length of the segment column */
- offset number not null) /* offset of column */
- cluster c_obj#(bo#)
- /
- create table col$ /* column table */
- ( obj# number not null, /* object number of base object */
- col# number not null, /* column number as created */
- segcol# number not null, /* column number in segment */
- segcollength number not null, /* length of the segment column */
- offset number not null, /* offset of column */
- name char("M_IDEN") not null, /* name of column */
- type# number not null, /* data type of column */
- length number not null, /* length of column in bytes */
- fixedstorage number not null, /* 0 = not fixed, 1 = fixed */
- precision number, /* precision */
- scale number, /* scale */
- null$ number not null, /* 0 = NULLs permitted, */
- /* > 0 = no NULLs permitted (for table, it is the constraint number) */
- spare1 number,
- spare2 number,
- spare3 number,
- /* The spares may be used as the column's NLS charset,
- the number of distinct column values, and the column's domain. */
- lowval raw(32), /* lowest value of column (second lowest if default) */
- hival raw(32), /* highest value of column (second highest if default) */
- deflength number, /* default value expression text length */
- default$ long) /* default value expression text */
- cluster c_obj#(obj#)
- /
- create table user$ /* user table */
- ( user# number not null, /* user identifier number */
- name char("M_IDEN") not null, /* name of user */
- password char("M_IDEN"), /* encrypted password */
- datats# number not null,/* default table space for permanent objects */
- tempts# number not null, /* default table space for temporary tables */
- ctime date not null, /* user account creation time */
- ptime date, /* password expiration time */
- connect$ number not null, /* connect privilege: 0 = NO, 1 = YES */
- dba$ number not null, /* dba privilege: 0 = NO, 1 = YES */
- resource$ number not null, /* resource privilege: 0 = NO, 1 = YES */
- audit$ char("S_OPFL"), /* For 6.1 user audit options */
- priv1 number not null, /* reserved for future privilege */
- priv2 number not null, /* reserved for future privilege */
- priv3 number not null, /* reserved for future privilege */
- priv4 number not null, /* reserved for future privilege */
- priv5 number not null) /* reserved for future privilege */
- cluster c_user#(user#)
- /
- create table con$ /* constraint table */
- ( owner# number not null, /* owner user number */
- name char("M_IDEN") not null, /* constraint name */
- con# number not null) /* constraint number */
- /
- create cluster c_cobj# (obj# number)
- pctfree 0 pctused 50
- /* space for: update cdef$ set condition = 'col IS NOT NULL' at // */
- size 300
- storage (initial 50K) /* avoid space mgmt during IORI */
- /
- create index i_cobj# on cluster c_cobj#
- /
- create table cdef$ /* constraint definition table */
- ( con# number not null, /* constraint number */
- obj# number not null, /* object number of base table/view */
- cols number, /* number of columns in constraint */
- type number not null, /* constraint type: */
- /* 1 = table check constraint */
- /* 2 = primary key constraint */
- /* 3 = unique key constraint */
- /* 4 = referential constraint */
- /* 5 = view check constraint */
- /* 6, 7 = special for replication logging hook */
- robj# number, /* object number of referenced table */
- rcon# number, /* constraint number of referenced columns */
- rrules char(3),
- /* future: on delete/update: restrict, cascade, set null, set default. */
- /* use char(3) for pendant? */
- spare1 number,
- spare2 number,
- /* One spare column might be used to indicate a constraint is currently
- * not enforced.
- */
- spare3 number,
- /* future: for supporting referential constraint match options and
- varieties of unique constraints */
- condlength number, /* table check condition text length */
- condition long) /* table check condition text */
- cluster c_cobj#(obj#)
- /
- create table ccol$ /* constraint column table */
- ( con# number not null, /* constraint number */
- obj# number not null, /* base object number */
- col# number not null, /* column number */
- pos# number) /* column position number as created */
- cluster c_cobj#(obj#)
- /
- create index i_tab1 on tab$(clu#)
- /
- create unique index i_undo1 on undo$(us#)
- /
- create unique index i_obj1 on obj$(obj#)
- /
- create unique index i_obj2 on obj$(owner#, name)
- /
- create unique index i_ind1 on ind$(obj#)
- /
- create index i_icol1 on icol$(obj#)
- /
- create unique index i_file1 on file$(file#)
- /
- create unique index i_user1 on user$(name)
- /
- create unique index i_col1 on col$(obj#, name)
- /
- create unique index i_col2 on col$(obj#, col#)
- /
- create unique index i_con1 on con$(owner#, name)
- /
- create unique index i_con2 on con$(con#)
- /
- create unique index i_cdef1 on cdef$(con#)
- /
- create index i_cdef2 on cdef$(robj#)
- /
- create unique index i_ccol1 on ccol$(con#, col#)
- //
- grant connect, resource, dba to sys identified by change_on_install
- /
- create table tsq$ /* table space quota table */
- ( ts# number not null, /* table space number */
- user# number not null, /* user number */
- grantor# number not null, /* grantor id */
- blocks number not null, /* number of blocks charged to user */
- maxblocks number, /* user's maximum number of blocks, NULL if none */
- priv1 number not null, /* reserved for future privilege */
- priv2 number not null, /* reserved for future privilege */
- priv3 number not null) /* reserved for future privilege */
- cluster c_user# (user#)
- /
- create table syn$ /* synonym table */
- ( obj# number not null, /* object number */
- node char("M_IDEN"), /* node of object */
- owner char("M_IDEN"), /* object owner */
- name char("M_IDEN") not null) /* object name */
- /
- create table view$ /* view table */
- ( obj# number not null, /* object number */
- audit$ char("S_OPFL") not null, /* auditing options */
- cols number not null, /* number of columns */
- textlength number, /* length of view text */
- text long) /* view text */
- /
- create table seq$
- ( obj# number not null, /* object number */
- increment$ number not null, /* the sequence number increment */
- minvalue number, /* minimum value of sequence */
- maxvalue number, /* maximum value of sequence */
- cycle number not null, /* 0 = FALSE, 1 = TRUE */
- order$ number not null, /* 0 = FALSE, 1 = TRUE */
- cache number not null, /* how many to cache in sga */
- highwater number not null, /* disk high water mark */
- audit$ char("S_OPFL") not null) /* auditing options */
- /
- create table tabauth$ /* table authorization table */
- ( obj# number not null, /* object number */
- grantor# number not null, /* grantor user number */
- grantee# number not null, /* grantee user number */
- time date not null, /* grant time */
- sequence# number not null, /* unique grant sequence number */
- alter$ number not null, /* ALTER privilege: */
- /* 0 = NO, 1 = restricted by column, 2 = YES, 3 = YES with GRANT option */
- delete$ number not null, /* DELETE privilege */
- index$ number not null, /* INDEX privilege */
- insert$ number not null, /* INSERT privilege */
- select$ number not null, /* SELECT privilege */
- update$ number not null, /* UPDATE privilege */
- references$ number not null, /* REFERENCES privilege */
- spare1 number,
- spare2 number,
- spare3 number,
- spare4 number)
- /
- create table colauth$ /* column authorization table */
- ( obj# number not null, /* object number */
- grantor# number not null, /* grantor user number */
- grantee# number not null, /* grantee user number */
- time date not null, /* grant time */
- sequence# number not null, /* unique grant sequence number */
- name char("M_IDEN") not null, /* column name */
- update$ number not null, /* UPDATE privilege: */
- /* 0 = NO, 2 = YES, 3 = YES with GRANT option */
- references$ number not null, /* REFERENCES privilege */
- select$ number not null, /* SELECT privilege */
- insert$ number not null, /* INSERT privilege */
- spare1 number,
- spare2 number)
- /
- create table xref$ /* cross reference table */
- ( owner char("M_IDEN") not null, /* owner of referencing object */
- name char("M_IDEN") not null, /* name of referencing object */
- rowner char("M_IDEN"), /* owner of referenced object */
- rname char("M_IDEN") not null, /* name of referenced object */
- rnode char("M_IDEN")) /* node of referenced object */
- /
- create table aud$ /* audit trail table */
- ( sessionid number not null,
- entryid number not null,
- statement number not null,
- timestamp date not null,
- userid char("M_IDEN"),
- userhost char("M_HOST"),
- terminal char("M_TERM"),
- action number not null,
- returncode number not null,
- obj$creator char("M_IDEN"),
- obj$name char("M_IDEN"),
- auth$privileges char("S_PRFL"),
- auth$grantee char("M_IDEN"),
- new$name char("M_IDEN"),
- ses$actions char("S_ACFL"),
- ses$tid number,
- logoff$lread number,
- logoff$pread number,
- logoff$lwrite number,
- logoff$dead number,
- logoff$time date,
- comment$text char("M_CSIZ"),
- spare1 char(255),
- spare2 number)
- /
- create table link$ /* remote database link table */
- ( owner# number not null, /* owner user number */
- name char("M_IDEN") not null, /* link name */
- ctime date not null, /* creation time */
- host char("M_HOST") not null, /* driver string for connect */
- userid char("M_IDEN"), /* user to logon as */
- password char("M_IDEN")) /* password for logon */
- /
- create table props$
- ( name char("M_IDEN") not null, /* property name */
- value$ char("M_CSIZ"), /* property value */
- comment$ char("M_CSIZ")) /* description of property */
- /
- create table com$ /* comment table */
- ( obj# number not null, /* object number */
- col# number, /* column number (NULL if for object) */
- comment$ char("M_CSIZ")) /* user-specified description */
- /
- insert into props$
- values('DICT.BASE', '2', 'dictionary base tables version #')
- /
- create unique index i_view1 on view$(obj#)
- /
- create unique index i_syn1 on syn$(obj#)
- /
- create unique index i_seq1 on seq$(obj#)
- /
- create index i_tabauth1 on tabauth$(obj#, grantor#, grantee#, time)
- /
- create index i_tabauth2 on tabauth$(obj#, grantee#)
- /
- create index i_colauth1 on colauth$(obj#, grantor#, grantee#, time)
- /
- create index i_colauth2 on colauth$(obj#, grantee#, name)
- /
- create index i_colauth3 on colauth$(obj#, grantor#, name)
- /
- create index i_aud1 on aud$(action)
- /
- create index i_aud2 on aud$(returncode)
- /
- create index i_aud3 on aud$(obj$creator)
- /
- create index i_aud4 on aud$(userid)
- /
- create index i_link1 on link$(owner#, name)
- /
- create unique index i_com1 on com$(obj#,col#)
- /
- grant connect to public identified by values 'public'
- /
- grant connect,resource,dba to system identified by manager
- /
- create sequence table_grant /* table grant sequence number */
- start with 1
- increment by 1
- minvalue 1
- nomaxvalue
- cache 20
- order
- nocycle
- /
- create sequence column_grant /* column grant sequence number */
- start with 1
- increment by 1
- minvalue 1
- nomaxvalue
- cache 20
- order
- nocycle
- /
- create table incexp /* incremental export support table */
- ( owner# number not null, /* owner id */
- name char("M_IDEN") not null, /* object name */
- type number(1) not null, /* object type */
- ctime date, /* time of last cumulative export */
- itime date not null, /* time of last incremental export */
- expid number(3) not null) /* export id */
- /
- create unique index i_incexp on incexp(owner#, name, type)
- /
- grant all on incexp to system
- /
- create table incvid /* incremental valid identifier table */
- ( expid number(3) not null) /* id of last valid export */
- /
- insert into incvid(expid) values (0)
- /
- grant all on incvid to system
- /
- create table incfil /* incremental file export table */
- ( expid number(3) not null, /* export id */
- exptype char(1) not null, /* export type: */
- /* f - full, i - incremental, c - cumulative */
- expfile char(100) not null, /* export file name */
- expdate date not null, /* export date */
- expuser char("M_IDEN") not null) /* user doing export */
- /
- grant all on incfil to system
- /
- create table "_system_auditing_options_" /* system auditing option table */
- ( a char(1)) /* auditing option */
- /
- create table "_default_auditing_options_" /* default auditing option table */
- ( a char(1)) /* auditing option */
- /
- create sequence audses$ /* auditing session id */
- start with 1
- increment by 1
- minvalue 1
- maxvalue 2E9 /* maxvalue fits in a ub4 */
- cycle
- cache 20
- noorder
- /
-