home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 5 / 05.iso / a / a524 / 28.ddi / admin / catalog.sql < prev    next >
Encoding:
Text File  |  1991-03-04  |  166.6 KB  |  5,644 lines

  1. rem
  2. rem $Header: catalog.sql,v 6002700.1 89/05/22 16:56:30 rcs Exp $ catalog.sql Copyr (c) 1989 Oracle
  3. rem
  4. rem RDBMS660027,DISK$DEV1:[V6SOURCE.OLB.60027]
  5. Rem Copyright (c) 1988 by Oracle Corporation
  6. Rem
  7. Rem NAME
  8. Rem   CATALOG.SQL
  9. Rem FUNCTION
  10. Rem   Creates data dictionary views.
  11. Rem NOTES
  12. Rem   Replaces old CATALOG.ORA.
  13. Rem   Must be run when connected to SYS.
  14. Rem MODIFIED
  15. Rem   Wijaya     05/11/89 - add v$rowcache
  16. Rem   Loaiza     05/05/89 - add index statistics
  17. Rem   Mendels    12/12/88 - fix 18656: use SYS/PUBLIC as rollback seg owner
  18. Rem   Bulchan    10/31/88 - Remove spurious '0'
  19. Rem   Mendels    10/25/88 - not exists errors: add 1418, 1435, 2289; drop 1719
  20. Rem   Bulchan    10/21/88 - add views from mon file and rollback
  21. Rem   Wijaya     10/17/88 - improve constraint views
  22. Rem   Wijaya     10/11/88 - add TABLE_NAME column to CONS_COLUMNS
  23. Rem   Mendels    10/07/88 - fix public synonym for all_sequences, dba_audit_dba
  24. Rem                       - delete user_sys_aud_opts
  25. Rem   Wijaya     10/05/88 - add [USER|ALL|DBA]_CONSTRAINTS and
  26. Rem                         [USER|ALL|DBA]_CONS_COLUMNS
  27. Rem   Bulchan    10/02/88 - Make it work in dbsdrv
  28. Rem   Wijaya     09/29/88 - remove ACGRA, UCGRA, UTCOM
  29. Rem   Hong       09/24/88 - fix export view
  30. Rem   Wijaya     09/22/88 - fix DATA_SCALE
  31. Rem   Mendels    09/08/88 - bug 15135 (add actions 34,49 to audit_actions)
  32. Rem   Mendels    08/30/88 - fix bug 14772 (tab returns indexes);
  33. Rem                         remove weird to_date's in %_objects;
  34. Rem                         remove some useless (+);
  35. Rem                         wrong column name in some comments on columns;
  36. Rem                         remove tabspaces and systabspaces views;
  37. Rem                         rename password_changed to expires;
  38. Rem                         fix 9981: decode type 69 as rowid in col;
  39. Rem   Mendels    08/07/88 - fix all/dba_indexes and all/dba_ind_columns views
  40. Rem                         to return indexes on public tables;
  41. Rem                         fix %_ind_columns views to use col# not pos# and
  42. Rem                         to return pos#
  43. Rem                         add %_indexes comments on max_extents.
  44. Rem   Baldwin    08/01/88 - Bad table name in all_ind_columns.
  45. Rem                         Wrong col name in comment on user_cluster.
  46. Rem   Baldwin    07/31/88 - Add password_change col to user_user and dba_user.
  47. Rem   Baldwin    07/28/88 - Enhance audit trail views.  
  48. Rem                         See notes$:audit_views.txt.
  49. Rem   Peeler     07/27/88 - Missing ' in user_tab_columns, accessible_columns.
  50. Rem   Bulchan    07/22/88 - Add v_$sga stuff
  51. Rem   Peeler     07/21/88 - cleanup various bugs in definitions
  52. Rem   Wijaya     06/21/88 - add PUBLIC synonyms/views for fixed views
  53. Rem   Moore      06/16/88 - fix missing ' and assorted other goodies
  54. Rem   Moore      06/16/88 - add synonym for dual
  55. Rem   Moore      06/02/88 - add comments to audit views (TGRAYSON)
  56. Rem   Moore      05/31/88 - add V5 audit views
  57. Rem   Moore      05/18/88 - integrate new segment views (dba,user)
  58. Rem   Wijaya     04/29/88 - fix comments
  59. Rem   Kabcenell  03/21/88 - dba_exp_files.dba_exp_version -> exp_version
  60. Rem   Grayson    03/21/88 - Creation
  61.  
  62.  
  63. remark
  64. remark  FAMILY "AUDIT"
  65. remark  Views for inspecting the audit trail.
  66. remark  For views of the audit options see the families: tab_audit_opts,
  67. remark  sys_audit_opts, and def_audit_opts.
  68. remark
  69. remark  User's are not allowed to see audit info for other people's
  70. remark  objects, so there are no all_ members in this family.
  71. remark  Users can see audit info for objects they own.
  72. remark               
  73. /
  74. remark  
  75. remark  AUDIT_ACTIONS maps an action number to the action name.
  76. remark  The table is accessible to public.
  77. remark  
  78. /
  79. drop table AUDIT_ACTIONS
  80. /
  81. create table AUDIT_ACTIONS(
  82.   action number not null, name char(27) not null)
  83. /
  84. comment on table AUDIT_ACTIONS is
  85. 'Description table for audit trail action type codes.  Maps action type numbers to action type names'
  86. /
  87. comment on column AUDIT_ACTIONS.ACTION is
  88. 'Numeric audit trail action type code'
  89. /
  90. comment on column AUDIT_ACTIONS.NAME is
  91. 'Name of the type of audit trail action'
  92. /
  93. insert into audit_actions values (0, 'UNKNOWN');
  94. insert into audit_actions values (1, 'CREATE TABLE');
  95. insert into audit_actions values (2, 'INSERT');
  96. insert into audit_actions values (3, 'SELECT');
  97. insert into audit_actions values (4, 'CREATE CLUSTER');
  98. insert into audit_actions values (5, 'ALTER CLUSTER');
  99. insert into audit_actions values (6, 'UPDATE');
  100. insert into audit_actions values (7, 'DELETE');
  101. insert into audit_actions values (8, 'DROP CLUSTER');
  102. insert into audit_actions values (9, 'CREATE INDEX');
  103. insert into audit_actions values (10, 'DROP INDEX');
  104. insert into audit_actions values (11, 'ALTER INDEX');
  105. insert into audit_actions values (12, 'DROP TABLE');
  106. insert into audit_actions values (13, 'CREATE SEQUENCE');
  107. insert into audit_actions values (14, 'ALTER SEQUENCE');
  108. insert into audit_actions values (15, 'ALTER TABLE');
  109. insert into audit_actions values (16, 'DROP SEQUENCE');
  110. insert into audit_actions values (17, 'GRANT OBJECT');
  111. insert into audit_actions values (18, 'REVOKE OBJECT');
  112. insert into audit_actions values (19, 'CREATE SYNONYM');
  113. insert into audit_actions values (20, 'DROP SYNONYM');
  114. insert into audit_actions values (21, 'CREATE VIEW');
  115. insert into audit_actions values (22, 'DROP VIEW');
  116. insert into audit_actions values (23, 'VALIDATE INDEX');
  117. insert into audit_actions values (26, 'LOCK');
  118. insert into audit_actions values (27, 'UNDEFINED');
  119. insert into audit_actions values (28, 'RENAME');
  120. insert into audit_actions values (29, 'COMMENT');
  121. insert into audit_actions values (30, 'AUDIT OBJECT');
  122. insert into audit_actions values (31, 'NOAUDIT OBJECT');
  123. insert into audit_actions values (32, 'CREATE DATABASE LINK');
  124. insert into audit_actions values (33, 'DROP DATABASE LINK');
  125. insert into audit_actions values (34, 'CREATE DATABASE');
  126. insert into audit_actions values (35, 'ALTER DATABASE');
  127. insert into audit_actions values (36, 'CREATE ROLLBACK SEG');
  128. insert into audit_actions values (37, 'ALTER ROLLBACK SEG');
  129. insert into audit_actions values (38, 'DROP ROLLBACK SEG');
  130. insert into audit_actions values (39, 'CREATE TABLESPACE');
  131. insert into audit_actions values (40, 'ALTER TABLESPACE');
  132. insert into audit_actions values (41, 'DROP TABLESPACE');
  133. insert into audit_actions values (42, 'ALTER SESSION');
  134. insert into audit_actions values (43, 'ALTER USER');
  135. insert into audit_actions values (49, 'ALTER SYSTEM');
  136. insert into audit_actions values (60, 'LOGON');
  137. insert into audit_actions values (61, 'LOGOFF');
  138. insert into audit_actions values (62, 'CLEANUP');
  139. insert into audit_actions values (63, 'SESSION');
  140. insert into audit_actions values (64, 'AUDIT SYSTEM');
  141. insert into audit_actions values (65, 'NOAUDIT SYSTEM');
  142. insert into audit_actions values (66, 'AUDIT DEFAULT');
  143. insert into audit_actions values (67, 'NOAUDIT DEFAULT');
  144. insert into audit_actions values (68, 'GRANT SYSTEM');
  145. insert into audit_actions values (69, 'REVOKE SYSTEM');
  146. insert into audit_actions values (70, 'CREATE PUBLIC SYNONYM');
  147. insert into audit_actions values (71, 'DROP PUBLIC SYNONYM');
  148. insert into audit_actions values (72, 'CREATE PUBLIC DATABASE LINK');
  149. insert into audit_actions values (73, 'DROP PUBLIC DATABASE LINK');
  150. insert into audit_actions values (80, 'USER COMMENT');
  151. commit;
  152. create unique index audact$uid on audit_actions(action,name) nocompress
  153. /
  154. drop public synonym AUDIT_ACTIONS
  155. /
  156. create public synonym AUDIT_ACTIONS for AUDIT_ACTIONS
  157. /
  158. grant select on AUDIT_ACTIONS to public
  159. /
  160.  
  161. remark  
  162. remark  USER_AUDIT_TRAIL
  163. remark  The raw audit trail of all information related to the user
  164. remark  or the objects owned by the user.  Some columns are only filled
  165. remark  in by certain statements (e.g., only rename uses new_name).
  166. remark  
  167. remark  DBA_AUDIT_TRAIL is implemented as a synonym for user_audit_trail.
  168. remark  This means that users with dba privilege have a hard time viewing
  169. remark  the audit info for just the objects they own because they always
  170. remark  see all the audit info.  Simplifying the implementation and
  171. remark  maintanence of these views seems more important.
  172. remark  A user with dba privilege sees all entries.
  173. remark  
  174. /
  175. drop view USER_AUDIT_TRAIL
  176. /
  177. create view USER_AUDIT_TRAIL
  178.         (
  179.          username, userhost, terminal, timestamp,
  180.          owner, obj_name,
  181.          action, action_name,
  182.          new_name,
  183.          privilege, grantee,
  184.          ses_actions,
  185.          logoff_time, logoff_lread, logoff_pread, logoff_lwrite, logoff_dlock,
  186.          comment_text,
  187.          sessionid, entryid, statementid, returncode
  188.         )
  189.  as 
  190.   select userid, userhost, terminal, timestamp,
  191.          t.obj$creator, t.obj$name,
  192.          t.action, act.name,
  193.          new$name,
  194.          auth$privileges, auth$grantee,
  195.          ses$actions,
  196.          logoff$time, logoff$lread,
  197.          logoff$pread, logoff$lwrite,
  198.          logoff$dead,
  199.          comment$text,
  200.          sessionid, entryid, statement, returncode
  201.   from sys.aud$ t, audit_actions act
  202.   where t.action = act.action
  203.     and ((t.obj$creator = user)
  204.          or (t.obj$creator is null and t.userid = user)
  205.          or exists
  206.             (select null from sys.user$
  207.                   where user# = uid and dba$ = 1)
  208.          )
  209. /
  210. comment on table USER_AUDIT_TRAIL is
  211. 'Audit trail entries relevant to the user'
  212. /
  213. comment on column USER_AUDIT_TRAIL.USERNAME is
  214. 'Name (not ID number) of the user whose actions were audited'
  215. /
  216. comment on column USER_AUDIT_TRAIL.USERHOST is
  217. 'Numeric instance ID for the Oracle instance from which the user is accessing the database.  Used only in environments with distributed file systems and shared database files (e.g., clustered Oracle on DEC VAX/VMS clusters)'
  218. /
  219. comment on column USER_AUDIT_TRAIL.TERMINAL is
  220. 'Identifier for the user''s terminal'
  221. /
  222. comment on column USER_AUDIT_TRAIL.TIMESTAMP is
  223. 'Timestamp for the creation of the audit trail entry (Timestamp for the user''s logon for entries created by AUDIT CONNECT)'
  224. /
  225. comment on column USER_AUDIT_TRAIL.OWNER is
  226. 'Creator of object affected by the action'
  227. /
  228. comment on column USER_AUDIT_TRAIL.OBJ_NAME is
  229. 'Name of the object affected by the action'
  230. /
  231. comment on column USER_AUDIT_TRAIL.ACTION is
  232. 'Numeric action type code.  The corresponding name of the action type (CREATE TABLE, INSERT, etc.) is in the column ACTION_NAME'
  233. /
  234. comment on column USER_AUDIT_TRAIL.ACTION_NAME is
  235. 'Name of the action type corresponding to the numeric code in ACTION'
  236. /
  237. comment on column USER_AUDIT_TRAIL.NEW_NAME is
  238. 'The new name of an object renamed by a RENAME statement'
  239. /
  240. comment on column USER_AUDIT_TRAIL.PRIVILEGE is
  241. 'Privileges granted/revoked by a GRANT/REVOKE statement'
  242. /
  243. remark  There is one audit entry for each grantee.
  244. /
  245. comment on column USER_AUDIT_TRAIL.GRANTEE is
  246. 'The name of the grantee specified in a GRANT/REVOKE statement'
  247. /
  248. comment on column USER_AUDIT_TRAIL.SES_ACTIONS is
  249. 'Session summary.  A string of 11 characters, one for each action type, in this order: Alter, Audit, Comment, Delete, Grant, Index, Insert, Lock, Rename, Select, Update.  Values:  "-" = None, "S" = Success, "F" = Failure, "B" = Both'
  250. /
  251. remark  A single audit entry describes both the logon and logoff.
  252. remark  The logoff_* columns are null while a user is logged in.
  253. /
  254. comment on column USER_AUDIT_TRAIL.LOGOFF_TIME is
  255. 'Timestamp for user logoff'
  256. /
  257. comment on column USER_AUDIT_TRAIL.LOGOFF_LREAD is
  258. 'Logical reads for the session'
  259. /
  260. comment on column USER_AUDIT_TRAIL.LOGOFF_PREAD is
  261. 'Physical reads for the session'
  262. /
  263. comment on column USER_AUDIT_TRAIL.LOGOFF_LWRITE is
  264. 'Logical writes for the session'
  265. /
  266. comment on column USER_AUDIT_TRAIL.LOGOFF_DLOCK is
  267. 'Deadlocks detected during the session'
  268. /
  269. comment on column USER_AUDIT_TRAIL.COMMENT_TEXT is
  270. 'Text comment on the audit trail entry'
  271. /
  272. comment on column USER_AUDIT_TRAIL.SESSIONID is
  273. 'Numeric ID for each Oracle session'
  274. /
  275. comment on column USER_AUDIT_TRAIL.ENTRYID is
  276. 'Numeric ID for each audit trail entry in the session'
  277. /
  278. comment on column USER_AUDIT_TRAIL.STATEMENTID is
  279. 'Numeric ID for each statement run (a statement may cause many actions)'
  280. /
  281. comment on column USER_AUDIT_TRAIL.RETURNCODE is
  282. 'Oracle error code generated by the action.  Zero if the action succeeded'
  283. /
  284. drop public synonym USER_AUDIT_TRAIL
  285. /
  286. create public synonym USER_AUDIT_TRAIL for USER_AUDIT_TRAIL
  287. /
  288. grant select on USER_AUDIT_TRAIL to public
  289. /
  290. drop public synonym DBA_AUDIT_TRAIL
  291. /
  292. create public synonym DBA_AUDIT_TRAIL for USER_AUDIT_TRAIL
  293. /
  294.  
  295. remark
  296. remark  USER_AUDIT_CONNECT
  297. remark  Lists the audit trail entries produced by AUDIT CONNECT.
  298. remark  DBA's see all entries, while ordinary users only
  299. remark  see entries for their own logins/logoffs.
  300. remark  
  301. remark  DBA_AUDIT_CONNECT is implemented as synonym of user_audit_connect,
  302. remark  which in turn is implemented in terms of user_audit_trail.
  303. remark  
  304. drop view USER_AUDIT_CONNECT
  305. /
  306. create view USER_AUDIT_CONNECT as
  307.   select username, userhost, terminal, timestamp,
  308.          action_name,
  309.          logoff_time, logoff_lread, logoff_pread, logoff_lwrite, logoff_dlock,
  310.          sessionid, returncode
  311.   from user_audit_trail
  312.   where action between 60 and 62
  313. /                 
  314. comment on table USER_AUDIT_CONNECT is
  315. 'Audit trail entries for user logons/logoffs'
  316. /
  317. comment on column USER_AUDIT_CONNECT.USERNAME is
  318. 'Name (not ID number) of the user whose actions were audited'
  319. /
  320. comment on column USER_AUDIT_CONNECT.USERHOST is
  321. 'Numeric instance ID for the Oracle instance from which the user is accessing the database.  Used only in environments with distributed file systems and shared database files (e.g., clustered Oracle on DEC VAX/VMS clusters)'
  322. /
  323. comment on column USER_AUDIT_CONNECT.TERMINAL is
  324. 'Identifier for the user''s terminal'
  325. /
  326. comment on column USER_AUDIT_CONNECT.TIMESTAMP is
  327. 'Timestamp for the user''s logon'
  328. /
  329. comment on column USER_AUDIT_CONNECT.ACTION_NAME is
  330. 'Name of the action type corresponding to the numeric code in ACTION'
  331. /
  332. remark  A single audit entry describes both the logon and logoff.
  333. remark  The logoff_* columns are null while a user is logged in.
  334. /
  335. comment on column USER_AUDIT_CONNECT.LOGOFF_TIME is
  336. 'Timestamp for user logoff'
  337. /
  338. comment on column USER_AUDIT_CONNECT.LOGOFF_LREAD is
  339. 'Logical reads for the session'
  340. /
  341. comment on column USER_AUDIT_CONNECT.LOGOFF_PREAD is
  342. 'Physical reads for the session'
  343. /
  344. comment on column USER_AUDIT_CONNECT.LOGOFF_LWRITE is
  345. 'Logical writes for the session'
  346. /
  347. comment on column USER_AUDIT_CONNECT.LOGOFF_DLOCK is
  348. 'Deadlocks detected during the session'
  349. /
  350. comment on column USER_AUDIT_CONNECT.SESSIONID is
  351. 'Numeric ID for each Oracle session'
  352. /
  353. comment on column USER_AUDIT_CONNECT.RETURNCODE is
  354. 'Oracle error code generated by the action.  Zero if the action succeeded'
  355. /
  356. drop public synonym USER_AUDIT_CONNECT
  357. /
  358. create public synonym USER_AUDIT_CONNECT for USER_AUDIT_CONNECT
  359. /
  360. grant select on USER_AUDIT_CONNECT to public
  361. /
  362. drop public synonym DBA_AUDIT_CONNECT
  363. /
  364. create public synonym DBA_AUDIT_CONNECT for USER_AUDIT_CONNECT
  365. /
  366.  
  367. remark
  368. remark  DBA_AUDIT_EXISTS
  369. remark  Only dba's can see audit info about objects that do not exist.
  370. remark  
  371. remark  Lists audit trail entries produced by AUDIT NOT EXISTS.
  372. remark  This is all audit trail entries with return codes of
  373. remark  942, 943, 959, 1418, 1432, 1434, 1435, 2019 and 2289.
  374. remark  This view is accessible to DBAs only.
  375. remark
  376. drop view DBA_AUDIT_EXISTS
  377. /
  378. create view DBA_AUDIT_EXISTS as
  379.   select username, userhost, terminal, timestamp,
  380.          owner, obj_name,
  381.          action_name,
  382.          new_name,
  383.          privilege, grantee,
  384.          sessionid, entryid, statementid, returncode
  385.   from user_audit_trail
  386.   where returncode in (942, 943, 959, 1418, 1432, 1434, 1435, 2019, 2289)
  387. /                 
  388. comment on column DBA_AUDIT_EXISTS.USERNAME is
  389. 'Name (not ID number) of the user whose actions were audited'
  390. /
  391. comment on column DBA_AUDIT_EXISTS.USERHOST is
  392. 'Numeric instance ID for the Oracle instance from which the user is accessing the database.  Used only in environments with distributed file systems and shared database files (e.g., clustered Oracle on DEC VAX/VMS clusters)'
  393. /
  394. comment on column DBA_AUDIT_EXISTS.TERMINAL is
  395. 'Identifier for the user''s terminal'
  396. /
  397. comment on column DBA_AUDIT_EXISTS.TIMESTAMP is
  398. 'Timestamp for the creation of the audit trail entry'
  399. /
  400. comment on column DBA_AUDIT_EXISTS.OWNER is
  401. 'Intended creator of the non-existent object'
  402. /
  403. comment on column DBA_AUDIT_EXISTS.OBJ_NAME is
  404. 'Name of the object affected by the action'
  405. /
  406. comment on column DBA_AUDIT_EXISTS.ACTION_NAME is
  407. 'Name of the action type corresponding to the numeric code in ACTION'
  408. /
  409. comment on column DBA_AUDIT_EXISTS.NEW_NAME is
  410. 'The new name of an object renamed by a RENAME statement'
  411. /
  412. comment on column DBA_AUDIT_EXISTS.PRIVILEGE is
  413. 'Privileges granted/revoked by a GRANT/REVOKE statement'
  414. /
  415. remark  There is one audit entry for each grantee.
  416. /
  417. comment on column DBA_AUDIT_EXISTS.GRANTEE is
  418. 'The name of the grantee specified in a GRANT/REVOKE statement'
  419. /
  420. comment on column DBA_AUDIT_EXISTS.SESSIONID is
  421. 'Numeric ID for each Oracle session'
  422. /
  423. comment on column DBA_AUDIT_EXISTS.ENTRYID is
  424. 'Numeric ID for each audit trail entry in the session'
  425. /
  426. comment on column DBA_AUDIT_EXISTS.STATEMENTID is
  427. 'Numeric ID for each statement run (a statement may cause many actions)'
  428. /
  429. comment on column DBA_AUDIT_EXISTS.RETURNCODE is
  430. 'Oracle error code generated by the action.  Zero if the action succeeded'
  431. /
  432. drop public synonym DBA_AUDIT_EXISTS
  433. /
  434. create public synonym DBA_AUDIT_EXISTS for DBA_AUDIT_EXISTS
  435. /
  436.  
  437. remark
  438. remark  USER_AUDIT_RESOURCE
  439. remark  DBA_AUDIT_RESOURCE implemented in terms of user_audit_resource.
  440. remark  DBA Sees all.
  441. remark  
  442. remark  Lists audit trail entries produced by AUDIT RESOURCE.
  443. remark
  444. /
  445. drop view USER_AUDIT_RESOURCE
  446. /
  447. create view USER_AUDIT_RESOURCE as
  448.   select username, userhost, terminal, timestamp,
  449.          owner, obj_name,
  450.          action_name,
  451.          sessionid, entryid, statementid, returncode
  452.   from user_audit_trail
  453.   where action in (1, 4, 8, 9, 10, 12, 13, 16, 19, 20, 21, 22,
  454.                    32, 33, 36, 38, 39, 41, 70, 71, 72, 73)
  455. /                 
  456. comment on column USER_AUDIT_RESOURCE.USERNAME is
  457. 'Name (not ID number) of the user whose actions were audited'
  458. /
  459. comment on column USER_AUDIT_RESOURCE.USERHOST is
  460. 'Numeric instance ID for the Oracle instance from which the user is accessing the database.  Used only in environments with distributed file systems and shared database files (e.g., clustered Oracle on DEC VAX/VMS clusters)'
  461. /
  462. comment on column USER_AUDIT_RESOURCE.TERMINAL is
  463. 'Identifier for the user''s terminal'
  464. /
  465. comment on column USER_AUDIT_RESOURCE.TIMESTAMP is
  466. 'Timestamp for the creation of the audit trail entry'
  467. /
  468. comment on column USER_AUDIT_RESOURCE.OWNER is
  469. 'Intended creator of the non-existent object'
  470. /
  471. comment on column USER_AUDIT_RESOURCE.OBJ_NAME is
  472. 'Name of the object affected by the action'
  473. /
  474. comment on column USER_AUDIT_RESOURCE.ACTION_NAME is
  475. 'Name of the action type corresponding to the numeric code in ACTION'
  476. /
  477. comment on column USER_AUDIT_RESOURCE.SESSIONID is
  478. 'Numeric ID for each Oracle session'
  479. /
  480. comment on column USER_AUDIT_RESOURCE.ENTRYID is
  481. 'Numeric ID for each audit trail entry in the session'
  482. /
  483. comment on column USER_AUDIT_RESOURCE.STATEMENTID is
  484. 'Numeric ID for each statement run (a statement may cause many actions)'
  485. /
  486. comment on column USER_AUDIT_RESOURCE.RETURNCODE is
  487. 'Oracle error code generated by the action.  Zero if the action succeeded'
  488. /
  489. drop public synonym USER_AUDIT_RESOURCE
  490. /
  491. create public synonym USER_AUDIT_RESOURCE for USER_AUDIT_RESOURCE
  492. /
  493. grant select on USER_AUDIT_RESOURCE to public
  494. /
  495. drop public synonym DBA_AUDIT_RESOURCE
  496. /
  497. create public synonym DBA_AUDIT_RESOURCE for USER_AUDIT_RESOURCE
  498. /
  499.  
  500. remark  
  501. remark  DBA_AUDIT_DBA
  502. remark  This view is only accessible to DBAs.
  503. remark  Lists audit trail entries produced by AUDIT DBA
  504. remark  (all operations with an action code of 24, 25, or
  505. remark  64 through 73).
  506. remark  The connect, resource and dba columns are filled in for
  507. remark  entries related to granting/revoking system-wide privileges.
  508. remark  The value 'Y' indicates the priv was granted/revoked.  If not,
  509. remark  a '-' appears.
  510. remark
  511. /
  512. drop view DBA_AUDIT_DBA
  513. /
  514. create view DBA_AUDIT_DBA as  
  515.   select username, userhost, terminal, timestamp,
  516.          owner, obj_name,
  517.          action, action_name,
  518.          substr(privilege,1,1) connect_priv,
  519.          substr(privilege,2,1) dba_priv,
  520.          substr(privilege,3,1) resource_priv,
  521.          grantee,
  522.          sessionid, entryid, statementid, returncode
  523.    from user_audit_trail
  524.    where action between 24 and 25
  525.          or action between 64 and 73
  526. /                 
  527. comment on table DBA_AUDIT_DBA is
  528. 'Audit trail entries created by AUDIT DBA'
  529. /
  530. comment on column DBA_AUDIT_DBA.USERNAME is
  531. 'Name (not ID number) of the user whose actions were audited'
  532. /
  533. comment on column DBA_AUDIT_DBA.USERHOST is
  534. 'Numeric instance ID for the Oracle instance from which the user is accessing the database.  Used only in environments with distributed file systems and shared database files (e.g., clustered Oracle on DEC VAX/VMS clusters)'
  535. /
  536. comment on column DBA_AUDIT_DBA.TERMINAL is
  537. 'Identifier for the user''s terminal'
  538. /
  539. comment on column DBA_AUDIT_DBA.TIMESTAMP is
  540. 'Timestamp for the creation of the audit trail entry (Timestamp for the user''s logon for entries created by AUDIT CONNECT)'
  541. /
  542. comment on column DBA_AUDIT_DBA.OWNER is
  543. 'Creator of object affected by the action'
  544. /
  545. comment on column DBA_AUDIT_DBA.OBJ_NAME is
  546. 'Name of the object affected by the action'
  547. /
  548. comment on column DBA_AUDIT_DBA.ACTION is
  549. 'Numeric action type code.  The corresponding name of the action type (CREATE TABLE, INSERT, etc.) is in the column ACTION_NAME'
  550. /
  551. comment on column DBA_AUDIT_DBA.ACTION_NAME is
  552. 'Name of the action type corresponding to the numeric code in ACTION'
  553. /
  554. comment on column DBA_AUDIT_DBA.CONNECT_PRIV is
  555. 'Y or - for CONNECT privilege did or did not appear in GRANT/REVOKE statement'
  556. /
  557. comment on column DBA_AUDIT_DBA.DBA_PRIV is
  558. 'Y or - for DBA privilege did or did not appear in GRANT/REVOKE statement'
  559. /
  560. comment on column DBA_AUDIT_DBA.RESOURCE_PRIV is
  561. 'Y or - for RESOURCE privilege did or did not appear in GRANT/REVOKE statement'
  562. /
  563. remark  There is one audit entry for each grantee.
  564. /
  565. comment on column DBA_AUDIT_DBA.GRANTEE is
  566. 'The name of the grantee specified in a GRANT/REVOKE statement'
  567. /
  568. comment on column DBA_AUDIT_DBA.SESSIONID is
  569. 'Numeric ID for each Oracle session'
  570. /
  571. comment on column DBA_AUDIT_DBA.ENTRYID is
  572. 'Numeric ID for each audit trail entry in the session'
  573. /
  574. comment on column DBA_AUDIT_DBA.STATEMENTID is
  575. 'Numeric ID for each statement run (a statement may cause many actions)'
  576. /
  577. comment on column DBA_AUDIT_DBA.RETURNCODE is
  578. 'Oracle error code generated by the action.  Zero if the action succeeded'
  579. /
  580. drop public synonym DBA_AUDIT_DBA
  581. /
  582. create public synonym DBA_AUDIT_DBA for DBA_AUDIT_DBA
  583. /
  584.  
  585. remark
  586. remark  FAMILY "CATALOG"
  587. remark  Objects which may be used as tables in SQL statements: 
  588. remark  Tables, Views, Synonyms.
  589. remark               
  590.  
  591. remark add DUAL
  592. drop table DUAL
  593. /
  594. create table DUAL(DUMMY char(1))
  595. /
  596. insert into DUAL values( 'X' );
  597. commit;
  598. create public synonym DUAL for DUAL
  599. /
  600. grant select on DUAL to public
  601. /
  602.  
  603.  
  604. drop view USER_CATALOG
  605. /
  606. create view USER_CATALOG
  607.     (TABLE_NAME,
  608.      TABLE_TYPE)
  609. as
  610. select o.name,
  611.        decode(o.type, 0, 'NEXT OBJECT', 1, 'INDEX', 2, 'TABLE', 3, 'CLUSTER',
  612.                       4, 'VIEW', 5, 'SYNONYM', 6, 'SEQUENCE', 'UNDEFINED')
  613. from sys.obj$ o
  614. where o.owner# = uid
  615.   and o.type in (2, 4, 5, 6)
  616. /
  617. comment on table USER_CATALOG is
  618. 'Tables, Views, Synonyms, Sequences accessible to the user'
  619. /
  620. comment on column USER_CATALOG.TABLE_NAME is
  621. 'Name of the object'
  622. /
  623. comment on column USER_CATALOG.TABLE_TYPE is
  624. 'Type of the object'
  625. /
  626. drop public synonym USER_CATALOG
  627. /
  628. create public synonym USER_CATALOG for USER_CATALOG
  629. /
  630. drop public synonym CAT
  631. /
  632. create public synonym CAT for USER_CATALOG
  633. /
  634. grant select on USER_CATALOG to PUBLIC
  635. /
  636. drop view ALL_CATALOG
  637. /
  638. remark
  639. remark  This view shows all tables, views, synonyms, and sequences owned by the
  640. remark  user and those tables, views, synonyms, and sequences that PUBLIC
  641. remark  has been granted access.
  642. remark
  643. create view ALL_CATALOG
  644.     (OWNER, TABLE_NAME,
  645.      TABLE_TYPE)
  646. as
  647. select u.name, o.name,
  648.        decode(o.type, 0, 'NEXT OBJECT', 1, 'INDEX', 2, 'TABLE', 3, 'CLUSTER',
  649.                       4, 'VIEW', 5, 'SYNONYM', 6, 'SEQUENCE', 'UNDEFINED')
  650. from sys.user$ u, sys.obj$ o
  651. where o.owner# = u.user#
  652.   and o.type in (2, 4, 5, 6)
  653.   and (o.owner# in (uid, 1)
  654.         or
  655.         obj# in ( select obj#
  656.                   from sys.tabauth$
  657.                   where grantee# in ( uid,1 )
  658.                 )
  659.        )
  660. /
  661. comment on table ALL_CATALOG is
  662. 'All tables, views, synonyms, sequences accesible to the user'
  663. /
  664. comment on column ALL_CATALOG.OWNER is
  665. 'Owner of the object'
  666. /
  667. comment on column ALL_CATALOG.TABLE_NAME is
  668. 'Name of the object'
  669. /
  670. comment on column ALL_CATALOG.TABLE_TYPE is
  671. 'Type of the object'
  672. /
  673. drop public synonym ALL_CATALOG
  674. /
  675. create public synonym ALL_CATALOG for ALL_CATALOG
  676. /
  677. grant select on ALL_CATALOG to PUBLIC
  678. /
  679. drop view ACCESSIBLE_TABLES
  680. /
  681. remark
  682. remark  This view shows all tables and views owned by the
  683. remark  user, plus all tables and views to which the user or PUBLIC
  684. remark  has been granted access.
  685. remark
  686. create view ACCESSIBLE_TABLES
  687.     (OWNER, TABLE_NAME,
  688.      TABLE_TYPE)
  689. as
  690. select u.name, o.name,
  691.        decode(o.type, 0, 'NEXT OBJECT', 1, 'INDEX', 2, 'TABLE', 3, 'CLUSTER',
  692.                       4, 'VIEW', 5, 'SYNONYM', 6, 'SEQUENCE', 'UNDEFINED')
  693. from sys.user$ u, sys.obj$ o
  694. where o.owner# = u.user#
  695.   and o.type in (2, 4)
  696.   and (o.owner# in (uid, 1)
  697.         or
  698.         obj# in ( select obj#
  699.                   from sys.tabauth$
  700.                   where grantee# in ( uid,1 )
  701.                 )
  702.        )
  703. /
  704. comment on table ACCESSIBLE_TABLES is
  705. 'Tables and Views accessible to the user'
  706. /
  707. comment on column ACCESSIBLE_TABLES.OWNER is
  708. 'Owner of the object'
  709. /
  710. comment on column ACCESSIBLE_TABLES.TABLE_NAME is
  711. 'Name of the object'
  712. /
  713. comment on column ACCESSIBLE_TABLES.TABLE_TYPE is
  714. 'Type of the object'
  715. /
  716. drop public synonym ACCESSIBLE_TABLES
  717. /
  718. create public synonym ACCESSIBLE_TABLES for ACCESSIBLE_TABLES
  719. /
  720. grant select on ACCESSIBLE_TABLES to PUBLIC
  721. /
  722. drop view DBA_CATALOG
  723. /
  724. create view DBA_CATALOG
  725.     (OWNER, TABLE_NAME,
  726.      TABLE_TYPE)
  727. as
  728. select u.name, o.name,
  729.        decode(o.type, 0, 'NEXT OBJECT', 1, 'INDEX', 2, 'TABLE', 3, 'CLUSTER',
  730.                       4, 'VIEW', 5, 'SYNONYM', 6, 'SEQUENCE', 'UNDEFINED')
  731. from sys.user$ u, sys.obj$ o
  732. where o.owner# = u.user#
  733.   and o.type in (2, 4, 5, 6)
  734. /
  735. comment on table DBA_CATALOG is
  736. 'All database Tables, Views, Synonyms, Sequences'
  737. /
  738. comment on column DBA_CATALOG.OWNER is
  739. 'Owner of the object'
  740. /
  741. comment on column DBA_CATALOG.TABLE_NAME is
  742. 'Name of the object'
  743. /
  744. comment on column DBA_CATALOG.TABLE_TYPE is
  745. 'Type of the object'
  746. /
  747. remark
  748. remark  FAMILY "CLUSTERS"
  749. remark  CREATE CLUSTER parameters.
  750. remark  This family has no "ALL" member.
  751. remark
  752. drop view USER_CLUSTERS
  753. /
  754. create view USER_CLUSTERS
  755.     (CLUSTER_NAME, TABLESPACE_NAME,
  756.      PCT_FREE, PCT_USED, KEY_SIZE,
  757.      INI_TRANS, MAX_TRANS,
  758.      INITIAL_EXTENT, NEXT_EXTENT,
  759.      MIN_EXTENTS, MAX_EXTENTS, PCT_INCREASE)
  760. as select o.name, ts.name,
  761.           c.pctfree$, c.pctused$, c.size$,c.initrans,c.maxtrans,
  762.           s.iniexts * ts.blocksize, s.extsize * ts.blocksize,
  763.           s.minexts, s.maxexts, s.extpct
  764. from sys.ts$ ts, sys.seg$ s, sys.clu$ c, sys.obj$ o
  765. where o.owner# = uid
  766.   and o.obj# = c.obj#
  767.   and c.ts# = ts.ts# 
  768.   and c.ts# = s.ts#
  769.   and c.file# = s.file#
  770.   and c.block# = s.block#
  771. /
  772. comment on table USER_CLUSTERS is
  773. 'Descriptions of user''s own clusters'
  774. /
  775. comment on column USER_CLUSTERS.CLUSTER_NAME is
  776. 'Name of the cluster'
  777. /
  778. comment on column USER_CLUSTERS.TABLESPACE_NAME is
  779. 'Name of the tablespace containing the cluster'
  780. /
  781. comment on column USER_CLUSTERS.PCT_FREE is
  782. 'Minimum percentage of free space in a block'
  783. /
  784. comment on column USER_CLUSTERS.PCT_USED is
  785. 'Minimum percentage of used space in a block'
  786. /
  787. comment on column USER_CLUSTERS.KEY_SIZE is
  788. 'Estimated size of cluster key plus associated rows'
  789. /
  790. comment on column USER_CLUSTERS.INI_TRANS is
  791. 'Initial number of transactions'
  792. /
  793. comment on column USER_CLUSTERS.MAX_TRANS is
  794. 'Maximum number of transactions'
  795. /
  796. comment on column USER_CLUSTERS.INITIAL_EXTENT is
  797. 'Size of the initial extent in bytes'
  798. /
  799. comment on column USER_CLUSTERS.NEXT_EXTENT is
  800. 'Size of secondary extents in bytes'
  801. /
  802. comment on column USER_CLUSTERS.MIN_EXTENTS is
  803. 'Minimum number of extents allowed in the segment'
  804. /
  805. comment on column USER_CLUSTERS.MAX_EXTENTS is
  806. 'Maximum number of extents allowed in the segment'
  807. /
  808. comment on column USER_CLUSTERS.PCT_INCREASE is
  809. 'Percentage increase in extent size'
  810. /
  811. drop public synonym USER_CLUSTERS
  812. /
  813. create public synonym USER_CLUSTERS for USER_CLUSTERS
  814. /
  815. drop public synonym CLU
  816. /
  817. create public synonym CLU for USER_CLUSTERS
  818. /
  819. grant select on USER_CLUSTERS to PUBLIC
  820. /
  821. drop view DBA_CLUSTERS
  822. /
  823. create view DBA_CLUSTERS
  824.     (OWNER, CLUSTER_NAME, TABLESPACE_NAME,
  825.      PCT_FREE, PCT_USED, KEY_SIZE,
  826.      INI_TRANS, MAX_TRANS,
  827.      INITIAL_EXTENT, NEXT_EXTENT,
  828.      MIN_EXTENTS, MAX_EXTENTS, PCT_INCREASE)
  829. as select u.name, o.name, ts.name,
  830.           c.pctfree$, c.pctused$, c.size$,c.initrans,c.maxtrans,
  831.           s.iniexts * ts.blocksize, s.extsize * ts.blocksize,
  832.           s.minexts, s.maxexts, s.extpct
  833. from sys.user$ u, sys.ts$ ts, sys.seg$ s, sys.clu$ c, sys.obj$ o
  834. where o.owner# = u.user#
  835.   and o.obj# = c.obj#
  836.   and c.ts# = ts.ts#
  837.   and c.ts# = s.ts#
  838.   and c.file# = s.file#
  839.   and c.block# = s.block#
  840. /
  841. comment on table DBA_CLUSTERS is
  842. 'Description of all clusters in the database'
  843. /
  844. comment on column DBA_CLUSTERS.OWNER is
  845. 'Owner of the cluster'
  846. /
  847. comment on column DBA_CLUSTERS.CLUSTER_NAME is
  848. 'Name of the cluster'
  849. /
  850. comment on column DBA_CLUSTERS.TABLESPACE_NAME is
  851. 'Name of the tablespace containing the cluster'
  852. /
  853. comment on column DBA_CLUSTERS.PCT_FREE is
  854. 'Minimum percentage of free space in a block'
  855. /
  856. comment on column DBA_CLUSTERS.PCT_USED is
  857. 'Minimum percentage of used space in a block'
  858. /
  859. comment on column DBA_CLUSTERS.KEY_SIZE is
  860. 'Estimated size of cluster key plus associated rows'
  861. /
  862. comment on column DBA_CLUSTERS.INI_TRANS is
  863. 'Initial number of transactions'
  864. /
  865. comment on column DBA_CLUSTERS.MAX_TRANS is
  866. 'Maximum number of transactions'
  867. /
  868. comment on column DBA_CLUSTERS.INITIAL_EXTENT is
  869. 'Size of the initial extent in bytes'
  870. /
  871. comment on column DBA_CLUSTERS.NEXT_EXTENT is
  872. 'Size of secondary extents in bytes'
  873. /
  874. comment on column DBA_CLUSTERS.MIN_EXTENTS is
  875. 'Minimum number of extents allowed in the segment'
  876. /
  877. comment on column DBA_CLUSTERS.MAX_EXTENTS is
  878. 'Maximum number of extents allowed in the segment'
  879. /
  880. comment on column DBA_CLUSTERS.PCT_INCREASE is
  881. 'Percentage increase in extent size'
  882. /
  883. remark
  884. remark  FAMILY "CLU_COLUMNS"
  885. remark  Mapping of cluster columns to table columns.
  886. remark  This family has no ALL member.
  887. remark  Creator:  Vicken Khachadourian
  888. remark
  889. drop view USER_CLU_COLUMNS
  890. /
  891. create view USER_CLU_COLUMNS
  892.     (CLUSTER_NAME, CLU_COLUMN_NAME, TABLE_NAME, TAB_COLUMN_NAME)
  893. as
  894. select oc.name, cc.name, ot.name, tc.name
  895. from sys.obj$ oc, sys.col$ cc, sys.obj$ ot, sys.col$ tc, sys.tab$ t
  896. where oc.obj#    = cc.obj#
  897.   and t.clu#     = oc.obj#
  898.   and t.obj#     = tc.obj#
  899.   and tc.segcol# = cc.segcol#
  900.   and t.obj#     = ot.obj#
  901.   and oc.type    = 3
  902.   and oc.owner#  = uid
  903. /
  904. comment on table USER_CLU_COLUMNS is
  905. 'Mapping of table columns to cluster columns'
  906. /
  907. comment on column USER_CLU_COLUMNS.CLUSTER_NAME is
  908. 'Cluster name'
  909. /
  910. comment on column USER_CLU_COLUMNS.CLU_COLUMN_NAME is
  911. 'Key column in the cluster'
  912. /
  913. comment on column USER_CLU_COLUMNS.TABLE_NAME is
  914. 'Clustered table name'
  915. /
  916. comment on column USER_CLU_COLUMNS.TAB_COLUMN_NAME is
  917. 'Key column in the table'
  918. /
  919. drop public synonym USER_CLU_COLUMNS
  920. /
  921. create public synonym USER_CLU_COLUMNS for USER_CLU_COLUMNS
  922. /
  923. grant select on USER_CLU_COLUMNS to PUBLIC
  924. /
  925. drop view DBA_CLU_COLUMNS
  926. /
  927. create view DBA_CLU_COLUMNS
  928.     (OWNER, CLUSTER_NAME, CLU_COLUMN_NAME, TABLE_NAME, TAB_COLUMN_NAME)
  929. as
  930. select u.name, oc.name, cc.name, ot.name, tc.name
  931. from sys.user$ u, sys.obj$ oc, sys.col$ cc, sys.obj$ ot, sys.col$ tc,
  932.      sys.tab$ t
  933. where oc.owner#  = u.user#
  934.   and oc.obj#    = cc.obj#
  935.   and t.clu#     = oc.obj#
  936.   and t.obj#     = tc.obj#
  937.   and tc.segcol# = cc.segcol#
  938.   and t.obj#     = ot.obj#
  939.   and oc.type    = 3
  940. /
  941. comment on table DBA_CLU_COLUMNS is
  942. 'Mapping of table columns to cluster columns'
  943. /
  944. comment on column DBA_CLU_COLUMNS.OWNER is
  945. 'Owner of the cluster'
  946. /
  947. comment on column DBA_CLU_COLUMNS.CLUSTER_NAME is
  948. 'Cluster name'
  949. /
  950. comment on column DBA_CLU_COLUMNS.CLU_COLUMN_NAME is
  951. 'Key column in the cluster'
  952. /
  953. comment on column DBA_CLU_COLUMNS.TABLE_NAME is
  954. 'Clustered table name'
  955. /
  956. comment on column DBA_CLU_COLUMNS.TAB_COLUMN_NAME is
  957. 'Key column in the table'
  958. /
  959. remark
  960. remark  FAMILY "COL_COMMENTS"
  961. remark  Comments on columns of tables and views.
  962. remark
  963. drop view USER_COL_COMMENTS
  964. /
  965. create view USER_COL_COMMENTS
  966.     (TABLE_NAME, COLUMN_NAME, COMMENTS)
  967. as
  968. select o.name, c.name, co.comment$
  969. from sys.obj$ o, sys.col$ c, sys.com$ co
  970. where o.owner# = uid
  971.   and o.type in (2, 4)
  972.   and o.obj# = c.obj#
  973.   and c.obj# = co.obj#(+)
  974.   and c.col# = co.col#(+)
  975. /
  976. comment on table USER_COL_COMMENTS is
  977. 'Comments on columns of user''s tables and views'
  978. /
  979. comment on column USER_COL_COMMENTS.TABLE_NAME is
  980. 'Object name'
  981. /
  982. comment on column USER_COL_COMMENTS.COLUMN_NAME is
  983. 'Column name'
  984. /
  985. comment on column USER_COL_COMMENTS.COMMENTS is
  986. 'Comment on the column'
  987. /
  988. drop public synonym USER_COL_COMMENTS
  989. /
  990. create public synonym USER_COL_COMMENTS for USER_COL_COMMENTS
  991. /
  992. grant select on USER_COL_COMMENTS to PUBLIC
  993. /
  994. drop view ALL_COL_COMMENTS
  995. /
  996. create view ALL_COL_COMMENTS
  997.     (OWNER, TABLE_NAME, COLUMN_NAME, COMMENTS)
  998. as
  999. select u.name, o.name, c.name, co.comment$
  1000. from sys.obj$ o, sys.col$ c, sys.user$ u, sys.com$ co
  1001. where o.owner# = u.user#
  1002.   and o.type in (2, 4)
  1003.   and o.obj# = c.obj#
  1004.   and c.obj# = co.obj#(+)
  1005.   and c.col# = co.col#(+)
  1006.   and (o.owner# = uid
  1007.        or o.obj# in
  1008.          (select obj#
  1009.           from sys.tabauth$
  1010.           where grantee# in (uid, 1))
  1011.       )
  1012. /
  1013. comment on table ALL_COL_COMMENTS is
  1014. 'Comments on columns of accessible tables and views'
  1015. /
  1016. comment on column ALL_COL_COMMENTS.OWNER is
  1017. 'Owner of the object'
  1018. /
  1019. comment on column ALL_COL_COMMENTS.TABLE_NAME is
  1020. 'Name of the object'
  1021. /
  1022. comment on column ALL_COL_COMMENTS.COLUMN_NAME is
  1023. 'Name of the column'
  1024. /
  1025. comment on column ALL_COL_COMMENTS.COMMENTS is
  1026. 'Comment on the column'
  1027. /
  1028. drop public synonym ALL_COL_COMMENTS
  1029. /
  1030. create public synonym ALL_COL_COMMENTS for ALL_COL_COMMENTS
  1031. /
  1032. grant select on ALL_COL_COMMENTS to PUBLIC
  1033. /
  1034. drop view DBA_COL_COMMENTS
  1035. /
  1036. create view DBA_COL_COMMENTS
  1037.     (OWNER, TABLE_NAME, COLUMN_NAME, COMMENTS)
  1038. as
  1039. select u.name, o.name, c.name, co.comment$
  1040. from sys.obj$ o, sys.col$ c, sys.user$ u, sys.com$ co
  1041. where o.owner# = u.user#
  1042.   and o.type in (2, 4)
  1043.   and o.obj# = c.obj#
  1044.   and c.obj# = co.obj#(+)
  1045.   and c.col# = co.col#(+)
  1046. /
  1047. comment on table DBA_COL_COMMENTS is
  1048. 'Comments on columns of all tables and views'
  1049. /
  1050. comment on column DBA_COL_COMMENTS.OWNER is
  1051. 'Name of the owner of the object'
  1052. /
  1053. comment on column DBA_COL_COMMENTS.TABLE_NAME is
  1054. 'Name of the object'
  1055. /
  1056. comment on column DBA_COL_COMMENTS.COLUMN_NAME is
  1057. 'Name of the column'
  1058. /
  1059. comment on column DBA_COL_COMMENTS.COMMENTS is
  1060. 'Comment on the object'
  1061. /
  1062. remark
  1063. remark  FAMILY "COL_GRANTS"
  1064. remark  Grants on columns.
  1065. remark
  1066. drop view USER_COL_GRANTS
  1067. /
  1068. create view USER_COL_GRANTS
  1069.       (GRANTEE, OWNER, TABLE_NAME, COLUMN_NAME, GRANTOR,
  1070.        /* INSERT_PRIV, */ UPDATE_PRIV, REFERENCES_PRIV,
  1071.        CREATED)
  1072. as
  1073. select ue.name, u.name, o.name, ca.name, ur.name,
  1074. /*     decode(ca.insert$, 0, 'N', 2, 'Y', 3, 'G', '?'), */
  1075.        decode(ca.update$, 0, 'N', 2, 'Y', 3, 'G', '?'),
  1076.        decode(ca.references$, 0, 'N', 2, 'Y', 3, 'G', '?'),
  1077.        ca.time
  1078. from sys.colauth$ ca, sys.obj$ o, sys.user$ u, sys.user$ ur, sys.user$ ue
  1079. where ca.obj# = o.obj#
  1080.   and ca.grantor# = ur.user#
  1081.   and ca.grantee# = ue.user#
  1082.   and u.user# = o.owner#
  1083.   and uid in (ca.grantor#, ca.grantee#, o.owner#)
  1084. /
  1085. comment on table USER_COL_GRANTS is
  1086. 'Grants on columns for which the user is the owner, grantor or grantee'
  1087. /
  1088. comment on column USER_COL_GRANTS.GRANTEE is
  1089. 'Name of the user to whom access was granted'
  1090. /
  1091. comment on column USER_COL_GRANTS.OWNER is
  1092. 'Username of the owner of the object'
  1093. /
  1094. comment on column USER_COL_GRANTS.TABLE_NAME is
  1095. 'Name of the object'
  1096. /
  1097. comment on column USER_COL_GRANTS.COLUMN_NAME is
  1098. 'Name of the column'
  1099. /
  1100. comment on column USER_COL_GRANTS.GRANTOR is
  1101. 'Name of the user who performed the grant'
  1102. /
  1103. remark comment on column USER_COL_GRANTS.INSERT_PRIV is
  1104. remark 'Permission to INSERT into the column?'
  1105. remark /
  1106. comment on column USER_COL_GRANTS.UPDATE_PRIV is
  1107. 'Permission to UPDATE the column?'
  1108. /
  1109. comment on column USER_COL_GRANTS.REFERENCES_PRIV is
  1110. 'Permission to make REFERENCES to the column?'
  1111. /
  1112. comment on column USER_COL_GRANTS.CREATED is
  1113. 'Timestamp for the grant'
  1114. /
  1115. drop public synonym USER_COL_GRANTS
  1116. /
  1117. create public synonym USER_COL_GRANTS for USER_COL_GRANTS
  1118. /
  1119. grant select on USER_COL_GRANTS to PUBLIC
  1120. /
  1121. drop view COLUMN_PRIVILEGES
  1122. /
  1123. create view COLUMN_PRIVILEGES
  1124.       (GRANTEE, OWNER, TABLE_NAME, COLUMN_NAME, GRANTOR,
  1125.        /* INSERT_PRIV, */ UPDATE_PRIV, REFERENCES_PRIV,
  1126.        CREATED)
  1127. as
  1128. select ue.name, u.name, o.name, ca.name, ur.name,
  1129. /*     decode(ca.insert$, 0, 'N', 2, 'Y', 3, 'G', '?'), */
  1130.        decode(ca.update$, 0, 'N', 2, 'Y', 3, 'G', '?'),
  1131.        decode(ca.references$, 0, 'N', 2, 'Y', 3, 'G', '?'),
  1132.        ca.time
  1133. from sys.colauth$ ca, sys.obj$ o, sys.user$ u, sys.user$ ur, sys.user$ ue
  1134. where ca.obj# = o.obj#
  1135.   and ca.grantor# = ur.user#
  1136.   and ca.grantee# = ue.user#
  1137.   and u.user# = o.owner#
  1138.   and (uid in (ca.grantor#, ca.grantee#, o.owner#)
  1139.    or  ca.grantee# = 1)
  1140. /
  1141. comment on table COLUMN_PRIVILEGES is
  1142. 'Grants on columns for which the user is the grantor, grantee, or owner, or PUBLIC is the grantee'
  1143. /
  1144. comment on column COLUMN_PRIVILEGES.GRANTEE is
  1145. 'Name of the user to whom access was granted'
  1146. /
  1147. comment on column COLUMN_PRIVILEGES.OWNER is
  1148. 'Username of the owner of the object'
  1149. /
  1150. comment on column COLUMN_PRIVILEGES.TABLE_NAME is
  1151. 'Name of the object'
  1152. /
  1153. comment on column COLUMN_PRIVILEGES.COLUMN_NAME is
  1154. 'Name of the column'
  1155. /
  1156. comment on column COLUMN_PRIVILEGES.GRANTOR is
  1157. 'Name of the user who performed the grant'
  1158. /
  1159. remark comment on column COLUMN_PRIVILEGES.INSERT_PRIV is
  1160. remark 'Permission to INSERT into the column?'
  1161. remark /
  1162. comment on column COLUMN_PRIVILEGES.UPDATE_PRIV is
  1163. 'Permission to UPDATE the column?'
  1164. /
  1165. comment on column COLUMN_PRIVILEGES.REFERENCES_PRIV is
  1166. 'Permission to make REFERENCES to the column?'
  1167. /
  1168. comment on column COLUMN_PRIVILEGES.CREATED is
  1169. 'Timestamp for the grant'
  1170. /
  1171. drop public synonym COLUMN_PRIVILEGES
  1172. /
  1173. create public synonym COLUMN_PRIVILEGES for COLUMN_PRIVILEGES
  1174. /
  1175. drop public synonym ALL_COL_GRANTS
  1176. /
  1177. create public synonym ALL_COL_GRANTS for COLUMN_PRIVILEGES
  1178. /
  1179. grant select on COLUMN_PRIVILEGES to PUBLIC
  1180. /
  1181. drop view DBA_COL_GRANTS
  1182. /
  1183. create view DBA_COL_GRANTS
  1184.       (GRANTEE, OWNER, TABLE_NAME, COLUMN_NAME, GRANTOR,
  1185.        /* INSERT_PRIV, */ UPDATE_PRIV, REFERENCES_PRIV,
  1186.        CREATED)
  1187. as
  1188. select ue.name, u.name, o.name, ca.name, ur.name,
  1189. /*     decode(ca.insert$, 0, 'N', 2, 'Y', 3, 'G', '?'), */
  1190.        decode(ca.update$, 0, 'N', 2, 'Y', 3, 'G', '?'),
  1191.        decode(ca.references$, 0, 'N', 2, 'Y', 3, 'G', '?'),
  1192.        ca.time
  1193. from sys.colauth$ ca, sys.obj$ o, sys.user$ u, sys.user$ ur, sys.user$ ue
  1194. where ca.obj# = o.obj#
  1195.   and ca.grantor# = ur.user#
  1196.   and ca.grantee# = ue.user#
  1197.   and u.user# = o.owner#
  1198. /
  1199. comment on table DBA_COL_GRANTS is
  1200. 'All grants on columns in the database'
  1201. /
  1202. comment on column DBA_COL_GRANTS.GRANTEE is
  1203. 'Name of the user to whom access was granted'
  1204. /
  1205. comment on column DBA_COL_GRANTS.OWNER is
  1206. 'Username of the owner of the object'
  1207. /
  1208. comment on column DBA_COL_GRANTS.TABLE_NAME is
  1209. 'Name of the object'
  1210. /
  1211. comment on column DBA_COL_GRANTS.COLUMN_NAME is
  1212. 'Name of the column'
  1213. /
  1214. comment on column DBA_COL_GRANTS.GRANTOR is
  1215. 'Name of the user who performed the grant'
  1216. /
  1217. remark comment on column DBA_COL_GRANTS.INSERT_PRIV is
  1218. remark 'Permission to INSERT into the column?'
  1219. remark /
  1220. comment on column DBA_COL_GRANTS.UPDATE_PRIV is
  1221. 'Permission to UPDATE the column?'
  1222. /
  1223. comment on column DBA_COL_GRANTS.REFERENCES_PRIV is
  1224. 'Permission to make REFERENCES to the column?'
  1225. /
  1226. comment on column DBA_COL_GRANTS.CREATED is
  1227. 'Timestamp for the grant'
  1228. /
  1229. remark
  1230. remark  FAMILY "COL_GRANTS_MADE"
  1231. remark  Grants on columns made by the user.
  1232. remark  This family has no DBA member.
  1233. remark
  1234. drop view USER_COL_GRANTS_MADE
  1235. /
  1236. create view USER_COL_GRANTS_MADE
  1237.       (GRANTEE, TABLE_NAME, COLUMN_NAME, GRANTOR,
  1238.        /* INSERT_PRIV, */ UPDATE_PRIV, REFERENCES_PRIV,
  1239.        CREATED)
  1240. as
  1241. select ue.name, o.name, ca.name, ur.name,
  1242. /*     decode(ca.insert$, 0, 'N', 2, 'Y', 3, 'G', '?'), */
  1243.        decode(ca.update$, 0, 'N', 2, 'Y', 3, 'G', '?'),
  1244.        decode(ca.references$, 0, 'N', 2, 'Y', 3, 'G', '?'),
  1245.        ca.time
  1246. from sys.colauth$ ca, sys.obj$ o, sys.user$ ue, sys.user$ ur
  1247. where ca.obj# = o.obj#
  1248.   and ca.grantor# = ur.user#
  1249.   and ca.grantee# = ue.user#
  1250.   and o.owner# = uid
  1251. /
  1252. comment on table USER_COL_GRANTS_MADE is
  1253. 'All grants on columns of objects owned by the user'
  1254. /
  1255. comment on column USER_COL_GRANTS_MADE.GRANTEE is
  1256. 'Name of the user to whom access was granted'
  1257. /
  1258. comment on column USER_COL_GRANTS_MADE.TABLE_NAME is
  1259. 'Name of the object'
  1260. /
  1261. comment on column USER_COL_GRANTS_MADE.COLUMN_NAME is
  1262. 'Name of the column'
  1263. /
  1264. comment on column USER_COL_GRANTS_MADE.GRANTOR is
  1265. 'Name of the user who performed the grant'
  1266. /
  1267. remark comment on column USER_COL_GRANTS_MADE.INSERT_PRIV is
  1268. remark 'Permission to INSERT into the column?'
  1269. remark /
  1270. comment on column USER_COL_GRANTS_MADE.UPDATE_PRIV is
  1271. 'Permission to UPDATE the column?'
  1272. /
  1273. comment on column USER_COL_GRANTS_MADE.REFERENCES_PRIV is
  1274. 'Permission to make REFERENCES to the column?'
  1275. /
  1276. comment on column USER_COL_GRANTS_MADE.CREATED is
  1277. 'Timestamp for the grant'
  1278. /
  1279. drop public synonym USER_COL_GRANTS_MADE
  1280. /
  1281. create public synonym USER_COL_GRANTS_MADE for USER_COL_GRANTS_MADE
  1282. /
  1283. grant select on USER_COL_GRANTS_MADE to PUBLIC
  1284. /
  1285. drop view ALL_COL_GRANTS_MADE
  1286. /
  1287. create view ALL_COL_GRANTS_MADE
  1288.       (GRANTEE, OWNER, TABLE_NAME, COLUMN_NAME, GRANTOR,
  1289.        /* INSERT_PRIV, */ UPDATE_PRIV, REFERENCES_PRIV,
  1290.        CREATED)
  1291. as
  1292. select ue.name, u.name, o.name, ca.name, ur.name,
  1293. /*     decode(ca.insert$, 0, 'N', 2, 'Y', 3, 'G', '?'), */
  1294.        decode(ca.update$, 0, 'N', 2, 'Y', 3, 'G', '?'),
  1295.        decode(ca.references$, 0, 'N', 2, 'Y', 3, 'G', '?'),
  1296.        ca.time
  1297. from sys.colauth$ ca, sys.obj$ o, sys.user$ u, sys.user$ ur, sys.user$ ue
  1298. where ca.obj# = o.obj#
  1299.   and ca.grantor# = ur.user#
  1300.   and ca.grantee# = ue.user#
  1301.   and u.user# = o.owner#
  1302.   and uid in (o.owner#, ca.grantor#)
  1303. /
  1304. comment on table ALL_COL_GRANTS_MADE is
  1305. 'Grants on columns for which the user is owner or grantor'
  1306. /
  1307. comment on column ALL_COL_GRANTS_MADE.GRANTEE is
  1308. 'Name of the user to whom access was granted'
  1309. /
  1310. comment on column ALL_COL_GRANTS_MADE.OWNER is
  1311. 'Username of the owner of the object'
  1312. /
  1313. comment on column ALL_COL_GRANTS_MADE.TABLE_NAME is
  1314. 'Name of the object'
  1315. /
  1316. comment on column ALL_COL_GRANTS_MADE.COLUMN_NAME is
  1317. 'Name of the column'
  1318. /
  1319. comment on column ALL_COL_GRANTS_MADE.GRANTOR is
  1320. 'Name of the user who performed the grant'
  1321. /
  1322. remark comment on column ALL_COL_GRANTS_MADE.INSERT_PRIV is
  1323. remark 'Permission to INSERT into the column?'
  1324. remark /
  1325. comment on column ALL_COL_GRANTS_MADE.UPDATE_PRIV is
  1326. 'Permission to UPDATE the column?'
  1327. /
  1328. comment on column ALL_COL_GRANTS_MADE.REFERENCES_PRIV is
  1329. 'Permission to make REFERENCES to the column?'
  1330. /
  1331. comment on column ALL_COL_GRANTS_MADE.CREATED is
  1332. 'Timestamp for the grant'
  1333. /
  1334. drop public synonym ALL_COL_GRANTS_MADE
  1335. /
  1336. create public synonym ALL_COL_GRANTS_MADE for ALL_COL_GRANTS_MADE
  1337. /
  1338. grant select on ALL_COL_GRANTS_MADE to PUBLIC
  1339. /
  1340. remark
  1341. remark  FAMILY "COL_GRANTS_RECD"
  1342. remark  Received grants on columns
  1343. remark
  1344. drop view USER_COL_GRANTS_RECD
  1345. /
  1346. create view USER_COL_GRANTS_RECD
  1347.       (OWNER, TABLE_NAME, COLUMN_NAME, GRANTOR,
  1348.        /* INSERT_PRIV, */ UPDATE_PRIV, REFERENCES_PRIV,
  1349.        CREATED)
  1350. as
  1351. select u.name, o.name, ca.name, ur.name,
  1352. /*     decode(ca.insert$, 0, 'N', 2, 'Y', 3, 'G', '?'), */
  1353.        decode(ca.update$, 0, 'N', 2, 'Y', 3, 'G', '?'),
  1354.        decode(ca.references$, 0, 'N', 2, 'Y', 3, 'G', '?'),
  1355.        ca.time
  1356. from sys.colauth$ ca, sys.obj$ o, sys.user$ u, sys.user$ ur
  1357. where ca.obj# = o.obj#
  1358.   and ca.grantor# = ur.user#
  1359.   and u.user# = o.owner#
  1360.   and ca.grantee# = uid
  1361. /
  1362. comment on table USER_COL_GRANTS_RECD is
  1363. 'Grants on columns for which the user is the grantee'
  1364. /
  1365. comment on column USER_COL_GRANTS_RECD.OWNER is
  1366. 'Username of the owner of the object'
  1367. /
  1368. comment on column USER_COL_GRANTS_RECD.TABLE_NAME is
  1369. 'Name of the object'
  1370. /
  1371. comment on column USER_COL_GRANTS_RECD.COLUMN_NAME is
  1372. 'Name of the column'
  1373. /
  1374. comment on column USER_COL_GRANTS_RECD.GRANTOR is
  1375. 'Name of the user who performed the grant'
  1376. /
  1377. remark comment on column USER_COL_GRANTS_RECD.INSERT_PRIV is
  1378. remark 'Permission to INSERT into the column?'
  1379. remark /
  1380. comment on column USER_COL_GRANTS_RECD.UPDATE_PRIV is
  1381. 'Permission to UPDATE the column?'
  1382. /
  1383. comment on column USER_COL_GRANTS_RECD.REFERENCES_PRIV is
  1384. 'Permission to make REFERENCES to the column?'
  1385. /
  1386. comment on column USER_COL_GRANTS_RECD.CREATED is
  1387. 'Timestamp for the grant'
  1388. /
  1389. drop public synonym USER_COL_GRANTS_RECD
  1390. /
  1391. create public synonym USER_COL_GRANTS_RECD for USER_COL_GRANTS_RECD
  1392. /
  1393. grant select on USER_COL_GRANTS_RECD to PUBLIC
  1394. /
  1395. drop view ALL_COL_GRANTS_RECD
  1396. /
  1397. create view ALL_COL_GRANTS_RECD
  1398.       (GRANTEE, OWNER, TABLE_NAME, COLUMN_NAME, GRANTOR,
  1399.        /* INSERT_PRIV, */ UPDATE_PRIV, REFERENCES_PRIV,
  1400.        CREATED)
  1401. as
  1402. select ue.name, u.name, o.name, ca.name, ur.name,
  1403. /*     decode(ca.insert$, 0, 'N', 2, 'Y', 3, 'G', '?'), */
  1404.        decode(ca.update$, 0, 'N', 2, 'Y', 3, 'G', '?'),
  1405.        decode(ca.references$, 0, 'N', 2, 'Y', 3, 'G', '?'),
  1406.        ca.time
  1407. from sys.colauth$ ca, sys.obj$ o, sys.user$ u, sys.user$ ur, sys.user$ ue
  1408. where ca.obj# = o.obj#
  1409.   and ca.grantor# = ur.user#
  1410.   and ca.grantee# = ue.user#
  1411.   and u.user# = o.owner#
  1412.   and ca.grantee# in (uid, 1)
  1413. /
  1414. comment on table ALL_COL_GRANTS_RECD is
  1415. 'Grants on columns for which the user or PUBLIC is the grantee'
  1416. /
  1417. comment on column ALL_COL_GRANTS_RECD.GRANTEE is
  1418. 'Name of the user to whom access was granted'
  1419. /
  1420. comment on column ALL_COL_GRANTS_RECD.OWNER is
  1421. 'Username of the owner of the object'
  1422. /
  1423. comment on column ALL_COL_GRANTS_RECD.TABLE_NAME is
  1424. 'Name of the object'
  1425. /
  1426. comment on column ALL_COL_GRANTS_RECD.COLUMN_NAME is
  1427. 'Name of the column'
  1428. /
  1429. comment on column ALL_COL_GRANTS_RECD.GRANTOR is
  1430. 'Name of the user who performed the grant'
  1431. /
  1432. remark comment on column ALL_COL_GRANTS_RECD.INSERT_PRIV is
  1433. remark 'Permission to INSERT into the column?'
  1434. remark /
  1435. comment on column ALL_COL_GRANTS_RECD.UPDATE_PRIV is
  1436. 'Permission to UPDATE the column?'
  1437. /
  1438. comment on column ALL_COL_GRANTS_RECD.REFERENCES_PRIV is
  1439. 'Permission to make REFERENCES to the column?'
  1440. /
  1441. comment on column ALL_COL_GRANTS_RECD.CREATED is
  1442. 'Timestamp for the grant'
  1443. /
  1444. drop public synonym ALL_COL_GRANTS_RECD
  1445. /
  1446. create public synonym ALL_COL_GRANTS_RECD for ALL_COL_GRANTS_RECD
  1447. /
  1448. grant select on ALL_COL_GRANTS_RECD to PUBLIC
  1449. /
  1450. remark
  1451. remark  FAMILY "CROSS_REFS"
  1452. remark  Object cross-referencing information
  1453. remark  Creator:  Brian G. Hirano
  1454. remark
  1455. drop view USER_CROSS_REFS
  1456. /
  1457. create view USER_CROSS_REFS
  1458.      (TABLE_NAME,
  1459.       TABLE_TYPE,
  1460.       REF_OWNER, REF_TABLE_NAME, REF_DB_LINK)
  1461. as
  1462. select x.name,
  1463.        decode(o.type, 0, 'NEXT OBJECT', 1, 'INDEX',
  1464.                       2, 'TABLE', 3, 'CLUSTER', 4, 'VIEW',
  1465.                       5, 'SYNONYM', 6, 'SEQUENCE', 'UNDEFINED'),
  1466.        x.rowner, x.rname, x.rnode
  1467. from sys.xref$ x, sys.obj$ o
  1468. where o.owner# = uid
  1469.   and x.name   = o.name
  1470.   and x.owner  = user
  1471. /
  1472. comment on table USER_CROSS_REFS is 
  1473. 'Cross references for user''s views, synonyms, and constraints'
  1474. /
  1475. comment on column USER_CROSS_REFS.TABLE_NAME is
  1476. 'Name of the referencing object'
  1477. /
  1478. comment on column USER_CROSS_REFS.TABLE_TYPE is
  1479. 'Type of the referencing object'
  1480. /
  1481. comment on column USER_CROSS_REFS.REF_OWNER is
  1482. 'Owner of the referenced object'
  1483. /
  1484. comment on column USER_CROSS_REFS.REF_TABLE_NAME is
  1485. 'Name of the referenced object'
  1486. /
  1487. comment on column USER_CROSS_REFS.REF_DB_LINK is
  1488. 'Database link of the referenced object'
  1489. /
  1490. drop public synonym USER_CROSS_REFS
  1491. /
  1492. create public synonym USER_CROSS_REFS for USER_CROSS_REFS
  1493. /
  1494. grant select on USER_CROSS_REFS to PUBLIC
  1495. /
  1496. drop view DBA_CROSS_REFS
  1497. create view DBA_CROSS_REFS
  1498.      (OWNER, TABLE_NAME,
  1499.       TABLE_TYPE,
  1500.       REF_OWNER, REF_TABLE_NAME, REF_DB_LINK)
  1501. as
  1502. select x.owner, x.name,
  1503.        decode(o.type, 0, 'NEXT OBJECT', 1, 'INDEX',
  1504.                       2, 'TABLE', 3, 'CLUSTER', 4, 'VIEW',
  1505.                       5, 'SYNONYM', 6, 'SEQUENCE', 'UNDEFINED'),
  1506.        x.rowner, x.rname, x.rnode
  1507. from sys.xref$ x, sys.obj$ o, sys.user$ u
  1508. where o.owner# = u.user#
  1509.   and x.name   = o.name
  1510.   and x.owner  = u.name
  1511. /
  1512. comment on table DBA_CROSS_REFS is
  1513. 'Cross reference of all views, synonyms, and constraints'
  1514. /
  1515. comment on column DBA_CROSS_REFS.OWNER is
  1516. 'Owner of the referencing object'
  1517. /
  1518. comment on column DBA_CROSS_REFS.TABLE_NAME is
  1519. 'Name of the referencing object'
  1520. /
  1521. comment on column DBA_CROSS_REFS.TABLE_TYPE is
  1522. 'Type of the referencing object'
  1523. /
  1524. comment on column DBA_CROSS_REFS.REF_OWNER is
  1525. 'Owner of the referenced object'
  1526. /
  1527. comment on column DBA_CROSS_REFS.REF_TABLE_NAME is
  1528. 'Name of the referenced object'
  1529. /
  1530. comment on column DBA_CROSS_REFS.REF_DB_LINK is
  1531. 'Database link of the referenced object'
  1532. /
  1533. remark
  1534. remark  FAMILY "DATA_FILES"
  1535. remark  Information about database files.
  1536. remark  This family has a DBA member only.
  1537. remark
  1538. drop view DBA_DATA_FILES
  1539. /
  1540. create view DBA_DATA_FILES
  1541.     (FILE_NAME, FILE_ID, TABLESPACE_NAME, 
  1542.      BYTES, BLOCKS, 
  1543.      STATUS)
  1544. as
  1545. select v.name, f.file#, ts.name, 
  1546.        ts.blocksize * f.blocks, f.blocks, 
  1547.        decode(f.status$, 1, 'INVALID', 2, 'AVAILABLE', 'UNDEFINED')
  1548. from sys.file$ f, sys.ts$ ts, sys.v$dbfile v
  1549. where v.file# = f.file# (+)
  1550.   and f.ts# = ts.ts# (+)
  1551. /
  1552. comment on table DBA_DATA_FILES is
  1553. 'Information about database files'
  1554. /
  1555. comment on column DBA_DATA_FILES.FILE_NAME is
  1556. 'Name of the database file'
  1557. /
  1558. comment on column DBA_DATA_FILES.FILE_ID is
  1559. 'ID of the database file'
  1560. /
  1561. comment on column DBA_DATA_FILES.TABLESPACE_NAME is
  1562. 'Name of the tablespace to which the file belongs'
  1563. /
  1564. comment on column DBA_DATA_FILES.BYTES is
  1565. 'Size of the file in bytes'
  1566. /
  1567. comment on column DBA_DATA_FILES.BLOCKS is
  1568. 'Size of the file in ORACLE blocks'
  1569. /
  1570. comment on column DBA_DATA_FILES.STATUS is
  1571. 'File status:  "INVALID" or "AVAILABLE"'
  1572. /
  1573. remark
  1574. remark  FAMILY "DB_LINKS"
  1575. remark  All relevant information about database links.
  1576. remark
  1577. drop view USER_DB_LINKS
  1578. /
  1579. create view USER_DB_LINKS
  1580.     (DB_LINK, USERNAME, PASSWORD, HOST, CREATED)
  1581. as
  1582. select l.name, l.userid, l.password, l.host, l.ctime
  1583. from sys.link$ l
  1584. where l.owner# = uid
  1585. /
  1586. comment on table USER_DB_LINKS is
  1587. 'Database links owned by the user'
  1588. /
  1589. comment on column USER_DB_LINKS.DB_LINK is
  1590. 'Name of the database link'
  1591. /
  1592. comment on column USER_DB_LINKS.USERNAME is
  1593. 'Name of user to log on as'
  1594. /
  1595. comment on column USER_DB_LINKS.PASSWORD is
  1596. 'Password for logon'
  1597. /
  1598. comment on column USER_DB_LINKS.HOST is
  1599. 'SQL*Net string for connect'
  1600. /
  1601. comment on column USER_DB_LINKS.CREATED is
  1602. 'Creation time of the database link'
  1603. /
  1604. drop public synonym USER_DB_LINKS
  1605. /
  1606. create public synonym USER_DB_LINKS for USER_DB_LINKS
  1607. /
  1608. grant select on USER_DB_LINKS to PUBLIC
  1609. /
  1610. drop view ALL_DB_LINKS
  1611. /
  1612. create view ALL_DB_LINKS
  1613.     (OWNER, DB_LINK, USERNAME, HOST, CREATED)
  1614. as
  1615. select u.name, l.name, l.userid, l.host, l.ctime
  1616. from sys.link$ l, sys.user$ u
  1617. where l.owner# in (uid, 1)
  1618.   and l.owner# = u.user#
  1619. /
  1620. comment on table ALL_DB_LINKS is
  1621. 'Database links accessible to the user'
  1622. /
  1623. comment on column ALL_DB_LINKS.DB_LINK is
  1624. 'Name of the database link'
  1625. /
  1626. comment on column ALL_DB_LINKS.USERNAME is
  1627. 'Name of user to log on as'
  1628. /
  1629. comment on column ALL_DB_LINKS.HOST is
  1630. 'SQL*Net string for connect'
  1631. /
  1632. comment on column ALL_DB_LINKS.CREATED is
  1633. 'Creation time of the database link'
  1634. /
  1635. drop public synonym ALL_DB_LINKS
  1636. /
  1637. create public synonym ALL_DB_LINKS for ALL_DB_LINKS
  1638. /
  1639. grant select on ALL_DB_LINKS to PUBLIC
  1640. /
  1641. drop view DBA_DB_LINKS
  1642. /
  1643. create view DBA_DB_LINKS
  1644.     (OWNER, DB_LINK, USERNAME, PASSWORD, HOST, CREATED)
  1645. as
  1646. select u.name, l.name, l.userid, l.password, l.host, l.ctime
  1647. from sys.link$ l, sys.user$ u
  1648. where l.owner# = u.user#
  1649. /
  1650. comment on table DBA_DB_LINKS is
  1651. 'All database links in the database'
  1652. /
  1653. comment on column DBA_DB_LINKS.DB_LINK is
  1654. 'Name of the database link'
  1655. /
  1656. comment on column DBA_DB_LINKS.USERNAME is
  1657. 'Name of user to log on as'
  1658. /
  1659. comment on column DBA_DB_LINKS.PASSWORD is
  1660. 'Password for logon'
  1661. /
  1662. comment on column DBA_DB_LINKS.HOST is
  1663. 'SQL*Net string for connect'
  1664. /
  1665. comment on column DBA_DB_LINKS.CREATED is
  1666. 'Creation time of the database link'
  1667. /
  1668. remark
  1669. remark  FAMILY "DEF_AUDIT_OPTS"
  1670. remark  Single row view indicating the default auditing options
  1671. remark  for newly created objects.
  1672. remark  This family has an ALL member only, since the default is
  1673. remark  system-wide and applies to all accessible objects.
  1674. remark
  1675. drop view ALL_DEF_AUDIT_OPTS
  1676. /
  1677. create view ALL_DEF_AUDIT_OPTS
  1678.     (ALT,
  1679.      AUD,
  1680.      COM,
  1681.      DEL,
  1682.      GRA,
  1683.      IND,
  1684.      INS,
  1685.      LOC,
  1686.      REN,
  1687.      SEL,
  1688.      UPD)
  1689. as
  1690. select substr(t.audit$, 1, 1) || '/' || substr(t.audit$, 2, 1),
  1691.        substr(t.audit$, 3, 1) || '/' || substr(t.audit$, 4, 1),
  1692.        substr(t.audit$, 5, 1) || '/' || substr(t.audit$, 6, 1),
  1693.        substr(t.audit$, 7, 1) || '/' || substr(t.audit$, 8, 1),
  1694.        substr(t.audit$, 9, 1) || '/' || substr(t.audit$, 10, 1),
  1695.        substr(t.audit$, 11, 1) || '/' || substr(t.audit$, 12, 1),
  1696.        substr(t.audit$, 13, 1) || '/' || substr(t.audit$, 14, 1),
  1697.        substr(t.audit$, 15, 1) || '/' || substr(t.audit$, 16, 1),
  1698.        substr(t.audit$, 17, 1) || '/' || substr(t.audit$, 18, 1),
  1699.        substr(t.audit$, 19, 1) || '/' || substr(t.audit$, 20, 1),
  1700.        substr(t.audit$, 21, 1) || '/' || substr(t.audit$, 22, 1)
  1701. from sys.obj$ o, sys.tab$ t
  1702. where o.obj# = t.obj#
  1703.   and o.owner# = 0
  1704.   and o.name = '_default_auditing_options_'
  1705. /
  1706. comment on table ALL_DEF_AUDIT_OPTS is
  1707. 'Auditing options for newly created objects'
  1708. /
  1709. comment on column ALL_DEF_AUDIT_OPTS.ALT is
  1710. 'Auditing ALTER WHENEVER SUCCESSFUL / UNSUCCESSFUL'
  1711. /
  1712. comment on column ALL_DEF_AUDIT_OPTS.AUD is
  1713. 'Auditing AUDIT WHENEVER SUCCESSFUL / UNSUCCESSFUL'
  1714. /
  1715. comment on column ALL_DEF_AUDIT_OPTS.COM is
  1716. 'Auditing COMMENT WHENEVER SUCCESSFUL / UNSUCCESSFUL'
  1717. /
  1718. comment on column ALL_DEF_AUDIT_OPTS.DEL is
  1719. 'Auditing DELETE WHENEVER SUCCESSFUL / UNSUCCESSFUL'
  1720. /
  1721. comment on column ALL_DEF_AUDIT_OPTS.GRA is
  1722. 'Auditing GRANT WHENEVER SUCCESSFUL / UNSUCCESSFUL'
  1723. /
  1724. comment on column ALL_DEF_AUDIT_OPTS.IND is
  1725. 'Auditing INDEX WHENEVER SUCCESSFUL / UNSUCCESSFUL'
  1726. /
  1727. comment on column ALL_DEF_AUDIT_OPTS.INS is
  1728. 'Auditing INSERT WHENEVER SUCCESSFUL / UNSUCCESSFUL'
  1729. /
  1730. comment on column ALL_DEF_AUDIT_OPTS.LOC is
  1731. 'Auditing LOCK WHENEVER SUCCESSFUL / UNSUCCESSFUL'
  1732. /
  1733. comment on column ALL_DEF_AUDIT_OPTS.REN is
  1734. 'Auditing RENAME WHENEVER SUCCESSFUL / UNSUCCESSFUL'
  1735. /
  1736. comment on column ALL_DEF_AUDIT_OPTS.SEL is
  1737. 'Auditing SELECT WHENEVER SUCCESSFUL / UNSUCCESSFUL'
  1738. /
  1739. comment on column ALL_DEF_AUDIT_OPTS.UPD is
  1740. 'Auditing UPDATE WHENEVER SUCCESSFUL / UNSUCCESSFUL'
  1741. /
  1742. drop public synonym ALL_DEF_AUDIT_OPTS
  1743. /
  1744. create public synonym ALL_DEF_AUDIT_OPTS for ALL_DEF_AUDIT_OPTS
  1745. /
  1746. grant select on ALL_DEF_AUDIT_OPTS to PUBLIC
  1747. /
  1748. remark
  1749. remark  VIEW "DICTIONARY"
  1750. remark  Online documentation for data dictionary tables and views.
  1751. remark  This view exists outside of the family schema.
  1752. remark
  1753. drop view DICTIONARY
  1754. /
  1755. create view DICTIONARY
  1756.     (TABLE_NAME, COMMENTS)
  1757. as
  1758. select o.name, c.comment$
  1759. from sys.obj$ o, sys.com$ c
  1760. where o.obj# = c.obj#(+)
  1761.   and c.col# is null
  1762.   and o.owner# = 0
  1763.   and o.type = 4
  1764.   and (o.name like 'USER%'
  1765.        or o.name like 'ALL%'
  1766.        or (o.name like 'DBA%'
  1767.            and uid in
  1768.                    (select u.user#
  1769.                     from sys.user$ u
  1770.                     where u.dba$ = 1)
  1771.            )
  1772.       )
  1773. union
  1774. select o.name, c.comment$
  1775. from sys.obj$ o, sys.com$ c
  1776. where o.obj# = c.obj#(+)
  1777.   and o.owner# = 0
  1778.   and o.name in ('AUDIT_ACTIONS', 'DICTIONARY', 'DICT_COLUMNS', 'DUAL',
  1779.                  /* ANSI views */
  1780.                  'ACCESSIBLE_TABLES', 'TABLE_PRIVILEGES',
  1781.                  'ACCESSIBLE_COLUMNS', 'COLUMN_PRIVILEGES',
  1782.                  'CONSTRAINT_DEFS', 'CONSTRAINT_COLUMNS')
  1783.   and c.col# is null
  1784. union
  1785. /* Find the names of public synonyms for views owned by SYS that
  1786. have names different from the synonym name.  This allows the user
  1787. to see the short-hand synonyms we have created.
  1788. */
  1789. select so.name, 'Synonym for ' || sy.name
  1790. from sys.obj$ ro, sys.syn$ sy, sys.obj$ so
  1791. where so.type = 5
  1792.   and so.owner# = 1
  1793.   and so.obj# = sy.obj#
  1794.   and so.name <> sy.name
  1795.   and sy.owner = 'SYS'
  1796.   and sy.name = ro.name
  1797.   and ro.owner# = 0
  1798.   and ro.type = 4
  1799. /
  1800. comment on table DICTIONARY is
  1801. 'Description of data dictionary tables and views'
  1802. /
  1803. comment on column DICTIONARY.TABLE_NAME is
  1804. 'Name of the object'
  1805. /
  1806. comment on column DICTIONARY.COMMENTS is
  1807. 'Text comment on the object'
  1808. /
  1809. drop public synonym DICTIONARY
  1810. /
  1811. create public synonym DICTIONARY for DICTIONARY
  1812. /
  1813. drop public synonym DICT
  1814. /
  1815. create public synonym DICT for DICTIONARY
  1816. /
  1817. grant select on DICTIONARY to PUBLIC
  1818. /
  1819. remark
  1820. remark  VIEW "DICT_COLUMNS"
  1821. remark  Online documentation for columns in data dictionary tables and views.
  1822. remark  This view exists outside of the family schema.
  1823. remark
  1824. drop view DICT_COLUMNS
  1825. /
  1826. create view DICT_COLUMNS
  1827.     (TABLE_NAME, COLUMN_NAME, COMMENTS)
  1828. as
  1829. select o.name, c.name, co.comment$
  1830. from sys.com$ co, sys.col$ c, sys.obj$ o
  1831. where  o.owner# = 0
  1832.   and o.type = 4
  1833.   and (o.name like 'USER%'
  1834.        or o.name like 'ALL$'
  1835.        or (o.name like 'DBA%'
  1836.            and uid in
  1837.                (select u.user#
  1838.                 from sys.user$ u
  1839.                 where u.dba$ = 1)
  1840.           )
  1841.       )
  1842.   and o.obj# = c.obj#
  1843.   and c.obj# = co.obj#(+)
  1844.   and c.col# = co.col#(+)
  1845. union
  1846. select o.name, c.name, co.comment$
  1847. from sys.com$ co, sys.col$ c, sys.obj$ o
  1848. where  o.owner# = 0
  1849.   and o.name in ('AUDIT_ACTIONS','DUAL','DICTIONARY', 'DICT_COLUMNS',
  1850.                  /* ANSI views */
  1851.                  'ACCESSIBLE_TABLES', 'TABLE_PRIVILEGES',
  1852.                  'ACCESSIBLE_COLUMNS', 'COLUMN_PRIVILEGES',
  1853.                  'CONSTRAINT_DEFS', 'CONSTRAINT_COLUMNS')
  1854.   and o.obj# = c.obj#
  1855.   and c.obj# = co.obj#(+)
  1856.   and c.col# = co.col#(+)
  1857. union
  1858.     /* Find the column comments for public synonyms for views owned by SYS that
  1859. have names different from the synonym name.  This allows the user
  1860. to see the columns of the short-hand synonyms we have created.
  1861. */
  1862. select so.name, c.name, co.comment$
  1863. from sys.com$ co,sys.col$ c, sys.obj$ ro, sys.syn$ sy, sys.obj$ so
  1864. where so.type = 5
  1865.   and so.owner# = 1
  1866.   and so.obj# = sy.obj#
  1867.   and so.name <> sy.name
  1868.   and sy.owner = 'SYS'
  1869.   and sy.name = ro.name
  1870.   and ro.owner# = 0
  1871.   and ro.type = 4
  1872.   and ro.obj# = c.obj#
  1873.   and c.col# = co.col#(+)  
  1874.   and c.obj# = co.obj#(+)
  1875. /
  1876. comment on table DICT_COLUMNS is
  1877. 'Description of columns in data dictionary tables and views'
  1878. /
  1879. comment on column DICT_COLUMNS.TABLE_NAME is
  1880. 'Name of the object that contains the column'
  1881. /
  1882. comment on column DICT_COLUMNS.COLUMN_NAME is
  1883. 'Name of the column'
  1884. /
  1885. comment on column DICT_COLUMNS.COMMENTS is
  1886. 'Text comment on the object'
  1887. /
  1888. drop public synonym DICT_COLUMNS
  1889. /
  1890. create public synonym DICT_COLUMNS for DICT_COLUMNS
  1891. /
  1892. grant select on DICT_COLUMNS to PUBLIC
  1893. /
  1894. remark
  1895. remark  FAMILY "EXP_OBJECTS"
  1896. remark  Objects that have been incrementally exported.
  1897. remark  This family has a DBA member only.
  1898. remark  Creator:  Vicken Khachadourian
  1899. remark
  1900. drop view DBA_EXP_OBJECTS
  1901. /
  1902. create view DBA_EXP_OBJECTS
  1903.     (OWNER, OBJECT_NAME, OBJECT_TYPE, CUMULATIVE, INCREMENTAL, EXPORT_VERSION)
  1904. as
  1905. select u.name, o.name, 
  1906.        decode(o.type, 1, 'INDEX', 2, 'TABLE', 3, 'CLUSTER',
  1907.                       4, 'VIEW', 5, 'SYNONYM', 6, 'SEQUENCE', 'UNDEFINED'),
  1908.        o.ctime, o.itime, o.expid
  1909. from sys.incexp o, sys.user$ u
  1910. where o.owner# = u.user#
  1911. /
  1912. comment on table DBA_EXP_OBJECTS is
  1913. 'Objects that have been incrementally exported'
  1914. /
  1915. comment on column DBA_EXP_OBJECTS.OWNER is
  1916. 'Owner of exported object'
  1917. comment on column DBA_EXP_OBJECTS.OBJECT_NAME is
  1918. 'Name of exported object'
  1919. comment on column DBA_EXP_OBJECTS.OBJECT_TYPE is
  1920. 'Type of exported object'
  1921. comment on column DBA_EXP_OBJECTS.CUMULATIVE is
  1922. 'Timestamp of last cumulative export'
  1923. comment on column DBA_EXP_OBJECTS.INCREMENTAL is
  1924. 'Timestamp of last incremental export'
  1925. comment on column DBA_EXP_OBJECTS.EXPORT_VERSION is
  1926. 'The id of the export session'
  1927. remark
  1928. remark  FAMILY "EXP_VERSION"
  1929. remark  Version number of last incremental export
  1930. remark  This family has a DBA member only.
  1931. remark  Creator:  Vicken Khachadourian
  1932. remark
  1933. drop view DBA_EXP_VERSION
  1934. /
  1935. create view DBA_EXP_VERSION 
  1936.     (EXP_VERSION)
  1937. as
  1938. select o.expid 
  1939. from sys.incvid o
  1940. /
  1941. comment on table DBA_EXP_VERSION is
  1942. 'Version number of the last export session'
  1943. /
  1944. comment on column DBA_EXP_VERSION.EXP_VERSION is
  1945. 'Version number of the last export session'
  1946. /
  1947. remark
  1948. remark  FAMILY "EXP_FILES"
  1949. remark  Files created by incremental exports.
  1950. remark  This family has a DBA member only.
  1951. remark  Creator:  Vicken Khachadourian
  1952. remark
  1953. drop view DBA_EXP_FILES
  1954. /
  1955. create view DBA_EXP_FILES 
  1956.      (EXP_VERSION, EXP_TYPE, FILE_NAME, USER_NAME, TIMESTAMP)
  1957. as
  1958. select o.expid, decode(o.exptype, 'X', 'COMPLETE', 'C', 'CUMULATIVE',
  1959.                                   'I', 'INCREMENTAL', 'UNDEFINED'),
  1960.        o.expfile, o.expuser, o.expdate
  1961. from sys.incfil o
  1962. /
  1963. comment on table DBA_EXP_FILES is
  1964. 'Description of export files'
  1965. /
  1966. comment on column DBA_EXP_FILES.EXP_VERSION is
  1967. 'Version number of the export session'
  1968. /
  1969. comment on column DBA_EXP_FILES.FILE_NAME is
  1970. 'Name of the export file'
  1971. /
  1972. comment on column DBA_EXP_FILES.USER_NAME is
  1973. 'Name of user who executed export'
  1974. /
  1975. comment on column DBA_EXP_FILES.TIMESTAMP is
  1976. 'Timestamp of the export session'
  1977. /
  1978. remark
  1979. remark  FAMILY "FREE_SPACE"
  1980. remark  Free extents.
  1981. remark  This family has no ALL member.
  1982. remark
  1983. drop view USER_FREE_SPACE
  1984. /
  1985. create view USER_FREE_SPACE
  1986.     (TABLESPACE_NAME, FILE_ID, BLOCK_ID,
  1987.      BYTES, BLOCKS)
  1988. as
  1989. select ts.name, f.file#, f.block#,
  1990.        f.length * ts.blocksize, f.length
  1991. from sys.fet$ f, sys.ts$ ts
  1992. where f.ts# = ts.ts#
  1993.   and (ts.ts# in
  1994.          (select tsq.ts#
  1995.           from sys.tsq$ tsq
  1996.           where tsq.user# = uid)
  1997.        or uid in
  1998.             (select u.user#
  1999.              from sys.user$ u
  2000.              where u.resource$ = 1)
  2001.       )
  2002. /
  2003. comment on table USER_FREE_SPACE is
  2004. 'Free extents in tablespaces accessible to the user'
  2005. /
  2006. comment on column USER_FREE_SPACE.TABLESPACE_NAME is
  2007. 'Name of the tablespace containing the extent'
  2008. /
  2009. comment on column USER_FREE_SPACE.FILE_ID is
  2010. 'ID number of the file containing the extent'
  2011. /
  2012. comment on column USER_FREE_SPACE.BLOCK_ID is
  2013. 'Starting block number of the extent'
  2014. /
  2015. comment on column USER_FREE_SPACE.BYTES is
  2016. 'Size of the extent in bytes'
  2017. /
  2018. comment on column USER_FREE_SPACE.BLOCKS is
  2019. 'Size of the extent in ORACLE blocks'
  2020. /
  2021. drop public synonym USER_FREE_SPACE
  2022. /
  2023. create public synonym USER_FREE_SPACE for USER_FREE_SPACE
  2024. /
  2025. grant select on USER_FREE_SPACE to PUBLIC
  2026. /
  2027. drop view DBA_FREE_SPACE
  2028. /
  2029. create view DBA_FREE_SPACE
  2030.     (TABLESPACE_NAME, FILE_ID, BLOCK_ID,
  2031.      BYTES, BLOCKS)
  2032. as
  2033. select ts.name, f.file#, f.block#,
  2034.        f.length * ts.blocksize, f.length
  2035. from sys.fet$ f, sys.ts$ ts
  2036. where f.ts# = ts.ts# (+)
  2037. /
  2038. comment on table DBA_FREE_SPACE is
  2039. 'Free extents in all tablespaces'
  2040. /
  2041. comment on column DBA_FREE_SPACE.TABLESPACE_NAME is
  2042. 'Name of the tablespace containing the extent'
  2043. /
  2044. comment on column DBA_FREE_SPACE.FILE_ID is
  2045. 'ID number of the file containing the extent'
  2046. /
  2047. comment on column DBA_FREE_SPACE.BLOCK_ID is
  2048. 'Starting block number of the extent'
  2049. /
  2050. comment on column DBA_FREE_SPACE.BYTES is
  2051. 'Size of the extent in bytes'
  2052. /
  2053. comment on column DBA_FREE_SPACE.BLOCKS is
  2054. 'Size of the extent in ORACLE blocks'
  2055. /
  2056. remark
  2057. remark  FAMILY "INDEXES"
  2058. remark  CREATE INDEX parameters.
  2059. remark
  2060. drop view USER_INDEXES
  2061. /
  2062. create view USER_INDEXES
  2063.     (INDEX_NAME, TABLE_OWNER, TABLE_NAME,
  2064.      TABLE_TYPE,
  2065.      UNIQUENESS,
  2066.      TABLESPACE_NAME, INI_TRANS, MAX_TRANS,
  2067.      INITIAL_EXTENT, NEXT_EXTENT,
  2068.      MIN_EXTENTS, MAX_EXTENTS, PCT_INCREASE)
  2069. as
  2070. select o.name, iu.name, io.name,
  2071.        decode(io.type, 0, 'NEXT OBJECT', 1, 'INDEX', 2, 'TABLE', 3, 'CLUSTER',
  2072.                        4, 'VIEW', 5, 'SYNONYM', 6, 'SEQUENCE', 'UNDEFINED'),
  2073.        decode(i.unique$, 0, 'NONUNIQUE', 1, 'UNIQUE', 'UNDEFINED'),
  2074.        ts.name, i.initrans, i.maxtrans,
  2075.        s.iniexts * ts.blocksize, s.extsize * ts.blocksize,
  2076.        s.minexts, s.maxexts, s.extpct
  2077. from sys.ts$ ts, sys.seg$ s, sys.user$ iu, sys.obj$ io, sys.ind$ i, sys.obj$ o
  2078. where o.owner# = uid
  2079.   and o.obj# = i.obj#
  2080.   and i.bo# = io.obj#
  2081.   and io.owner# = iu.user#
  2082.   and i.ts# = ts.ts#
  2083.   and i.file# = s.file#
  2084.   and i.block# = s.block#
  2085. /
  2086. comment on table USER_INDEXES is
  2087. 'Description of the user''s own indexes'
  2088. /
  2089. comment on column USER_INDEXES.INDEX_NAME is
  2090. 'Name of the index'
  2091. /
  2092. comment on column USER_INDEXES.TABLE_OWNER is
  2093. 'Owner of the indexed object'
  2094. /
  2095. comment on column USER_INDEXES.TABLE_NAME is
  2096. 'Name of the indexed object'
  2097. /
  2098. comment on column USER_INDEXES.TABLE_TYPE is
  2099. 'Type of the indexed object'
  2100. /
  2101. comment on column USER_INDEXES.UNIQUENESS is
  2102. 'Uniqueness status of the index:  "UNIQUE" or "NONUNIQUE"'
  2103. /
  2104. comment on column USER_INDEXES.TABLESPACE_NAME is
  2105. 'Name of the tablespace containing the index'
  2106. /
  2107. comment on column USER_INDEXES.INI_TRANS is
  2108. 'Initial number of transactions'
  2109. /
  2110. comment on column USER_INDEXES.MAX_TRANS is
  2111. 'Maximum number of transactions'
  2112. /
  2113. comment on column USER_INDEXES.INITIAL_EXTENT is
  2114. 'Size of the initial extent in bytes'
  2115. /
  2116. comment on column USER_INDEXES.NEXT_EXTENT is
  2117. 'Size of secondary extents in bytes'
  2118. /
  2119. comment on column USER_INDEXES.MIN_EXTENTS is
  2120. 'Minimum number of extents allowed in the segment'
  2121. /
  2122. comment on column USER_INDEXES.MAX_EXTENTS is
  2123. 'Maximum number of extents allowed in the segment'
  2124. /
  2125. comment on column USER_INDEXES.PCT_INCREASE is
  2126. 'Percentage increase in extent size'
  2127. /
  2128. drop public synonym USER_INDEXES
  2129. /
  2130. create public synonym USER_INDEXES for USER_INDEXES
  2131. /
  2132. drop public synonym IND
  2133. /
  2134. create public synonym IND for USER_INDEXES
  2135. /
  2136. grant select on USER_INDEXES to PUBLIC
  2137. /
  2138. remark
  2139. remark  This view does not include cluster indexes on clusters
  2140. remark  containing tables which are accessible to the user.
  2141. remark
  2142. drop view ALL_INDEXES
  2143. /
  2144. create view ALL_INDEXES
  2145.     (OWNER, INDEX_NAME, TABLE_OWNER, TABLE_NAME,
  2146.      TABLE_TYPE,
  2147.      UNIQUENESS,
  2148.      TABLESPACE_NAME, INI_TRANS, MAX_TRANS,
  2149.      INITIAL_EXTENT, NEXT_EXTENT, MIN_EXTENTS, MAX_EXTENTS, PCT_INCREASE)
  2150.  as 
  2151. select u.name, o.name, iu.name, io.name, 
  2152.        decode(io.type, 0, 'NEXT OBJECT', 1, 'INDEX', 2, 'TABLE', 3, 'CLUSTER',
  2153.                        4, 'VIEW', 5, 'SYNONYM', 6, 'SEQUENCE', 'UNDEFINED'),
  2154.        decode(i.unique$, 0, 'NONUNIQUE', 1, 'UNIQUE', 'UNDEFINED'), 
  2155.        ts.name, i.initrans, i.maxtrans,
  2156.        s.iniexts * ts.blocksize, s.extsize * ts.blocksize, 
  2157.        s.minexts, s.maxexts, s.extpct 
  2158. from sys.ts$ ts, sys.seg$ s, sys.user$ iu, sys.obj$ io, 
  2159.      sys.user$ u, sys.ind$ i, sys.obj$ o
  2160. where u.user# = o.owner#
  2161.   and o.obj# = i.obj#
  2162.   and i.bo# = io.obj#
  2163.   and io.owner# = iu.user# 
  2164.   and i.ts# = ts.ts# 
  2165.   and i.file# = s.file#
  2166.   and i.block# = s.block# 
  2167.   and (io.owner# = uid
  2168.         or
  2169.        io.obj# in ( select obj#
  2170.                     from tabauth$
  2171.                     where grantee# in ( uid, 1 )
  2172.                   )
  2173.        )
  2174. /
  2175. comment on table ALL_INDEXES is
  2176. 'Descriptions of indexes on tables accessible to the user'
  2177. /
  2178. comment on column ALL_INDEXES.OWNER is
  2179. 'Username of the owner of the index'
  2180. /
  2181. comment on column ALL_INDEXES.INDEX_NAME is
  2182. 'Name of the index'
  2183. /
  2184. comment on column ALL_INDEXES.TABLE_OWNER is
  2185. 'Owner of the indexed object'
  2186. /
  2187. comment on column ALL_INDEXES.TABLE_NAME is
  2188. 'Name of the indexed object'
  2189. /
  2190. comment on column ALL_INDEXES.TABLE_TYPE is
  2191. 'Type of the indexed object'
  2192. /
  2193. comment on column ALL_INDEXES.UNIQUENESS is
  2194. 'Uniqueness status of the index:  "UNIQUE" or "NONUNIQUE"'
  2195. /
  2196. comment on column ALL_INDEXES.TABLESPACE_NAME is
  2197. 'Name of the tablespace containing the index'
  2198. /
  2199. comment on column ALL_INDEXES.INI_TRANS is
  2200. 'Initial number of transactions'
  2201. /
  2202. comment on column ALL_INDEXES.MAX_TRANS is
  2203. 'Maximum number of transactions'
  2204. /
  2205. comment on column ALL_INDEXES.INITIAL_EXTENT is
  2206. 'Size of the initial extent'
  2207. /
  2208. comment on column ALL_INDEXES.NEXT_EXTENT is
  2209. 'Size of secondary extents'
  2210. /
  2211. comment on column ALL_INDEXES.MIN_EXTENTS is
  2212. 'Minimum number of extents allowed in the segment'
  2213. /
  2214. comment on column ALL_INDEXES.MAX_EXTENTS is
  2215. 'Maximum number of extents allowed in the segment'
  2216. /
  2217. comment on column ALL_INDEXES.PCT_INCREASE is
  2218. 'Percentage increase in extent size'
  2219. /
  2220. drop public synonym ALL_INDEXES
  2221. /
  2222. create public synonym ALL_INDEXES for ALL_INDEXES
  2223. /
  2224. grant select on ALL_INDEXES to PUBLIC
  2225. /
  2226. drop view DBA_INDEXES
  2227. /
  2228. create view DBA_INDEXES
  2229.     (OWNER, INDEX_NAME, TABLE_OWNER, TABLE_NAME,
  2230.      TABLE_TYPE,
  2231.      UNIQUENESS,
  2232.      TABLESPACE_NAME, INI_TRANS, MAX_TRANS,
  2233.      INITIAL_EXTENT, NEXT_EXTENT,
  2234.      MIN_EXTENTS, MAX_EXTENTS, PCT_INCREASE)
  2235. as
  2236. select u.name, o.name, iu.name, io.name,
  2237.        decode(io.type, 0, 'NEXT OBJECT', 1, 'INDEX', 2, 'TABLE', 3, 'CLUSTER',
  2238.                        4, 'VIEW', 5, 'SYNONYM', 6, 'SEQUENCE', 'UNDEFINED'),
  2239.        decode(i.unique$, 0, 'NONUNIQUE', 1, 'UNIQUE', 'UNDEFINED'),
  2240.        ts.name, i.initrans, i.maxtrans,
  2241.        s.iniexts * ts.blocksize, s.extsize * ts.blocksize,
  2242.        s.minexts, s.maxexts, s.extpct
  2243. from sys.ts$ ts, sys.seg$ s,
  2244.      sys.user$ iu, sys.obj$ io, sys.user$ u, sys.ind$ i, sys.obj$ o
  2245. where u.user# = o.owner#
  2246.   and o.obj# = i.obj#
  2247.   and i.bo# = io.obj#
  2248.   and io.owner# = iu.user#
  2249.   and i.ts# = ts.ts#
  2250.   and i.file# = s.file#
  2251.   and i.block# = s.block#
  2252. /
  2253. comment on table DBA_INDEXES is
  2254. 'Description for all indexes in the database'
  2255. /
  2256. comment on column DBA_INDEXES.OWNER is
  2257. 'Username of the owner of the index'
  2258. /
  2259. comment on column DBA_INDEXES.INDEX_NAME is
  2260. 'Name of the index'
  2261. /
  2262. comment on column DBA_INDEXES.TABLE_OWNER is
  2263. 'Owner of the indexed object'
  2264. /
  2265. comment on column DBA_INDEXES.TABLE_NAME is
  2266. 'Name of the indexed object'
  2267. /
  2268. comment on column DBA_INDEXES.TABLE_TYPE is
  2269. 'Type of the indexed object'
  2270. /
  2271. comment on column DBA_INDEXES.UNIQUENESS is
  2272. 'Uniqueness status of the index:  "UNIQUE" or "NONUNIQUE"'
  2273. /
  2274. comment on column DBA_INDEXES.TABLESPACE_NAME is
  2275. 'Name of the tablespace containing the index'
  2276. /
  2277. comment on column DBA_INDEXES.INI_TRANS is
  2278. 'Initial number of transactions'
  2279. /
  2280. comment on column DBA_INDEXES.MAX_TRANS is
  2281. 'Maximum number of transactions'
  2282. /
  2283. comment on column DBA_INDEXES.INITIAL_EXTENT is
  2284. 'Size of the initial extent'
  2285. /
  2286. comment on column DBA_INDEXES.NEXT_EXTENT is
  2287. 'Size of secondary extents'
  2288. /
  2289. comment on column DBA_INDEXES.MIN_EXTENTS is
  2290. 'Minimum number of extents allowed in the segment'
  2291. /
  2292. comment on column DBA_INDEXES.MAX_EXTENTS is
  2293. 'Maximum number of extents allowed in the segment'
  2294. /
  2295. comment on column DBA_INDEXES.PCT_INCREASE is
  2296. 'Percentage increase in extent size'
  2297. /
  2298. remark
  2299. remark  FAMILY "IND_COLUMNS"
  2300. remark  Displays information on which columns are contained in which
  2301. remark  indexes
  2302. remark
  2303. drop view USER_IND_COLUMNS
  2304. /
  2305. create view USER_IND_COLUMNS
  2306.     (INDEX_NAME, TABLE_NAME, COLUMN_NAME, COLUMN_POSITION, COLUMN_LENGTH)
  2307. as
  2308. select idx.name, base.name, 
  2309.        c.name, ic.pos#, c.length
  2310. from sys.col$ c, sys.obj$ idx, sys.obj$ base, sys.icol$ ic
  2311. where base.obj# = c.obj#
  2312.   and ic.bo# = base.obj#
  2313.   and ic.col# = c.col#
  2314.   and (base.owner# = uid or idx.owner# = uid)
  2315.   and ic.obj# = idx.obj#
  2316. /
  2317. comment on table USER_IND_COLUMNS is
  2318. 'COLUMNs comprising user''s INDEXes or on user''s TABLES'
  2319. /
  2320. comment on column USER_IND_COLUMNS.INDEX_NAME is
  2321. 'Index name'
  2322. /
  2323. comment on column USER_IND_COLUMNS.TABLE_NAME is
  2324. 'Table or cluster name'
  2325. /
  2326. comment on column USER_IND_COLUMNS.COLUMN_NAME is
  2327. 'Column name'
  2328. /
  2329. comment on column USER_IND_COLUMNS.COLUMN_POSITION is
  2330. 'Position of column within index'
  2331. /
  2332. comment on column USER_IND_COLUMNS.COLUMN_LENGTH is
  2333. 'Indexed length of the column'
  2334. /
  2335. drop public synonym USER_IND_COLUMNS
  2336. /
  2337. create public synonym USER_IND_COLUMNS for USER_IND_COLUMNS
  2338. /
  2339. grant select on USER_IND_COLUMNS to PUBLIC
  2340. /
  2341. drop view ALL_IND_COLUMNS
  2342. /
  2343. create view ALL_IND_COLUMNS
  2344.     (INDEX_OWNER, INDEX_NAME,
  2345.      TABLE_OWNER, TABLE_NAME,
  2346.      COLUMN_NAME, COLUMN_POSITION, COLUMN_LENGTH)
  2347. as
  2348. select io.name, idx.name, bo.name, base.name, 
  2349.        c.name, ic.pos#, c.length
  2350. from sys.col$ c, sys.obj$ idx, sys.obj$ base, sys.icol$ ic,
  2351.      sys.user$ io, sys.user$ bo
  2352. where base.obj# = c.obj#
  2353.   and ic.col# = c.col#
  2354.   and ic.bo# = base.obj#
  2355.   and io.user# = idx.owner#
  2356.   and bo.user# = base.owner#
  2357.   and ic.obj# = idx.obj#
  2358.   and (idx.owner# = uid or
  2359.        base.owner# = uid
  2360.        or
  2361.        base.obj# in ( select obj#
  2362.                      from sys.tabauth$
  2363.                      where grantee# in ( uid, 1 )
  2364.                    )
  2365.        )
  2366. /
  2367. comment on table ALL_IND_COLUMNS is
  2368. 'COLUMNs comprising INDEXes on accessible TABLES'
  2369. /
  2370. comment on column ALL_IND_COLUMNS.INDEX_OWNER is
  2371. 'Index owner'
  2372. /
  2373. comment on column ALL_IND_COLUMNS.INDEX_NAME is
  2374. 'Index name'
  2375. /
  2376. comment on column ALL_IND_COLUMNS.TABLE_OWNER is
  2377. 'Table or cluster owner'
  2378. /
  2379. comment on column ALL_IND_COLUMNS.TABLE_NAME is
  2380. 'Table or cluster name'
  2381. /
  2382. comment on column ALL_IND_COLUMNS.COLUMN_NAME is
  2383. 'Column name'
  2384. /
  2385. comment on column ALL_IND_COLUMNS.COLUMN_POSITION is
  2386. 'Position of column within index'
  2387. /
  2388. comment on column ALL_IND_COLUMNS.COLUMN_LENGTH is
  2389. 'Indexed length of the column'
  2390. /
  2391. drop public synonym ALL_IND_COLUMNS
  2392. /
  2393. create public synonym ALL_IND_COLUMNS for ALL_IND_COLUMNS
  2394. /
  2395. grant select on ALL_IND_COLUMNS to PUBLIC
  2396. /
  2397. drop view DBA_IND_COLUMNS
  2398. /
  2399. create view DBA_IND_COLUMNS
  2400.     (INDEX_OWNER, INDEX_NAME,
  2401.      TABLE_OWNER, TABLE_NAME,
  2402.      COLUMN_NAME, COLUMN_POSITION, COLUMN_LENGTH)
  2403. as
  2404. select io.name, idx.name, bo.name, base.name, 
  2405.        c.name, ic.pos#, c.length
  2406. from sys.col$ c, sys.obj$ idx, sys.obj$ base, sys.icol$ ic,
  2407.      sys.user$ io, sys.user$ bo
  2408. where base.obj# = c.obj#
  2409.   and ic.col# = c.col#
  2410.   and ic.bo# = base.obj#
  2411.   and io.user# = idx.owner#
  2412.   and bo.user# = base.owner#
  2413.   and ic.obj# = idx.obj#
  2414. /
  2415. comment on table DBA_IND_COLUMNS is
  2416. 'COLUMNs comprising INDEXes on all TABLEs and CLUSTERs'
  2417. /
  2418. comment on column DBA_IND_COLUMNS.INDEX_OWNER is
  2419. 'Index owner'
  2420. /
  2421. comment on column DBA_IND_COLUMNS.INDEX_NAME is
  2422. 'Index name'
  2423. /
  2424. comment on column DBA_IND_COLUMNS.TABLE_OWNER is
  2425. 'Table or cluster owner'
  2426. /
  2427. comment on column DBA_IND_COLUMNS.TABLE_NAME is
  2428. 'Table or cluster name'
  2429. /
  2430. comment on column DBA_IND_COLUMNS.COLUMN_NAME is
  2431. 'Column name'
  2432. /
  2433. comment on column DBA_IND_COLUMNS.COLUMN_POSITION is
  2434. 'Position of column within index'
  2435. /
  2436. comment on column DBA_IND_COLUMNS.COLUMN_LENGTH is
  2437. 'Indexed length of the column'
  2438. /
  2439. drop view INDEX_STATS
  2440. /
  2441. create view INDEX_STATS as
  2442.  select    kdxstrot+1    height, 
  2443.     s.blocks,
  2444.     o.name,
  2445.            kdxstlrw     lf_rows,
  2446.     kdxstlbk    lf_blks,
  2447.     kdxstlln    lf_rows_len,
  2448.     kdxstlub    lf_blk_len,
  2449.            kdxstbrw     br_rows,
  2450.     kdxstbbk    br_blks,
  2451.     kdxstbln    br_rows_len,
  2452.     kdxstbub    br_blk_len,
  2453.     kdxstdrw    del_lf_rows,
  2454.     kdxstdln    del_lf_rows_len,
  2455.     kdxstdis    distinct_keys,
  2456.     kdxstmrl    most_repeated_key,
  2457.     kdxstlbk*kdxstlub+kdxstbbk*kdxstbub    btree_space,
  2458.     kdxstlln+kdxstbln            used_space,
  2459.     ceil(((kdxstlln+kdxstbln)*100)/
  2460.     (kdxstlbk*kdxstlub+kdxstbbk*kdxstbub))
  2461.                         pct_used,    
  2462.     kdxstlrw/kdxstdis            rows_per_key,
  2463.     kdxstrot+1+(kdxstlrw+kdxstdis)/(kdxstdis*2)
  2464.                         blks_gets_per_access
  2465.   from obj$ o, ind$ i, seg$ s, x$kdxst
  2466.  where kdxstfil = s.file#
  2467.   and  kdxstblk = s.block#
  2468.   and  s.file#  = i.file#
  2469.   and  s.block# = i.block#
  2470.   and  i.obj#   = o.obj#
  2471. /
  2472. comment on column index_stats.height is 
  2473. 'height of the b-tree'
  2474. /
  2475. comment on column index_stats.blocks is
  2476. 'blocks allocated to the segment'
  2477. /
  2478. comment on column index_stats.name is
  2479. 'name of the index'
  2480. /
  2481. comment on column index_stats.lf_rows is
  2482. 'number of leaf rows (values in the index)'
  2483. /
  2484. comment on column index_stats.lf_blks is
  2485. 'number of leaf blocks in the b-tree'
  2486. /
  2487. comment on column index_stats.lf_rows_len is
  2488. 'sum of the lengths of all the leaf rows'
  2489. /
  2490. comment on column index_stats.lf_blk_len is
  2491. 'useable space in a leaf block'
  2492. /
  2493. comment on column index_stats.br_rows is
  2494. 'number of branch rows'
  2495. /
  2496. comment on column index_stats.br_blks is
  2497. 'number of branch blocks in the b-tree'
  2498. /
  2499. comment on column index_stats.br_rows_len is
  2500. 'sum of the lengths of all the branch blocks in the b-tree'
  2501. /
  2502. comment on column index_stats.br_blk_len is
  2503. 'useable space in a branch block'
  2504. /
  2505. comment on column index_stats.del_lf_rows is
  2506. 'number of deleted leaf rows in the index'
  2507. /
  2508. comment on column index_stats.del_lf_rows_len is
  2509. 'total length of all deleted rows in the index'
  2510. /
  2511. comment on column index_stats.distinct_keys is
  2512. 'number of distinct keys in the index'
  2513. /
  2514. comment on column index_stats.most_repeated_key is
  2515. 'how many times the most repeated key is repeated'
  2516. /
  2517. comment on column index_stats.btree_space is
  2518. 'total space currently allocated in the b-tree'
  2519. /
  2520. comment on column index_stats.used_space is
  2521. 'total space that is currently being used in the b-tree'
  2522. /
  2523. comment on column index_stats.pct_used is
  2524. 'percent of space allocated in the b-tree that is being used'
  2525. /
  2526. comment on column index_stats.rows_per_key is
  2527. 'average number of rows per distinct key'
  2528. /
  2529. comment on column index_stats.blks_gets_per_access is
  2530. 'Expected number of consistent mode block gets per row. This assumes that a row chosen at random from the table is being searched for using the index'
  2531. /
  2532. drop public synonym INDEX_STATS
  2533. /
  2534. create public synonym INDEX_STATS for INDEX_STATS
  2535. /
  2536. grant select on INDEX_STATS to public
  2537. /
  2538. drop view INDEX_HISTOGRAM
  2539. /
  2540. create view INDEX_HISTOGRAM as
  2541.  select hist.indx * power(2, stats.kdxstscl-4)    repeat_count,
  2542.     hist.kdxhsval                keys_with_repeat_count
  2543.     from  x$kdxst stats, x$kdxhs hist
  2544. /
  2545. comment on column index_histogram.repeat_count is
  2546. 'number of times that a key is repeated'
  2547. /
  2548. comment on column index_histogram.keys_with_repeat_count is
  2549. 'number of keys that are repeated REPEAT_COUNT times'
  2550. /
  2551. drop public synonym INDEX_HISTOGRAM
  2552. /
  2553. create public synonym INDEX_HISTOGRAM for INDEX_HISTOGRAM
  2554. /
  2555. grant select on INDEX_HISTOGRAM to public
  2556. /
  2557. remark
  2558. remark  FAMILY "OBJECTS"
  2559. remark  List of objects, including creation and modify times.
  2560. remark
  2561. drop view USER_OBJECTS
  2562. /
  2563. create view USER_OBJECTS
  2564.     (OBJECT_NAME, OBJECT_ID,
  2565.      OBJECT_TYPE,
  2566.      CREATED, MODIFIED)
  2567. as
  2568. select o.name, o.obj#,
  2569.        decode(o.type, 0, 'NEXT OBJECT', 1, 'INDEX', 2, 'TABLE', 3, 'CLUSTER',
  2570.                       4, 'VIEW', 5, 'SYNONYM', 6, 'SEQUENCE', 'UNDEFINED'),
  2571.        o.ctime, o.mtime
  2572. from sys.obj$ o
  2573. where o.owner# = uid
  2574. union
  2575. select l.name, to_number(null),
  2576.        'DATABASE LINK',
  2577.        l.ctime, to_date(null)
  2578. from sys.link$ l
  2579. where l.owner# = uid
  2580. /
  2581. comment on table USER_OBJECTS is
  2582. 'Objects owned by the user'
  2583. /
  2584. comment on column USER_OBJECTS.OBJECT_NAME is
  2585. 'Name of the object'
  2586. /
  2587. comment on column USER_OBJECTS.OBJECT_ID is
  2588. 'Object number of the object'
  2589. /
  2590. comment on column USER_OBJECTS.OBJECT_TYPE is
  2591. 'Type of the object'
  2592. /
  2593. comment on column USER_OBJECTS.CREATED is
  2594. 'Timestamp for the creation of the object'
  2595. /
  2596. comment on column USER_OBJECTS.MODIFIED is
  2597. 'Timestamp for the last DDL change to the object'
  2598. /
  2599. drop public synonym USER_OBJECTS
  2600. /
  2601. create public synonym USER_OBJECTS for USER_OBJECTS
  2602. /
  2603. drop public synonym OBJ
  2604. /
  2605. create public synonym OBJ for USER_OBJECTS
  2606. /
  2607. grant select on USER_OBJECTS to PUBLIC
  2608. /
  2609. drop view ALL_OBJECTS
  2610. /
  2611. create view ALL_OBJECTS
  2612.     (OWNER, OBJECT_NAME, OBJECT_ID,
  2613.      OBJECT_TYPE,
  2614.      CREATED, MODIFIED)
  2615. as
  2616. select u.name, o.name, o.obj#,
  2617.        decode(o.type, 0, 'NEXT OBJECT', 1, 'INDEX', 2, 'TABLE', 3, 'CLUSTER',
  2618.                       4, 'VIEW', 5, 'SYNONYM', 6, 'SEQUENCE', 'UNDEFINED'),
  2619.        o.ctime, o.mtime
  2620. from sys.obj$ o, sys.user$ u
  2621. where o.owner# = u.user#
  2622.   and (o.owner# in (uid, 1)
  2623.         or
  2624.         o.obj# in ( select obj#
  2625.                     from sys.tabauth$
  2626.                     where grantee# in ( uid, 1 )
  2627.                   )
  2628.        )
  2629. /
  2630. comment on table ALL_OBJECTS is
  2631. 'Objects accessible to the user'
  2632. /
  2633. comment on column ALL_OBJECTS.OWNER is
  2634. 'Username of the owner of the object'
  2635. /
  2636. comment on column ALL_OBJECTS.OBJECT_NAME is
  2637. 'Name of the object'
  2638. /
  2639. comment on column ALL_OBJECTS.OBJECT_ID is
  2640. 'Object number of the object'
  2641. /
  2642. comment on column ALL_OBJECTS.OBJECT_TYPE is
  2643. 'Type of the object'
  2644. /
  2645. comment on column ALL_OBJECTS.CREATED is
  2646. 'Timestamp for the creation of the object'
  2647. /
  2648. comment on column ALL_OBJECTS.MODIFIED is
  2649. 'Timestamp for the last DDL change to the object'
  2650. /
  2651. drop public synonym ALL_OBJECTS
  2652. /
  2653. create public synonym ALL_OBJECTS for ALL_OBJECTS
  2654. /
  2655. grant select on ALL_OBJECTS to PUBLIC
  2656. /
  2657. drop view DBA_OBJECTS
  2658. /
  2659. create view DBA_OBJECTS
  2660.     (OWNER, OBJECT_NAME, OBJECT_ID,
  2661.      OBJECT_TYPE,
  2662.      CREATED, MODIFIED)
  2663. as
  2664. select u.name, o.name, o.obj#,
  2665.        decode(o.type, 0, 'NEXT OBJECT', 1, 'INDEX', 2, 'TABLE', 3, 'CLUSTER',
  2666.                       4, 'VIEW', 5, 'SYNONYM', 6, 'SEQUENCE', 'UNDEFINED'),
  2667.        o.ctime, o.mtime
  2668. from sys.obj$ o, sys.user$ u
  2669. where o.owner# = u.user#
  2670. union
  2671. select u.name, l.name, to_number(null),
  2672.        'DATABASE LINK',
  2673.        l.ctime, to_date(null)
  2674. from sys.link$ l, sys.user$ u
  2675. where l.owner# = u.user#
  2676. /
  2677. comment on table DBA_OBJECTS is
  2678. 'All objects in the database'
  2679. /
  2680. comment on column DBA_OBJECTS.OWNER is
  2681. 'Username of the owner of the object'
  2682. /
  2683. comment on column DBA_OBJECTS.OBJECT_NAME is
  2684. 'Name of the object'
  2685. /
  2686. comment on column DBA_OBJECTS.OBJECT_ID is
  2687. 'Object number of the object'
  2688. /
  2689. comment on column DBA_OBJECTS.OBJECT_TYPE is
  2690. 'Type of the object'
  2691. /
  2692. comment on column DBA_OBJECTS.CREATED is
  2693. 'Timestamp for the creation of the object'
  2694. /
  2695. comment on column DBA_OBJECTS.MODIFIED is
  2696. 'Timestamp for the last DDL change to the object'
  2697. /
  2698. remark
  2699. remark  FAMILY "ROLLBACK_SEGS"
  2700. remark  CREATE ROLLBACK SEGMENT parameters.
  2701. remark  This family has a DBA member only.
  2702. remark
  2703. drop view DBA_ROLLBACK_SEGS
  2704. /
  2705. create view DBA_ROLLBACK_SEGS
  2706.     (SEGMENT_NAME, OWNER, TABLESPACE_NAME, SEGMENT_ID, FILE_ID, BLOCK_ID,
  2707.      INITIAL_EXTENT, NEXT_EXTENT,
  2708.      MIN_EXTENTS, MAX_EXTENTS, PCT_INCREASE,
  2709.      STATUS)
  2710. as
  2711. select un.name, decode(un.user#,1,'PUBLIC','SYS'),
  2712.        ts.name, un.us#, un.file#, un.block#,
  2713.        s.iniexts * ts.blocksize, s.extsize * ts.blocksize,
  2714.        s.minexts, s.maxexts, s.extpct,
  2715.        decode(un.status$, 1, 'INVALID', 2, 'AVAILABLE', 3, 'IN USE',
  2716.                           4, 'OFFLINE', 5, 'NEEDS RECOVERY', 'UNDEFINED')
  2717. from sys.undo$ un, sys.seg$ s, sys.ts$ ts
  2718. where un.file# = s.file# (+)
  2719.   and un.block# = s.block# (+)
  2720.   and s.type = 1
  2721.   and s.ts# = ts.ts#
  2722. /
  2723. comment on table DBA_ROLLBACK_SEGS is
  2724. 'Description of rollback segments'
  2725. /
  2726. comment on column DBA_ROLLBACK_SEGS.SEGMENT_NAME is
  2727. 'Name of the rollback segment'
  2728. /
  2729. comment on column DBA_ROLLBACK_SEGS.OWNER is
  2730. 'Owner of the rollback segment'
  2731. /
  2732. comment on column DBA_ROLLBACK_SEGS.TABLESPACE_NAME is
  2733. 'Name of the tablespace containing the rollback segment'
  2734. /
  2735. comment on column DBA_ROLLBACK_SEGS.SEGMENT_ID is
  2736. 'ID number of the rollback segment'
  2737. /
  2738. comment on column DBA_ROLLBACK_SEGS.FILE_ID is
  2739. 'ID number of the file containing the segment header'
  2740. /
  2741. comment on column DBA_ROLLBACK_SEGS.FILE_ID is
  2742. 'ID number of the block containing the segment header'
  2743. /
  2744. comment on column DBA_ROLLBACK_SEGS.INITIAL_EXTENT is
  2745. 'Initial extent size in bytes'
  2746. /
  2747. comment on column DBA_ROLLBACK_SEGS.NEXT_EXTENT is
  2748. 'Secondary extent size in bytes'
  2749. /
  2750. comment on column DBA_ROLLBACK_SEGS.MIN_EXTENTS is
  2751. 'Minimum number of extents'
  2752. /
  2753. comment on column DBA_ROLLBACK_SEGS.MAX_EXTENTS is
  2754. 'Maximum number of extents'
  2755. /
  2756. comment on column DBA_ROLLBACK_SEGS.PCT_INCREASE is
  2757. 'Percent increase for extent size'
  2758. /
  2759. comment on column DBA_ROLLBACK_SEGS.STATUS is
  2760. 'Rollback segment status'
  2761. /   
  2762. remark  FAMILY "SEGMENTS"
  2763. remark  Storage for all types of segments
  2764. remark  This family has no ALL member.
  2765. drop view SYS_OBJECTS
  2766. /
  2767. remark  define SYS_OBJECTS for use by segments views
  2768. create view SYS_OBJECTS
  2769.     (OBJECT_TYPE, OBJECT_TYPE_ID, SEGMENT_TYPE_ID,
  2770.      OBJECT_ID, HEADER_FILE, HEADER_BLOCK)
  2771. as
  2772. select 'TABLE', 2, 5,
  2773.        t.obj#, t.file#, t.block#
  2774. from sys.tab$ t
  2775. where t.clu# is null  /* exclude clustered tables */
  2776. union
  2777. select 'CLUSTER', 3, 5,
  2778.        c.obj#, c.file#, c.block#
  2779. from sys.clu$ c
  2780. union
  2781. select 'INDEX', 1, 6,
  2782.        i.obj#, i.file#, i.block#
  2783. from sys.ind$ i
  2784. /
  2785. drop view USER_SEGMENTS
  2786. /
  2787. create view USER_SEGMENTS
  2788.     (SEGMENT_NAME,
  2789.      SEGMENT_TYPE,
  2790.      TABLESPACE_NAME,
  2791.      BYTES, BLOCKS, EXTENTS, MAX_EXTENTS)
  2792. as
  2793. select o.name,
  2794.        so.object_type,
  2795.        ts.name,
  2796.        s.blocks * ts.blocksize, s.blocks, s.extents, s.maxexts
  2797. from sys.obj$ o, sys.ts$ ts, sys.sys_objects so, sys.seg$ s
  2798. where s.file# = so.header_file
  2799.   and s.block# = so.header_block
  2800.   and s.ts# = ts.ts#
  2801.   and o.obj# = so.object_id
  2802.   and o.owner# = uid
  2803.   and s.type = so.segment_type_id
  2804.   and o.type = so.object_type_id
  2805. union
  2806. select un.name,
  2807.        'ROLLBACK',
  2808.        ts.name,
  2809.        s.blocks * ts.blocksize, s.blocks, s.extents, s.maxexts
  2810. from sys.user$ u, sys.ts$ ts, sys.undo$ un, sys.seg$ s
  2811. where s.file# = un.file#
  2812.   and s.block# = un.block#
  2813.   and s.ts# = ts.ts#
  2814.   and un.user# = uid
  2815.   and s.type = 1
  2816. union
  2817. select to_char(s.file#) || '.' || to_char(s.block#),
  2818.        decode(s.type, 2, 'DEFERRED ROLLBACK', 3, 'TEMPORARY',
  2819.                       4, 'CACHE', 'UNDEFINED'),
  2820.        ts.name,
  2821.        s.blocks * ts.blocksize, s.blocks, s.extents, s.maxexts
  2822. from sys.ts$ ts, sys.seg$ s
  2823. where s.ts# = ts.ts#
  2824.   and s.user# = uid
  2825.   and s.type not in (1, 5, 6)
  2826. /
  2827. comment on table USER_SEGMENTS is
  2828. 'Storage allocated for all database segments'
  2829. /
  2830. comment on column USER_SEGMENTS.SEGMENT_NAME is
  2831. 'Name, if any, of the segment'
  2832. /
  2833. comment on column USER_SEGMENTS.SEGMENT_TYPE is
  2834. 'Type of segment:  "TABLE", "CLUSTER", "INDEX", "ROLLBACK",
  2835. "DEFERRED ROLLBACK", "TEMPORARY", or "CACHE"'
  2836. /
  2837. comment on column USER_SEGMENTS.TABLESPACE_NAME is
  2838. 'Name of the tablespace containing the segment'
  2839. /
  2840. comment on column USER_SEGMENTS.BYTES is
  2841. 'Size, in bytes, of the segment'
  2842. /
  2843. comment on column USER_SEGMENTS.BLOCKS is
  2844. 'Size, in Oracle blocks, of the segment'
  2845. /
  2846. comment on column USER_SEGMENTS.EXTENTS is
  2847. 'Number of extents allocated to the segment'
  2848. /
  2849. comment on column USER_SEGMENTS.MAX_EXTENTS is
  2850. 'Maximum number of extents allowed in the segment'
  2851. /
  2852. drop public synonym USER_SEGMENTS
  2853. /
  2854. create public synonym USER_SEGMENTS for USER_SEGMENTS
  2855. /
  2856. grant select on USER_SEGMENTS to PUBLIC
  2857. /
  2858. drop view DBA_SEGMENTS
  2859. /
  2860. create view DBA_SEGMENTS
  2861.     (OWNER, SEGMENT_NAME,
  2862.      SEGMENT_TYPE,
  2863.      TABLESPACE_NAME,
  2864.      HEADER_FILE, HEADER_BLOCK,
  2865.      BYTES, BLOCKS, EXTENTS, MAX_EXTENTS)
  2866. as
  2867. select u.name, o.name,
  2868.        so.object_type,
  2869.        ts.name,
  2870.        s.file#, s.block#,
  2871.        s.blocks * ts.blocksize, s.blocks, s.extents, s.maxexts
  2872. from sys.user$ u, sys.obj$ o, sys.ts$ ts, sys.sys_objects so, sys.seg$ s
  2873. where s.file# = so.header_file
  2874.   and s.block# = so.header_block
  2875.   and s.ts# = ts.ts#
  2876.   and o.obj# = so.object_id
  2877.   and o.owner# = u.user#
  2878.   and s.type = so.segment_type_id
  2879.   and o.type = so.object_type_id
  2880. union
  2881. select decode(un.user#,1,'PUBLIC','SYS'), un.name,
  2882.        'ROLLBACK', ts.name, s.file#, s.block#,
  2883.        s.blocks * ts.blocksize, s.blocks, s.extents, s.maxexts
  2884. from sys.ts$ ts, sys.undo$ un, sys.seg$ s
  2885. where s.file# = un.file#
  2886.   and s.block# = un.block#
  2887.   and s.ts# = ts.ts#
  2888.   and s.type = 1
  2889. union
  2890. select u.name, to_char(s.file#) || '.' || to_char(s.block#),
  2891.        decode(s.type, 2, 'DEFERRED ROLLBACK', 3, 'TEMPORARY',
  2892.                       4, 'CACHE', 'UNDEFINED'),
  2893.        ts.name,
  2894.        s.file#, s.block#,
  2895.        s.blocks * ts.blocksize, s.blocks, s.extents, s.maxexts
  2896. from sys.user$ u, sys.ts$ ts, sys.seg$ s
  2897. where s.ts# = ts.ts#
  2898.   and s.user# = u.user#
  2899.   and s.type not in (1, 5, 6)
  2900. /
  2901. comment on table DBA_SEGMENTS is
  2902. 'Storage allocated for all database segments'
  2903. /
  2904. comment on column DBA_SEGMENTS.OWNER is
  2905. 'Username of the segment owner'
  2906. /
  2907. comment on column DBA_SEGMENTS.SEGMENT_NAME is
  2908. 'Name, if any, of the segment'
  2909. /
  2910. comment on column DBA_SEGMENTS.SEGMENT_TYPE is
  2911. 'Type of segment:  "TABLE", "CLUSTER", "INDEX", "ROLLBACK",
  2912. "DEFERRED ROLLBACK", "TEMPORARY", or "CACHE"'
  2913. /
  2914. comment on column DBA_SEGMENTS.TABLESPACE_NAME is
  2915. 'Name of the tablespace containing the segment'
  2916. /
  2917. comment on column DBA_SEGMENTS.HEADER_FILE is
  2918. 'ID of the file containing the segment header'
  2919. /
  2920. comment on column DBA_SEGMENTS.HEADER_BLOCK is
  2921. 'ID of the block containing the segment header'
  2922. /
  2923. comment on column DBA_SEGMENTS.BYTES is
  2924. 'Size, in bytes, of the segment'
  2925. /
  2926. comment on column DBA_SEGMENTS.BLOCKS is
  2927. 'Size, in Oracle blocks, of the segment'
  2928. /
  2929. comment on column DBA_SEGMENTS.EXTENTS is
  2930. 'Number of extents allocated to the segment'
  2931. /
  2932. comment on column DBA_SEGMENTS.MAX_EXTENTS is
  2933. 'Maximum number of extents allowed in the segment'
  2934. /
  2935. remark
  2936. remark  FAMILY "EXTENTS"
  2937. remark  Extents associated with their segments.
  2938. remark
  2939. drop view USER_EXTENTS
  2940. /
  2941. create view USER_EXTENTS
  2942.     (SEGMENT_NAME, SEGMENT_TYPE, TABLESPACE_NAME,
  2943.      EXTENT_ID, BYTES, BLOCKS)
  2944. as
  2945. select ds.segment_name, ds.segment_type, ds.tablespace_name,
  2946.        e.ext#, e.length * ds.bytes / ds.blocks, e.length
  2947. from sys.uet$ e, sys.dba_segments ds
  2948. where e.segfile# = ds.header_file
  2949.   and e.segblock# = ds.header_block
  2950.   and ds.owner = user
  2951. /
  2952. comment on table USER_EXTENTS is
  2953. 'Extents comprising segments owned by the user'
  2954. /
  2955. comment on column USER_EXTENTS.SEGMENT_NAME is
  2956. 'Name of the segment associated with the extent'
  2957. /
  2958. comment on column USER_EXTENTS.TABLESPACE_NAME is
  2959. 'Name of the tablespace containing the extent'
  2960. /
  2961. comment on column USER_EXTENTS.SEGMENT_TYPE is
  2962. 'Type of the segment'
  2963. /
  2964. comment on column USER_EXTENTS.EXTENT_ID is
  2965. 'Extent number in the segment'
  2966. /
  2967. comment on column USER_EXTENTS.BYTES is
  2968. 'Size of the extent in bytes'
  2969. /
  2970. comment on column USER_EXTENTS.BLOCKS is
  2971. 'Size of the extent in ORACLE blocks'
  2972. /
  2973. drop public synonym USER_EXTENTS
  2974. /
  2975. create public synonym USER_EXTENTS for USER_EXTENTS
  2976. /
  2977. grant select on USER_EXTENTS to PUBLIC
  2978. /
  2979. drop view DBA_EXTENTS
  2980. /
  2981. create view DBA_EXTENTS
  2982.     (OWNER, SEGMENT_NAME, SEGMENT_TYPE, TABLESPACE_NAME,
  2983.      EXTENT_ID, FILE_ID, BLOCK_ID,
  2984.      BYTES, BLOCKS)
  2985. as
  2986. select ds.owner, ds.segment_name, ds.segment_type, ds.tablespace_name,
  2987.        e.ext#, e.file#, e.block#,
  2988.        e.length * ds.bytes / ds.blocks, e.length
  2989. from sys.uet$ e, sys.dba_segments ds
  2990. where e.segfile# = ds.header_file
  2991.   and e.segblock# = ds.header_block
  2992. /
  2993. comment on table DBA_EXTENTS is
  2994. 'Extents comprising all segments in the database'
  2995. /
  2996. comment on column DBA_EXTENTS.OWNER is
  2997. 'Owner of the segment associated with the extent'
  2998. /
  2999. comment on column DBA_EXTENTS.SEGMENT_NAME is
  3000. 'Name of the segment associated with the extent'
  3001. /
  3002. comment on column DBA_EXTENTS.TABLESPACE_NAME is
  3003. 'Name of the tablespace containing the extent'
  3004. /
  3005. comment on column DBA_EXTENTS.SEGMENT_TYPE is
  3006. 'Type of the segment'
  3007. /
  3008. comment on column DBA_EXTENTS.FILE_ID is
  3009. 'Name of the file containing the extent'
  3010. /
  3011. comment on column DBA_EXTENTS.BLOCK_ID is
  3012. 'Starting block number of the extent'
  3013. /
  3014. comment on column DBA_EXTENTS.EXTENT_ID is
  3015. 'Extent number in the segment'
  3016. /
  3017. comment on column DBA_EXTENTS.BYTES is
  3018. 'Size of the extent in bytes'
  3019. /
  3020. comment on column DBA_EXTENTS.BLOCKS is
  3021. 'Size of the extent in ORACLE blocks'
  3022. /
  3023. remark
  3024. remark  FAMILY "SEQUENCES"
  3025. remark  CREATE SEQUENCE information.
  3026. remark
  3027. drop view USER_SEQUENCES
  3028. /
  3029. create view USER_SEQUENCES
  3030.   (SEQUENCE_NAME, MIN_VALUE, MAX_VALUE, INCREMENT_BY,
  3031.                   CYCLE_FLAG, ORDER_FLAG, CACHE_SIZE, LAST_NUMBER)
  3032. as select o.name,
  3033.       s.minvalue, s.maxvalue, s.increment$,
  3034.       decode (s.cycle, 0, 'N', 1, 'Y'),
  3035.       decode (s.order$, 0, 'N', 1, 'Y'),
  3036.       s.cache, s.highwater
  3037. from sys.seq$ s, sys.obj$ o
  3038. where o.owner# = uid
  3039.   and o.obj# = s.obj#
  3040. /
  3041. comment on table USER_SEQUENCES is
  3042. 'Description of the user''s own SEQUENCEs'
  3043. /
  3044. comment on column USER_SEQUENCES.SEQUENCE_NAME is
  3045. 'SEQUENCE name'
  3046. /
  3047. comment on column USER_SEQUENCES.INCREMENT_BY is
  3048. 'Value by which sequence is incremented'
  3049. /
  3050. comment on column USER_SEQUENCES.MIN_VALUE is
  3051. 'Minimum value of the sequence'
  3052. /
  3053. comment on column USER_SEQUENCES.MAX_VALUE is
  3054. 'Maximum value of the sequence'
  3055. /
  3056. comment on column USER_SEQUENCES.CYCLE_FLAG is
  3057. 'Does sequence wrap around on reaching limit?'
  3058. /
  3059. comment on column USER_SEQUENCES.ORDER_FLAG is
  3060. 'Are sequence numbers generated in order?'
  3061. /
  3062. comment on column USER_SEQUENCES.CACHE_SIZE is
  3063. 'Number of sequence numbers to cache'
  3064. /
  3065. comment on column USER_SEQUENCES.LAST_NUMBER is
  3066. 'Last sequence number written to disk'
  3067. /
  3068. drop public synonym USER_SEQUENCES
  3069. /
  3070. create public synonym USER_SEQUENCES for USER_SEQUENCES
  3071. /
  3072. drop public synonym SEQ
  3073. /
  3074. create public synonym SEQ for USER_SEQUENCES
  3075. /
  3076. grant select on USER_SEQUENCES to PUBLIC
  3077. /
  3078. drop view ALL_SEQUENCES
  3079. /
  3080. create view ALL_SEQUENCES
  3081.   (SEQUENCE_OWNER, SEQUENCE_NAME, 
  3082.                   MIN_VALUE, MAX_VALUE, INCREMENT_BY,
  3083.                   CYCLE_FLAG, ORDER_FLAG, CACHE_SIZE, LAST_NUMBER)
  3084. as select u.name, o.name,
  3085.       s.minvalue, s.maxvalue, s.increment$, 
  3086.       decode (s.cycle, 0, 'N', 1, 'Y'),
  3087.       decode (s.order$, 0, 'N', 1, 'Y'),
  3088.       s.cache, s.highwater
  3089. from sys.seq$ s, sys.obj$ o, sys.user$ u
  3090. where u.user# = o.owner#
  3091.   and o.obj# = s.obj#
  3092.   and (o.owner# = uid
  3093.        or o.obj# in
  3094.             (select ta.obj#
  3095.              from sys.tabauth$ ta
  3096.              where ta.grantee# in (uid, 1))
  3097.       )
  3098. /
  3099. comment on table ALL_SEQUENCES is
  3100. 'Description of SEQUENCEs accessible to the user'
  3101. /
  3102. comment on column ALL_SEQUENCES.SEQUENCE_OWNER is
  3103. 'Name of the owner of the sequence'
  3104. /
  3105. comment on column ALL_SEQUENCES.SEQUENCE_NAME is
  3106. 'SEQUENCE name'
  3107. /
  3108. comment on column ALL_SEQUENCES.INCREMENT_BY is
  3109. 'Value by which sequence is incremented'
  3110. /
  3111. comment on column ALL_SEQUENCES.MIN_VALUE is
  3112. 'Minimum value of the sequence'
  3113. /
  3114. comment on column ALL_SEQUENCES.MAX_VALUE is
  3115. 'Maximum value of the sequence'
  3116. /
  3117. comment on column ALL_SEQUENCES.CYCLE_FLAG is
  3118. 'Does sequence wrap around on reaching limit?'
  3119. /
  3120. comment on column ALL_SEQUENCES.ORDER_FLAG is
  3121. 'Are sequence numbers generated in order?'
  3122. /
  3123. comment on column ALL_SEQUENCES.CACHE_SIZE is
  3124. 'Number of sequence numbers to cache'
  3125. /
  3126. comment on column ALL_SEQUENCES.LAST_NUMBER is
  3127. 'Last sequence number written to disk'
  3128. /
  3129. drop public synonym ALL_SEQUENCES
  3130. /
  3131. create public synonym ALL_SEQUENCES for ALL_SEQUENCES
  3132. /
  3133. grant select on ALL_SEQUENCES to PUBLIC
  3134. /
  3135. drop view DBA_SEQUENCES
  3136. /
  3137. create view DBA_SEQUENCES
  3138.   (SEQUENCE_OWNER, SEQUENCE_NAME, 
  3139.                   MIN_VALUE, MAX_VALUE, INCREMENT_BY,
  3140.                   CYCLE_FLAG, ORDER_FLAG, CACHE_SIZE, LAST_NUMBER)
  3141. as select u.name, o.name,
  3142.       s.minvalue, s.maxvalue, s.increment$, 
  3143.       decode (s.cycle, 0, 'N', 1, 'Y'),
  3144.       decode (s.order$, 0, 'N', 1, 'Y'),
  3145.       s.cache, s.highwater
  3146. from sys.seq$ s, sys.obj$ o, sys.user$ u
  3147. where u.user# = o.owner#
  3148.   and o.obj# = s.obj#
  3149. /
  3150. comment on table DBA_SEQUENCES is
  3151. 'Description of all SEQUENCEs in the database'
  3152. /
  3153. comment on column DBA_SEQUENCES.SEQUENCE_OWNER is
  3154. 'Name of the owner of the sequence'
  3155. /
  3156. comment on column DBA_SEQUENCES.SEQUENCE_NAME is
  3157. 'SEQUENCE name'
  3158. /
  3159. comment on column DBA_SEQUENCES.INCREMENT_BY is
  3160. 'Value by which sequence is incremented'
  3161. /
  3162. comment on column DBA_SEQUENCES.MIN_VALUE is
  3163. 'Minimum value of the sequence'
  3164. /
  3165. comment on column DBA_SEQUENCES.MAX_VALUE is
  3166. 'Maximum value of the sequence'
  3167. /
  3168. comment on column DBA_SEQUENCES.CYCLE_FLAG is
  3169. 'Does sequence wrap around on reaching limit?'
  3170. /
  3171. comment on column DBA_SEQUENCES.ORDER_FLAG is
  3172. 'Are sequence numbers generated in order?'
  3173. /
  3174. comment on column DBA_SEQUENCES.CACHE_SIZE is
  3175. 'Number of sequence numbers to cache'
  3176. /
  3177. comment on column DBA_SEQUENCES.LAST_NUMBER is
  3178. 'Last sequence number written to disk'
  3179. /
  3180. remark
  3181. remark  FAMILY "SYNONYMS"
  3182. remark  CREATE SYNONYM information.
  3183. remark
  3184. drop view USER_SYNONYMS
  3185. /
  3186. create view USER_SYNONYMS
  3187.     (SYNONYM_NAME, TABLE_OWNER, TABLE_NAME, DB_LINK)
  3188. as select o.name, s.owner, s.name, s.node
  3189. from sys.syn$ s, sys.obj$ o
  3190. where o.obj# = s.obj#
  3191.   and o.type = 5
  3192.   and o.owner# = uid
  3193. /
  3194. comment on table USER_SYNONYMS is
  3195. 'The user''s private synonyms'
  3196. /
  3197. comment on column USER_SYNONYMS.SYNONYM_NAME is
  3198. 'Name of the synonym'
  3199. /
  3200. comment on column USER_SYNONYMS.TABLE_OWNER is
  3201. 'Owner of the object referenced by the synonym'
  3202. /
  3203. comment on column USER_SYNONYMS.TABLE_NAME is
  3204. 'Name of the object referenced by the synonym'
  3205. /
  3206. comment on column USER_SYNONYMS.DB_LINK is
  3207. 'Database link referenced in a remote synonym'
  3208. /
  3209. drop public synonym SYN
  3210. /
  3211. create public synonym SYN for USER_SYNONYMS
  3212. /
  3213. drop public synonym USER_SYNONYMS
  3214. /
  3215. create public synonym USER_SYNONYMS for USER_SYNONYMS
  3216. /
  3217. grant select on USER_SYNONYMS to PUBLIC
  3218. /
  3219. drop view ALL_SYNONYMS
  3220. /
  3221. remark
  3222. remark  This view shows all synonyms owned by the user (private synonyms),
  3223. remark  plus all public synonyms.
  3224. remark
  3225. create view ALL_SYNONYMS
  3226.     (OWNER, SYNONYM_NAME, TABLE_OWNER, TABLE_NAME, DB_LINK)
  3227. as
  3228. select u.name, o.name, s.owner, s.name, s.node
  3229. from sys.user$ u, sys.syn$ s, sys.obj$ o
  3230. where o.obj# = s.obj#
  3231.   and o.type = 5
  3232.   and o.owner# = u.user#
  3233.   and o.owner# in (uid, 1)
  3234. /
  3235. comment on table ALL_SYNONYMS is
  3236. 'All synonyms accessible to the user'
  3237. /
  3238. comment on column ALL_SYNONYMS.OWNER is
  3239. 'Owner of the synonym'
  3240. /
  3241. comment on column ALL_SYNONYMS.SYNONYM_NAME is
  3242. 'Name of the synonym'
  3243. /
  3244. comment on column ALL_SYNONYMS.TABLE_OWNER is
  3245. 'Owner of the object referenced by the synonym'
  3246. /
  3247. comment on column ALL_SYNONYMS.TABLE_NAME is
  3248. 'Name of the object referenced by the synonym'
  3249. /
  3250. comment on column ALL_SYNONYMS.DB_LINK is
  3251. 'Name of the database link referenced in a remote synonym'
  3252. /
  3253. drop public synonym ALL_SYNONYMS
  3254. /
  3255. create public synonym ALL_SYNONYMS for ALL_SYNONYMS
  3256. /
  3257. grant select on ALL_SYNONYMS to PUBLIC
  3258. /
  3259. drop view DBA_SYNONYMS
  3260. /
  3261. create view DBA_SYNONYMS
  3262.     (OWNER, SYNONYM_NAME, TABLE_OWNER, TABLE_NAME, DB_LINK)
  3263. as select u.name, o.name, s.owner, s.name, s.node
  3264. from sys.user$ u, sys.syn$ s, sys.obj$ o
  3265. where o.obj# = s.obj#
  3266.   and o.type = 5
  3267.   and o.owner# = u.user#
  3268. /
  3269. comment on table DBA_SYNONYMS is
  3270. 'All synonyms in the database'
  3271. /
  3272. comment on column DBA_SYNONYMS.OWNER is
  3273. 'Username of the owner of the synonym'
  3274. /
  3275. comment on column DBA_SYNONYMS.SYNONYM_NAME is
  3276. 'Name of the synonym'
  3277. /
  3278. comment on column DBA_SYNONYMS.TABLE_OWNER is
  3279. 'Owner of the object referenced by the synonym'
  3280. /
  3281. comment on column DBA_SYNONYMS.TABLE_NAME is
  3282. 'Name of the object referenced by the synonym'
  3283. /
  3284. comment on column DBA_SYNONYMS.DB_LINK is
  3285. 'Name of the database link referenced in a remote synonym'
  3286. /
  3287. remark
  3288. remark  FAMILY "SYS_AUDIT_OPTS"
  3289. remark  This view is only accessible to DBAs.
  3290. remark  Single row view indicating the current system auditing options.
  3291. remark
  3292. drop view DBA_SYS_AUDIT_OPTS
  3293. /
  3294. create view DBA_SYS_AUDIT_OPTS
  3295.     (CONNECT_ACTION, DBA_ACTION, NOT_EXISTS, RESOURCE_ACTION)
  3296. as
  3297. select decode(substr(t.audit$, 1, 2), 'S-', 'A/-',
  3298.                                       '-S', '-/A',
  3299.                                       'SS', 'A/A',
  3300.                                       '--', '-/-',
  3301.                                       '?'),
  3302.        decode(substr(t.audit$, 3, 2), 'S-', 'A/-',
  3303.                                       '-S', '-/A',
  3304.                                       'SS', 'A/A',
  3305.                                       '--', '-/-',
  3306.                                       '?'),
  3307.        decode(substr(t.audit$, 5, 2), 'S-', 'A/-',
  3308.                                       '-S', '-/A',
  3309.                                       'SS', 'A/A',
  3310.                                       '--', '-/-',
  3311.                                       '?'),
  3312.        decode(substr(t.audit$, 7, 2), 'S-', 'A/-',
  3313.                                       '-S', '-/A',
  3314.                                       'SS', 'A/A',
  3315.                                       '--', '-/-',
  3316.                                       '?')
  3317. from sys.obj$ o, sys.tab$ t
  3318. where o.obj# = t.obj#
  3319.   and o.owner# = 0
  3320.   and o.name = '_system_auditing_options_'
  3321. /
  3322. comment on table DBA_SYS_AUDIT_OPTS is
  3323. 'Describes current system auditing options'
  3324. /
  3325. comment on column DBA_SYS_AUDIT_OPTS.CONNECT_ACTION is
  3326. 'Auditing CONNECT/DISCONNECT actions'
  3327. /
  3328. comment on column DBA_SYS_AUDIT_OPTS.DBA_ACTION is
  3329. 'Auditing actions requiring DBA privilege' 
  3330. /
  3331. comment on column DBA_SYS_AUDIT_OPTS.NOT_EXISTS is
  3332. 'Auditing actions on objects that do NOT EXIST'
  3333. /
  3334. comment on column DBA_SYS_AUDIT_OPTS.RESOURCE_ACTION is
  3335. 'Auditing RESOURCE actions' 
  3336. /
  3337. remark
  3338. remark  FAMILY "TABLES"
  3339. remark  CREATE TABLE parameters.
  3340. remark
  3341. drop view USER_TABLES
  3342. /
  3343. create view USER_TABLES
  3344.     (TABLE_NAME, TABLESPACE_NAME, CLUSTER_NAME,
  3345.      PCT_FREE, PCT_USED,
  3346.      INI_TRANS, MAX_TRANS,
  3347.      INITIAL_EXTENT, NEXT_EXTENT,
  3348.      MIN_EXTENTS, MAX_EXTENTS, PCT_INCREASE,
  3349.      BACKED_UP)
  3350. as
  3351. select o.name, ts.name, co.name,
  3352.        t.pctfree$, t.pctused$,
  3353.        t.initrans, t.maxtrans,
  3354.        s.iniexts * ts.blocksize, s.extsize * ts.blocksize,
  3355.        s.minexts, s.maxexts, s.extpct,
  3356.        decode(t.modified, 0, 'Y', 1, 'N', '?')
  3357. from sys.ts$ ts, sys.seg$ s, sys.obj$ co, sys.tab$ t, sys.obj$ o
  3358. where o.owner# = uid
  3359.   and o.obj# = t.obj#
  3360.   and t.clu# = co.obj# (+)
  3361.   and t.ts# = ts.ts#
  3362.   and t.file# = s.file# (+)
  3363.   and t.block# = s.block# (+)
  3364. /
  3365. comment on table USER_TABLES is
  3366. 'Description of the user''s own tables'
  3367. /
  3368. comment on column USER_TABLES.TABLE_NAME is
  3369. 'Name of the table'
  3370. /
  3371. comment on column USER_TABLES.TABLESPACE_NAME is
  3372. 'Name of the tablespace containing the table'
  3373. /
  3374. comment on column USER_TABLES.CLUSTER_NAME is
  3375. 'Name of the cluster, if any, to which the table belongs'
  3376. /
  3377. comment on column USER_TABLES.PCT_FREE is
  3378. 'Minimum percentage of free space in a block'
  3379. /
  3380. comment on column USER_TABLES.PCT_USED is
  3381. 'Minimum percentage of used space in a block'
  3382. /
  3383. comment on column USER_TABLES.INI_TRANS is
  3384. 'Initial number of transactions'
  3385. /
  3386. comment on column USER_TABLES.MAX_TRANS is
  3387. 'Maximum number of transactions'
  3388. /
  3389. comment on column USER_TABLES.INITIAL_EXTENT is
  3390. 'Size of the initial extent in bytes'
  3391. /
  3392. comment on column USER_TABLES.NEXT_EXTENT is
  3393. 'Size of secondary extents in bytes'
  3394. /
  3395. comment on column USER_TABLES.MIN_EXTENTS is
  3396. 'Minimum number of extents allowed in the segment'
  3397. /
  3398. comment on column USER_TABLES.MAX_EXTENTS is
  3399. 'Maximum number of extents allowed in the segment'
  3400. /
  3401. comment on column USER_TABLES.PCT_INCREASE is
  3402. 'Percentage increase in extent size'
  3403. /
  3404. comment on column USER_TABLES.BACKED_UP is
  3405. 'Has table been backed up since last modification?'
  3406. /
  3407. drop public synonym USER_TABLES
  3408. /
  3409. create public synonym USER_TABLES for USER_TABLES
  3410. /
  3411. drop public synonym TABS
  3412. /
  3413. create public synonym TABS for USER_TABLES
  3414. /
  3415. grant select on USER_TABLES to PUBLIC
  3416. /
  3417. drop view ALL_TABLES
  3418. /
  3419. create view ALL_TABLES
  3420.     (OWNER, TABLE_NAME, TABLESPACE_NAME, CLUSTER_NAME,
  3421.      PCT_FREE, PCT_USED,
  3422.      INI_TRANS, MAX_TRANS,
  3423.      INITIAL_EXTENT, NEXT_EXTENT,
  3424.      MIN_EXTENTS, MAX_EXTENTS, PCT_INCREASE,
  3425.      BACKED_UP)
  3426. as
  3427. select u.name, o.name, ts.name, co.name,
  3428.        t.pctfree$, t.pctused$,
  3429.        t.initrans, t.maxtrans,
  3430.        s.iniexts * ts.blocksize, s.extsize * ts.blocksize,
  3431.        s.minexts, s.maxexts, s.extpct,
  3432.        decode(t.modified, 0, 'Y', 1, 'N', '?')
  3433. from sys.user$ u, sys.ts$ ts, sys.seg$ s, sys.obj$ co, sys.tab$ t, sys.obj$ o
  3434. where o.owner# = u.user#
  3435.   and o.obj# = t.obj#
  3436.   and t.clu# = co.obj# (+)
  3437.   and t.ts# = ts.ts#
  3438.   and t.file# = s.file# (+)
  3439.   and t.block# = s.block# (+)
  3440.   and (o.owner# = uid
  3441.        or o.obj# in
  3442.             (select ta.obj#
  3443.              from sys.tabauth$ ta
  3444.              where ta.grantee# in (uid, 1))
  3445.       )
  3446. /
  3447. comment on table ALL_TABLES is
  3448. 'Description of tables accessible to the user'
  3449. /
  3450. comment on column ALL_TABLES.OWNER is
  3451. 'Owner of the table'
  3452. /
  3453. comment on column ALL_TABLES.TABLE_NAME is
  3454. 'Name of the table'
  3455. /
  3456. comment on column ALL_TABLES.TABLESPACE_NAME is
  3457. 'Name of the tablespace containing the table'
  3458. /
  3459. comment on column ALL_TABLES.CLUSTER_NAME is
  3460. 'Name of the cluster, if any, to which the table belongs'
  3461. /
  3462. comment on column ALL_TABLES.PCT_FREE is
  3463. 'Minimum percentage of free space in a block'
  3464. /
  3465. comment on column ALL_TABLES.PCT_USED is
  3466. 'Minimum percentage of used space in a block'
  3467. /
  3468. comment on column ALL_TABLES.INI_TRANS is
  3469. 'Initial number of transactions'
  3470. /
  3471. comment on column ALL_TABLES.MAX_TRANS is
  3472. 'Maximum number of transactions'
  3473. /
  3474. comment on column ALL_TABLES.INITIAL_EXTENT is
  3475. 'Size of the initial extent in bytes'
  3476. /
  3477. comment on column ALL_TABLES.NEXT_EXTENT is
  3478. 'Size of secondary extents in bytes'
  3479. /
  3480. comment on column ALL_TABLES.MIN_EXTENTS is
  3481. 'Minimum number of extents allowed in the segment'
  3482. /
  3483. comment on column ALL_TABLES.MAX_EXTENTS is
  3484. 'Maximum number of extents allowed in the segment'
  3485. /
  3486. comment on column ALL_TABLES.PCT_INCREASE is
  3487. 'Percentage increase in extent size'
  3488. /
  3489. comment on column ALL_TABLES.BACKED_UP is
  3490. 'Has table been backed up since last modification?'
  3491. /
  3492. drop public synonym ALL_TABLES
  3493. /
  3494. create public synonym ALL_TABLES for ALL_TABLES
  3495. /
  3496. grant select on ALL_TABLES to PUBLIC
  3497. /
  3498. drop view DBA_TABLES
  3499. /
  3500. create view DBA_TABLES
  3501.     (OWNER, TABLE_NAME, TABLESPACE_NAME, CLUSTER_NAME,
  3502.      PCT_FREE, PCT_USED,
  3503.      INI_TRANS, MAX_TRANS,
  3504.      INITIAL_EXTENT, NEXT_EXTENT,
  3505.      MIN_EXTENTS, MAX_EXTENTS, PCT_INCREASE,
  3506.      BACKED_UP)
  3507. as
  3508. select u.name, o.name, ts.name, co.name,
  3509.        t.pctfree$, t.pctused$,
  3510.        t.initrans, t.maxtrans,
  3511.        s.iniexts * ts.blocksize, s.extsize * ts.blocksize,
  3512.        s.minexts, s.maxexts, s.extpct,
  3513.        decode(t.modified, 0, 'Y', 1, 'N', '?')
  3514. from sys.user$ u, sys.ts$ ts, sys.seg$ s, sys.obj$ co, sys.tab$ t, sys.obj$ o
  3515. where o.owner# = u.user#
  3516.   and o.obj# = t.obj#
  3517.   and t.clu# = co.obj# (+)
  3518.   and t.ts# = ts.ts#
  3519.   and t.file# = s.file# (+)
  3520.   and t.block# = s.block# (+)
  3521. /
  3522. comment on table DBA_TABLES is
  3523. 'Description of all tables in the database'
  3524. /
  3525. comment on column DBA_TABLES.OWNER is
  3526. 'Owner of the table'
  3527. /
  3528. comment on column DBA_TABLES.TABLE_NAME is
  3529. 'Name of the table'
  3530. /
  3531. comment on column DBA_TABLES.TABLESPACE_NAME is
  3532. 'Name of the tablespace containing the table'
  3533. /
  3534. comment on column DBA_TABLES.CLUSTER_NAME is
  3535. 'Name of the cluster, if any, to which the table belongs'
  3536. /
  3537. comment on column DBA_TABLES.PCT_FREE is
  3538. 'Minimum percentage of free space in a block'
  3539. /
  3540. comment on column DBA_TABLES.PCT_USED is
  3541. 'Minimum percentage of used space in a block'
  3542. /
  3543. comment on column DBA_TABLES.INI_TRANS is
  3544. 'Initial number of transactions'
  3545. /
  3546. comment on column DBA_TABLES.MAX_TRANS is
  3547. 'Maximum number of transactions'
  3548. /
  3549. comment on column DBA_TABLES.INITIAL_EXTENT is
  3550. 'Size of the initial extent in bytes'
  3551. /
  3552. comment on column DBA_TABLES.NEXT_EXTENT is
  3553. 'Size of secondary extents in bytes'
  3554. /
  3555. comment on column DBA_TABLES.MIN_EXTENTS is
  3556. 'Minimum number of extents allowed in the segment'
  3557. /
  3558. comment on column DBA_TABLES.MAX_EXTENTS is
  3559. 'Maximum number of extents allowed in the segment'
  3560. /
  3561. comment on column DBA_TABLES.PCT_INCREASE is
  3562. 'Percentage increase in extent size'
  3563. /
  3564. comment on column DBA_TABLES.BACKED_UP is
  3565. 'Has table been backed up since last modification?'
  3566. /
  3567. remark
  3568. remark  FAMILY "TABLESPACES"
  3569. remark  CREATE TABLESPACE parameters, except datafiles.
  3570. remark  This family has no ALL member.
  3571. remark
  3572. drop view USER_TABLESPACES
  3573. /
  3574. create view USER_TABLESPACES
  3575.     (TABLESPACE_NAME, INITIAL_EXTENT, NEXT_EXTENT, MIN_EXTENTS,
  3576.      MAX_EXTENTS, PCT_INCREASE,
  3577.      STATUS)
  3578. as select ts.name, ts.blocksize * ts.dflinit,
  3579.                    ts.blocksize * ts.dflincr,
  3580.                    ts.dflminext, ts.dflmaxext, ts.dflextpct,
  3581.           decode(ts.online$, 1, 'ONLINE', 2, 'OFFLINE', 3, 'INVALID',
  3582.                  'UNDEFINED')
  3583. from sys.ts$ ts
  3584. where exists (select null from sys.tsq$ tsq
  3585.               where tsq.ts# = ts.ts#
  3586.                 and tsq.user# = uid)
  3587.      or exists (select null from sys.user$ u
  3588.                 where u.user# = uid
  3589.                   and u.resource$ = 1)
  3590. /
  3591. comment on table USER_TABLESPACES is
  3592. 'Description of accessible tablespaces'
  3593. /
  3594. comment on column USER_TABLESPACES.TABLESPACE_NAME is
  3595. 'Tablespace name'
  3596. /
  3597. comment on column USER_TABLESPACES.INITIAL_EXTENT is
  3598. 'Default initial extent size'
  3599. /
  3600. comment on column USER_TABLESPACES.NEXT_EXTENT is
  3601. 'Default incremental extent size'
  3602. /
  3603. comment on column USER_TABLESPACES.MIN_EXTENTS is
  3604. 'Default minimum number of extents'
  3605. /
  3606. comment on column USER_TABLESPACES.MAX_EXTENTS is
  3607. 'Default maximum number of extents'
  3608. /
  3609. comment on column USER_TABLESPACES.PCT_INCREASE is
  3610. 'Default percent increase for extent size'
  3611. /
  3612. comment on column USER_TABLESPACES.STATUS is
  3613. 'Tablespace status: "ONLINE" or "OFFLINE"'
  3614. /
  3615. drop public synonym USER_TABLESPACES
  3616. /
  3617. create public synonym USER_TABLESPACES for USER_TABLESPACES
  3618. /
  3619. grant select on USER_TABLESPACES to PUBLIC
  3620. /
  3621. drop view DBA_TABLESPACES
  3622. /
  3623. create view DBA_TABLESPACES
  3624.     (TABLESPACE_NAME, INITIAL_EXTENT, NEXT_EXTENT, MIN_EXTENTS,
  3625.      MAX_EXTENTS, PCT_INCREASE,
  3626.      STATUS)
  3627. as select ts.name, ts.blocksize * ts.dflinit,
  3628.           ts.blocksize * ts.dflincr, ts.dflminext,
  3629.           ts.dflmaxext, ts.dflextpct,
  3630.           decode(ts.online$, 1, 'ONLINE', 2, 'OFFLINE', 3, 'INVALID',
  3631.                  'UNDEFINED')
  3632. from sys.ts$ ts
  3633. /
  3634. comment on table DBA_TABLESPACES is
  3635. 'Description of all tablespaces'
  3636. /
  3637. comment on column DBA_TABLESPACES.TABLESPACE_NAME is
  3638. 'Tablespace name'
  3639. /
  3640. comment on column DBA_TABLESPACES.INITIAL_EXTENT is
  3641. 'Default initial extent size'
  3642. /
  3643. comment on column DBA_TABLESPACES.NEXT_EXTENT is
  3644. 'Default incremental extent size'
  3645. /
  3646. comment on column DBA_TABLESPACES.MIN_EXTENTS is
  3647. 'Default minimum number of extents'
  3648. /
  3649. comment on column DBA_TABLESPACES.MAX_EXTENTS is
  3650. 'Default maximum number of extents'
  3651. /
  3652. comment on column DBA_TABLESPACES.PCT_INCREASE is
  3653. 'Default percent increase for extent size'
  3654. /
  3655. comment on column DBA_TABLESPACES.STATUS is
  3656. 'Tablespace status: "ONLINE" or "OFFLINE"'
  3657. /
  3658. remark
  3659. remark  FAMILY "TAB_AUDIT_OPTS"
  3660. remark  Auditing options on objects.  Only "user_" and "dba_" members.
  3661. remark  A user is not allowed to see audit options for other people's objects.
  3662. remark
  3663. remark  These views indicate what kind of audit trail entries (none,
  3664. remark  session-level, or access-level) are generated by the success or failure
  3665. remark  of each possible operation on a table or view (e.g., select, alter).
  3666. remark
  3667. remark  The values in the columns ALT through UPD are three character
  3668. remark  strings like 'A/S', 'A/-'.  The letters 'A', 'S', and '-' correspond to
  3669. remark  different levels of detail called Access, Session and None.  The
  3670. remark  character before the slash determines the auditing level if the action
  3671. remark  is successful.  The character after the slash determines auditing level
  3672. remark  if the operation fails for any reason.
  3673. remark
  3674. remark  This compressed three character format has been chosen to make all
  3675. remark  the information fit on a single line.  The column names are
  3676. remark  three chars long for the same reason.  The alternative is to use long
  3677. remark  column names to improve readability, but 
  3678. remark  serious users can get further documentation using the describe
  3679. remark  column statement.  I do not expect novice users to be looking at audit
  3680. remark  information.  Another alternative is to have separate columns for the
  3681. remark  success and failure settings.  This would eliminate the need to
  3682. remark  use the substr function in views built on top of these views,
  3683. remark  but the advantage to users of making information fit on one line
  3684. remark  overrides the hassle to view-implementors of using the substr function.
  3685. remark
  3686. drop view USER_TAB_AUDIT_OPTS
  3687. /
  3688. create view USER_TAB_AUDIT_OPTS
  3689.     (TABLE_NAME, 
  3690.      TABLE_TYPE,
  3691.      ALT,
  3692.      AUD,
  3693.      COM,
  3694.      DEL,
  3695.      GRA,
  3696.      IND,
  3697.      INS,
  3698.      LOC,
  3699.      REN,
  3700.      SEL,
  3701.      UPD)
  3702. as
  3703. select o.name, 'TABLE',
  3704.        substr(t.audit$, 1, 1) || '/' || substr(t.audit$, 2, 1),
  3705.        substr(t.audit$, 3, 1) || '/' || substr(t.audit$, 4, 1),
  3706.        substr(t.audit$, 5, 1) || '/' || substr(t.audit$, 6, 1),
  3707.        substr(t.audit$, 7, 1) || '/' || substr(t.audit$, 8, 1),
  3708.        substr(t.audit$, 9, 1) || '/' || substr(t.audit$, 10, 1),
  3709.        substr(t.audit$, 11, 1) || '/' || substr(t.audit$, 12, 1),
  3710.        substr(t.audit$, 13, 1) || '/' || substr(t.audit$, 14, 1),
  3711.        substr(t.audit$, 15, 1) || '/' || substr(t.audit$, 16, 1),
  3712.        substr(t.audit$, 17, 1) || '/' || substr(t.audit$, 18, 1),
  3713.        substr(t.audit$, 19, 1) || '/' || substr(t.audit$, 20, 1),
  3714.        substr(t.audit$, 21, 1) || '/' || substr(t.audit$, 22, 1)
  3715. from sys.obj$ o, sys.tab$ t
  3716. where o.type = 2
  3717.   and not (o.owner# = 0
  3718.   and      o.name in ('_default_auditing_options_',
  3719.                       '_system_auditing_options_'))
  3720.   and o.owner# = uid
  3721.   and o.obj# = t.obj#
  3722. union
  3723. select o.name, 'VIEW',
  3724.        substr(v.audit$, 1, 1) || '/' || substr(v.audit$, 2, 1),
  3725.        substr(v.audit$, 3, 1) || '/' || substr(v.audit$, 4, 1),
  3726.        substr(v.audit$, 5, 1) || '/' || substr(v.audit$, 6, 1),
  3727.        substr(v.audit$, 7, 1) || '/' || substr(v.audit$, 8, 1),
  3728.        substr(v.audit$, 9, 1) || '/' || substr(v.audit$, 10, 1),
  3729.        substr(v.audit$, 11, 1) || '/' || substr(v.audit$, 12, 1),
  3730.        substr(v.audit$, 13, 1) || '/' || substr(v.audit$, 14, 1),
  3731.        substr(v.audit$, 15, 1) || '/' || substr(v.audit$, 16, 1),
  3732.        substr(v.audit$, 17, 1) || '/' || substr(v.audit$, 18, 1),
  3733.        substr(v.audit$, 19, 1) || '/' || substr(v.audit$, 20, 1),
  3734.        substr(v.audit$, 21, 1) || '/' || substr(v.audit$, 22, 1)
  3735. from sys.obj$ o, sys.view$ v
  3736. where o.type = 4
  3737.   and o.owner# = uid
  3738.   and o.obj# = v.obj#
  3739. /
  3740. comment on table USER_TAB_AUDIT_OPTS is
  3741. 'Auditing options for user''s own tables and views'
  3742. /
  3743. comment on column USER_TAB_AUDIT_OPTS.TABLE_NAME is
  3744. 'Name of the object'
  3745. /
  3746. comment on column USER_TAB_AUDIT_OPTS.TABLE_TYPE is
  3747. 'Type of the object:  "TABLE" or "VIEW"'
  3748. /
  3749. comment on column USER_TAB_AUDIT_OPTS.ALT is
  3750. 'Auditing ALTER WHENEVER SUCCESSFUL / UNSUCCESSFUL'
  3751. /
  3752. comment on column USER_TAB_AUDIT_OPTS.AUD is
  3753. 'Auditing AUDIT WHENEVER SUCCESSFUL / UNSUCCESSFUL'
  3754. /
  3755. comment on column USER_TAB_AUDIT_OPTS.COM is
  3756. 'Auditing COMMENT WHENEVER SUCCESSFUL / UNSUCCESSFUL'
  3757. /
  3758. comment on column USER_TAB_AUDIT_OPTS.DEL is
  3759. 'Auditing DELETE WHENEVER SUCCESSFUL / UNSUCCESSFUL'
  3760. /
  3761. comment on column USER_TAB_AUDIT_OPTS.GRA is
  3762. 'Auditing GRANT WHENEVER SUCCESSFUL / UNSUCCESSFUL'
  3763. /
  3764. comment on column USER_TAB_AUDIT_OPTS.IND is
  3765. 'Auditing INDEX WHENEVER SUCCESSFUL / UNSUCCESSFUL'
  3766. /
  3767. comment on column USER_TAB_AUDIT_OPTS.INS is
  3768. 'Auditing INSERT WHENEVER SUCCESSFUL / UNSUCCESSFUL'
  3769. /
  3770. comment on column USER_TAB_AUDIT_OPTS.LOC is
  3771. 'Auditing LOCK WHENEVER SUCCESSFUL / UNSUCCESSFUL'
  3772. /
  3773. comment on column USER_TAB_AUDIT_OPTS.REN is
  3774. 'Auditing RENAME WHENEVER SUCCESSFUL / UNSUCCESSFUL'
  3775. /
  3776. comment on column USER_TAB_AUDIT_OPTS.SEL is
  3777. 'Auditing SELECT WHENEVER SUCCESSFUL / UNSUCCESSFUL'
  3778. /
  3779. comment on column USER_TAB_AUDIT_OPTS.UPD is
  3780. 'Auditing UPDATE WHENEVER SUCCESSFUL / UNSUCCESSFUL'
  3781. /
  3782. drop public synonym USER_TAB_AUDIT_OPTS
  3783. /
  3784. create public synonym USER_TAB_AUDIT_OPTS for USER_TAB_AUDIT_OPTS
  3785. /
  3786. grant select on USER_TAB_AUDIT_OPTS to PUBLIC
  3787. /
  3788. drop view DBA_TAB_AUDIT_OPTS
  3789. /
  3790. create view DBA_TAB_AUDIT_OPTS
  3791.     (OWNER,
  3792.      TABLE_NAME, 
  3793.      TABLE_TYPE,
  3794.      ALT,
  3795.      AUD,
  3796.      COM,
  3797.      DEL,
  3798.      GRA,
  3799.      IND,
  3800.      INS,
  3801.      LOC,
  3802.      REN,
  3803.      SEL,
  3804.      UPD)
  3805. as
  3806. select u.name, o.name, 'TABLE',
  3807.        substr(t.audit$, 1, 1) || '/' || substr(t.audit$, 2, 1),
  3808.        substr(t.audit$, 3, 1) || '/' || substr(t.audit$, 4, 1),
  3809.        substr(t.audit$, 5, 1) || '/' || substr(t.audit$, 6, 1),
  3810.        substr(t.audit$, 7, 1) || '/' || substr(t.audit$, 8, 1),
  3811.        substr(t.audit$, 9, 1) || '/' || substr(t.audit$, 10, 1),
  3812.        substr(t.audit$, 11, 1) || '/' || substr(t.audit$, 12, 1),
  3813.        substr(t.audit$, 13, 1) || '/' || substr(t.audit$, 14, 1),
  3814.        substr(t.audit$, 15, 1) || '/' || substr(t.audit$, 16, 1),
  3815.        substr(t.audit$, 17, 1) || '/' || substr(t.audit$, 18, 1),
  3816.        substr(t.audit$, 19, 1) || '/' || substr(t.audit$, 20, 1),
  3817.        substr(t.audit$, 21, 1) || '/' || substr(t.audit$, 22, 1)
  3818. from sys.obj$ o, sys.user$ u, sys.tab$ t
  3819. where o.type = 2
  3820.   and not (o.owner# = 0
  3821.   and      o.name in ('_default_auditing_options_',
  3822.                       '_system_auditing_options_'))
  3823.   and o.owner# = u.user#
  3824.   and o.obj# = t.obj#
  3825. union
  3826. select u.name, o.name, 'VIEW',
  3827.        substr(v.audit$, 1, 1) || '/' || substr(v.audit$, 2, 1),
  3828.        substr(v.audit$, 3, 1) || '/' || substr(v.audit$, 4, 1),
  3829.        substr(v.audit$, 5, 1) || '/' || substr(v.audit$, 6, 1),
  3830.        substr(v.audit$, 7, 1) || '/' || substr(v.audit$, 8, 1),
  3831.        substr(v.audit$, 9, 1) || '/' || substr(v.audit$, 10, 1),
  3832.        substr(v.audit$, 11, 1) || '/' || substr(v.audit$, 12, 1),
  3833.        substr(v.audit$, 13, 1) || '/' || substr(v.audit$, 14, 1),
  3834.        substr(v.audit$, 15, 1) || '/' || substr(v.audit$, 16, 1),
  3835.        substr(v.audit$, 17, 1) || '/' || substr(v.audit$, 18, 1),
  3836.        substr(v.audit$, 19, 1) || '/' || substr(v.audit$, 20, 1),
  3837.        substr(v.audit$, 21, 1) || '/' || substr(v.audit$, 22, 1)
  3838. from sys.obj$ o, sys.user$ u, sys.view$ v
  3839. where o.type = 4
  3840.   and o.owner# = u.user#
  3841.   and o.obj# = v.obj#
  3842. /
  3843. comment on table DBA_TAB_AUDIT_OPTS is
  3844. 'Auditing options for all tables and views'
  3845. /
  3846. comment on column DBA_TAB_AUDIT_OPTS.OWNER is
  3847. 'Owner of the object'
  3848. /
  3849. comment on column DBA_TAB_AUDIT_OPTS.TABLE_NAME is
  3850. 'Name of the object'
  3851. /
  3852. comment on column DBA_TAB_AUDIT_OPTS.TABLE_TYPE is
  3853. 'Type of the object'
  3854. /
  3855. comment on column DBA_TAB_AUDIT_OPTS.ALT is
  3856. 'Auditing ALTER WHENEVER SUCCESSFUL / UNSUCCESSFUL'
  3857. /
  3858. comment on column DBA_TAB_AUDIT_OPTS.AUD is
  3859. 'Auditing AUDIT WHENEVER SUCCESSFUL / UNSUCCESSFUL'
  3860. /
  3861. comment on column DBA_TAB_AUDIT_OPTS.COM is
  3862. 'Auditing COMMENT WHENEVER SUCCESSFUL / UNSUCCESSFUL'
  3863. /
  3864. comment on column DBA_TAB_AUDIT_OPTS.DEL is
  3865. 'Auditing DELETE WHENEVER SUCCESSFUL / UNSUCCESSFUL'
  3866. /
  3867. comment on column DBA_TAB_AUDIT_OPTS.GRA is
  3868. 'Auditing GRANT WHENEVER SUCCESSFUL / UNSUCCESSFUL'
  3869. /
  3870. comment on column DBA_TAB_AUDIT_OPTS.IND is
  3871. 'Auditing INDEX WHENEVER SUCCESSFUL / UNSUCCESSFUL'
  3872. /
  3873. comment on column DBA_TAB_AUDIT_OPTS.INS is
  3874. 'Auditing INSERT WHENEVER SUCCESSFUL / UNSUCCESSFUL'
  3875. /
  3876. comment on column DBA_TAB_AUDIT_OPTS.LOC is
  3877. 'Auditing LOCK WHENEVER SUCCESSFUL / UNSUCCESSFUL'
  3878. /
  3879. comment on column DBA_TAB_AUDIT_OPTS.REN is
  3880. 'Auditing RENAME WHENEVER SUCCESSFUL / UNSUCCESSFUL'
  3881. /
  3882. comment on column DBA_TAB_AUDIT_OPTS.SEL is
  3883. 'Auditing SELECT WHENEVER SUCCESSFUL / UNSUCCESSFUL'
  3884. /
  3885. comment on column DBA_TAB_AUDIT_OPTS.UPD is
  3886. 'Auditing UPDATE WHENEVER SUCCESSFUL / UNSUCCESSFUL'
  3887. /
  3888. remark
  3889. remark  FAMILY "TAB_COLUMNS"
  3890. remark  The columns that make up objects:  Tables, Views, Clusters
  3891. remark  Includes information specified or implied by user in 
  3892. remark  CREATE/ALTER TABLE/VIEW/CLUSTER.
  3893. remark
  3894. drop view USER_TAB_COLUMNS
  3895. /
  3896. create view USER_TAB_COLUMNS
  3897.     (TABLE_NAME,
  3898.      COLUMN_NAME, DATA_TYPE,
  3899.      DATA_LENGTH, DATA_PRECISION, DATA_SCALE, NULLABLE, COLUMN_ID,
  3900.      DEFAULT_LENGTH, DATA_DEFAULT)
  3901. as
  3902. select o.name,
  3903.        c.name,
  3904.        decode(c.type#, 1, 'CHAR',
  3905.                        2, decode(c.scale, null,
  3906.                                  decode(c.precision, null, 'NUMBER', 'FLOAT'),
  3907.                                  'NUMBER'),
  3908.                        8, 'LONG', 9, 'VARCHAR',
  3909.                        12, 'DATE', 23, 'RAW', 24, 'LONG RAW', 
  3910.                        69, 'ROWID', 'UNDEFINED'),
  3911.        c.length, c.precision, c.scale,
  3912.        decode(c.null$, 0, 'Y', 'N'), c.col#, c.deflength, c.default$
  3913. from sys.col$ c, sys.obj$ o
  3914. where o.obj# = c.obj#
  3915.   and o.owner# = uid
  3916.   and o.type in (2, 3, 4)
  3917. /
  3918. comment on table USER_TAB_COLUMNS is
  3919. 'Columns of user''s tables, views and clusters'
  3920. /
  3921. comment on column USER_TAB_COLUMNS.TABLE_NAME is
  3922. 'Table, view or cluster name'
  3923. /
  3924. comment on column USER_TAB_COLUMNS.COLUMN_NAME is
  3925. 'Column name'
  3926. /
  3927. comment on column USER_TAB_COLUMNS.DATA_LENGTH is
  3928. 'Length of the column in bytes'
  3929. /
  3930. comment on column USER_TAB_COLUMNS.DATA_TYPE is
  3931. 'Datatype of the column'
  3932. /
  3933. comment on column USER_TAB_COLUMNS.DATA_PRECISION is
  3934. 'Length: decimal digits (NUMBER), binary digits (FLOAT), or characters (CHAR, RAW)'
  3935. /
  3936. comment on column USER_TAB_COLUMNS.DATA_SCALE is
  3937. 'Digits to right of decimal point in a number'
  3938. /
  3939. comment on column USER_TAB_COLUMNS.NULLABLE is
  3940. 'Does column allow NULL values?'
  3941. /
  3942. comment on column USER_TAB_COLUMNS.COLUMN_ID is
  3943. 'Sequence number of the column as created'
  3944. /
  3945. comment on column USER_TAB_COLUMNS.DEFAULT_LENGTH is
  3946. 'Length of default value for the column'
  3947. /
  3948. comment on column USER_TAB_COLUMNS.DATA_DEFAULT is
  3949. 'Default value for the column'
  3950. /
  3951. drop public synonym USER_TAB_COLUMNS
  3952. /
  3953. create public synonym USER_TAB_COLUMNS for USER_TAB_COLUMNS
  3954. /
  3955. drop public synonym COLS
  3956. /
  3957. create public synonym COLS for USER_TAB_COLUMNS
  3958. /
  3959. grant select on USER_TAB_COLUMNS to PUBLIC
  3960. /
  3961. drop view ACCESSIBLE_COLUMNS
  3962. /
  3963. create view ACCESSIBLE_COLUMNS
  3964.     (OWNER, TABLE_NAME,
  3965.      COLUMN_NAME, 
  3966.      DATA_TYPE,
  3967.      DATA_LENGTH, DATA_PRECISION, DATA_SCALE,
  3968.      NULLABLE, COLUMN_ID, DEFAULT_LENGTH, DATA_DEFAULT)
  3969. as
  3970. select u.name, o.name,
  3971.        c.name,
  3972.        decode(c.type#, 1, 'CHAR',
  3973.                        2, decode(c.scale, null,
  3974.                                  decode(c.precision, null, 'NUMBER', 'FLOAT'),
  3975.                                  'NUMBER'),
  3976.                        8, 'LONG', 9, 'VARCHAR',
  3977.                        12, 'DATE', 23, 'RAW', 24, 'LONG RAW',
  3978.                        69, 'ROWID',  'UNDEFINED'),
  3979.        c.length, c.precision, c.scale,
  3980.        decode(c.null$, 0, 'Y', 'N'), c.col#, c.deflength, c.default$
  3981. from sys.col$ c, sys.obj$ o, sys.user$ u
  3982. where o.obj# = c.obj#
  3983.   and o.owner# = u.user#
  3984.   and o.type in (2, 3, 4)
  3985.   and (o.owner# = uid
  3986.         or
  3987.         o.obj# in ( select obj#
  3988.                     from sys.tabauth$
  3989.                     where grantee# in ( uid, 1 )
  3990.                   )
  3991.        )
  3992. /
  3993. comment on table ACCESSIBLE_COLUMNS is
  3994. 'Columns of all tables, views and clusters'
  3995. /
  3996. comment on column ACCESSIBLE_COLUMNS.OWNER is
  3997. 'Owner of the table, view or cluster'
  3998. /
  3999. comment on column ACCESSIBLE_COLUMNS.TABLE_NAME is
  4000. 'Table, view or cluster name'
  4001. /
  4002. comment on column ACCESSIBLE_COLUMNS.COLUMN_NAME is
  4003. 'Column name'
  4004. /
  4005. comment on column ACCESSIBLE_COLUMNS.DATA_LENGTH is
  4006. 'Length of the column in bytes'
  4007. /
  4008. comment on column ACCESSIBLE_COLUMNS.DATA_TYPE is
  4009. 'Datatype of the column'
  4010. /
  4011. comment on column ACCESSIBLE_COLUMNS.DATA_PRECISION is
  4012. 'Length: decimal digits (NUMBER), binary digits (FLOAT), or characters (CHAR, RAW)'
  4013. /
  4014. comment on column ACCESSIBLE_COLUMNS.DATA_SCALE is
  4015. 'Digits to right of decimal point in a number'
  4016. /
  4017. comment on column ACCESSIBLE_COLUMNS.NULLABLE is
  4018. 'Does column allow NULL values?'
  4019. /
  4020. comment on column ACCESSIBLE_COLUMNS.COLUMN_ID is
  4021. 'Sequence number of the column as created'
  4022. /
  4023. comment on column ACCESSIBLE_COLUMNS.DEFAULT_LENGTH is
  4024. 'Length of default value for the column'
  4025. /
  4026. comment on column ACCESSIBLE_COLUMNS.DATA_DEFAULT is
  4027. 'Default value for the column'
  4028. /
  4029. drop public synonym ACCESSIBLE_COLUMNS
  4030. /
  4031. create public synonym ACCESSIBLE_COLUMNS for ACCESSIBLE_COLUMNS
  4032. /
  4033. drop public synonym ALL_TAB_COLUMNS
  4034. /
  4035. create public synonym ALL_TAB_COLUMNS for ACCESSIBLE_COLUMNS
  4036. /
  4037. grant select on ACCESSIBLE_COLUMNS to PUBLIC
  4038. /
  4039. drop view DBA_TAB_COLUMNS
  4040. /
  4041. create view DBA_TAB_COLUMNS
  4042.     (OWNER, TABLE_NAME,
  4043.      COLUMN_NAME,
  4044.      DATA_TYPE,
  4045.      DATA_LENGTH, DATA_PRECISION, DATA_SCALE,
  4046.      NULLABLE, COLUMN_ID, DEFAULT_LENGTH, DATA_DEFAULT)
  4047. as
  4048. select u.name, o.name,
  4049.        c.name,
  4050.        decode(c.type#, 1, 'CHAR',
  4051.                        2, decode(c.scale, null,
  4052.                                  decode(c.precision, null, 'NUMBER', 'FLOAT'),
  4053.                                  'NUMBER'),
  4054.                        8, 'LONG', 9, 'VARCHAR',
  4055.                        12, 'DATE', 23, 'RAW', 24, 'LONG RAW',
  4056.                        69, 'ROWID',  'UNDEFINED'),
  4057.        c.length, c.precision, c.scale,
  4058.        decode(c.null$, 0, 'Y', 'N'), c.col#, c.deflength, c.default$
  4059. from sys.col$ c, sys.obj$ o, sys.user$ u
  4060. where o.obj# = c.obj#
  4061.   and o.owner# = u.user#
  4062.   and o.type in (2, 3, 4)
  4063. /
  4064. comment on table DBA_TAB_COLUMNS is
  4065. 'Columns of all tables, views and clusters'
  4066. /
  4067. comment on column DBA_TAB_COLUMNS.OWNER is
  4068. 'Owner of the table, view or cluster'
  4069. /
  4070. comment on column DBA_TAB_COLUMNS.TABLE_NAME is
  4071. 'Table, view or cluster name'
  4072. /
  4073. comment on column DBA_TAB_COLUMNS.COLUMN_NAME is
  4074. 'Column name'
  4075. /
  4076. comment on column DBA_TAB_COLUMNS.DATA_LENGTH is
  4077. 'Length of the column in bytes'
  4078. /
  4079. comment on column DBA_TAB_COLUMNS.DATA_TYPE is
  4080. 'Datatype of the column'
  4081. /
  4082. comment on column DBA_TAB_COLUMNS.DATA_PRECISION is
  4083. 'Length: decimal digits (NUMBER), binary digits (FLOAT), or characters (CHAR, RAW)'
  4084. /
  4085. comment on column DBA_TAB_COLUMNS.DATA_SCALE is
  4086. 'Digits to right of decimal point in a number'
  4087. /
  4088. comment on column DBA_TAB_COLUMNS.NULLABLE is
  4089. 'Does column allow NULL values?'
  4090. /
  4091. comment on column DBA_TAB_COLUMNS.COLUMN_ID is
  4092. 'Sequence number of the column as created'
  4093. /
  4094. comment on column DBA_TAB_COLUMNS.DEFAULT_LENGTH is
  4095. 'Length of default value for the column'
  4096. /
  4097. comment on column DBA_TAB_COLUMNS.DATA_DEFAULT is
  4098. 'Default value for the column'
  4099. /
  4100. remark
  4101. remark  FAMILY "TAB_COMMENTS"
  4102. remark  Comments on objects.
  4103. remark
  4104. drop view USER_TAB_COMMENTS
  4105. /
  4106. create view USER_TAB_COMMENTS
  4107.     (TABLE_NAME,
  4108.      TABLE_TYPE,
  4109.      COMMENTS)
  4110. as
  4111. select o.name,
  4112.        decode(o.type, 0, 'NEXT OBJECT', 1, 'INDEX', 2, 'TABLE', 3, 'CLUSTER',
  4113.                       4, 'VIEW', 5, 'SYNONYM', 'UNDEFINED'),
  4114.        c.comment$
  4115. from sys.obj$ o, sys.com$ c
  4116. where o.owner# = uid
  4117.   and o.type in (2, 4)
  4118.   and o.obj# = c.obj#(+)
  4119.   and c.col#(+) is null
  4120. /
  4121. comment on table USER_TAB_COMMENTS is
  4122. 'Comments on the tables and views owned by the user'
  4123. /
  4124. comment on column USER_TAB_COMMENTS.TABLE_NAME is
  4125. 'Name of the object'
  4126. /
  4127. comment on column USER_TAB_COMMENTS.TABLE_TYPE is
  4128. 'Type of the object:  "TABLE" or "VIEW"'
  4129. /
  4130. comment on column USER_TAB_COMMENTS.COMMENTS is
  4131. 'Comment on the object'
  4132. /
  4133. drop public synonym USER_TAB_COMMENTS
  4134. /
  4135. create public synonym USER_TAB_COMMENTS for USER_TAB_COMMENTS
  4136. /
  4137. grant select on USER_TAB_COMMENTS to PUBLIC
  4138. /
  4139. drop view ALL_TAB_COMMENTS
  4140. /
  4141. create view ALL_TAB_COMMENTS
  4142.     (OWNER, TABLE_NAME,
  4143.      TABLE_TYPE,
  4144.      COMMENTS)
  4145. as
  4146. select u.name, o.name,
  4147.        decode(o.type, 0, 'NEXT OBJECT', 1, 'INDEX', 2, 'TABLE', 3, 'CLUSTER',
  4148.                       4, 'VIEW', 5, 'SYNONYM', 'UNDEFINED'),
  4149.        c.comment$
  4150. from sys.obj$ o, sys.user$ u, sys.com$ c
  4151. where o.owner# = u.user#
  4152.   and o.obj# = c.obj#(+)
  4153.   and c.col#(+) is null
  4154.   and o.type in (2, 4)
  4155.   and (o.owner# = uid
  4156.         or
  4157.         o.obj# in ( select obj#
  4158.                     from sys.tabauth$
  4159.                     where grantee# in ( uid, 1 )
  4160.                   )
  4161.        )
  4162. /
  4163. comment on table ALL_TAB_COMMENTS is
  4164. 'Comments on tables and views accessible to the user'
  4165. /
  4166. comment on column ALL_TAB_COMMENTS.OWNER is
  4167. 'Owner of the object'
  4168. /
  4169. comment on column ALL_TAB_COMMENTS.TABLE_NAME is
  4170. 'Name of the object'
  4171. /
  4172. comment on column ALL_TAB_COMMENTS.TABLE_TYPE is
  4173. 'Type of the object'
  4174. /
  4175. comment on column ALL_TAB_COMMENTS.COMMENTS is
  4176. 'Comment on the object'
  4177. /
  4178. drop public synonym ALL_TAB_COMMENTS
  4179. /
  4180. create public synonym ALL_TAB_COMMENTS for ALL_TAB_COMMENTS
  4181. /
  4182. grant select on ALL_TAB_COMMENTS to PUBLIC
  4183. /
  4184. drop view DBA_TAB_COMMENTS
  4185. /
  4186. create view DBA_TAB_COMMENTS
  4187.     (OWNER, TABLE_NAME,
  4188.      TABLE_TYPE,
  4189.      COMMENTS)
  4190. as
  4191. select u.name, o.name,
  4192.        decode(o.type, 0, 'NEXT OBJECT', 1, 'INDEX', 2, 'TABLE', 3, 'CLUSTER',
  4193.                       4, 'VIEW', 5, 'SYNONYM', 'UNDEFINED'),
  4194.        c.comment$
  4195. from sys.obj$ o, sys.user$ u, sys.com$ c
  4196. where o.owner# = u.user#
  4197.   and o.type in (2, 4)
  4198.   and o.obj# = c.obj#(+)
  4199.   and c.col#(+) is null
  4200. /
  4201. comment on table DBA_TAB_COMMENTS is
  4202. 'Comments on all tables and views in the database'
  4203. /
  4204. comment on column DBA_TAB_COMMENTS.OWNER is
  4205. 'Owner of the object'
  4206. /
  4207. comment on column DBA_TAB_COMMENTS.TABLE_NAME is
  4208. 'Name of the object'
  4209. /
  4210. comment on column DBA_TAB_COMMENTS.TABLE_TYPE is
  4211. 'Type of the object'
  4212. /
  4213. comment on column DBA_TAB_COMMENTS.COMMENTS is
  4214. 'Comment on the object'
  4215. /
  4216. remark
  4217. remark  FAMILY "TAB_GRANTS"
  4218. remark  Grants on objects.
  4219. remark
  4220. drop view USER_TAB_GRANTS
  4221. /
  4222. create view USER_TAB_GRANTS
  4223.       (GRANTEE, OWNER, TABLE_NAME, GRANTOR,
  4224.        SELECT_PRIV, INSERT_PRIV, DELETE_PRIV, 
  4225.        UPDATE_PRIV, REFERENCES_PRIV, ALTER_PRIV, INDEX_PRIV,
  4226.        CREATED)
  4227. as
  4228. select ue.name, u.name, o.name, ur.name,
  4229.        decode(ta.select$, 0, 'N', 2, 'Y', 3, 'G', '?'),
  4230.        decode(ta.insert$, 0, 'N', 1, 'S', 2, 'A', 3, 'G', '?'),
  4231.        decode(ta.delete$, 0, 'N', 2, 'Y', 3, 'G', '?'),
  4232.        decode(ta.update$, 0, 'N', 1, 'S', 2, 'A', 3, 'G', '?'),
  4233.        decode(ta.references$, 0, 'N', 1, 'S', 2, 'A', 3, 'G', '?'),
  4234.        decode(ta.alter$, 0, 'N', 2, 'Y', 3, 'G', '?'),
  4235.        decode(ta.index$, 0, 'N', 2, 'Y', 3, 'G', '?'),
  4236.        ta.time
  4237. from sys.tabauth$ ta, sys.obj$ o, sys.user$ u, sys.user$ ur, sys.user$ ue
  4238. where ta.obj# = o.obj#
  4239.   and ta.grantor# = ur.user#
  4240.   and ta.grantee# = ue.user#
  4241.   and u.user# = o.owner#
  4242.   and uid in (ta.grantor#, ta.grantee#, o.owner#)
  4243. /
  4244. comment on table USER_TAB_GRANTS is
  4245. 'Grants on objects for which the user is the owner, grantor or grantee'
  4246. /
  4247. comment on column USER_TAB_GRANTS.GRANTEE is
  4248. 'Name of the user to whom access was granted'
  4249. /
  4250. comment on column USER_TAB_GRANTS.OWNER is
  4251. 'Owner of the object'
  4252. /
  4253. comment on column USER_TAB_GRANTS.TABLE_NAME is
  4254. 'Name of the object'
  4255. /
  4256. comment on column USER_TAB_GRANTS.GRANTOR is
  4257. 'Name of the user who performed the grant'
  4258. /
  4259. comment on column USER_TAB_GRANTS.SELECT_PRIV is
  4260. 'Permission to SELECT from the object?'
  4261. /
  4262. comment on column USER_TAB_GRANTS.INSERT_PRIV is
  4263. 'Permission to INSERT into the object?'
  4264. /
  4265. comment on column USER_TAB_GRANTS.DELETE_PRIV is
  4266. 'Permission to DELETE from the object?'
  4267. /
  4268. comment on column USER_TAB_GRANTS.UPDATE_PRIV is
  4269. 'Permission to UPDATE the object?'
  4270. /
  4271. comment on column USER_TAB_GRANTS.REFERENCES_PRIV is
  4272. 'Permission to make REFERENCES to the object?'
  4273. /
  4274. comment on column USER_TAB_GRANTS.ALTER_PRIV is
  4275. 'Permission to ALTER the object?'
  4276. /
  4277. comment on column USER_TAB_GRANTS.INDEX_PRIV is
  4278. 'Permission to create/drop an INDEX on the object?'
  4279. /
  4280. comment on column USER_TAB_GRANTS.CREATED is
  4281. 'Timestamp for the grant'
  4282. /
  4283. drop public synonym USER_TAB_GRANTS
  4284. /
  4285. create public synonym USER_TAB_GRANTS for USER_TAB_GRANTS
  4286. /
  4287. grant select on USER_TAB_GRANTS to PUBLIC
  4288. /
  4289. drop view TABLE_PRIVILEGES
  4290. /
  4291. create view TABLE_PRIVILEGES
  4292.       (GRANTEE, OWNER, TABLE_NAME, GRANTOR,
  4293.        SELECT_PRIV, INSERT_PRIV, DELETE_PRIV, 
  4294.        UPDATE_PRIV, REFERENCES_PRIV, ALTER_PRIV, INDEX_PRIV,
  4295.        CREATED)
  4296. as
  4297. select ue.name, u.name, o.name, ur.name,
  4298.        decode(ta.select$, 0, 'N', 2, 'Y', 3, 'G', '?'),
  4299.        decode(ta.insert$, 0, 'N', 1, 'S', 2, 'A', 3, 'G', '?'),
  4300.        decode(ta.delete$, 0, 'N', 2, 'Y', 3, 'G', '?'),
  4301.        decode(ta.update$, 0, 'N', 1, 'S', 2, 'A', 3, 'G', '?'),
  4302.        decode(ta.references$, 0, 'N', 1, 'S', 2, 'A', 3, 'G', '?'),
  4303.        decode(ta.alter$, 0, 'N', 2, 'Y', 3, 'G', '?'),
  4304.        decode(ta.index$, 0, 'N', 2, 'Y', 3, 'G', '?'),
  4305.        ta.time
  4306. from sys.tabauth$ ta, sys.obj$ o, sys.user$ u, sys.user$ ur, sys.user$ ue
  4307. where ta.obj# = o.obj#
  4308.   and ta.grantor# = ur.user#
  4309.   and ta.grantee# = ue.user#
  4310.   and u.user# = o.owner#
  4311.   and (uid in (ta.grantor#, ta.grantee#, o.owner#)
  4312.    or  ta.grantee# = 1)
  4313. /
  4314. comment on table TABLE_PRIVILEGES is
  4315. 'Grants on objects for which the user is the grantor, grantee, or owner, or PUBLIC is the grantee'
  4316. /
  4317. comment on column TABLE_PRIVILEGES.GRANTEE is
  4318. 'Name of the user to whom access was granted'
  4319. /
  4320. comment on column TABLE_PRIVILEGES.OWNER is
  4321. 'Owner of the object'
  4322. /
  4323. comment on column TABLE_PRIVILEGES.TABLE_NAME is
  4324. 'Name of the object'
  4325. /
  4326. comment on column TABLE_PRIVILEGES.GRANTOR is
  4327. 'Name of the user who performed the grant'
  4328. /
  4329. comment on column TABLE_PRIVILEGES.SELECT_PRIV is
  4330. 'Permission to SELECT from the object?'
  4331. /
  4332. comment on column TABLE_PRIVILEGES.INSERT_PRIV is
  4333. 'Permission to INSERT into the object?'
  4334. /
  4335. comment on column TABLE_PRIVILEGES.DELETE_PRIV is
  4336. 'Permission to DELETE from the object?'
  4337. /
  4338. comment on column TABLE_PRIVILEGES.UPDATE_PRIV is
  4339. 'Permission to UPDATE the object?'
  4340. /
  4341. comment on column TABLE_PRIVILEGES.REFERENCES_PRIV is
  4342. 'Permission to make REFERENCES to the object?'
  4343. /
  4344. comment on column TABLE_PRIVILEGES.ALTER_PRIV is
  4345. 'Permission to ALTER the object?'
  4346. /
  4347. comment on column TABLE_PRIVILEGES.INDEX_PRIV is
  4348. 'Permission to create/drop an INDEX on the object?'
  4349. /
  4350. comment on column TABLE_PRIVILEGES.CREATED is
  4351. 'Timestamp for the grant'
  4352. /
  4353. drop public synonym TABLE_PRIVILEGES
  4354. /
  4355. create public synonym TABLE_PRIVILEGES for TABLE_PRIVILEGES
  4356. /
  4357. drop public synonym ALL_TAB_GRANTS
  4358. /
  4359. create public synonym ALL_TAB_GRANTS for TABLE_PRIVILEGES
  4360. /
  4361. grant select on TABLE_PRIVILEGES to PUBLIC
  4362. /
  4363. drop view DBA_TAB_GRANTS
  4364. /
  4365. create view DBA_TAB_GRANTS
  4366.       (GRANTEE, OWNER, TABLE_NAME, GRANTOR,
  4367.        SELECT_PRIV, INSERT_PRIV, DELETE_PRIV, 
  4368.        UPDATE_PRIV, REFERENCES_PRIV, ALTER_PRIV, INDEX_PRIV,
  4369.        CREATED)
  4370. as
  4371. select ue.name, u.name, o.name, ur.name,
  4372.        decode(ta.select$, 0, 'N', 2, 'Y', 3, 'G', '?'),
  4373.        decode(ta.insert$, 0, 'N', 1, 'S', 2, 'A', 3, 'G', '?'),
  4374.        decode(ta.delete$, 0, 'N', 2, 'Y', 3, 'G', '?'),
  4375.        decode(ta.update$, 0, 'N', 1, 'S', 2, 'A', 3, 'G', '?'),
  4376.        decode(ta.references$, 0, 'N', 1, 'S', 2, 'A', 3, 'G', '?'),
  4377.        decode(ta.alter$, 0, 'N', 2, 'Y', 3, 'G', '?'),
  4378.        decode(ta.index$, 0, 'N', 2, 'Y', 3, 'G', '?'),
  4379.        ta.time
  4380. from sys.tabauth$ ta, sys.obj$ o, sys.user$ u, sys.user$ ur, sys.user$ ue
  4381. where ta.obj# = o.obj#
  4382.   and ta.grantor# = ur.user#
  4383.   and ta.grantee# = ue.user#
  4384.   and u.user# = o.owner#
  4385. /
  4386. comment on table DBA_TAB_GRANTS is
  4387. 'All grants on objects in the database'
  4388. /
  4389. comment on column DBA_TAB_GRANTS.GRANTEE is
  4390. 'User to whom access was granted'
  4391. /
  4392. comment on column DBA_TAB_GRANTS.OWNER is
  4393. 'Owner of the object'
  4394. /
  4395. comment on column DBA_TAB_GRANTS.TABLE_NAME is
  4396. 'Name of the object'
  4397. /
  4398. comment on column DBA_TAB_GRANTS.GRANTOR is
  4399. 'Name of the user who performed the grant'
  4400. /
  4401. comment on column DBA_TAB_GRANTS.SELECT_PRIV is
  4402. 'Permission to SELECT from the object?'
  4403. /
  4404. comment on column DBA_TAB_GRANTS.INSERT_PRIV is
  4405. 'Permission to INSERT into the object?'
  4406. /
  4407. comment on column DBA_TAB_GRANTS.DELETE_PRIV is
  4408. 'Permission to DELETE from the object?'
  4409. /
  4410. comment on column DBA_TAB_GRANTS.UPDATE_PRIV is
  4411. 'Permission to UPDATE the object?'
  4412. /
  4413. comment on column DBA_TAB_GRANTS.REFERENCES_PRIV is
  4414. 'Permission to make REFERENCES to the object?'
  4415. /
  4416. comment on column DBA_TAB_GRANTS.ALTER_PRIV is
  4417. 'Permission to ALTER the object?'
  4418. /
  4419. comment on column DBA_TAB_GRANTS.INDEX_PRIV is
  4420. 'Permission to create/drop an INDEX on the object?'
  4421. /
  4422. comment on column DBA_TAB_GRANTS.CREATED is
  4423. 'Timestamp for the grant'
  4424. /
  4425. remark
  4426. remark  FAMILY "TAB_GRANTS_MADE"
  4427. remark  Grants made on objects.
  4428. remark  This family has no DBA member.
  4429. remark
  4430. drop view USER_TAB_GRANTS_MADE
  4431. /
  4432. create view USER_TAB_GRANTS_MADE
  4433.       (GRANTEE, TABLE_NAME, GRANTOR,
  4434.        SELECT_PRIV, INSERT_PRIV, DELETE_PRIV, 
  4435.        UPDATE_PRIV, REFERENCES_PRIV, ALTER_PRIV, INDEX_PRIV,
  4436.        CREATED)
  4437. as
  4438. select ue.name, o.name, ur.name,
  4439.        decode(ta.select$, 0, 'N', 2, 'Y', 3, 'G', '?'),
  4440.        decode(ta.insert$, 0, 'N', 1, 'S', 2, 'A', 3, 'G', '?'),
  4441.        decode(ta.delete$, 0, 'N', 2, 'Y', 3, 'G', '?'),
  4442.        decode(ta.update$, 0, 'N', 1, 'S', 2, 'A', 3, 'G', '?'),
  4443.        decode(ta.references$, 0, 'N', 1, 'S', 2, 'A', 3, 'G', '?'),
  4444.        decode(ta.alter$, 0, 'N', 2, 'Y', 3, 'G', '?'),
  4445.        decode(ta.index$, 0, 'N', 2, 'Y', 3, 'G', '?'),
  4446.        ta.time
  4447. from sys.tabauth$ ta, sys.obj$ o, sys.user$ ue, sys.user$ ur
  4448. where ta.obj# = o.obj#
  4449.   and ta.grantor# = ur.user#
  4450.   and ta.grantee# = ue.user#
  4451.   and o.owner# = uid
  4452. /
  4453. comment on table USER_TAB_GRANTS_MADE is
  4454. 'All grants on objects owned by the user'
  4455. /
  4456. comment on column USER_TAB_GRANTS_MADE.GRANTEE is
  4457. 'Name of the user to whom access was granted'
  4458. /
  4459. comment on column USER_TAB_GRANTS_MADE.TABLE_NAME is
  4460. 'Name of the object'
  4461. /
  4462. comment on column USER_TAB_GRANTS_MADE.GRANTOR is
  4463. 'Name of the user who performed the grant'
  4464. /
  4465. comment on column USER_TAB_GRANTS_MADE.SELECT_PRIV is
  4466. 'Permission to SELECT from the object?'
  4467. /
  4468. comment on column USER_TAB_GRANTS_MADE.INSERT_PRIV is
  4469. 'Permission to INSERT into the object?'
  4470. /
  4471. comment on column USER_TAB_GRANTS_MADE.DELETE_PRIV is
  4472. 'Permission to DELETE from the object?'
  4473. /
  4474. comment on column USER_TAB_GRANTS_MADE.UPDATE_PRIV is
  4475. 'Permission to UPDATE the object?'
  4476. /
  4477. comment on column USER_TAB_GRANTS_MADE.REFERENCES_PRIV is
  4478. 'Permission to make REFERENCES to the object?'
  4479. /
  4480. comment on column USER_TAB_GRANTS_MADE.ALTER_PRIV is
  4481. 'Permission to ALTER the object?'
  4482. /
  4483. comment on column USER_TAB_GRANTS_MADE.INDEX_PRIV is
  4484. 'Permission to CREATE/DROP INDEX on the object?'
  4485. /
  4486. comment on column USER_TAB_GRANTS_MADE.CREATED is
  4487. 'Timestamp for the grant'
  4488. /
  4489. drop public synonym USER_TAB_GRANTS_MADE
  4490. /
  4491. create public synonym USER_TAB_GRANTS_MADE for USER_TAB_GRANTS_MADE
  4492. /
  4493. grant select on USER_TAB_GRANTS_MADE to PUBLIC
  4494. /
  4495. drop view ALL_TAB_GRANTS_MADE
  4496. /
  4497. create view ALL_TAB_GRANTS_MADE
  4498.       (GRANTEE, OWNER, TABLE_NAME, GRANTOR,
  4499.        SELECT_PRIV, INSERT_PRIV, DELETE_PRIV, 
  4500.        UPDATE_PRIV, REFERENCES_PRIV, ALTER_PRIV, INDEX_PRIV,
  4501.        CREATED)
  4502. as
  4503. select ue.name, u.name, o.name, ur.name,
  4504.        decode(ta.select$, 0, 'N', 2, 'Y', 3, 'G', '?'),
  4505.        decode(ta.insert$, 0, 'N', 1, 'S', 2, 'A', 3, 'G', '?'),
  4506.        decode(ta.delete$, 0, 'N', 2, 'Y', 3, 'G', '?'),
  4507.        decode(ta.update$, 0, 'N', 1, 'S', 2, 'A', 3, 'G', '?'),
  4508.        decode(ta.references$, 0, 'N', 1, 'S', 2, 'A', 3, 'G', '?'),
  4509.        decode(ta.alter$, 0, 'N', 2, 'Y', 3, 'G', '?'),
  4510.        decode(ta.index$, 0, 'N', 2, 'Y', 3, 'G', '?'),
  4511.        ta.time
  4512. from sys.tabauth$ ta, sys.obj$ o, sys.user$ u, sys.user$ ur, sys.user$ ue
  4513. where ta.obj# = o.obj#
  4514.   and ta.grantor# = ur.user#
  4515.   and ta.grantee# = ue.user#
  4516.   and u.user# = o.owner#
  4517.   and uid in (o.owner#, ta.grantor#)
  4518. /
  4519. comment on table ALL_TAB_GRANTS_MADE is
  4520. 'User''s grants and grants on user''s objects'
  4521. /
  4522. comment on column ALL_TAB_GRANTS_MADE.GRANTEE is
  4523. 'Name of the user to whom access was granted'
  4524. /
  4525. comment on column ALL_TAB_GRANTS_MADE.OWNER is
  4526. 'Owner of the object'
  4527. /
  4528. comment on column ALL_TAB_GRANTS_MADE.TABLE_NAME is
  4529. 'Name of the object'
  4530. /
  4531. comment on column ALL_TAB_GRANTS_MADE.GRANTOR is
  4532. 'Name of the user who performed the grant'
  4533. /
  4534. comment on column ALL_TAB_GRANTS_MADE.SELECT_PRIV is
  4535. 'Permission to SELECT from the object?'
  4536. /
  4537. comment on column ALL_TAB_GRANTS_MADE.INSERT_PRIV is
  4538. 'Permission to INSERT into the object?'
  4539. /
  4540. comment on column ALL_TAB_GRANTS_MADE.DELETE_PRIV is
  4541. 'Permission to DELETE from the object?'
  4542. /
  4543. comment on column ALL_TAB_GRANTS_MADE.UPDATE_PRIV is
  4544. 'Permission to UPDATE the object?'
  4545. /
  4546. comment on column ALL_TAB_GRANTS_MADE.REFERENCES_PRIV is
  4547. 'Permission to make REFERENCES to the object?'
  4548. /
  4549. comment on column ALL_TAB_GRANTS_MADE.ALTER_PRIV is
  4550. 'Permission to ALTER the object?'
  4551. /
  4552. comment on column ALL_TAB_GRANTS_MADE.INDEX_PRIV is
  4553. 'Permission to CREATE/DROP INDEX on the object?'
  4554. /
  4555. comment on column ALL_TAB_GRANTS_MADE.CREATED is
  4556. 'Timestamp for the grant'
  4557. /
  4558. drop public synonym ALL_TAB_GRANTS_MADE
  4559. /
  4560. create public synonym ALL_TAB_GRANTS_MADE for ALL_TAB_GRANTS_MADE
  4561. /
  4562. grant select on ALL_TAB_GRANTS_MADE to PUBLIC
  4563. /
  4564. remark
  4565. remark  FAMILY "TAB_GRANTS_RECD"
  4566. remark  Grants received on objects.
  4567. remark  This family has no DBA member.
  4568. remark
  4569. drop view USER_TAB_GRANTS_RECD
  4570. /
  4571. create view USER_TAB_GRANTS_RECD
  4572.       (OWNER, TABLE_NAME, GRANTOR,
  4573.        SELECT_PRIV, INSERT_PRIV, DELETE_PRIV, 
  4574.        UPDATE_PRIV, REFERENCES_PRIV, ALTER_PRIV, INDEX_PRIV,
  4575.        CREATED)
  4576. as
  4577. select u.name, o.name, ur.name,
  4578.        decode(ta.select$, 0, 'N', 2, 'Y', 3, 'G', '?'),
  4579.        decode(ta.insert$, 0, 'N', 1, 'S', 2, 'A', 3, 'G', '?'),
  4580.        decode(ta.delete$, 0, 'N', 2, 'Y', 3, 'G', '?'),
  4581.        decode(ta.update$, 0, 'N', 1, 'S', 2, 'A', 3, 'G', '?'),
  4582.        decode(ta.references$, 0, 'N', 1, 'S', 2, 'A', 3, 'G', '?'),
  4583.        decode(ta.alter$, 0, 'N', 2, 'Y', 3, 'G', '?'),
  4584.        decode(ta.index$, 0, 'N', 2, 'Y', 3, 'G', '?'),
  4585.        ta.time
  4586. from sys.tabauth$ ta, sys.obj$ o, sys.user$ u, sys.user$ ur
  4587. where ta.obj# = o.obj#
  4588.   and ta.grantor# = ur.user#
  4589.   and u.user# = o.owner#
  4590.   and ta.grantee# = uid
  4591. /
  4592. comment on table USER_TAB_GRANTS_RECD is
  4593. 'Grants on objects for which the user is the grantee'
  4594. /
  4595. comment on column USER_TAB_GRANTS_RECD.OWNER is
  4596. 'Owner of the object'
  4597. /
  4598. comment on column USER_TAB_GRANTS_RECD.TABLE_NAME is
  4599. 'Name of the object'
  4600. /
  4601. comment on column USER_TAB_GRANTS_RECD.GRANTOR is
  4602. 'Name of the user who performed the grant'
  4603. /
  4604. comment on column USER_TAB_GRANTS_RECD.SELECT_PRIV is
  4605. 'Permission to SELECT from the object?'
  4606. /
  4607. comment on column USER_TAB_GRANTS_RECD.INSERT_PRIV is
  4608. 'Permission to INSERT into the object?'
  4609. /
  4610. comment on column USER_TAB_GRANTS_RECD.DELETE_PRIV is
  4611. 'Permission to DELETE from the object?'
  4612. /
  4613. comment on column USER_TAB_GRANTS_RECD.UPDATE_PRIV is
  4614. 'Permission to UPDATE the object?'
  4615. /
  4616. comment on column USER_TAB_GRANTS_RECD.REFERENCES_PRIV is
  4617. 'Permission to make REFERENCES to the object?'
  4618. /
  4619. comment on column USER_TAB_GRANTS_RECD.ALTER_PRIV is
  4620. 'Permission to ALTER the object?'
  4621. /
  4622. comment on column USER_TAB_GRANTS_RECD.INDEX_PRIV is
  4623. 'Permission to create/drop an INDEX on the object?'
  4624. /
  4625. comment on column USER_TAB_GRANTS_RECD.CREATED is
  4626. 'Timestamp for the grant'
  4627. /
  4628. drop public synonym USER_TAB_GRANTS_RECD
  4629. /
  4630. create public synonym USER_TAB_GRANTS_RECD for USER_TAB_GRANTS_RECD
  4631. /
  4632. grant select on USER_TAB_GRANTS_RECD to PUBLIC
  4633. /
  4634. drop view ALL_TAB_GRANTS_RECD
  4635. /
  4636. create view ALL_TAB_GRANTS_RECD
  4637.       (GRANTEE, OWNER, TABLE_NAME, GRANTOR,
  4638.        SELECT_PRIV, INSERT_PRIV, DELETE_PRIV, 
  4639.        UPDATE_PRIV, REFERENCES_PRIV, ALTER_PRIV, INDEX_PRIV,
  4640.        CREATED)
  4641. as
  4642. select ue.name, u.name, o.name, ur.name,
  4643.        decode(ta.select$, 0, 'N', 2, 'Y', 3, 'G', '?'),
  4644.        decode(ta.insert$, 0, 'N', 1, 'S', 2, 'A', 3, 'G', '?'),
  4645.        decode(ta.delete$, 0, 'N', 2, 'Y', 3, 'G', '?'),
  4646.        decode(ta.update$, 0, 'N', 1, 'S', 2, 'A', 3, 'G', '?'),
  4647.        decode(ta.references$, 0, 'N', 1, 'S', 2, 'A', 3, 'G', '?'),
  4648.        decode(ta.alter$, 0, 'N', 2, 'Y', 3, 'G', '?'),
  4649.        decode(ta.index$, 0, 'N', 2, 'Y', 3, 'G', '?'),
  4650.        ta.time
  4651. from sys.tabauth$ ta, sys.obj$ o, sys.user$ u, sys.user$ ur, sys.user$ ue
  4652. where ta.obj# = o.obj#
  4653.   and ta.grantor# = ur.user#
  4654.   and ta.grantee# = ue.user#
  4655.   and u.user# = o.owner#
  4656.   and ta.grantee# in (uid, 1)
  4657. /
  4658. comment on table ALL_TAB_GRANTS_RECD is
  4659. 'Grants on objects for which the user or PUBLIC is the grantee'
  4660. /
  4661. comment on column ALL_TAB_GRANTS_RECD.GRANTEE is
  4662. 'Name of the user to whom access was granted'
  4663. /
  4664. comment on column ALL_TAB_GRANTS_RECD.OWNER is
  4665. 'Owner of the object'
  4666. /
  4667. comment on column ALL_TAB_GRANTS_RECD.TABLE_NAME is
  4668. 'Name of the object'
  4669. /
  4670. comment on column ALL_TAB_GRANTS_RECD.GRANTOR is
  4671. 'Name of the user who performed the grant'
  4672. /
  4673. comment on column ALL_TAB_GRANTS_RECD.SELECT_PRIV is
  4674. 'Permission to SELECT from the object?'
  4675. /
  4676. comment on column ALL_TAB_GRANTS_RECD.INSERT_PRIV is
  4677. 'Permission to INSERT into the object?'
  4678. /
  4679. comment on column ALL_TAB_GRANTS_RECD.DELETE_PRIV is
  4680. 'Permission to DELETE from the object?'
  4681. /
  4682. comment on column ALL_TAB_GRANTS_RECD.UPDATE_PRIV is
  4683. 'Permission to UPDATE the object?'
  4684. /
  4685. comment on column ALL_TAB_GRANTS_RECD.REFERENCES_PRIV is
  4686. 'Permission to make REFERENCES to the object?'
  4687. /
  4688. comment on column ALL_TAB_GRANTS_RECD.ALTER_PRIV is
  4689. 'Permission to ALTER the object?'
  4690. /
  4691. comment on column ALL_TAB_GRANTS_RECD.INDEX_PRIV is
  4692. 'Permission to create/drop an INDEX on the object?'
  4693. /
  4694. comment on column ALL_TAB_GRANTS_RECD.CREATED is
  4695. 'Timestamp for the grant'
  4696. /
  4697. drop public synonym ALL_TAB_GRANTS_RECD
  4698. /
  4699. create public synonym ALL_TAB_GRANTS_RECD for ALL_TAB_GRANTS_RECD
  4700. /
  4701. grant select on ALL_TAB_GRANTS_RECD to PUBLIC
  4702. /
  4703. remark
  4704. remark  FAMILY "TS_QUOTAS"
  4705. remark  Tablespace quotas for users.
  4706. remark  This family has no ALL member.
  4707. remark
  4708. drop view USER_TS_QUOTAS
  4709. /
  4710. create view USER_TS_QUOTAS
  4711.     (TABLESPACE_NAME, BYTES, MAX_BYTES, BLOCKS, MAX_BLOCKS)
  4712. as
  4713. select ts.name, q.blocks * ts.blocksize,
  4714.        q.maxblocks * ts.blocksize,
  4715.        q.blocks, q.maxblocks
  4716. from sys.tsq$ q, sys.ts$ ts
  4717. where q.ts# = ts.ts#
  4718.   and q.user# = uid
  4719. /
  4720. comment on table USER_TS_QUOTAS is
  4721. 'Tablespace quotas for the user'
  4722. /
  4723. comment on column USER_TS_QUOTAS.TABLESPACE_NAME is
  4724. 'Tablespace name'
  4725. /
  4726. comment on column USER_TS_QUOTAS.BLOCKS is
  4727. 'Number of ORACLE blocks charged to the user'
  4728. /
  4729. comment on column USER_TS_QUOTAS.MAX_BLOCKS is
  4730. 'User''s quota in ORACLE blocks.  NULL if no limit'
  4731. /
  4732. comment on column USER_TS_QUOTAS.BYTES is
  4733. 'Number of bytes charged to the user'
  4734. /
  4735. comment on column USER_TS_QUOTAS.MAX_BYTES is
  4736. 'User''s quota in bytes.  NULL if no limit'
  4737. /
  4738. drop public synonym USER_TS_QUOTAS
  4739. /
  4740. create public synonym USER_TS_QUOTAS for USER_TS_QUOTAS
  4741. /
  4742. grant select on USER_TS_QUOTAS to PUBLIC
  4743. /
  4744. drop view DBA_TS_QUOTAS
  4745. /
  4746. create view DBA_TS_QUOTAS
  4747.     (TABLESPACE_NAME, USERNAME, BYTES, MAX_BYTES, BLOCKS, MAX_BLOCKS)
  4748. as
  4749. select ts.name, u.name, 
  4750.        q.blocks * ts.blocksize, q.maxblocks * ts.blocksize,
  4751.        q.blocks, q.maxblocks
  4752. from sys.tsq$ q, sys.ts$ ts, sys.user$ u
  4753. where q.ts# = ts.ts#
  4754.   and q.user# = u.user#
  4755. /
  4756. comment on table DBA_TS_QUOTAS is
  4757. 'Tablespace quotas for all users'
  4758. /
  4759. comment on column DBA_TS_QUOTAS.TABLESPACE_NAME is
  4760. 'Tablespace name'
  4761. /
  4762. comment on column DBA_TS_QUOTAS.USERNAME is
  4763. 'User with resource rights on the tablespace'
  4764. /
  4765. comment on column DBA_TS_QUOTAS.BLOCKS is
  4766. 'Number of ORACLE blocks charged to the user'
  4767. /
  4768. comment on column DBA_TS_QUOTAS.MAX_BLOCKS is
  4769. 'User''s quota in ORACLE blocks.  NULL if no limit'
  4770. /
  4771. comment on column DBA_TS_QUOTAS.BYTES is
  4772. 'Number of bytes charged to the user'
  4773. /
  4774. comment on column DBA_TS_QUOTAS.MAX_BYTES is
  4775. 'User''s quota in bytes.  NULL if no limit'
  4776. /
  4777. remark
  4778. remark  FAMILY "USERS"
  4779. remark  Users enrolled in the database.
  4780. remark
  4781. drop view USER_USERS
  4782. /
  4783. create view USER_USERS
  4784.     (USERNAME, USER_ID,
  4785.      CONNECT_PRIV, RESOURCE_PRIV, DBA_PRIV,
  4786.      DEFAULT_TABLESPACE, TEMPORARY_TABLESPACE, CREATED, EXPIRES)
  4787. as
  4788. select u.name, u.user#,
  4789.        u.connect$, u.resource$, u.dba$,
  4790.        dts.name, tts.name, u.ctime, u.ptime
  4791. from sys.user$ u, sys.ts$ dts, sys.ts$ tts
  4792. where u.datats# = dts.ts#
  4793.   and u.tempts# = tts.ts#
  4794.   and u.user# = uid
  4795. /
  4796. comment on table USER_USERS is
  4797. 'Information about the current user'
  4798. /
  4799. comment on column USER_USERS.USERNAME is
  4800. 'Name of the user'
  4801. /
  4802. comment on column USER_USERS.USER_ID is
  4803. 'ID number of the user'
  4804. /
  4805. comment on column USER_USERS.CONNECT_PRIV is
  4806. 'Does user have CONNECT privilege?'
  4807. /
  4808. comment on column USER_USERS.RESOURCE_PRIV is
  4809. 'Does user have RESOURCE privilege?'
  4810. /
  4811. comment on column USER_USERS.DBA_PRIV is
  4812. 'Does user have DBA Privilege?'
  4813. /
  4814. comment on column USER_USERS.DEFAULT_TABLESPACE is
  4815. 'Default tablespace for data'
  4816. /
  4817. comment on column USER_USERS.TEMPORARY_TABLESPACE is
  4818. 'Default tablespace for temporary tables'
  4819. /
  4820. comment on column USER_USERS.CREATED is
  4821. 'User creation date'
  4822. /
  4823. comment on column USER_USERS.EXPIRES is
  4824. 'Password expiration date'
  4825. /
  4826. drop public synonym USER_USERS
  4827. /
  4828. create public synonym USER_USERS for USER_USERS
  4829. /
  4830. drop public synonym MYPRIVS
  4831. /
  4832. create public synonym MYPRIVS for USER_USERS
  4833. /
  4834. grant select on USER_USERS to PUBLIC
  4835. /
  4836. drop view ALL_USERS
  4837. /
  4838. create view ALL_USERS
  4839.     (USERNAME, USER_ID,
  4840.      /*   CONNECT_PRIV, RESOURCE_PRIV, DBA_PRIV,
  4841.      DEFAULT_TABLESPACE, TEMPORARY_TABLESPACE, */  CREATED)
  4842. as
  4843. select u.name, u.user#,
  4844.        /* u.connect$, u.resource$, u.dba$, 
  4845.        dts.name, tts.name, */   u.ctime
  4846. from sys.user$ u, sys.ts$ dts, sys.ts$ tts
  4847. where u.datats# = dts.ts#
  4848.   and u.tempts# = tts.ts#
  4849. /
  4850. comment on table ALL_USERS is
  4851. 'Information about all users of the database'
  4852. /
  4853. comment on column ALL_USERS.USERNAME is
  4854. 'Name of the user'
  4855. /
  4856. comment on column ALL_USERS.USER_ID is
  4857. 'ID number of the user'
  4858. /
  4859. remark comment on column ALL_USERS.CONNECT_PRIV is
  4860. remark 'Does the user have CONNECT privilege?'
  4861. remark /
  4862. remark comment on column ALL_USERS.RESOURCE_PRIV is
  4863. remark 'Does the user have RESOURCE privilege?'
  4864. remark /
  4865. remark comment on column ALL_USERS.DBA_PRIV is
  4866. remark 'Does the user have DBA privilege?'
  4867. remark /
  4868. remark comment on column ALL_USERS.DEFAULT_TABLESPACE is
  4869. remark 'Default tablespace for data'
  4870. remark /
  4871. remark comment on column ALL_USERS.TEMPORARY_TABLESPACE is
  4872. remark 'Default tablespace for temporary tables'
  4873. remark /
  4874. comment on column ALL_USERS.CREATED is
  4875. 'User creation date'
  4876. /
  4877. drop public synonym ALL_USERS
  4878. /
  4879. create public synonym ALL_USERS for ALL_USERS
  4880. /
  4881. grant select on ALL_USERS to PUBLIC
  4882. /
  4883. drop view DBA_USERS
  4884. /
  4885. create view DBA_USERS
  4886.     (USERNAME, USER_ID, PASSWORD,
  4887.      CONNECT_PRIV, RESOURCE_PRIV, DBA_PRIV,
  4888.      DEFAULT_TABLESPACE, TEMPORARY_TABLESPACE, CREATED, EXPIRES)
  4889. as
  4890. select u.name, u.user#, u.password,
  4891.        u.connect$, u.resource$, u.dba$,
  4892.        dts.name, tts.name, u.ctime, u.ptime
  4893. from sys.user$ u, sys.ts$ dts, sys.ts$ tts
  4894. where u.datats# = dts.ts#
  4895.   and u.tempts# = tts.ts#
  4896. /
  4897. comment on table DBA_USERS is
  4898. 'Information about all users of the database'
  4899. /
  4900. comment on column DBA_USERS.USERNAME is
  4901. 'Name of the user'
  4902. /
  4903. comment on column DBA_USERS.USER_ID is
  4904. 'ID number of the user'
  4905. /
  4906. comment on column DBA_USERS.PASSWORD is
  4907. 'Encrypted password'
  4908. /
  4909. comment on column DBA_USERS.CONNECT_PRIV is
  4910. 'Does the user have CONNECT privilege?'
  4911. /
  4912. comment on column DBA_USERS.RESOURCE_PRIV is
  4913. 'Does the user have RESOURCE privilege?'
  4914. /
  4915. comment on column DBA_USERS.DBA_PRIV is
  4916. 'Does the user have DBA privilege?'
  4917. /
  4918. comment on column DBA_USERS.DEFAULT_TABLESPACE is
  4919. 'Default tablespace for data'
  4920. /
  4921. comment on column DBA_USERS.TEMPORARY_TABLESPACE is
  4922. 'Default tablespace for temporary tables'
  4923. /
  4924. comment on column DBA_USERS.CREATED is
  4925. 'User creation date'
  4926. /
  4927. comment on column DBA_USERS.EXPIRES is
  4928. 'Password expiration date'
  4929. /
  4930. remark
  4931. remark  FAMILY "VIEWS"
  4932. remark  All relevant information about views, except columns.
  4933. remark
  4934. drop view USER_VIEWS
  4935. /
  4936. create view USER_VIEWS
  4937.     (VIEW_NAME, TEXT_LENGTH, TEXT)
  4938. as
  4939. select o.name, v.textlength, v.text
  4940. from sys.obj$ o, sys.view$ v
  4941. where o.obj# = v.obj#
  4942.   and o.owner# = uid
  4943. /
  4944. comment on table USER_VIEWS is
  4945. 'Text of views owned by the user'
  4946. /
  4947. comment on column USER_VIEWS.VIEW_NAME is
  4948. 'Name of the view'
  4949. /
  4950. comment on column USER_VIEWS.TEXT_LENGTH is
  4951. 'Length of the view text'
  4952. /
  4953. comment on column USER_VIEWS.TEXT is
  4954. 'View text'
  4955. /
  4956. drop public synonym USER_VIEWS
  4957. /
  4958. create public synonym USER_VIEWS for USER_VIEWS
  4959. /
  4960. grant select on USER_VIEWS to PUBLIC
  4961. /
  4962. drop view ALL_VIEWS
  4963. /
  4964. create view ALL_VIEWS
  4965.     (OWNER, VIEW_NAME)
  4966. as
  4967. select u.name, o.name
  4968. from sys.obj$ o, sys.view$ v, sys.user$ u
  4969. where o.obj# = v.obj#
  4970.   and o.owner# = u.user#
  4971.   and (o.owner# = uid
  4972.        or o.obj# in
  4973.             (select ta.obj#
  4974.              from sys.tabauth$ ta
  4975.              where ta.grantee# in (uid, 1))
  4976.       )
  4977. /
  4978. comment on table ALL_VIEWS is
  4979. 'Text of views accessible to the user'
  4980. /
  4981. comment on column ALL_VIEWS.OWNER is
  4982. 'Owner of the view'
  4983. /
  4984. comment on column ALL_VIEWS.VIEW_NAME is
  4985. 'Name of the view'
  4986. /
  4987. drop public synonym ALL_VIEWS
  4988. /
  4989. create public synonym ALL_VIEWS for ALL_VIEWS
  4990. /
  4991. grant select on ALL_VIEWS to PUBLIC
  4992. /
  4993. drop view DBA_VIEWS
  4994. /
  4995. create view DBA_VIEWS
  4996.     (OWNER, VIEW_NAME, TEXT_LENGTH, TEXT)
  4997. as
  4998. select u.name, o.name, v.textlength, v.text
  4999. from sys.obj$ o, sys.view$ v, sys.user$ u
  5000. where o.obj# = v.obj#
  5001.   and o.owner# = u.user#
  5002. /
  5003. comment on table DBA_VIEWS is
  5004. 'Text of all views in the database'
  5005. /
  5006. comment on column DBA_VIEWS.OWNER is
  5007. 'Owner of the view'
  5008. /
  5009. comment on column DBA_VIEWS.VIEW_NAME is
  5010. 'Name of the view'
  5011. /
  5012. comment on column DBA_VIEWS.TEXT_LENGTH is
  5013. 'Length of the view text'
  5014. /
  5015. comment on column DBA_VIEWS.TEXT is
  5016. 'View text'
  5017. /
  5018. remark
  5019. remark  FAMILY "CONSTRAINTS"
  5020. remark
  5021. drop view USER_CONSTRAINTS
  5022. /
  5023. create view USER_CONSTRAINTS (OWNER, CONSTRAINT_NAME, CONSTRAINT_TYPE,
  5024.                               TABLE_NAME, SEARCH_CONDITION, R_OWNER,
  5025.                               R_CONSTRAINT_NAME)
  5026. as
  5027. select ou.name, oc.name,
  5028.        decode(c.type, 1, 'C', 2, 'P', 3, 'U', 4, 'R', 5, 'V', '?'),
  5029.        o.name, c.condition, ru.name, rc.name
  5030. from sys.con$ oc, sys.con$ rc, sys.user$ ou, sys.user$ ru,
  5031.      sys.obj$ o, sys.cdef$ c
  5032. where oc.owner# = ou.user#
  5033.   and oc.con# = c.con#
  5034.   and c.obj# = o.obj#
  5035.   and c.rcon# = rc.con#(+)
  5036.   and rc.owner# = ru.user#(+)
  5037.   and o.owner# = uid
  5038. /
  5039. comment on table USER_CONSTRAINTS is
  5040. 'Constraint definitions on accessible tables'
  5041. /
  5042. comment on column USER_CONSTRAINTS.OWNER is
  5043. 'Owner of the table'
  5044. /
  5045. comment on column USER_CONSTRAINTS.CONSTRAINT_NAME is
  5046. 'Name associated with constraint definition'
  5047. /
  5048. comment on column USER_CONSTRAINTS.CONSTRAINT_TYPE is
  5049. 'Type of constraint definition'
  5050. /
  5051. comment on column USER_CONSTRAINTS.TABLE_NAME is
  5052. 'Name associated with table with constraint definition'
  5053. /
  5054. comment on column USER_CONSTRAINTS.SEARCH_CONDITION is
  5055. 'Text of search condition for table check'
  5056. /
  5057. comment on column USER_CONSTRAINTS.R_OWNER is
  5058. 'Owner of table used in referential constraint'
  5059. /
  5060. comment on column USER_CONSTRAINTS.R_CONSTRAINT_NAME is
  5061. 'Name of unique constraint definition for referenced table'
  5062. /
  5063. grant select on USER_CONSTRAINTS to public
  5064. /
  5065. drop public synonym USER_CONSTRAINTS
  5066. /
  5067. create public synonym USER_CONSTRAINTS for USER_CONSTRAINTS
  5068. /
  5069. drop view ALL_CONSTRAINTS
  5070. /
  5071. create view ALL_CONSTRAINTS (OWNER, CONSTRAINT_NAME, CONSTRAINT_TYPE,
  5072.                              TABLE_NAME, SEARCH_CONDITION, R_OWNER,
  5073.                              R_CONSTRAINT_NAME)
  5074. as
  5075. select ou.name, oc.name,
  5076.        decode(c.type, 1, 'C', 2, 'P', 3, 'U', 4, 'R', 5, 'V', '?'),
  5077.        o.name, c.condition, ru.name, rc.name
  5078. from sys.con$ oc, sys.con$ rc, sys.user$ ou, sys.user$ ru,
  5079.      sys.obj$ o, sys.cdef$ c
  5080. where oc.owner# = ou.user#
  5081.   and oc.con# = c.con#
  5082.   and c.obj# = o.obj#
  5083.   and c.rcon# = rc.con#(+)
  5084.   and rc.owner# = ru.user#(+)
  5085.   and (o.owner# = uid
  5086.        or o.obj# in (select obj#
  5087.                      from sys.tabauth$
  5088.                      where grantee# in (1,uid)
  5089.                     )
  5090.       )
  5091. /
  5092. comment on table ALL_CONSTRAINTS is
  5093. 'Constraint definitions on accessible tables'
  5094. /
  5095. comment on column ALL_CONSTRAINTS.OWNER is
  5096. 'Owner of the table'
  5097. /
  5098. comment on column ALL_CONSTRAINTS.CONSTRAINT_NAME is
  5099. 'Name associated with constraint definition'
  5100. /
  5101. comment on column ALL_CONSTRAINTS.CONSTRAINT_TYPE is
  5102. 'Type of constraint definition'
  5103. /
  5104. comment on column ALL_CONSTRAINTS.TABLE_NAME is
  5105. 'Name associated with table with constraint definition'
  5106. /
  5107. comment on column ALL_CONSTRAINTS.SEARCH_CONDITION is
  5108. 'Text of search condition for table check'
  5109. /
  5110. comment on column ALL_CONSTRAINTS.R_OWNER is
  5111. 'Owner of table used in referential constraint'
  5112. /
  5113. comment on column ALL_CONSTRAINTS.R_CONSTRAINT_NAME is
  5114. 'Name of unique constraint definition for referenced table'
  5115. /
  5116. grant select on ALL_CONSTRAINTS to public
  5117. /
  5118. drop public synonym ALL_CONSTRAINTS
  5119. /
  5120. create public synonym ALL_CONSTRAINTS for ALL_CONSTRAINTS
  5121. /
  5122. drop view DBA_CONSTRAINTS
  5123. /
  5124. create view DBA_CONSTRAINTS (OWNER, CONSTRAINT_NAME, CONSTRAINT_TYPE,
  5125.                              TABLE_NAME, SEARCH_CONDITION, R_OWNER,
  5126.                              R_CONSTRAINT_NAME)
  5127. as
  5128. select ou.name, oc.name,
  5129.        decode(c.type, 1, 'C', 2, 'P', 3, 'U', 4, 'R', 5, 'V', '?'),
  5130.        o.name, c.condition, ru.name, rc.name
  5131. from sys.con$ oc, sys.con$ rc, sys.user$ ou, sys.user$ ru,
  5132.      sys.obj$ o, sys.cdef$ c
  5133. where oc.owner# = ou.user#
  5134.   and oc.con# = c.con#
  5135.   and c.obj# = o.obj#
  5136.   and c.rcon# = rc.con#(+)
  5137.   and rc.owner# = ru.user#(+)
  5138. /
  5139. comment on table DBA_CONSTRAINTS is
  5140. 'Constraint definitions on accessible tables'
  5141. /
  5142. comment on column DBA_CONSTRAINTS.OWNER is
  5143. 'Owner of the table'
  5144. /
  5145. comment on column DBA_CONSTRAINTS.CONSTRAINT_NAME is
  5146. 'Name associated with constraint definition'
  5147. /
  5148. comment on column DBA_CONSTRAINTS.CONSTRAINT_TYPE is
  5149. 'Type of constraint definition'
  5150. /
  5151. comment on column DBA_CONSTRAINTS.TABLE_NAME is
  5152. 'Name associated with table with constraint definition'
  5153. /
  5154. comment on column DBA_CONSTRAINTS.SEARCH_CONDITION is
  5155. 'Text of search condition for table check'
  5156. /
  5157. comment on column DBA_CONSTRAINTS.R_OWNER is
  5158. 'Owner of table used in referential constraint'
  5159. /
  5160. comment on column DBA_CONSTRAINTS.R_CONSTRAINT_NAME is
  5161. 'Name of unique constraint definition for referenced table'
  5162. /
  5163. drop public synonym DBA_CONSTRAINTS
  5164. /
  5165. create public synonym DBA_CONSTRAINTS for DBA_CONSTRAINTS
  5166. /
  5167. remark
  5168. remark  FAMILY "CONS_COLUMNS"
  5169. remark
  5170. drop view USER_CONS_COLUMNS
  5171. /
  5172. create view USER_CONS_COLUMNS (OWNER, CONSTRAINT_NAME, TABLE_NAME, COLUMN_NAME,
  5173.                                POSITION)
  5174. as
  5175. select u.name, c.name, o.name, col.name, cc.pos#
  5176. from sys.user$ u, sys.con$ c, sys.col$ col, sys.ccol$ cc, sys.cdef$ cd,
  5177.      sys.obj$ o
  5178. where c.owner# = u.user#
  5179.   and c.con# = cd.con#
  5180.   and cd.con# = cc.con#
  5181.   and cc.obj# = col.obj#
  5182.   and cc.col# = col.col#
  5183.   and cc.obj# = o.obj#
  5184.   and c.owner# = uid
  5185. /
  5186. comment on table USER_CONS_COLUMNS is
  5187. 'Information about accessible columns in constraint definitions'
  5188. /
  5189. comment on column USER_CONS_COLUMNS.OWNER is
  5190. 'Owner of the constraint definition'
  5191. /
  5192. comment on column USER_CONS_COLUMNS.CONSTRAINT_NAME is
  5193. 'Name associated with the constraint definition'
  5194. /
  5195. comment on column USER_CONS_COLUMNS.TABLE_NAME is
  5196. 'Name associated with table with constraint definition'
  5197. /
  5198. comment on column USER_CONS_COLUMNS.COLUMN_NAME is
  5199. 'Name associated with column specified in the constraint definition'
  5200. /
  5201. comment on column USER_CONS_COLUMNS.POSITION is
  5202. 'Original position of column in definition'
  5203. /
  5204. grant select on USER_CONS_COLUMNS to public
  5205. /
  5206. drop public synonym USER_CONS_COLUMNS
  5207. /
  5208. create public synonym USER_CONS_COLUMNS for USER_CONS_COLUMNS
  5209. /
  5210. drop view ALL_CONS_COLUMNS
  5211. /
  5212. create view ALL_CONS_COLUMNS (OWNER, CONSTRAINT_NAME, TABLE_NAME, COLUMN_NAME,
  5213.                               POSITION)
  5214. as
  5215. select u.name, c.name, o.name, col.name, cc.pos#
  5216. from sys.user$ u, sys.con$ c, sys.col$ col, sys.ccol$ cc, sys.cdef$ cd,
  5217.      sys.obj$ o
  5218. where c.owner# = u.user#
  5219.   and c.con# = cd.con#
  5220.   and cd.con# = cc.con#
  5221.   and cc.obj# = col.obj#
  5222.   and cc.col# = col.col#
  5223.   and cc.obj# = o.obj#
  5224.   and (c.owner# = uid
  5225.        or cd.obj# in (select obj#
  5226.                       from sys.tabauth$
  5227.                       where grantee# in (1,uid)
  5228.                      )
  5229.       )
  5230. /
  5231. comment on table ALL_CONS_COLUMNS is
  5232. 'Information about accessible columns in constraint definitions'
  5233. /
  5234. comment on column ALL_CONS_COLUMNS.OWNER is
  5235. 'Owner of the constraint definition'
  5236. /
  5237. comment on column ALL_CONS_COLUMNS.CONSTRAINT_NAME is
  5238. 'Name associated with the constraint definition'
  5239. /
  5240. comment on column ALL_CONS_COLUMNS.TABLE_NAME is
  5241. 'Name associated with table with constraint definition'
  5242. /
  5243. comment on column ALL_CONS_COLUMNS.COLUMN_NAME is
  5244. 'Name associated with column specified in the constraint definition'
  5245. /
  5246. comment on column ALL_CONS_COLUMNS.POSITION is
  5247. 'Original position of column in definition'
  5248. /
  5249. grant select on ALL_CONS_COLUMNS to public
  5250. /
  5251. drop public synonym ALL_CONS_COLUMNS
  5252. /
  5253. create public synonym ALL_CONS_COLUMNS for ALL_CONS_COLUMNS
  5254. /
  5255. drop view DBA_CONS_COLUMNS
  5256. /
  5257. create view DBA_CONS_COLUMNS (OWNER, CONSTRAINT_NAME, TABLE_NAME, COLUMN_NAME,
  5258.                               POSITION)
  5259. as
  5260. select u.name, c.name, o.name, col.name, cc.pos#
  5261. from sys.user$ u, sys.con$ c, sys.col$ col, sys.ccol$ cc, sys.cdef$ cd,
  5262.      sys.obj$ o
  5263. where c.owner# = u.user#
  5264.   and c.con# = cd.con#
  5265.   and cd.con# = cc.con#
  5266.   and cc.obj# = col.obj#
  5267.   and cc.col# = col.col#
  5268.   and cc.obj# = o.obj#
  5269. /
  5270. comment on table DBA_CONS_COLUMNS is
  5271. 'Information about accessible columns in constraint definitions'
  5272. /
  5273. comment on column DBA_CONS_COLUMNS.OWNER is
  5274. 'Owner of the constraint definition'
  5275. /
  5276. comment on column DBA_CONS_COLUMNS.CONSTRAINT_NAME is
  5277. 'Name associated with the constraint definition'
  5278. /
  5279. comment on column DBA_CONS_COLUMNS.TABLE_NAME is
  5280. 'Name associated with table with constraint definition'
  5281. /
  5282. comment on column DBA_CONS_COLUMNS.COLUMN_NAME is
  5283. 'Name associated with column specified in the constraint definition'
  5284. /
  5285. comment on column DBA_CONS_COLUMNS.POSITION is
  5286. 'Original position of column in definition'
  5287. /
  5288. drop public synonym DBA_CONS_COLUMNS
  5289. /
  5290. create public synonym DBA_CONS_COLUMNS for DBA_CONS_COLUMNS
  5291. /
  5292. remark
  5293. remark  FAMILY "CONSTRAINT VIEWS" FOR ANSI
  5294. remark
  5295. drop view CONSTRAINT_DEFS
  5296. /
  5297. create view CONSTRAINT_DEFS (OWNER, CONSTRAINT_NAME, CONSTRAINT_TYPE,
  5298.                              TABLE_NAME, SEARCH_CONDITION, R_OWNER,
  5299.                              R_CONSTRAINT_NAME)
  5300. as
  5301. select ou.name, oc.name,
  5302.        decode(c.type, 1, 'C', 2, 'P', 3, 'U', 4, 'R', 5, 'V', '?'),
  5303.        o.name, c.condition, ru.name, rc.name
  5304. from sys.con$ oc, sys.con$ rc, sys.user$ ou, sys.user$ ru,
  5305.      sys.obj$ o, sys.cdef$ c
  5306. where oc.owner# = ou.user#
  5307.   and oc.con# = c.con#
  5308.   and c.obj# = o.obj#
  5309.   and c.rcon# = rc.con#(+)
  5310.   and rc.owner# = ru.user#(+)
  5311.   and (o.owner# = uid
  5312.        or o.obj# in (select obj#
  5313.                      from sys.tabauth$
  5314.                      where grantee# in (1,uid)
  5315.                     )
  5316.       )
  5317. /
  5318. comment on table CONSTRAINT_DEFS is
  5319. 'Constraint Definitions on accessible tables'
  5320. /
  5321. comment on column CONSTRAINT_DEFS.OWNER is
  5322. 'Owner of the table'
  5323. /
  5324. comment on column CONSTRAINT_DEFS.CONSTRAINT_NAME is
  5325. 'Name associated with constraint definition'
  5326. /
  5327. comment on column CONSTRAINT_DEFS.CONSTRAINT_TYPE is
  5328. 'Type of constraint definition'
  5329. /
  5330. comment on column CONSTRAINT_DEFS.TABLE_NAME is
  5331. 'Name associated with table with constraint definition'
  5332. /
  5333. comment on column CONSTRAINT_DEFS.SEARCH_CONDITION is
  5334. 'Text of search condition for table check'
  5335. /
  5336. comment on column CONSTRAINT_DEFS.R_OWNER is
  5337. 'Owner of table used in referential constraint'
  5338. /
  5339. comment on column CONSTRAINT_DEFS.R_CONSTRAINT_NAME is
  5340. 'Name of unique constraint definition for referenced table'
  5341. /
  5342. grant select on CONSTRAINT_DEFS to public
  5343. /
  5344. drop public synonym CONSTRAINT_DEFS
  5345. /
  5346. create public synonym CONSTRAINT_DEFS for CONSTRAINT_DEFS
  5347. /
  5348. drop view CONSTRAINT_COLUMNS
  5349. /
  5350. create view CONSTRAINT_COLUMNS (OWNER, CONSTRAINT_NAME, COLUMN_NAME,
  5351.                                 POSITION)
  5352. as
  5353. select u.name, c.name, col.name, cc.pos#
  5354. from sys.user$ u, sys.con$ c, sys.col$ col, sys.ccol$ cc, sys.cdef$ cd
  5355. where c.owner# = u.user#
  5356.   and c.con# = cd.con#
  5357.   and cd.type in (2,3,4)
  5358.   and cd.con# = cc.con#
  5359.   and cc.obj# = col.obj#
  5360.   and cc.col# = col.col#
  5361.   and (c.owner# = uid
  5362.        or cd.obj# in (select obj#
  5363.               from sys.tabauth$
  5364.               where grantee# in (1,uid)
  5365.              )
  5366.       )
  5367. /
  5368. comment on table CONSTRAINT_COLUMNS is
  5369. 'Information about accessible columns in constraint definitions'
  5370. /
  5371. comment on column CONSTRAINT_COLUMNS.OWNER is
  5372. 'Owner of the constraint definition'
  5373. /
  5374. comment on column CONSTRAINT_COLUMNS.CONSTRAINT_NAME is
  5375. 'Name associated with the constraint definition'
  5376. /
  5377. comment on column CONSTRAINT_COLUMNS.COLUMN_NAME is
  5378. 'Name associated with column specified in the constraint definition'
  5379. /
  5380. comment on column CONSTRAINT_COLUMNS.POSITION is
  5381. 'Original position of column in definition'
  5382. /
  5383. grant select on CONSTRAINT_COLUMNS to public
  5384. /
  5385. drop public synonym CONSTRAINT_COLUMNS
  5386. /
  5387. create public synonym CONSTRAINT_COLUMNS for CONSTRAINT_COLUMNS
  5388. /
  5389. remark
  5390. remark    FAMILY "FIXED (VIRTUAL) VIEWS"
  5391. remark               
  5392. drop view v_$process;
  5393. create view v_$process as select * from v$process;
  5394. drop public synonym v$process;
  5395. create public synonym v$process for v_$process;
  5396.  
  5397. drop view v_$bgprocess;
  5398. create view v_$bgprocess as select * from v$bgprocess;
  5399. drop public synonym v$bgprocess;
  5400. create public synonym v$bgprocess for v_$bgprocess;
  5401.  
  5402. drop view v_$session;
  5403. create view v_$session as select * from v$session;
  5404. drop public synonym v$session;
  5405. create public synonym v$session for v_$session;
  5406.  
  5407. drop view v_$transaction;
  5408. create view v_$transaction as select * from v$transaction;
  5409. drop public synonym v$transaction;
  5410. create public synonym v$transaction for v_$transaction;
  5411.  
  5412. drop view v_$latch;
  5413. create view v_$latch as select * from v$latch;
  5414. drop public synonym v$latch;
  5415. create public synonym v$latch for v_$latch;
  5416.  
  5417. drop view v_$latchname;
  5418. create view v_$latchname as select * from v$latchname;
  5419. drop public synonym v$latchname;
  5420. create public synonym v$latchname for v_$latchname;
  5421.  
  5422. drop view v_$latchholder;
  5423. create view v_$latchholder as select * from v$latchholder;
  5424. drop public synonym v$latchholder;
  5425. create public synonym v$latchholder for v_$latchholder;
  5426.  
  5427. drop view v_$resource;
  5428. create view v_$resource as select * from v$resource;
  5429. drop public synonym v$resource;
  5430. create public synonym v$resource for v_$resource;
  5431.  
  5432. drop view v_$_lock;
  5433. create view v_$_lock as select * from v$_lock;
  5434. drop public synonym v$_lock;
  5435. create public synonym v$_lock for v_$_lock;
  5436.  
  5437. drop view v_$lock;
  5438. create view v_$lock as select * from v$lock;
  5439. drop public synonym v$lock;
  5440. create public synonym v$lock for v_$lock;
  5441.  
  5442. drop view v_$sesstat;
  5443. create view v_$sesstat as select * from v$sesstat;
  5444. drop public synonym v$sesstat;
  5445. create public synonym v$sesstat for v_$sesstat;
  5446.  
  5447. drop view v_$sysstat;
  5448. create view v_$sysstat as select * from v$sysstat;
  5449. drop public synonym v$sysstat;
  5450. create public synonym v$sysstat for v_$sysstat;
  5451.  
  5452. drop view v_$statname;
  5453. create view v_$statname as select * from v$statname;
  5454. drop public synonym v$statname;
  5455. create public synonym v$statname for v_$statname;
  5456.  
  5457. drop view v_$access;
  5458. create view v_$access as select * from v$access;
  5459. drop public synonym v$access;
  5460. create public synonym v$access for v_$access;
  5461.  
  5462. drop view v_$dbfile;
  5463. create view v_$dbfile as select * from v$dbfile;
  5464. drop public synonym v$dbfile;
  5465. create public synonym v$dbfile for v_$dbfile;
  5466.  
  5467. drop view v_$filestat;
  5468. create view v_$filestat as select * from v$filestat;
  5469. drop public synonym v$filestat;
  5470. create public synonym v$filestat for v_$filestat;
  5471.  
  5472. drop view v_$logfile;
  5473. create view v_$logfile as select * from v$logfile;
  5474. drop public synonym v$logfile;
  5475. create public synonym v$logfile for v_$logfile;
  5476.  
  5477. drop view v_$rollname;
  5478. create view v_$rollname as select * from v$rollname;
  5479. drop public synonym v$rollname;
  5480. create public synonym v$rollname for v_$rollname;
  5481.  
  5482. drop view v_$rollstat;
  5483. create view v_$rollstat as select * from v$rollstat;
  5484. drop public synonym v$rollstat;
  5485. create public synonym v$rollstat for v_$rollstat;
  5486.  
  5487. drop view v_$sga;
  5488. create view v_$sga as select * from v$sga;
  5489. drop public synonym v$sga;
  5490. create public synonym v$sga for v_$sga;
  5491.  
  5492. drop view v_$parameter;
  5493. create view v_$parameter as select * from v$parameter;
  5494. drop public synonym v$parameter;
  5495. create public synonym v$parameter for v_$parameter;
  5496.  
  5497. drop view v_$rowcache;
  5498. create view v_$rowcache as select * from v$rowcache;
  5499. drop public synonym v$rowcache;
  5500. create public synonym v$rowcache for v_$rowcache;
  5501.  
  5502. rem 
  5503. rem V5 views required for other Oracle products
  5504. rem
  5505.  
  5506. drop view syscatalog_;
  5507. create view syscatalog_ (tname, creator, creatorid, tabletype)
  5508.   as
  5509.   select o.name, u.name, o.owner#,
  5510.          decode(o.type, 2, 'TABLE', 4, 'VIEW', 6, 'SEQUENCE','?')
  5511.   from    sys.user$ u, sys.obj$ o
  5512.   where u.user# = o.owner#
  5513.     and    o.type in (2, 4, 6)
  5514.     and ( o.owner# = uid
  5515.         or o.obj# in
  5516.            (select tau.obj#
  5517.         from   sys.tabauth$ tau
  5518.         where  tau.grantee# in (uid, 1)
  5519.             )
  5520.     )
  5521. /
  5522. drop view syscatalog;
  5523. create view syscatalog (tname, creator, tabletype) as
  5524.   select tname, creator, tabletype
  5525.   from syscatalog_
  5526. /
  5527. grant select on syscatalog to public;
  5528. create synonym system.syscatalog for syscatalog;
  5529. rem
  5530. rem The catalog view returns almost all tables accessible to the user
  5531. rem except tables in SYS and SYSTEM ("dictionary tables").
  5532. rem 
  5533. drop view catalog;
  5534. create view catalog (tname, creator, tabletype) as
  5535.   select tname, creator, tabletype
  5536.   from    syscatalog_
  5537.   where creatorid not in (0,2)
  5538. /
  5539. grant select on catalog to public;
  5540. create synonym system.catalog for catalog;
  5541.  
  5542. drop view tab;
  5543. create view tab (tname, tabtype, clusterid) as
  5544.    select o.name,
  5545.       decode(o.type, 2, 'TABLE', 3, 'CLUSTER', 
  5546.              4, 'VIEW', 5, 'SYNONYM'), t.tab#
  5547.   from  sys.tab$ t, sys.obj$ o
  5548.   where o.owner# = uid and o.type >=2 and o.type <=5
  5549.      and o.obj# = t.obj# (+)
  5550. /
  5551. grant select on tab to public;
  5552. create synonym system.tab for tab;
  5553. drop view col;
  5554. create view col (tname, colno, cname, coltype, width, scale, precision, nulls,
  5555.                  defaultval) as
  5556.   select t.name, c.col#, c.name, 
  5557.      decode(c.type#, 1, 'CHAR',
  5558.                          2, decode(c.scale, null,
  5559.                                    decode(c.precision, null, 'NUMBER', 'FLOAT'),
  5560.                                   'NUMBER'),
  5561.                          8, 'LONG', 9, 'VARCHAR',
  5562.                          12, 'DATE', 23, 'RAW', 24, 'LONG RAW',
  5563.                          69, 'ROWID', 'UNDEFINED'),
  5564.          c.length, c.scale, c.precision,
  5565.      decode(c.null$, 0, 'NULL', 'NOT NULL'), c.default$
  5566.    from  sys.col$ c, sys.obj$ t
  5567.    where t.obj# = c.obj#
  5568.    and     t.type in (2, 3, 4)
  5569.    and     t.owner# = uid
  5570. /
  5571. grant select on col to public;
  5572. create synonym system.col for col;
  5573. drop view syssegobj;
  5574. create view syssegobj (obj#, file#, block#, type, pctfree$, pctused$) as
  5575.   select obj#, file#, block#, 'TABLE', pctfree$, pctused$ from sys.tab$
  5576.   union
  5577.   select obj#, file#, block#, 'CLUSTER', pctfree$, pctused$ from sys.clu$
  5578.   union 
  5579.   select obj#, file#, block#, 'INDEX', to_number(null), to_number(null)
  5580.          from sys.ind$
  5581. /
  5582. grant select on syssegobj to public;
  5583. drop view tabquotas;
  5584. create view tabquotas (tname, type, objno, nextext, maxext, pinc,
  5585.                pfree, pused) as
  5586.   select t.name, so.type, t.obj#, s.extsize, s.maxexts, s.extpct, so.pctfree$,
  5587.      so.pctused$
  5588.   from  sys.seg$ s, sys.obj$ t, syssegobj so
  5589.   where t.owner# = uid
  5590.     and t.obj# = so.obj#
  5591.     and so.file# = s.file# 
  5592.     and so.block# = s.block#
  5593. /
  5594. grant select on tabquotas to public;
  5595. create synonym system.tabquotas for tabquotas;
  5596.  
  5597. drop view sysfiles;
  5598. create view sysfiles (tsname, fname, blocks) as
  5599.   select ts.name, dbf.name, f.blocks
  5600.   from  sys.ts$ ts, sys.file$ f, sys.v$dbfile dbf
  5601.   where ts.ts# = f.ts#(+) and dbf.file# = f.file# and f.status$ = 2
  5602. /
  5603. grant select on sysfiles to public;
  5604. create synonym system.sysfiles for sysfiles;
  5605. drop view synonyms;
  5606. create view synonyms (sname, syntype, creator, tname, database, tabtype) as
  5607.   select s.name, 
  5608.      decode (s.owner#,1,'PUBLIC','PRIVATE'), t.owner, t.name, 'LOCAL', 
  5609.      decode(ot.type, 1, 'INDEX', 2, 'TABLE', 3, 'CLUSTER', 4, 'VIEW',
  5610.              5, 'SYNONYM', 6, 'SEQUENCE', 'UNDEFINED')
  5611.   from  sys.obj$ s, sys.obj$ ot, sys.syn$ t, sys.user$ u
  5612.   where s.obj# = t.obj# 
  5613.     and s.type = 5
  5614.     and ot.name = t.name
  5615.     and t.owner = u.name
  5616.     and ot.owner# = u.user#
  5617.     and s.owner# in (1,uid)
  5618.     and t.node is null
  5619. union
  5620.   select s.name, decode(s.owner#, 1, 'PUBLIC', 'PRIVATE'),
  5621.      t.owner, t.name, t.node, 'REMOTE'
  5622.   from  sys.obj$ s, sys.syn$ t
  5623.   where s.obj# = t.obj#
  5624.     and s.type = 5
  5625.     and s.owner# in (1, uid)
  5626.     and t.node is not null
  5627. /  
  5628. grant select on synonyms to public;
  5629. drop view publicsyn;
  5630. create view publicsyn (sname, creator, tname, database, tabtype) as
  5631.   select sname, creator, tname, database, tabtype
  5632.   from  synonyms
  5633.   where syntype = 'PUBLIC'
  5634. /
  5635. grant select on publicsyn to public;
  5636. create synonym system.publicsyn for publicsyn;
  5637.