home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 5 / 05.iso / a / a523 / 17.ddi / CATALOG.SQ2 next >
Encoding:
Text File  |  1990-10-12  |  47.9 KB  |  1,596 lines

  1.                            decode(c.precision, null, 'NUMBER', 'FLOAT'),
  2.                                  'NUMBER'),
  3.                        8, 'LONG', 9, 'VARCHAR',
  4.                        12, 'DATE', 23, 'RAW', 24, 'LONG RAW',
  5.                        69, 'ROWID',  'UNDEFINED'),
  6.        c.length, c.precision, c.scale,
  7.        decode(c.null$, 0, 'Y', 'N'), c.col#, c.deflength, c.default$
  8. from sys.col$ c, sys.obj$ o, sys.user$ u
  9. where o.obj# = c.obj#
  10.   and o.owner# = u.user#
  11.   and o.type in (2, 3, 4)
  12. /
  13. comment on table DBA_TAB_COLUMNS is
  14. 'Columns of all tables, views and clusters'
  15. /
  16. comment on column DBA_TAB_COLUMNS.OWNER is
  17. 'Owner of the table, view or cluster'
  18. /
  19. comment on column DBA_TAB_COLUMNS.TABLE_NAME is
  20. 'Table, view or cluster name'
  21. /
  22. comment on column DBA_TAB_COLUMNS.COLUMN_NAME is
  23. 'Column name'
  24. /
  25. comment on column DBA_TAB_COLUMNS.DATA_LENGTH is
  26. 'Length of the column in bytes'
  27. /
  28. comment on column DBA_TAB_COLUMNS.DATA_TYPE is
  29. 'Datatype of the column'
  30. /
  31. comment on column DBA_TAB_COLUMNS.DATA_PRECISION is
  32. 'Length: decimal digits (NUMBER), binary digits (FLOAT)'
  33. /
  34. comment on column DBA_TAB_COLUMNS.DATA_SCALE is
  35. 'Digits to right of decimal point in a number'
  36. /
  37. comment on column DBA_TAB_COLUMNS.NULLABLE is
  38. 'Does column allow NULL values?'
  39. /
  40. comment on column DBA_TAB_COLUMNS.COLUMN_ID is
  41. 'Sequence number of the column as created'
  42. /
  43. comment on column DBA_TAB_COLUMNS.DEFAULT_LENGTH is
  44. 'Length of default value for the column'
  45. /
  46. comment on column DBA_TAB_COLUMNS.DATA_DEFAULT is
  47. 'Default value for the column'
  48. /
  49. remark
  50. remark  FAMILY "TAB_COMMENTS"
  51. remark  Comments on objects.
  52. remark
  53. drop view USER_TAB_COMMENTS
  54. /
  55. create view USER_TAB_COMMENTS
  56.     (TABLE_NAME,
  57.      TABLE_TYPE,
  58.      COMMENTS)
  59. as
  60. select o.name,
  61.        decode(o.type, 0, 'NEXT OBJECT', 1, 'INDEX', 2, 'TABLE', 3, 'CLUSTER',
  62.                       4, 'VIEW', 5, 'SYNONYM', 'UNDEFINED'),
  63.        c.comment$
  64. from sys.obj$ o, sys.com$ c
  65. where o.owner# = uid
  66.   and o.type in (2, 4)
  67.   and o.obj# = c.obj#(+)
  68.   and c.col#(+) is null
  69. /
  70. comment on table USER_TAB_COMMENTS is
  71. 'Comments on the tables and views owned by the user'
  72. /
  73. comment on column USER_TAB_COMMENTS.TABLE_NAME is
  74. 'Name of the object'
  75. /
  76. comment on column USER_TAB_COMMENTS.TABLE_TYPE is
  77. 'Type of the object:  "TABLE" or "VIEW"'
  78. /
  79. comment on column USER_TAB_COMMENTS.COMMENTS is
  80. 'Comment on the object'
  81. /
  82. drop public synonym USER_TAB_COMMENTS
  83. /
  84. create public synonym USER_TAB_COMMENTS for USER_TAB_COMMENTS
  85. /
  86. grant select on USER_TAB_COMMENTS to PUBLIC
  87. /
  88. drop view ALL_TAB_COMMENTS
  89. /
  90. create view ALL_TAB_COMMENTS
  91.     (OWNER, TABLE_NAME,
  92.      TABLE_TYPE,
  93.      COMMENTS)
  94. as
  95. select u.name, o.name,
  96.        decode(o.type, 0, 'NEXT OBJECT', 1, 'INDEX', 2, 'TABLE', 3, 'CLUSTER',
  97.                       4, 'VIEW', 5, 'SYNONYM', 'UNDEFINED'),
  98.        c.comment$
  99. from sys.obj$ o, sys.user$ u, sys.com$ c
  100. where o.owner# = u.user#
  101.   and o.obj# = c.obj#(+)
  102.   and c.col#(+) is null
  103.   and o.type in (2, 4)
  104.   and (o.owner# = uid
  105.         or
  106.         o.obj# in ( select obj#
  107.                     from sys.tabauth$
  108.                     where grantee# in ( uid, 1 )
  109.                   )
  110.        )
  111. /
  112. comment on table ALL_TAB_COMMENTS is
  113. 'Comments on tables and views accessible to the user'
  114. /
  115. comment on column ALL_TAB_COMMENTS.OWNER is
  116. 'Owner of the object'
  117. /
  118. comment on column ALL_TAB_COMMENTS.TABLE_NAME is
  119. 'Name of the object'
  120. /
  121. comment on column ALL_TAB_COMMENTS.TABLE_TYPE is
  122. 'Type of the object'
  123. /
  124. comment on column ALL_TAB_COMMENTS.COMMENTS is
  125. 'Comment on the object'
  126. /
  127. drop public synonym ALL_TAB_COMMENTS
  128. /
  129. create public synonym ALL_TAB_COMMENTS for ALL_TAB_COMMENTS
  130. /
  131. grant select on ALL_TAB_COMMENTS to PUBLIC
  132. /
  133. drop view DBA_TAB_COMMENTS
  134. /
  135. create view DBA_TAB_COMMENTS
  136.     (OWNER, TABLE_NAME,
  137.      TABLE_TYPE,
  138.      COMMENTS)
  139. as
  140. select u.name, o.name,
  141.        decode(o.type, 0, 'NEXT OBJECT', 1, 'INDEX', 2, 'TABLE', 3, 'CLUSTER',
  142.                       4, 'VIEW', 5, 'SYNONYM', 'UNDEFINED'),
  143.        c.comment$
  144. from sys.obj$ o, sys.user$ u, sys.com$ c
  145. where o.owner# = u.user#
  146.   and o.type in (2, 4)
  147.   and o.obj# = c.obj#(+)
  148.   and c.col#(+) is null
  149. /
  150. comment on table DBA_TAB_COMMENTS is
  151. 'Comments on all tables and views in the database'
  152. /
  153. comment on column DBA_TAB_COMMENTS.OWNER is
  154. 'Owner of the object'
  155. /
  156. comment on column DBA_TAB_COMMENTS.TABLE_NAME is
  157. 'Name of the object'
  158. /
  159. comment on column DBA_TAB_COMMENTS.TABLE_TYPE is
  160. 'Type of the object'
  161. /
  162. comment on column DBA_TAB_COMMENTS.COMMENTS is
  163. 'Comment on the object'
  164. /
  165. remark
  166. remark  FAMILY "TAB_GRANTS"
  167. remark  Grants on objects.
  168. remark
  169. drop view USER_TAB_GRANTS
  170. /
  171. create view USER_TAB_GRANTS
  172.       (GRANTEE, OWNER, TABLE_NAME, GRANTOR,
  173.        SELECT_PRIV, INSERT_PRIV, DELETE_PRIV, 
  174.        UPDATE_PRIV, REFERENCES_PRIV, ALTER_PRIV, INDEX_PRIV,
  175.        CREATED)
  176. as
  177. select ue.name, u.name, o.name, ur.name,
  178.        decode(ta.select$, 0, 'N', 2, 'Y', 3, 'G', '?'),
  179.        decode(ta.insert$, 0, 'N', 1, 'S', 2, 'A', 3, 'G', '?'),
  180.        decode(ta.delete$, 0, 'N', 2, 'Y', 3, 'G', '?'),
  181.        decode(ta.update$, 0, 'N', 1, 'S', 2, 'A', 3, 'G', '?'),
  182.        decode(ta.references$, 0, 'N', 1, 'S', 2, 'A', 3, 'G', '?'),
  183.        decode(ta.alter$, 0, 'N', 2, 'Y', 3, 'G', '?'),
  184.        decode(ta.index$, 0, 'N', 2, 'Y', 3, 'G', '?'),
  185.        ta.time
  186. from sys.tabauth$ ta, sys.obj$ o, sys.user$ u, sys.user$ ur, sys.user$ ue
  187. where ta.obj# = o.obj#
  188.   and ta.grantor# = ur.user#
  189.   and ta.grantee# = ue.user#
  190.   and u.user# = o.owner#
  191.   and uid in (ta.grantor#, ta.grantee#, o.owner#)
  192. /
  193. comment on table USER_TAB_GRANTS is
  194. 'Grants on objects for which the user is the owner, grantor or grantee'
  195. /
  196. comment on column USER_TAB_GRANTS.GRANTEE is
  197. 'Name of the user to whom access was granted'
  198. /
  199. comment on column USER_TAB_GRANTS.OWNER is
  200. 'Owner of the object'
  201. /
  202. comment on column USER_TAB_GRANTS.TABLE_NAME is
  203. 'Name of the object'
  204. /
  205. comment on column USER_TAB_GRANTS.GRANTOR is
  206. 'Name of the user who performed the grant'
  207. /
  208. comment on column USER_TAB_GRANTS.SELECT_PRIV is
  209. 'Permission to SELECT from the object?'
  210. /
  211. comment on column USER_TAB_GRANTS.INSERT_PRIV is
  212. 'Permission to INSERT into the object?'
  213. /
  214. comment on column USER_TAB_GRANTS.DELETE_PRIV is
  215. 'Permission to DELETE from the object?'
  216. /
  217. comment on column USER_TAB_GRANTS.UPDATE_PRIV is
  218. 'Permission to UPDATE the object?'
  219. /
  220. comment on column USER_TAB_GRANTS.REFERENCES_PRIV is
  221. 'Permission to make REFERENCES to the object?'
  222. /
  223. comment on column USER_TAB_GRANTS.ALTER_PRIV is
  224. 'Permission to ALTER the object?'
  225. /
  226. comment on column USER_TAB_GRANTS.INDEX_PRIV is
  227. 'Permission to create/drop an INDEX on the object?'
  228. /
  229. comment on column USER_TAB_GRANTS.CREATED is
  230. 'Timestamp for the grant'
  231. /
  232. drop public synonym USER_TAB_GRANTS
  233. /
  234. create public synonym USER_TAB_GRANTS for USER_TAB_GRANTS
  235. /
  236. grant select on USER_TAB_GRANTS to PUBLIC
  237. /
  238. drop view TABLE_PRIVILEGES
  239. /
  240. create view TABLE_PRIVILEGES
  241.       (GRANTEE, OWNER, TABLE_NAME, GRANTOR,
  242.        SELECT_PRIV, INSERT_PRIV, DELETE_PRIV, 
  243.        UPDATE_PRIV, REFERENCES_PRIV, ALTER_PRIV, INDEX_PRIV,
  244.        CREATED)
  245. as
  246. select ue.name, u.name, o.name, ur.name,
  247.        decode(ta.select$, 0, 'N', 2, 'Y', 3, 'G', '?'),
  248.        decode(ta.insert$, 0, 'N', 1, 'S', 2, 'A', 3, 'G', '?'),
  249.        decode(ta.delete$, 0, 'N', 2, 'Y', 3, 'G', '?'),
  250.        decode(ta.update$, 0, 'N', 1, 'S', 2, 'A', 3, 'G', '?'),
  251.        decode(ta.references$, 0, 'N', 1, 'S', 2, 'A', 3, 'G', '?'),
  252.        decode(ta.alter$, 0, 'N', 2, 'Y', 3, 'G', '?'),
  253.        decode(ta.index$, 0, 'N', 2, 'Y', 3, 'G', '?'),
  254.        ta.time
  255. from sys.tabauth$ ta, sys.obj$ o, sys.user$ u, sys.user$ ur, sys.user$ ue
  256. where ta.obj# = o.obj#
  257.   and ta.grantor# = ur.user#
  258.   and ta.grantee# = ue.user#
  259.   and u.user# = o.owner#
  260.   and (uid in (ta.grantor#, ta.grantee#, o.owner#)
  261.    or  ta.grantee# = 1)
  262. /
  263. comment on table TABLE_PRIVILEGES is
  264. 'Grants on objects for which the user is the grantor, grantee, or owner, or PUBLIC is the grantee'
  265. /
  266. comment on column TABLE_PRIVILEGES.GRANTEE is
  267. 'Name of the user to whom access was granted'
  268. /
  269. comment on column TABLE_PRIVILEGES.OWNER is
  270. 'Owner of the object'
  271. /
  272. comment on column TABLE_PRIVILEGES.TABLE_NAME is
  273. 'Name of the object'
  274. /
  275. comment on column TABLE_PRIVILEGES.GRANTOR is
  276. 'Name of the user who performed the grant'
  277. /
  278. comment on column TABLE_PRIVILEGES.SELECT_PRIV is
  279. 'Permission to SELECT from the object?'
  280. /
  281. comment on column TABLE_PRIVILEGES.INSERT_PRIV is
  282. 'Permission to INSERT into the object?'
  283. /
  284. comment on column TABLE_PRIVILEGES.DELETE_PRIV is
  285. 'Permission to DELETE from the object?'
  286. /
  287. comment on column TABLE_PRIVILEGES.UPDATE_PRIV is
  288. 'Permission to UPDATE the object?'
  289. /
  290. comment on column TABLE_PRIVILEGES.REFERENCES_PRIV is
  291. 'Permission to make REFERENCES to the object?'
  292. /
  293. comment on column TABLE_PRIVILEGES.ALTER_PRIV is
  294. 'Permission to ALTER the object?'
  295. /
  296. comment on column TABLE_PRIVILEGES.INDEX_PRIV is
  297. 'Permission to create/drop an INDEX on the object?'
  298. /
  299. comment on column TABLE_PRIVILEGES.CREATED is
  300. 'Timestamp for the grant'
  301. /
  302. drop public synonym TABLE_PRIVILEGES
  303. /
  304. create public synonym TABLE_PRIVILEGES for TABLE_PRIVILEGES
  305. /
  306. drop public synonym ALL_TAB_GRANTS
  307. /
  308. create public synonym ALL_TAB_GRANTS for TABLE_PRIVILEGES
  309. /
  310. grant select on TABLE_PRIVILEGES to PUBLIC
  311. /
  312. drop view DBA_TAB_GRANTS
  313. /
  314. create view DBA_TAB_GRANTS
  315.       (GRANTEE, OWNER, TABLE_NAME, GRANTOR,
  316.        SELECT_PRIV, INSERT_PRIV, DELETE_PRIV, 
  317.        UPDATE_PRIV, REFERENCES_PRIV, ALTER_PRIV, INDEX_PRIV,
  318.        CREATED)
  319. as
  320. select ue.name, u.name, o.name, ur.name,
  321.        decode(ta.select$, 0, 'N', 2, 'Y', 3, 'G', '?'),
  322.        decode(ta.insert$, 0, 'N', 1, 'S', 2, 'A', 3, 'G', '?'),
  323.        decode(ta.delete$, 0, 'N', 2, 'Y', 3, 'G', '?'),
  324.        decode(ta.update$, 0, 'N', 1, 'S', 2, 'A', 3, 'G', '?'),
  325.        decode(ta.references$, 0, 'N', 1, 'S', 2, 'A', 3, 'G', '?'),
  326.        decode(ta.alter$, 0, 'N', 2, 'Y', 3, 'G', '?'),
  327.        decode(ta.index$, 0, 'N', 2, 'Y', 3, 'G', '?'),
  328.        ta.time
  329. from sys.tabauth$ ta, sys.obj$ o, sys.user$ u, sys.user$ ur, sys.user$ ue
  330. where ta.obj# = o.obj#
  331.   and ta.grantor# = ur.user#
  332.   and ta.grantee# = ue.user#
  333.   and u.user# = o.owner#
  334. /
  335. comment on table DBA_TAB_GRANTS is
  336. 'All grants on objects in the database'
  337. /
  338. comment on column DBA_TAB_GRANTS.GRANTEE is
  339. 'User to whom access was granted'
  340. /
  341. comment on column DBA_TAB_GRANTS.OWNER is
  342. 'Owner of the object'
  343. /
  344. comment on column DBA_TAB_GRANTS.TABLE_NAME is
  345. 'Name of the object'
  346. /
  347. comment on column DBA_TAB_GRANTS.GRANTOR is
  348. 'Name of the user who performed the grant'
  349. /
  350. comment on column DBA_TAB_GRANTS.SELECT_PRIV is
  351. 'Permission to SELECT from the object?'
  352. /
  353. comment on column DBA_TAB_GRANTS.INSERT_PRIV is
  354. 'Permission to INSERT into the object?'
  355. /
  356. comment on column DBA_TAB_GRANTS.DELETE_PRIV is
  357. 'Permission to DELETE from the object?'
  358. /
  359. comment on column DBA_TAB_GRANTS.UPDATE_PRIV is
  360. 'Permission to UPDATE the object?'
  361. /
  362. comment on column DBA_TAB_GRANTS.REFERENCES_PRIV is
  363. 'Permission to make REFERENCES to the object?'
  364. /
  365. comment on column DBA_TAB_GRANTS.ALTER_PRIV is
  366. 'Permission to ALTER the object?'
  367. /
  368. comment on column DBA_TAB_GRANTS.INDEX_PRIV is
  369. 'Permission to create/drop an INDEX on the object?'
  370. /
  371. comment on column DBA_TAB_GRANTS.CREATED is
  372. 'Timestamp for the grant'
  373. /
  374. remark
  375. remark  FAMILY "TAB_GRANTS_MADE"
  376. remark  Grants made on objects.
  377. remark  This family has no DBA member.
  378. remark
  379. drop view USER_TAB_GRANTS_MADE
  380. /
  381. create view USER_TAB_GRANTS_MADE
  382.       (GRANTEE, TABLE_NAME, GRANTOR,
  383.        SELECT_PRIV, INSERT_PRIV, DELETE_PRIV, 
  384.        UPDATE_PRIV, REFERENCES_PRIV, ALTER_PRIV, INDEX_PRIV,
  385.        CREATED)
  386. as
  387. select ue.name, o.name, ur.name,
  388.        decode(ta.select$, 0, 'N', 2, 'Y', 3, 'G', '?'),
  389.        decode(ta.insert$, 0, 'N', 1, 'S', 2, 'A', 3, 'G', '?'),
  390.        decode(ta.delete$, 0, 'N', 2, 'Y', 3, 'G', '?'),
  391.        decode(ta.update$, 0, 'N', 1, 'S', 2, 'A', 3, 'G', '?'),
  392.        decode(ta.references$, 0, 'N', 1, 'S', 2, 'A', 3, 'G', '?'),
  393.        decode(ta.alter$, 0, 'N', 2, 'Y', 3, 'G', '?'),
  394.        decode(ta.index$, 0, 'N', 2, 'Y', 3, 'G', '?'),
  395.        ta.time
  396. from sys.tabauth$ ta, sys.obj$ o, sys.user$ ue, sys.user$ ur
  397. where ta.obj# = o.obj#
  398.   and ta.grantor# = ur.user#
  399.   and ta.grantee# = ue.user#
  400.   and o.owner# = uid
  401. /
  402. comment on table USER_TAB_GRANTS_MADE is
  403. 'All grants on objects owned by the user'
  404. /
  405. comment on column USER_TAB_GRANTS_MADE.GRANTEE is
  406. 'Name of the user to whom access was granted'
  407. /
  408. comment on column USER_TAB_GRANTS_MADE.TABLE_NAME is
  409. 'Name of the object'
  410. /
  411. comment on column USER_TAB_GRANTS_MADE.GRANTOR is
  412. 'Name of the user who performed the grant'
  413. /
  414. comment on column USER_TAB_GRANTS_MADE.SELECT_PRIV is
  415. 'Permission to SELECT from the object?'
  416. /
  417. comment on column USER_TAB_GRANTS_MADE.INSERT_PRIV is
  418. 'Permission to INSERT into the object?'
  419. /
  420. comment on column USER_TAB_GRANTS_MADE.DELETE_PRIV is
  421. 'Permission to DELETE from the object?'
  422. /
  423. comment on column USER_TAB_GRANTS_MADE.UPDATE_PRIV is
  424. 'Permission to UPDATE the object?'
  425. /
  426. comment on column USER_TAB_GRANTS_MADE.REFERENCES_PRIV is
  427. 'Permission to make REFERENCES to the object?'
  428. /
  429. comment on column USER_TAB_GRANTS_MADE.ALTER_PRIV is
  430. 'Permission to ALTER the object?'
  431. /
  432. comment on column USER_TAB_GRANTS_MADE.INDEX_PRIV is
  433. 'Permission to CREATE/DROP INDEX on the object?'
  434. /
  435. comment on column USER_TAB_GRANTS_MADE.CREATED is
  436. 'Timestamp for the grant'
  437. /
  438. drop public synonym USER_TAB_GRANTS_MADE
  439. /
  440. create public synonym USER_TAB_GRANTS_MADE for USER_TAB_GRANTS_MADE
  441. /
  442. grant select on USER_TAB_GRANTS_MADE to PUBLIC
  443. /
  444. drop view ALL_TAB_GRANTS_MADE
  445. /
  446. create view ALL_TAB_GRANTS_MADE
  447.       (GRANTEE, OWNER, TABLE_NAME, GRANTOR,
  448.        SELECT_PRIV, INSERT_PRIV, DELETE_PRIV, 
  449.        UPDATE_PRIV, REFERENCES_PRIV, ALTER_PRIV, INDEX_PRIV,
  450.        CREATED)
  451. as
  452. select ue.name, u.name, o.name, ur.name,
  453.        decode(ta.select$, 0, 'N', 2, 'Y', 3, 'G', '?'),
  454.        decode(ta.insert$, 0, 'N', 1, 'S', 2, 'A', 3, 'G', '?'),
  455.        decode(ta.delete$, 0, 'N', 2, 'Y', 3, 'G', '?'),
  456.        decode(ta.update$, 0, 'N', 1, 'S', 2, 'A', 3, 'G', '?'),
  457.        decode(ta.references$, 0, 'N', 1, 'S', 2, 'A', 3, 'G', '?'),
  458.        decode(ta.alter$, 0, 'N', 2, 'Y', 3, 'G', '?'),
  459.        decode(ta.index$, 0, 'N', 2, 'Y', 3, 'G', '?'),
  460.        ta.time
  461. from sys.tabauth$ ta, sys.obj$ o, sys.user$ u, sys.user$ ur, sys.user$ ue
  462. where ta.obj# = o.obj#
  463.   and ta.grantor# = ur.user#
  464.   and ta.grantee# = ue.user#
  465.   and u.user# = o.owner#
  466.   and uid in (o.owner#, ta.grantor#)
  467. /
  468. comment on table ALL_TAB_GRANTS_MADE is
  469. 'User''s grants and grants on user''s objects'
  470. /
  471. comment on column ALL_TAB_GRANTS_MADE.GRANTEE is
  472. 'Name of the user to whom access was granted'
  473. /
  474. comment on column ALL_TAB_GRANTS_MADE.OWNER is
  475. 'Owner of the object'
  476. /
  477. comment on column ALL_TAB_GRANTS_MADE.TABLE_NAME is
  478. 'Name of the object'
  479. /
  480. comment on column ALL_TAB_GRANTS_MADE.GRANTOR is
  481. 'Name of the user who performed the grant'
  482. /
  483. comment on column ALL_TAB_GRANTS_MADE.SELECT_PRIV is
  484. 'Permission to SELECT from the object?'
  485. /
  486. comment on column ALL_TAB_GRANTS_MADE.INSERT_PRIV is
  487. 'Permission to INSERT into the object?'
  488. /
  489. comment on column ALL_TAB_GRANTS_MADE.DELETE_PRIV is
  490. 'Permission to DELETE from the object?'
  491. /
  492. comment on column ALL_TAB_GRANTS_MADE.UPDATE_PRIV is
  493. 'Permission to UPDATE the object?'
  494. /
  495. comment on column ALL_TAB_GRANTS_MADE.REFERENCES_PRIV is
  496. 'Permission to make REFERENCES to the object?'
  497. /
  498. comment on column ALL_TAB_GRANTS_MADE.ALTER_PRIV is
  499. 'Permission to ALTER the object?'
  500. /
  501. comment on column ALL_TAB_GRANTS_MADE.INDEX_PRIV is
  502. 'Permission to CREATE/DROP INDEX on the object?'
  503. /
  504. comment on column ALL_TAB_GRANTS_MADE.CREATED is
  505. 'Timestamp for the grant'
  506. /
  507. drop public synonym ALL_TAB_GRANTS_MADE
  508. /
  509. create public synonym ALL_TAB_GRANTS_MADE for ALL_TAB_GRANTS_MADE
  510. /
  511. grant select on ALL_TAB_GRANTS_MADE to PUBLIC
  512. /
  513. remark
  514. remark  FAMILY "TAB_GRANTS_RECD"
  515. remark  Grants received on objects.
  516. remark  This family has no DBA member.
  517. remark
  518. drop view USER_TAB_GRANTS_RECD
  519. /
  520. create view USER_TAB_GRANTS_RECD
  521.       (OWNER, TABLE_NAME, GRANTOR,
  522.        SELECT_PRIV, INSERT_PRIV, DELETE_PRIV, 
  523.        UPDATE_PRIV, REFERENCES_PRIV, ALTER_PRIV, INDEX_PRIV,
  524.        CREATED)
  525. as
  526. select u.name, o.name, ur.name,
  527.        decode(ta.select$, 0, 'N', 2, 'Y', 3, 'G', '?'),
  528.        decode(ta.insert$, 0, 'N', 1, 'S', 2, 'A', 3, 'G', '?'),
  529.        decode(ta.delete$, 0, 'N', 2, 'Y', 3, 'G', '?'),
  530.        decode(ta.update$, 0, 'N', 1, 'S', 2, 'A', 3, 'G', '?'),
  531.        decode(ta.references$, 0, 'N', 1, 'S', 2, 'A', 3, 'G', '?'),
  532.        decode(ta.alter$, 0, 'N', 2, 'Y', 3, 'G', '?'),
  533.        decode(ta.index$, 0, 'N', 2, 'Y', 3, 'G', '?'),
  534.        ta.time
  535. from sys.tabauth$ ta, sys.obj$ o, sys.user$ u, sys.user$ ur
  536. where ta.obj# = o.obj#
  537.   and ta.grantor# = ur.user#
  538.   and u.user# = o.owner#
  539.   and ta.grantee# = uid
  540. /
  541. comment on table USER_TAB_GRANTS_RECD is
  542. 'Grants on objects for which the user is the grantee'
  543. /
  544. comment on column USER_TAB_GRANTS_RECD.OWNER is
  545. 'Owner of the object'
  546. /
  547. comment on column USER_TAB_GRANTS_RECD.TABLE_NAME is
  548. 'Name of the object'
  549. /
  550. comment on column USER_TAB_GRANTS_RECD.GRANTOR is
  551. 'Name of the user who performed the grant'
  552. /
  553. comment on column USER_TAB_GRANTS_RECD.SELECT_PRIV is
  554. 'Permission to SELECT from the object?'
  555. /
  556. comment on column USER_TAB_GRANTS_RECD.INSERT_PRIV is
  557. 'Permission to INSERT into the object?'
  558. /
  559. comment on column USER_TAB_GRANTS_RECD.DELETE_PRIV is
  560. 'Permission to DELETE from the object?'
  561. /
  562. comment on column USER_TAB_GRANTS_RECD.UPDATE_PRIV is
  563. 'Permission to UPDATE the object?'
  564. /
  565. comment on column USER_TAB_GRANTS_RECD.REFERENCES_PRIV is
  566. 'Permission to make REFERENCES to the object?'
  567. /
  568. comment on column USER_TAB_GRANTS_RECD.ALTER_PRIV is
  569. 'Permission to ALTER the object?'
  570. /
  571. comment on column USER_TAB_GRANTS_RECD.INDEX_PRIV is
  572. 'Permission to create/drop an INDEX on the object?'
  573. /
  574. comment on column USER_TAB_GRANTS_RECD.CREATED is
  575. 'Timestamp for the grant'
  576. /
  577. drop public synonym USER_TAB_GRANTS_RECD
  578. /
  579. create public synonym USER_TAB_GRANTS_RECD for USER_TAB_GRANTS_RECD
  580. /
  581. grant select on USER_TAB_GRANTS_RECD to PUBLIC
  582. /
  583. drop view ALL_TAB_GRANTS_RECD
  584. /
  585. create view ALL_TAB_GRANTS_RECD
  586.       (GRANTEE, OWNER, TABLE_NAME, GRANTOR,
  587.        SELECT_PRIV, INSERT_PRIV, DELETE_PRIV, 
  588.        UPDATE_PRIV, REFERENCES_PRIV, ALTER_PRIV, INDEX_PRIV,
  589.        CREATED)
  590. as
  591. select ue.name, u.name, o.name, ur.name,
  592.        decode(ta.select$, 0, 'N', 2, 'Y', 3, 'G', '?'),
  593.        decode(ta.insert$, 0, 'N', 1, 'S', 2, 'A', 3, 'G', '?'),
  594.        decode(ta.delete$, 0, 'N', 2, 'Y', 3, 'G', '?'),
  595.        decode(ta.update$, 0, 'N', 1, 'S', 2, 'A', 3, 'G', '?'),
  596.        decode(ta.references$, 0, 'N', 1, 'S', 2, 'A', 3, 'G', '?'),
  597.        decode(ta.alter$, 0, 'N', 2, 'Y', 3, 'G', '?'),
  598.        decode(ta.index$, 0, 'N', 2, 'Y', 3, 'G', '?'),
  599.        ta.time
  600. from sys.tabauth$ ta, sys.obj$ o, sys.user$ u, sys.user$ ur, sys.user$ ue
  601. where ta.obj# = o.obj#
  602.   and ta.grantor# = ur.user#
  603.   and ta.grantee# = ue.user#
  604.   and u.user# = o.owner#
  605.   and ta.grantee# in (uid, 1)
  606. /
  607. comment on table ALL_TAB_GRANTS_RECD is
  608. 'Grants on objects for which the user or PUBLIC is the grantee'
  609. /
  610. comment on column ALL_TAB_GRANTS_RECD.GRANTEE is
  611. 'Name of the user to whom access was granted'
  612. /
  613. comment on column ALL_TAB_GRANTS_RECD.OWNER is
  614. 'Owner of the object'
  615. /
  616. comment on column ALL_TAB_GRANTS_RECD.TABLE_NAME is
  617. 'Name of the object'
  618. /
  619. comment on column ALL_TAB_GRANTS_RECD.GRANTOR is
  620. 'Name of the user who performed the grant'
  621. /
  622. comment on column ALL_TAB_GRANTS_RECD.SELECT_PRIV is
  623. 'Permission to SELECT from the object?'
  624. /
  625. comment on column ALL_TAB_GRANTS_RECD.INSERT_PRIV is
  626. 'Permission to INSERT into the object?'
  627. /
  628. comment on column ALL_TAB_GRANTS_RECD.DELETE_PRIV is
  629. 'Permission to DELETE from the object?'
  630. /
  631. comment on column ALL_TAB_GRANTS_RECD.UPDATE_PRIV is
  632. 'Permission to UPDATE the object?'
  633. /
  634. comment on column ALL_TAB_GRANTS_RECD.REFERENCES_PRIV is
  635. 'Permission to make REFERENCES to the object?'
  636. /
  637. comment on column ALL_TAB_GRANTS_RECD.ALTER_PRIV is
  638. 'Permission to ALTER the object?'
  639. /
  640. comment on column ALL_TAB_GRANTS_RECD.INDEX_PRIV is
  641. 'Permission to create/drop an INDEX on the object?'
  642. /
  643. comment on column ALL_TAB_GRANTS_RECD.CREATED is
  644. 'Timestamp for the grant'
  645. /
  646. drop public synonym ALL_TAB_GRANTS_RECD
  647. /
  648. create public synonym ALL_TAB_GRANTS_RECD for ALL_TAB_GRANTS_RECD
  649. /
  650. grant select on ALL_TAB_GRANTS_RECD to PUBLIC
  651. /
  652. remark
  653. remark  FAMILY "TS_QUOTAS"
  654. remark  Tablespace quotas for users.
  655. remark  This family has no ALL member.
  656. remark
  657. drop view USER_TS_QUOTAS
  658. /
  659. create view USER_TS_QUOTAS
  660.     (TABLESPACE_NAME, BYTES, MAX_BYTES, BLOCKS, MAX_BLOCKS)
  661. as
  662. select ts.name, q.blocks * ts.blocksize,
  663.        q.maxblocks * ts.blocksize,
  664.        q.blocks, q.maxblocks
  665. from sys.tsq$ q, sys.ts$ ts
  666. where q.ts# = ts.ts#
  667.   and q.user# = uid
  668. /
  669. comment on table USER_TS_QUOTAS is
  670. 'Tablespace quotas for the user'
  671. /
  672. comment on column USER_TS_QUOTAS.TABLESPACE_NAME is
  673. 'Tablespace name'
  674. /
  675. comment on column USER_TS_QUOTAS.BLOCKS is
  676. 'Number of ORACLE blocks charged to the user'
  677. /
  678. comment on column USER_TS_QUOTAS.MAX_BLOCKS is
  679. 'User''s quota in ORACLE blocks.  NULL if no limit'
  680. /
  681. comment on column USER_TS_QUOTAS.BYTES is
  682. 'Number of bytes charged to the user'
  683. /
  684. comment on column USER_TS_QUOTAS.MAX_BYTES is
  685. 'User''s quota in bytes.  NULL if no limit'
  686. /
  687. drop public synonym USER_TS_QUOTAS
  688. /
  689. create public synonym USER_TS_QUOTAS for USER_TS_QUOTAS
  690. /
  691. grant select on USER_TS_QUOTAS to PUBLIC
  692. /
  693. drop view DBA_TS_QUOTAS
  694. /
  695. create view DBA_TS_QUOTAS
  696.     (TABLESPACE_NAME, USERNAME, BYTES, MAX_BYTES, BLOCKS, MAX_BLOCKS)
  697. as
  698. select ts.name, u.name, 
  699.        q.blocks * ts.blocksize, q.maxblocks * ts.blocksize,
  700.        q.blocks, q.maxblocks
  701. from sys.tsq$ q, sys.ts$ ts, sys.user$ u
  702. where q.ts# = ts.ts#
  703.   and q.user# = u.user#
  704. /
  705. comment on table DBA_TS_QUOTAS is
  706. 'Tablespace quotas for all users'
  707. /
  708. comment on column DBA_TS_QUOTAS.TABLESPACE_NAME is
  709. 'Tablespace name'
  710. /
  711. comment on column DBA_TS_QUOTAS.USERNAME is
  712. 'User with resource rights on the tablespace'
  713. /
  714. comment on column DBA_TS_QUOTAS.BLOCKS is
  715. 'Number of ORACLE blocks charged to the user'
  716. /
  717. comment on column DBA_TS_QUOTAS.MAX_BLOCKS is
  718. 'User''s quota in ORACLE blocks.  NULL if no limit'
  719. /
  720. comment on column DBA_TS_QUOTAS.BYTES is
  721. 'Number of bytes charged to the user'
  722. /
  723. comment on column DBA_TS_QUOTAS.MAX_BYTES is
  724. 'User''s quota in bytes.  NULL if no limit'
  725. /
  726. remark
  727. remark  FAMILY "USERS"
  728. remark  Users enrolled in the database.
  729. remark
  730. drop view USER_USERS
  731. /
  732. create view USER_USERS
  733.     (USERNAME, USER_ID,
  734.      CONNECT_PRIV, RESOURCE_PRIV, DBA_PRIV,
  735.      DEFAULT_TABLESPACE, TEMPORARY_TABLESPACE, CREATED, EXPIRES)
  736. as
  737. select u.name, u.user#,
  738.        u.connect$, u.resource$, u.dba$,
  739.        dts.name, tts.name, u.ctime, u.ptime
  740. from sys.user$ u, sys.ts$ dts, sys.ts$ tts
  741. where u.datats# = dts.ts#
  742.   and u.tempts# = tts.ts#
  743.   and u.user# = uid
  744. /
  745. comment on table USER_USERS is
  746. 'Information about the current user'
  747. /
  748. comment on column USER_USERS.USERNAME is
  749. 'Name of the user'
  750. /
  751. comment on column USER_USERS.USER_ID is
  752. 'ID number of the user'
  753. /
  754. comment on column USER_USERS.CONNECT_PRIV is
  755. 'Does user have CONNECT privilege?'
  756. /
  757. comment on column USER_USERS.RESOURCE_PRIV is
  758. 'Does user have RESOURCE privilege?'
  759. /
  760. comment on column USER_USERS.DBA_PRIV is
  761. 'Does user have DBA Privilege?'
  762. /
  763. comment on column USER_USERS.DEFAULT_TABLESPACE is
  764. 'Default tablespace for data'
  765. /
  766. comment on column USER_USERS.TEMPORARY_TABLESPACE is
  767. 'Default tablespace for temporary tables'
  768. /
  769. comment on column USER_USERS.CREATED is
  770. 'User creation date'
  771. /
  772. comment on column USER_USERS.EXPIRES is
  773. 'Password expiration date'
  774. /
  775. drop public synonym USER_USERS
  776. /
  777. create public synonym USER_USERS for USER_USERS
  778. /
  779. drop public synonym MYPRIVS
  780. /
  781. create public synonym MYPRIVS for USER_USERS
  782. /
  783. grant select on USER_USERS to PUBLIC
  784. /
  785. drop view ALL_USERS
  786. /
  787. create view ALL_USERS
  788.     (USERNAME, USER_ID,
  789.      /*   CONNECT_PRIV, RESOURCE_PRIV, DBA_PRIV,
  790.      DEFAULT_TABLESPACE, TEMPORARY_TABLESPACE, */  CREATED)
  791. as
  792. select u.name, u.user#,
  793.        /* u.connect$, u.resource$, u.dba$, 
  794.        dts.name, tts.name, */   u.ctime
  795. from sys.user$ u, sys.ts$ dts, sys.ts$ tts
  796. where u.datats# = dts.ts#
  797.   and u.tempts# = tts.ts#
  798. /
  799. comment on table ALL_USERS is
  800. 'Information about all users of the database'
  801. /
  802. comment on column ALL_USERS.USERNAME is
  803. 'Name of the user'
  804. /
  805. comment on column ALL_USERS.USER_ID is
  806. 'ID number of the user'
  807. /
  808. remark comment on column ALL_USERS.CONNECT_PRIV is
  809. remark 'Does the user have CONNECT privilege?'
  810. remark /
  811. remark comment on column ALL_USERS.RESOURCE_PRIV is
  812. remark 'Does the user have RESOURCE privilege?'
  813. remark /
  814. remark comment on column ALL_USERS.DBA_PRIV is
  815. remark 'Does the user have DBA privilege?'
  816. remark /
  817. remark comment on column ALL_USERS.DEFAULT_TABLESPACE is
  818. remark 'Default tablespace for data'
  819. remark /
  820. remark comment on column ALL_USERS.TEMPORARY_TABLESPACE is
  821. remark 'Default tablespace for temporary tables'
  822. remark /
  823. comment on column ALL_USERS.CREATED is
  824. 'User creation date'
  825. /
  826. drop public synonym ALL_USERS
  827. /
  828. create public synonym ALL_USERS for ALL_USERS
  829. /
  830. grant select on ALL_USERS to PUBLIC
  831. /
  832. drop view DBA_USERS
  833. /
  834. create view DBA_USERS
  835.     (USERNAME, USER_ID, PASSWORD,
  836.      CONNECT_PRIV, RESOURCE_PRIV, DBA_PRIV,
  837.      DEFAULT_TABLESPACE, TEMPORARY_TABLESPACE, CREATED, EXPIRES)
  838. as
  839. select u.name, u.user#, u.password,
  840.        u.connect$, u.resource$, u.dba$,
  841.        dts.name, tts.name, u.ctime, u.ptime
  842. from sys.user$ u, sys.ts$ dts, sys.ts$ tts
  843. where u.datats# = dts.ts#
  844.   and u.tempts# = tts.ts#
  845. /
  846. comment on table DBA_USERS is
  847. 'Information about all users of the database'
  848. /
  849. comment on column DBA_USERS.USERNAME is
  850. 'Name of the user'
  851. /
  852. comment on column DBA_USERS.USER_ID is
  853. 'ID number of the user'
  854. /
  855. comment on column DBA_USERS.PASSWORD is
  856. 'Encrypted password'
  857. /
  858. comment on column DBA_USERS.CONNECT_PRIV is
  859. 'Does the user have CONNECT privilege?'
  860. /
  861. comment on column DBA_USERS.RESOURCE_PRIV is
  862. 'Does the user have RESOURCE privilege?'
  863. /
  864. comment on column DBA_USERS.DBA_PRIV is
  865. 'Does the user have DBA privilege?'
  866. /
  867. comment on column DBA_USERS.DEFAULT_TABLESPACE is
  868. 'Default tablespace for data'
  869. /
  870. comment on column DBA_USERS.TEMPORARY_TABLESPACE is
  871. 'Default tablespace for temporary tables'
  872. /
  873. comment on column DBA_USERS.CREATED is
  874. 'User creation date'
  875. /
  876. comment on column DBA_USERS.EXPIRES is
  877. 'Password expiration date'
  878. /
  879. remark
  880. remark  FAMILY "VIEWS"
  881. remark  All relevant information about views, except columns.
  882. remark
  883. drop view USER_VIEWS
  884. /
  885. create view USER_VIEWS
  886.     (VIEW_NAME, TEXT_LENGTH, TEXT)
  887. as
  888. select o.name, v.textlength, v.text
  889. from sys.obj$ o, sys.view$ v
  890. where o.obj# = v.obj#
  891.   and o.owner# = uid
  892. /
  893. comment on table USER_VIEWS is
  894. 'Text of views owned by the user'
  895. /
  896. comment on column USER_VIEWS.VIEW_NAME is
  897. 'Name of the view'
  898. /
  899. comment on column USER_VIEWS.TEXT_LENGTH is
  900. 'Length of the view text'
  901. /
  902. comment on column USER_VIEWS.TEXT is
  903. 'View text'
  904. /
  905. drop public synonym USER_VIEWS
  906. /
  907. create public synonym USER_VIEWS for USER_VIEWS
  908. /
  909. grant select on USER_VIEWS to PUBLIC
  910. /
  911. drop view ALL_VIEWS
  912. /
  913. create view ALL_VIEWS
  914.     (OWNER, VIEW_NAME, TEXT_LENGTH, TEXT)
  915. as
  916. select u.name, o.name, v.textlength, v.text
  917. from sys.obj$ o, sys.view$ v, sys.user$ u
  918. where o.obj# = v.obj#
  919.   and o.owner# = u.user#
  920.   and (o.owner# = uid
  921.        or o.obj# in
  922.             (select ta.obj#
  923.              from sys.tabauth$ ta
  924.              where ta.grantee# in (uid, 1))
  925.       )
  926. /
  927. comment on table ALL_VIEWS is
  928. 'Text of views accessible to the user'
  929. /
  930. comment on column ALL_VIEWS.OWNER is
  931. 'Owner of the view'
  932. /
  933. comment on column ALL_VIEWS.VIEW_NAME is
  934. 'Name of the view'
  935. /
  936. comment on column ALL_VIEWS.TEXT_LENGTH is
  937. 'Length of the view text'
  938. /
  939. comment on column ALL_VIEWS.TEXT is
  940. 'View text'
  941. /
  942. drop public synonym ALL_VIEWS
  943. /
  944. create public synonym ALL_VIEWS for ALL_VIEWS
  945. /
  946. grant select on ALL_VIEWS to PUBLIC
  947. /
  948. drop view DBA_VIEWS
  949. /
  950. create view DBA_VIEWS
  951.     (OWNER, VIEW_NAME, TEXT_LENGTH, TEXT)
  952. as
  953. select u.name, o.name, v.textlength, v.text
  954. from sys.obj$ o, sys.view$ v, sys.user$ u
  955. where o.obj# = v.obj#
  956.   and o.owner# = u.user#
  957. /
  958. comment on table DBA_VIEWS is
  959. 'Text of all views in the database'
  960. /
  961. comment on column DBA_VIEWS.OWNER is
  962. 'Owner of the view'
  963. /
  964. comment on column DBA_VIEWS.VIEW_NAME is
  965. 'Name of the view'
  966. /
  967. comment on column DBA_VIEWS.TEXT_LENGTH is
  968. 'Length of the view text'
  969. /
  970. comment on column DBA_VIEWS.TEXT is
  971. 'View text'
  972. /
  973. remark
  974. remark  FAMILY "CONSTRAINTS"
  975. remark
  976. drop view USER_CONSTRAINTS
  977. /
  978. create view USER_CONSTRAINTS (OWNER, CONSTRAINT_NAME, CONSTRAINT_TYPE,
  979.                               TABLE_NAME, SEARCH_CONDITION, R_OWNER,
  980.                               R_CONSTRAINT_NAME)
  981. as
  982. select ou.name, oc.name,
  983.        decode(c.type, 1, 'C', 2, 'P', 3, 'U', 4, 'R', 5, 'V', 6, 'RL', 7, 'RS',
  984.               '?'),
  985.        o.name, c.condition, ru.name, rc.name
  986. from sys.con$ oc, sys.con$ rc, sys.user$ ou, sys.user$ ru,
  987.      sys.obj$ o, sys.cdef$ c
  988. where oc.owner# = ou.user#
  989.   and oc.con# = c.con#
  990.   and c.obj# = o.obj#
  991.   and c.rcon# = rc.con#(+)
  992.   and rc.owner# = ru.user#(+)
  993.   and o.owner# = uid
  994. /
  995. comment on table USER_CONSTRAINTS is
  996. 'Constraint definitions on accessible tables'
  997. /
  998. comment on column USER_CONSTRAINTS.OWNER is
  999. 'Owner of the table'
  1000. /
  1001. comment on column USER_CONSTRAINTS.CONSTRAINT_NAME is
  1002. 'Name associated with constraint definition'
  1003. /
  1004. comment on column USER_CONSTRAINTS.CONSTRAINT_TYPE is
  1005. 'Type of constraint definition'
  1006. /
  1007. comment on column USER_CONSTRAINTS.TABLE_NAME is
  1008. 'Name associated with table with constraint definition'
  1009. /
  1010. comment on column USER_CONSTRAINTS.SEARCH_CONDITION is
  1011. 'Text of search condition for table check'
  1012. /
  1013. comment on column USER_CONSTRAINTS.R_OWNER is
  1014. 'Owner of table used in referential constraint'
  1015. /
  1016. comment on column USER_CONSTRAINTS.R_CONSTRAINT_NAME is
  1017. 'Name of unique constraint definition for referenced table'
  1018. /
  1019. grant select on USER_CONSTRAINTS to public
  1020. /
  1021. drop public synonym USER_CONSTRAINTS
  1022. /
  1023. create public synonym USER_CONSTRAINTS for USER_CONSTRAINTS
  1024. /
  1025. drop view ALL_CONSTRAINTS
  1026. /
  1027. create view ALL_CONSTRAINTS (OWNER, CONSTRAINT_NAME, CONSTRAINT_TYPE,
  1028.                              TABLE_NAME, SEARCH_CONDITION, R_OWNER,
  1029.                              R_CONSTRAINT_NAME)
  1030. as
  1031. select ou.name, oc.name,
  1032.        decode(c.type, 1, 'C', 2, 'P', 3, 'U', 4, 'R', 5, 'V', 6, 'RL', 7, 'RS',
  1033.               '?'),
  1034.        o.name, c.condition, ru.name, rc.name
  1035. from sys.con$ oc, sys.con$ rc, sys.user$ ou, sys.user$ ru,
  1036.      sys.obj$ o, sys.cdef$ c
  1037. where oc.owner# = ou.user#
  1038.   and oc.con# = c.con#
  1039.   and c.obj# = o.obj#
  1040.   and c.rcon# = rc.con#(+)
  1041.   and rc.owner# = ru.user#(+)
  1042.   and (o.owner# = uid
  1043.        or o.obj# in (select obj#
  1044.                      from sys.tabauth$
  1045.                      where grantee# in (1,uid)
  1046.                     )
  1047.       )
  1048. /
  1049. comment on table ALL_CONSTRAINTS is
  1050. 'Constraint definitions on accessible tables'
  1051. /
  1052. comment on column ALL_CONSTRAINTS.OWNER is
  1053. 'Owner of the table'
  1054. /
  1055. comment on column ALL_CONSTRAINTS.CONSTRAINT_NAME is
  1056. 'Name associated with constraint definition'
  1057. /
  1058. comment on column ALL_CONSTRAINTS.CONSTRAINT_TYPE is
  1059. 'Type of constraint definition'
  1060. /
  1061. comment on column ALL_CONSTRAINTS.TABLE_NAME is
  1062. 'Name associated with table with constraint definition'
  1063. /
  1064. comment on column ALL_CONSTRAINTS.SEARCH_CONDITION is
  1065. 'Text of search condition for table check'
  1066. /
  1067. comment on column ALL_CONSTRAINTS.R_OWNER is
  1068. 'Owner of table used in referential constraint'
  1069. /
  1070. comment on column ALL_CONSTRAINTS.R_CONSTRAINT_NAME is
  1071. 'Name of unique constraint definition for referenced table'
  1072. /
  1073. grant select on ALL_CONSTRAINTS to public
  1074. /
  1075. drop public synonym ALL_CONSTRAINTS
  1076. /
  1077. create public synonym ALL_CONSTRAINTS for ALL_CONSTRAINTS
  1078. /
  1079. drop view DBA_CONSTRAINTS
  1080. /
  1081. create view DBA_CONSTRAINTS (OWNER, CONSTRAINT_NAME, CONSTRAINT_TYPE,
  1082.                              TABLE_NAME, SEARCH_CONDITION, R_OWNER,
  1083.                              R_CONSTRAINT_NAME)
  1084. as
  1085. select ou.name, oc.name,
  1086.        decode(c.type, 1, 'C', 2, 'P', 3, 'U', 4, 'R', 5, 'V', 6, 'RL', 7, 'RS',
  1087.               '?'),
  1088.        o.name, c.condition, ru.name, rc.name
  1089. from sys.con$ oc, sys.con$ rc, sys.user$ ou, sys.user$ ru,
  1090.      sys.obj$ o, sys.cdef$ c
  1091. where oc.owner# = ou.user#
  1092.   and oc.con# = c.con#
  1093.   and c.obj# = o.obj#
  1094.   and c.rcon# = rc.con#(+)
  1095.   and rc.owner# = ru.user#(+)
  1096. /
  1097. comment on table DBA_CONSTRAINTS is
  1098. 'Constraint definitions on accessible tables'
  1099. /
  1100. comment on column DBA_CONSTRAINTS.OWNER is
  1101. 'Owner of the table'
  1102. /
  1103. comment on column DBA_CONSTRAINTS.CONSTRAINT_NAME is
  1104. 'Name associated with constraint definition'
  1105. /
  1106. comment on column DBA_CONSTRAINTS.CONSTRAINT_TYPE is
  1107. 'Type of constraint definition'
  1108. /
  1109. comment on column DBA_CONSTRAINTS.TABLE_NAME is
  1110. 'Name associated with table with constraint definition'
  1111. /
  1112. comment on column DBA_CONSTRAINTS.SEARCH_CONDITION is
  1113. 'Text of search condition for table check'
  1114. /
  1115. comment on column DBA_CONSTRAINTS.R_OWNER is
  1116. 'Owner of table used in referential constraint'
  1117. /
  1118. comment on column DBA_CONSTRAINTS.R_CONSTRAINT_NAME is
  1119. 'Name of unique constraint definition for referenced table'
  1120. /
  1121. drop public synonym DBA_CONSTRAINTS
  1122. /
  1123. create public synonym DBA_CONSTRAINTS for DBA_CONSTRAINTS
  1124. /
  1125. remark
  1126. remark  FAMILY "CONS_COLUMNS"
  1127. remark
  1128. drop view USER_CONS_COLUMNS
  1129. /
  1130. create view USER_CONS_COLUMNS (OWNER, CONSTRAINT_NAME, TABLE_NAME, COLUMN_NAME,
  1131.                                POSITION)
  1132. as
  1133. select u.name, c.name, o.name, col.name, cc.pos#
  1134. from sys.user$ u, sys.con$ c, sys.col$ col, sys.ccol$ cc, sys.cdef$ cd,
  1135.      sys.obj$ o
  1136. where c.owner# = u.user#
  1137.   and c.con# = cd.con#
  1138.   and cd.con# = cc.con#
  1139.   and cc.obj# = col.obj#
  1140.   and cc.col# = col.col#
  1141.   and cc.obj# = o.obj#
  1142.   and c.owner# = uid
  1143. /
  1144. comment on table USER_CONS_COLUMNS is
  1145. 'Information about accessible columns in constraint definitions'
  1146. /
  1147. comment on column USER_CONS_COLUMNS.OWNER is
  1148. 'Owner of the constraint definition'
  1149. /
  1150. comment on column USER_CONS_COLUMNS.CONSTRAINT_NAME is
  1151. 'Name associated with the constraint definition'
  1152. /
  1153. comment on column USER_CONS_COLUMNS.TABLE_NAME is
  1154. 'Name associated with table with constraint definition'
  1155. /
  1156. comment on column USER_CONS_COLUMNS.COLUMN_NAME is
  1157. 'Name associated with column specified in the constraint definition'
  1158. /
  1159. comment on column USER_CONS_COLUMNS.POSITION is
  1160. 'Original position of column in definition'
  1161. /
  1162. grant select on USER_CONS_COLUMNS to public
  1163. /
  1164. drop public synonym USER_CONS_COLUMNS
  1165. /
  1166. create public synonym USER_CONS_COLUMNS for USER_CONS_COLUMNS
  1167. /
  1168. drop view ALL_CONS_COLUMNS
  1169. /
  1170. create view ALL_CONS_COLUMNS (OWNER, CONSTRAINT_NAME, TABLE_NAME, COLUMN_NAME,
  1171.                               POSITION)
  1172. as
  1173. select u.name, c.name, o.name, col.name, cc.pos#
  1174. from sys.user$ u, sys.con$ c, sys.col$ col, sys.ccol$ cc, sys.cdef$ cd,
  1175.      sys.obj$ o
  1176. where c.owner# = u.user#
  1177.   and c.con# = cd.con#
  1178.   and cd.con# = cc.con#
  1179.   and cc.obj# = col.obj#
  1180.   and cc.col# = col.col#
  1181.   and cc.obj# = o.obj#
  1182.   and (c.owner# = uid
  1183.        or cd.obj# in (select obj#
  1184.                       from sys.tabauth$
  1185.                       where grantee# in (1,uid)
  1186.                      )
  1187.       )
  1188. /
  1189. comment on table ALL_CONS_COLUMNS is
  1190. 'Information about accessible columns in constraint definitions'
  1191. /
  1192. comment on column ALL_CONS_COLUMNS.OWNER is
  1193. 'Owner of the constraint definition'
  1194. /
  1195. comment on column ALL_CONS_COLUMNS.CONSTRAINT_NAME is
  1196. 'Name associated with the constraint definition'
  1197. /
  1198. comment on column ALL_CONS_COLUMNS.TABLE_NAME is
  1199. 'Name associated with table with constraint definition'
  1200. /
  1201. comment on column ALL_CONS_COLUMNS.COLUMN_NAME is
  1202. 'Name associated with column specified in the constraint definition'
  1203. /
  1204. comment on column ALL_CONS_COLUMNS.POSITION is
  1205. 'Original position of column in definition'
  1206. /
  1207. grant select on ALL_CONS_COLUMNS to public
  1208. /
  1209. drop public synonym ALL_CONS_COLUMNS
  1210. /
  1211. create public synonym ALL_CONS_COLUMNS for ALL_CONS_COLUMNS
  1212. /
  1213. drop view DBA_CONS_COLUMNS
  1214. /
  1215. create view DBA_CONS_COLUMNS (OWNER, CONSTRAINT_NAME, TABLE_NAME, COLUMN_NAME,
  1216.                               POSITION)
  1217. as
  1218. select u.name, c.name, o.name, col.name, cc.pos#
  1219. from sys.user$ u, sys.con$ c, sys.col$ col, sys.ccol$ cc, sys.cdef$ cd,
  1220.      sys.obj$ o
  1221. where c.owner# = u.user#
  1222.   and c.con# = cd.con#
  1223.   and cd.con# = cc.con#
  1224.   and cc.obj# = col.obj#
  1225.   and cc.col# = col.col#
  1226.   and cc.obj# = o.obj#
  1227. /
  1228. comment on table DBA_CONS_COLUMNS is
  1229. 'Information about accessible columns in constraint definitions'
  1230. /
  1231. comment on column DBA_CONS_COLUMNS.OWNER is
  1232. 'Owner of the constraint definition'
  1233. /
  1234. comment on column DBA_CONS_COLUMNS.CONSTRAINT_NAME is
  1235. 'Name associated with the constraint definition'
  1236. /
  1237. comment on column DBA_CONS_COLUMNS.TABLE_NAME is
  1238. 'Name associated with table with constraint definition'
  1239. /
  1240. comment on column DBA_CONS_COLUMNS.COLUMN_NAME is
  1241. 'Name associated with column specified in the constraint definition'
  1242. /
  1243. comment on column DBA_CONS_COLUMNS.POSITION is
  1244. 'Original position of column in definition'
  1245. /
  1246. drop public synonym DBA_CONS_COLUMNS
  1247. /
  1248. create public synonym DBA_CONS_COLUMNS for DBA_CONS_COLUMNS
  1249. /
  1250. remark
  1251. remark  FAMILY "CONSTRAINT VIEWS" FOR ANSI
  1252. remark
  1253. drop view CONSTRAINT_DEFS
  1254. /
  1255. create view CONSTRAINT_DEFS (OWNER, CONSTRAINT_NAME, CONSTRAINT_TYPE,
  1256.                              TABLE_NAME, SEARCH_CONDITION, R_OWNER,
  1257.                              R_CONSTRAINT_NAME)
  1258. as
  1259. select ou.name, oc.name,
  1260.        decode(c.type, 1, 'C', 2, 'P', 3, 'U', 4, 'R', 5, 'V', 6, 'RL', 7, 'RS',
  1261.               '?'),
  1262.        o.name, c.condition, ru.name, rc.name
  1263. from sys.con$ oc, sys.con$ rc, sys.user$ ou, sys.user$ ru,
  1264.      sys.obj$ o, sys.cdef$ c
  1265. where oc.owner# = ou.user#
  1266.   and oc.con# = c.con#
  1267.   and c.obj# = o.obj#
  1268.   and c.rcon# = rc.con#(+)
  1269.   and rc.owner# = ru.user#(+)
  1270.   and (o.owner# = uid
  1271.        or o.obj# in (select obj#
  1272.                      from sys.tabauth$
  1273.                      where grantee# in (1,uid)
  1274.                     )
  1275.       )
  1276. /
  1277. comment on table CONSTRAINT_DEFS is
  1278. 'Constraint Definitions on accessible tables'
  1279. /
  1280. comment on column CONSTRAINT_DEFS.OWNER is
  1281. 'Owner of the table'
  1282. /
  1283. comment on column CONSTRAINT_DEFS.CONSTRAINT_NAME is
  1284. 'Name associated with constraint definition'
  1285. /
  1286. comment on column CONSTRAINT_DEFS.CONSTRAINT_TYPE is
  1287. 'Type of constraint definition'
  1288. /
  1289. comment on column CONSTRAINT_DEFS.TABLE_NAME is
  1290. 'Name associated with table with constraint definition'
  1291. /
  1292. comment on column CONSTRAINT_DEFS.SEARCH_CONDITION is
  1293. 'Text of search condition for table check'
  1294. /
  1295. comment on column CONSTRAINT_DEFS.R_OWNER is
  1296. 'Owner of table used in referential constraint'
  1297. /
  1298. comment on column CONSTRAINT_DEFS.R_CONSTRAINT_NAME is
  1299. 'Name of unique constraint definition for referenced table'
  1300. /
  1301. grant select on CONSTRAINT_DEFS to public
  1302. /
  1303. drop public synonym CONSTRAINT_DEFS
  1304. /
  1305. create public synonym CONSTRAINT_DEFS for CONSTRAINT_DEFS
  1306. /
  1307. drop view CONSTRAINT_COLUMNS
  1308. /
  1309. create view CONSTRAINT_COLUMNS (OWNER, CONSTRAINT_NAME, COLUMN_NAME,
  1310.                                 POSITION)
  1311. as
  1312. select u.name, c.name, col.name, cc.pos#
  1313. from sys.user$ u, sys.con$ c, sys.col$ col, sys.ccol$ cc, sys.cdef$ cd
  1314. where c.owner# = u.user#
  1315.   and c.con# = cd.con#
  1316.   and cd.type in (2,3,4)
  1317.   and cd.con# = cc.con#
  1318.   and cc.obj# = col.obj#
  1319.   and cc.col# = col.col#
  1320.   and (c.owner# = uid
  1321.        or cd.obj# in (select obj#
  1322.               from sys.tabauth$
  1323.               where grantee# in (1,uid)
  1324.              )
  1325.       )
  1326. /
  1327. comment on table CONSTRAINT_COLUMNS is
  1328. 'Information about accessible columns in constraint definitions'
  1329. /
  1330. comment on column CONSTRAINT_COLUMNS.OWNER is
  1331. 'Owner of the constraint definition'
  1332. /
  1333. comment on column CONSTRAINT_COLUMNS.CONSTRAINT_NAME is
  1334. 'Name associated with the constraint definition'
  1335. /
  1336. comment on column CONSTRAINT_COLUMNS.COLUMN_NAME is
  1337. 'Name associated with column specified in the constraint definition'
  1338. /
  1339. comment on column CONSTRAINT_COLUMNS.POSITION is
  1340. 'Original position of column in definition'
  1341. /
  1342. grant select on CONSTRAINT_COLUMNS to public
  1343. /
  1344. drop public synonym CONSTRAINT_COLUMNS
  1345. /
  1346. create public synonym CONSTRAINT_COLUMNS for CONSTRAINT_COLUMNS
  1347. /
  1348. remark
  1349. remark    FAMILY "FIXED (VIRTUAL) VIEWS"
  1350. remark               
  1351. drop view v_$process;
  1352. create view v_$process as select * from v$process;
  1353. drop public synonym v$process;
  1354. create public synonym v$process for v_$process;
  1355.  
  1356. drop view v_$bgprocess;
  1357. create view v_$bgprocess as select * from v$bgprocess;
  1358. drop public synonym v$bgprocess;
  1359. create public synonym v$bgprocess for v_$bgprocess;
  1360.  
  1361. drop view v_$session;
  1362. create view v_$session as select * from v$session;
  1363. drop public synonym v$session;
  1364. create public synonym v$session for v_$session;
  1365.  
  1366. drop view v_$transaction;
  1367. create view v_$transaction as select * from v$transaction;
  1368. drop public synonym v$transaction;
  1369. create public synonym v$transaction for v_$transaction;
  1370.  
  1371. drop view v_$latch;
  1372. create view v_$latch as select * from v$latch;
  1373. drop public synonym v$latch;
  1374. create public synonym v$latch for v_$latch;
  1375.  
  1376. drop view v_$latchname;
  1377. create view v_$latchname as select * from v$latchname;
  1378. drop public synonym v$latchname;
  1379. create public synonym v$latchname for v_$latchname;
  1380.  
  1381. drop view v_$latchholder;
  1382. create view v_$latchholder as select * from v$latchholder;
  1383. drop public synonym v$latchholder;
  1384. create public synonym v$latchholder for v_$latchholder;
  1385.  
  1386. drop view v_$resource;
  1387. create view v_$resource as select * from v$resource;
  1388. drop public synonym v$resource;
  1389. create public synonym v$resource for v_$resource;
  1390.  
  1391. drop view v_$_lock;
  1392. create view v_$_lock as select * from v$_lock;
  1393. drop public synonym v$_lock;
  1394. create public synonym v$_lock for v_$_lock;
  1395.  
  1396. drop view v_$lock;
  1397. create view v_$lock as select * from v$lock;
  1398. drop public synonym v$lock;
  1399. create public synonym v$lock for v_$lock;
  1400.  
  1401. drop view v_$sesstat;
  1402. create view v_$sesstat as select * from v$sesstat;
  1403. drop public synonym v$sesstat;
  1404. create public synonym v$sesstat for v_$sesstat;
  1405.  
  1406. drop view v_$sysstat;
  1407. create view v_$sysstat as select * from v$sysstat;
  1408. drop public synonym v$sysstat;
  1409. create public synonym v$sysstat for v_$sysstat;
  1410.  
  1411. drop view v_$statname;
  1412. create view v_$statname as select * from v$statname;
  1413. drop public synonym v$statname;
  1414. create public synonym v$statname for v_$statname;
  1415.  
  1416. drop view v_$access;
  1417. create view v_$access as select * from v$access;
  1418. drop public synonym v$access;
  1419. create public synonym v$access for v_$access;
  1420.  
  1421. drop view v_$dbfile;
  1422. create view v_$dbfile as select * from v$dbfile;
  1423. drop public synonym v$dbfile;
  1424. create public synonym v$dbfile for v_$dbfile;
  1425.  
  1426. drop view v_$filestat;
  1427. create view v_$filestat as select * from v$filestat;
  1428. drop public synonym v$filestat;
  1429. create public synonym v$filestat for v_$filestat;
  1430.  
  1431. drop view v_$logfile;
  1432. create view v_$logfile as select * from v$logfile;
  1433. drop public synonym v$logfile;
  1434. create public synonym v$logfile for v_$logfile;
  1435.  
  1436. drop view v_$rollname;
  1437. create view v_$rollname as select * from v$rollname;
  1438. drop public synonym v$rollname;
  1439. create public synonym v$rollname for v_$rollname;
  1440.  
  1441. drop view v_$rollstat;
  1442. create view v_$rollstat as select * from v$rollstat;
  1443. drop public synonym v$rollstat;
  1444. create public synonym v$rollstat for v_$rollstat;
  1445.  
  1446. drop view v_$sga;
  1447. create view v_$sga as select * from v$sga;
  1448. drop public synonym v$sga;
  1449. create public synonym v$sga for v_$sga;
  1450.  
  1451. drop view v_$parameter;
  1452. create view v_$parameter as select * from v$parameter;
  1453. drop public synonym v$parameter;
  1454. create public synonym v$parameter for v_$parameter;
  1455.  
  1456. drop view v_$rowcache;
  1457. create view v_$rowcache as select * from v$rowcache;
  1458. drop public synonym v$rowcache;
  1459. create public synonym v$rowcache for v_$rowcache;
  1460.  
  1461. rem 
  1462. rem V5 views required for other Oracle products
  1463. rem
  1464.  
  1465. drop view syscatalog_;
  1466. create view syscatalog_ (tname, creator, creatorid, tabletype)
  1467.   as
  1468.   select o.name, u.name, o.owner#,
  1469.          decode(o.type, 2, 'TABLE', 4, 'VIEW', 6, 'SEQUENCE','?')
  1470.   from    sys.user$ u, sys.obj$ o
  1471.   where u.user# = o.owner#
  1472.     and    o.type in (2, 4, 6)
  1473.     and ( o.owner# = uid
  1474.         or o.obj# in
  1475.            (select tau.obj#
  1476.         from   sys.tabauth$ tau
  1477.         where  tau.grantee# in (uid, 1)
  1478.             )
  1479.     )
  1480. /
  1481. drop view syscatalog;
  1482. create view syscatalog (tname, creator, tabletype) as
  1483.   select tname, creator, tabletype
  1484.   from syscatalog_
  1485. /
  1486. grant select on syscatalog to public;
  1487. create synonym system.syscatalog for syscatalog;
  1488. rem
  1489. rem The catalog view returns almost all tables accessible to the user
  1490. rem except tables in SYS and SYSTEM ("dictionary tables").
  1491. rem 
  1492. drop view catalog;
  1493. create view catalog (tname, creator, tabletype) as
  1494.   select tname, creator, tabletype
  1495.   from    syscatalog_
  1496.   where creatorid not in (0,2)
  1497. /
  1498. grant select on catalog to public;
  1499. create synonym system.catalog for catalog;
  1500.  
  1501. drop view tab;
  1502. create view tab (tname, tabtype, clusterid) as
  1503.    select o.name,
  1504.       decode(o.type, 2, 'TABLE', 3, 'CLUSTER', 
  1505.              4, 'VIEW', 5, 'SYNONYM'), t.tab#
  1506.   from  sys.tab$ t, sys.obj$ o
  1507.   where o.owner# = uid and o.type >=2 and o.type <=5
  1508.      and o.obj# = t.obj# (+)
  1509. /
  1510. grant select on tab to public;
  1511. create synonym system.tab for tab;
  1512. drop view col;
  1513. create view col (tname, colno, cname, coltype, width, scale, precision, nulls,
  1514.                  defaultval) as
  1515.   select t.name, c.col#, c.name, 
  1516.      decode(c.type#, 1, 'CHAR',
  1517.                          2, decode(c.scale, null,
  1518.                                    decode(c.precision, null, 'NUMBER', 'FLOAT'),
  1519.                                   'NUMBER'),
  1520.                          8, 'LONG', 9, 'VARCHAR',
  1521.                          12, 'DATE', 23, 'RAW', 24, 'LONG RAW',
  1522.                          69, 'ROWID', 'UNDEFINED'),
  1523.          c.length, c.scale, c.precision,
  1524.      decode(c.null$, 0, 'NULL', 'NOT NULL'), c.default$
  1525.    from  sys.col$ c, sys.obj$ t
  1526.    where t.obj# = c.obj#
  1527.    and     t.type in (2, 3, 4)
  1528.    and     t.owner# = uid
  1529. /
  1530. grant select on col to public;
  1531. create synonym system.col for col;
  1532. drop view syssegobj;
  1533. create view syssegobj (obj#, file#, block#, type, pctfree$, pctused$) as
  1534.   select obj#, file#, block#, 'TABLE', pctfree$, pctused$ from sys.tab$
  1535.   union
  1536.   select obj#, file#, block#, 'CLUSTER', pctfree$, pctused$ from sys.clu$
  1537.   union 
  1538.   select obj#, file#, block#, 'INDEX', to_number(null), to_number(null)
  1539.          from sys.ind$
  1540. /
  1541. grant select on syssegobj to public;
  1542. drop view tabquotas;
  1543. create view tabquotas (tname, type, objno, nextext, maxext, pinc,
  1544.                pfree, pused) as
  1545.   select t.name, so.type, t.obj#, s.extsize, s.maxexts, s.extpct, so.pctfree$,
  1546.      so.pctused$
  1547.   from  sys.seg$ s, sys.obj$ t, syssegobj so
  1548.   where t.owner# = uid
  1549.     and t.obj# = so.obj#
  1550.     and so.file# = s.file# 
  1551.     and so.block# = s.block#
  1552. /
  1553. grant select on tabquotas to public;
  1554. create synonym system.tabquotas for tabquotas;
  1555.  
  1556. drop view sysfiles;
  1557. create view sysfiles (tsname, fname, blocks) as
  1558.   select ts.name, dbf.name, f.blocks
  1559.   from  sys.ts$ ts, sys.file$ f, sys.v$dbfile dbf
  1560.   where ts.ts# = f.ts#(+) and dbf.file# = f.file# and f.status$ = 2
  1561. /
  1562. grant select on sysfiles to public;
  1563. create synonym system.sysfiles for sysfiles;
  1564. drop view synonyms;
  1565. create view synonyms (sname, syntype, creator, tname, database, tabtype) as
  1566.   select s.name, 
  1567.      decode (s.owner#,1,'PUBLIC','PRIVATE'), t.owner, t.name, 'LOCAL', 
  1568.      decode(ot.type, 1, 'INDEX', 2, 'TABLE', 3, 'CLUSTER', 4, 'VIEW',
  1569.              5, 'SYNONYM', 6, 'SEQUENCE', 'UNDEFINED')
  1570.   from  sys.obj$ s, sys.obj$ ot, sys.syn$ t, sys.user$ u
  1571.   where s.obj# = t.obj# 
  1572.     and s.type = 5
  1573.     and ot.name = t.name
  1574.     and t.owner = u.name
  1575.     and ot.owner# = u.user#
  1576.     and s.owner# in (1,uid)
  1577.     and t.node is null
  1578. union
  1579.   select s.name, decode(s.owner#, 1, 'PUBLIC', 'PRIVATE'),
  1580.      t.owner, t.name, t.node, 'REMOTE'
  1581.   from  sys.obj$ s, sys.syn$ t
  1582.   where s.obj# = t.obj#
  1583.     and s.type = 5
  1584.     and s.owner# in (1, uid)
  1585.     and t.node is not null
  1586. /  
  1587. grant select on synonyms to public;
  1588. drop view publicsyn;
  1589. create view publicsyn (sname, creator, tname, database, tabtype) as
  1590.   select sname, creator, tname, database, tabtype
  1591.   from  synonyms
  1592.   where syntype = 'PUBLIC'
  1593. /
  1594. grant select on publicsyn to public;
  1595. create synonym system.publicsyn for publicsyn;
  1596.