home *** CD-ROM | disk | FTP | other *** search
- create table tables
- (
- tab$pid number,
- tab$rba number,
- tab$tbl number,
-
- tab$owner number not null,
- tab$name char("M_IDEN") not null,
- tab$type char("S_TTFL") not null,
- tab$logblk number,
-
- tab$cluster number,
- tab$reqblk number,
- tab$indcompr char("S_ICFL"),
-
- tab$time date,
-
- tab$sowner number,
- tab$sname char("M_IDEN"),
-
- tab$audit char("S_OPFL"),
- tab$comment char("M_CSIZ"),
- tab$snode char("M_IDEN"),
- tab$sownername char("M_IDEN")
- )
- /
- create table columns
- (
- col$pid number not null,
- col$rba number not null,
- col$tbl number not null,
-
- col$name char("M_IDEN") not null,
- col$datatype char("S_DTFL") not null,
- col$length number not null,
- col$scale number,
- col$null_type char("S_NLFL") not null,
- col$id number not null,
- col$comment char("M_CSIZ"),
- col$default char("M_CSIZ")
- )
- //
- create table extents
- (
- ext$pid number not null,
- ext$rba number not null,
- ext$type char("S_ETFL") not null,
-
- ext$startblock number not null,
- ext$endblock number not null
- )
- //
- insert into extents values (
- "S_PID", "TBLRBA", 'DATA',
- "TBLRBA", "TBLRBA"+"D_DINI"-1 )
- /
- insert into extents values (
- "S_PID", "TBLRBA", 'INDEX',
- "TBLRBA"+"D_DINI", "TBLRBA"+"D_DINI"+"D_IINI"-1 )
- /
- insert into extents values (
- "S_PID", "TBLRBA"+"D_DINI"+"D_IINI", 'DATA',
- "TBLRBA"+"D_DINI"+"D_IINI", "TBLRBA"+2*"D_DINI"+"D_IINI"-1 )
- /
- insert into extents values (
- "S_PID", "TBLRBA"+"D_DINI"+"D_IINI", 'INDEX',
- "TBLRBA"+2*"D_DINI"+"D_IINI", "TBLRBA"+2*("D_DINI"+"D_IINI")-1 )
- /
- create table tabauth
- (
- tau$grantor char("M_IDEN") not null,
- tau$grantee char("M_IDEN") not null,
- tau$creator char("M_IDEN") not null,
- tau$tname char("M_IDEN") not null,
- tau$time date not null,
- tau$alter char(1) not null,
- tau$delete char(1) not null,
- tau$index char(1) not null,
- tau$insert char(1) not null,
- tau$select char(1) not null,
- tau$update char(1) not null
- )
- /
- create table colauth
- (
- cau$grantor char("M_IDEN") not null,
- cau$grantee char("M_IDEN") not null,
- cau$creator char("M_IDEN") not null,
- cau$tname char("M_IDEN") not null,
- cau$time date not null,
- cau$colname char("M_IDEN") not null,
- cau$update char(1) not null
- )
- /
- create table views
- (
- vew$pid number not null,
- vew$rba number not null,
- vew$tbl number not null,
- vew$textlen number not null,
- vew$text long not null
- )
- /
- create table spaces
- (
- spc$name char("M_IDEN") not null,
- spc$dini number not null,
- spc$dinc number not null,
- spc$dmextnt number not null,
- spc$iini number not null,
- spc$iinc number not null,
- spc$imextnt number not null,
- spc$pctfree number not null,
- spc$pid number
- )
- /
- create table indexes
- (
- idx$pid number not null,
- idx$rba number not null,
- idx$tbl number not null,
-
- idx$owner number not null,
- idx$name char("M_IDEN") not null,
- idx$colseq number not null,
- idx$column char("M_IDEN") not null,
- idx$unique char("S_UNFL") not null,
- idx$order char("S_ORFL") not null,
- idx$compress char("S_ICFL") not null,
- idx$concatid number
- )
- /
- create table userauth
- (
- usr$uid number not null,
- usr$name char("M_IDEN") ,
- usr$password char("M_IDEN") ,
- usr$time date not null,
- usr$connect char(1),
- usr$dba char(1),
- usr$resource char(1)
- )
- /
- insert into userauth values ( 2, NULL, NULL, SYSDATE, NULL, NULL, NULL )
- /
- insert into userauth values ( 0, 'SYS', 'IOR', SYSDATE, 'Y', 'Y', 'Y' )
- /
- insert into userauth values ( 1, 'PUBLIC', NULL, SYSDATE, NULL, NULL, NULL )
- /
- grant connect,dba,resource to sys,system identified by change_on_install,manager
- /
- create table progs
- (
- creator number not null,
- program char("M_IDEN") not null,
- am_id number not null,
- revision number ,
- stmnts number not null,
- cdate date ,
- rdate date ,
- language char("M_IDEN") not null
- )
- /
- create table prog_stmnts
- (
- am_id number not null,
- stmnt_id number not null,
- textl number not null,
- text long not null
- )
- /
- create table spacemap
- (
- spm$pid number not null,
- spm$startblock number not null,
- spm$endblock number not null
- )
- /
- create table partitions
- (
- par$id number not null,
- par$name char("M_IDEN") not null
- )
- /
- create table files
- (
- fil$id number not null,
- fil$name char("M_FFNM") not null,
- fil$pid number not null,
- fil$rba number not null,
- fil$length number not null
- )
- /
- create table segquotas
- (
- sgq$pid number not null,
- sgq$rba number not null,
- sgq$tbl number not null,
-
- sgq$dini number not null,
- sgq$dinc number not null,
- sgq$dmextnt number not null,
- sgq$iini number not null,
- sgq$iinc number not null,
- sgq$imextnt number not null,
- sgq$pctfree number not null,
- sgq$date date not null
- )
- /
- create table audit_trail
- (
- 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 raw("TIDSIZE"),
-
- logoff$lread number,
- logoff$pread number,
- logoff$lwrite number,
- logoff$dead number,
- logoff$time date,
-
- comment$text char("M_CSIZ")
- )
- /
- create table "_system_auditing_options_" (a char(1))
- /
- create table "_default_auditing_options_" (a char(1))
- /
- create space temptable
- datapages (initial 20, increment 100, maxextents 240, pctfree 1)
- indexpages(initial 20, increment 100, maxextents 240)
- /
- insert into tabauth values(
- 'SYS','SYS','SYS','AUDIT_TRAIL',SYSDATE,'G','G','G','G','G','G')
- /
- insert into tabauth values(
- 'SYS','SYS','SYS','COLAUTH',SYSDATE,'G','G','G','G','G','G')
- /
- insert into tabauth values(
- 'SYS','SYS','SYS','COLUMNS',SYSDATE,'G','G','G','G','G','G')
- /
- insert into tabauth values(
- 'SYS','SYS','SYS','EXTENTS',SYSDATE,'G','G','G','G','G','G')
- /
- insert into tabauth values(
- 'SYS','SYS','SYS','FILES',SYSDATE,'G','G','G','G','G','G')
- /
- insert into tabauth values(
- 'SYS','SYS','SYS','INDEXES',SYSDATE,'G','G','G','G','G','G')
- /
- insert into tabauth values(
- 'SYS','SYS','SYS','PARTITIONS',SYSDATE,'G','G','G','G','G','G')
- /
- insert into tabauth values(
- 'SYS','SYS','SYS','PROGS',SYSDATE,'G','G','G','G','G','G')
- /
- insert into tabauth values(
- 'SYS','SYS','SYS','PROG_STMNTS',SYSDATE,'G','G','G','G','G','G')
- /
- insert into tabauth values(
- 'SYS','SYS','SYS','SEGQUOTAS',SYSDATE,'G','G','G','G','G','G')
- /
- insert into tabauth values(
- 'SYS','SYS','SYS','SPACES',SYSDATE,'G','G','G','G','G','G')
- /
- insert into tabauth values(
- 'SYS','SYS','SYS','SPACEMAP',SYSDATE,'G','G','G','G','G','G')
- /
- insert into tabauth values(
- 'SYS','SYS','SYS','TABLES',SYSDATE,'G','G','G','G','G','G')
- /
- insert into tabauth values(
- 'SYS','SYS','SYS','TABAUTH',SYSDATE,'G','G','G','G','G','G')
- /
- insert into tabauth values(
- 'SYS','SYS','SYS','USERAUTH',SYSDATE,'G','G','G','G','G','G')
- /
- insert into tabauth values(
- 'SYS','SYS','SYS','VIEWS',SYSDATE,'G','G','G','G','G','G')
- /
- insert into tabauth values(
- 'SYS','SYS','SYS','_system_auditing_options_',SYSDATE,'G','G','G','G','G','G')
- /
- insert into tabauth values(
- 'SYS','SYS','SYS','VIEWS',SYSDATE,'G','G','G','G','G','G')
- /
- grant select on tables to system with grant option
- /
- grant select on columns to system with grant option
- /
- grant select on extents to system with grant option
- /
- grant select on spaces to system with grant option
- /
- grant select on indexes to system with grant option
- /
- grant select on userauth to system with grant option
- /
- grant select on progs to system with grant option
- /
- grant select on prog_stmnts to system with grant option
- /
- grant select on spacemap to system with grant option
- /
- grant select on partitions to system with grant option
- /
- grant select on files to system with grant option
- /
- grant select on segquotas to system with grant option
- /
- grant select on tabauth to system with grant option
- /
- grant select on colauth to system with grant option
- /
- grant select on views to system with grant option
- /
- grant select on audit_trail to system with grant option
- /
- create index tab$name on tables(tab$name)
- /
- create unique index tab$owner on tables(tab$owner,tab$name)
- /
- create unique index usr$uid on userauth(usr$uid) nocompress
- /
- create unique index usr$name on userauth(usr$name) nocompress
- /
- create unique index sgq$tid on segquotas(sgq$pid,sgq$rba,sgq$tbl)
- /
- create index tau$gtc on
- tabauth(tau$grantee,tau$tname,tau$creator) nocompress
- /
- create index tau$ctg on
- tabauth(tau$creator,tau$tname,tau$grantor) nocompress
- /
- create unique index vew$tid on views(vew$pid,vew$rba,vew$tbl)
- /
- create unique index aud$uid on audit_trail(sessionid,entryid)
- /
- create view v4expuser (myid, mypsswd, myprivs, myname) as
- select uid, usr$password,
- nvl(usr$connect, ' ')||nvl(usr$dba, ' ')||nvl(usr$resource, ' '), user
- from sys.userauth
- where usr$uid = uid
- /
- grant select on v4expuser to public
- /
- create view v4expspace
- (dini, dinc, dmax, iini, iinc, imax, pctf, pname, pid, rba, tbl) as
- select sgq$dini, sgq$dinc, sgq$dmextnt, sgq$iini, sgq$iinc, sgq$imextnt,
- sgq$pctfree, par$name, sgq$pid, sgq$rba,sgq$tbl
- from sys.segquotas, sys.partitions, sys.tables
- where sgq$rba = tab$rba and sgq$tbl = tab$tbl and sgq$pid = tab$pid
- and tab$owner = uid and sgq$pid = par$id
- /
- grant select on v4expspace to public
- /
- create view v4expindex
- (tname, usrname, usrid, iname, colname, iunique, icompr, cid, cseq) as
- select tab$name, user, uid, idx$name, idx$column,
- decode(idx$unique, 'UNIQUE', 1, 0),
- decode(idx$compress, 'COMPRESS', 1, 0),
- idx$concatid, idx$colseq
- from sys.indexes, sys.tables
- where idx$rba = tab$rba and idx$tbl = tab$tbl and idx$pid = tab$pid
- and tab$type = 'TABLE'
- and tab$owner = idx$owner and idx$owner = uid
- /
- grant select on v4expindex to public
- /
- create view v4exptab (name, pid, rba, tbl, aud, cmnt) as
- select tab$name, tab$pid, tab$rba, tab$tbl, tab$audit, tab$comment
- from sys.tables
- where tab$type = 'TABLE' and tab$owner = uid
- /
- grant select on v4exptab to public
- /
- create view v4expclus (name, pid, rba, tbl, compr, reqblk, owner) as
- select tab$name, tab$pid, tab$rba, tab$tbl,
- decode(tab$indcompr,'COMPRESS',1, 0), nvl(tab$reqblk,0), uid
- from sys.tables
- where tab$type = 'CLUSTER' and tab$owner = uid
- /
- grant select on v4expclus to public
- /
- create view v4exptabauth (object, grantor, grantee, privs, owner) as
- select tau$tname, tau$grantor, tau$grantee,
- nvl(tau$alter,' ')||nvl(tau$delete,' ')||nvl(tau$index,' ')||
- nvl(tau$insert,' ')||nvl(tau$select,' ')||nvl(tau$update,' '), user
- from sys.tabauth
- where tau$creator = user
- /
- grant select on v4exptabauth to public
- /
- create view v4expextents (pid, rba, type, sblock, eblock) as
- select distinct *
- from sys.extents
- where (ext$pid, ext$rba) in (
- select tab$pid, tab$rba
- from sys.tables
- where tab$owner = uid)
- /
- grant select on v4expextents to public
- /
- create view v4expcol
- (rba, tbl, pid, name, length, scale, type, mand, id, cmnt, dflt ) as
- select col$rba, col$tbl, col$pid, col$name, col$length,
- nvl(col$scale, 0),
- col$datatype,
- decode(col$null_type, 'NOT NULL', 1, 0), col$id, col$comment, col$default
- from sys.columns,sys.tables
- where col$rba = tab$rba and col$pid = tab$pid and col$tbl = tab$tbl
- and tab$type != 'SYNONYM'
- and tab$owner = uid
- /
- grant select on v4expcol to public
- /
- create view v4expsyn (name, sname, sowner, stime) as
- select tab$name, tab$sname, usr$name, tab$time
- from sys.tables, sys.userauth
- where tab$sowner = usr$uid
- and tab$type = 'SYNONYM'
- and tab$owner = uid
- /
- grant select on v4expsyn to public
- /
- create view v4expview
- (name, pid, rba, tbl, aud, cmnt, vtime, vlen, vtext) as
- select tab$name, tab$pid, tab$rba, tab$tbl, tab$audit, tab$comment,
- tab$time, vew$textlen, vew$text
- from sys.tables, sys.views
- where tab$type = 'VIEW' and tab$owner = uid
- and tab$rba = vew$rba and tab$pid = vew$pid and tab$tbl = vew$tbl
- /
- grant select on v4expview to public
- /