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

  1. rem 
  2. rem $Header: catrpc.sql 7020200.1 95/02/15 18:32:08 cli Generic<base> $ 
  3. rem 
  4. Rem  Copyright (c) 1991 by Oracle Corporation 
  5. Rem    NAME
  6. Rem      catrpc.sql
  7. Rem    DESCRIPTION
  8. Rem      Creates internal views for RPC. 
  9. Rem      
  10. Rem      These views are needed only for databases with the procedural option
  11. Rem      that are accessed by remote databases
  12. Rem
  13. Rem    NOTES
  14. Rem      Must be run as SYS.
  15. Rem    MODIFIED   (MM/DD/YY)
  16. Rem     mramache   02/02/95 -  bug 256246 - tuned ORA_KGLR7_DEPENDENCIES
  17. Rem     jbellemo   12/17/93 -  merge changes from branch 1.3.710.1
  18. Rem     jbellemo   11/09/93 -  #170173: change uid to userenv schemaid
  19. Rem     jwijaya    02/22/93 -  merge changes from branch 1.2.312.1 
  20. Rem     jwijaya    02/12/93 -  heterogeneous/nls rpc bug
  21. Rem     tpystyne   10/28/92 -  use create or replace view 
  22. Rem     glumpkin   10/20/92 -  Renamed from KGLR.SQL 
  23. Rem     jwijaya    09/09/92 -  also select from v$fixed_table 
  24. Rem     jwijaya    07/17/92 -  remove database link owner from name 
  25. Rem     jwijaya    02/20/92 -  v$enabledroles -> x$kzsro 
  26. Rem     jwijaya    10/18/91 -  support portable IDL 
  27. Rem     jwijaya    06/19/91 -         add ORA_KGLR7_DB_LINKS 
  28. Rem     jwijaya    05/09/91 -         Creation 
  29. Rem
  30.  
  31. create or replace view ORA_KGLR7_OBJECTS
  32.   (OWNER, NAME, LINK_NAME, OWNER_ID, OBJECT_ID, TYPE)
  33. as
  34. select decode(o.linkname, null, u.name, o.remoteowner), o.name, 
  35.        o.linkname, u.user#, o.obj#, o.type
  36. from sys.obj$ o, sys.user$ u
  37. where o.owner# = u.user#
  38.   and (o.namespace = 1 /* TABLE/PROCEDURE */  
  39.        or
  40.        o.namespace = 2 /* BODY */ and o.owner# = userenv('SCHEMAID'))
  41. union
  42. select 'SYS', name, null, 0, object_id,
  43.        decode(type, 'TABLE', 2, 'VIEW', 4, 2)
  44. from sys.v$fixed_table
  45. /
  46.  
  47. create or replace view ORA_KGLR7_DEPENDENCIES
  48.   (OWNER, NAME, TYPE, PARENT_OWNER, PARENT_NAME, PARENT_TYPE,
  49.    PARENT_LINK_NAME, PARENT_TIMESTAMP, ORDER_NUMBER)
  50. as
  51. select u.name, o.name, o.type,
  52.     decode(o2.linkname, null, u2.name, o2.remoteowner), o2.name, o2.type,
  53.          o2.linkname, d.p_timestamp, d.order#
  54. from sys.obj$ o, sys.dependency$ d,
  55.      sys.user$ u, sys.obj$ o2, sys.user$ u2
  56. where o.obj# = d.d_obj#
  57.   and o.owner# = u.user#
  58.   and o.status = 1 /* VALID/AUTHORIZED WITHOUT ERRORS */
  59.   and (o2.obj# = d.p_obj# and o2.owner# = u2.user# and
  60.        (o2.namespace = 1 /* TABLE/PROCEDURE */
  61.        or
  62.        o2.namespace = 2 /* BODY */ and o2.owner# = userenv('SCHEMAID')))
  63.   and (o.owner# in (userenv('SCHEMAID'), 1 /* PUBLIC */)
  64.        or (o.namespace = 1 /* TABLE/PROCEDURE */
  65.            and (o.obj# in (select obj# from sys.objauth$
  66.                            where grantee# in (select kzsrorol
  67.                                               from x$kzsro)
  68.                              and privilege# = 12 /* EXECUTE */)
  69.                 or
  70.                 exists (select null from sys.sysauth$
  71.                         where grantee# in (select kzsrorol
  72.                                            from x$kzsro)
  73.                           and privilege# = -144
  74.                                            /* EXECUTE ANY PROCEDURE */))))
  75. union
  76. select u.name, o.name, o.type, 'SYS', po.name,
  77.       decode(po.type, 'TABLE', 2, 'VIEW', 4, 2),
  78.          null, d.p_timestamp, d.order#
  79. from sys.obj$ o, sys.v$fixed_table po, sys.dependency$ d,
  80.      sys.user$ u
  81. where o.obj# = d.d_obj#
  82.   and o.owner# = u.user#
  83.   and o.status = 1 /* VALID/AUTHORIZED WITHOUT ERRORS */
  84.   and po.object_id = d.p_obj#
  85.   and (o.owner# in (userenv('SCHEMAID'), 1 /* PUBLIC */)
  86.        or (o.namespace = 1 /* TABLE/PROCEDURE */
  87.            and (o.obj# in (select obj# from sys.objauth$
  88.                            where grantee# in (select kzsrorol
  89.                                               from x$kzsro)
  90.                              and privilege# = 12 /* EXECUTE */)
  91.                 or
  92.                 exists (select null from sys.sysauth$
  93.                         where grantee# in (select kzsrorol
  94.                                            from x$kzsro)
  95.                           and privilege# = -144
  96.                                            /* EXECUTE ANY PROCEDURE */))))
  97. /
  98.  
  99. drop public synonym ORA_KGLR7_DEPENDENCIES
  100. /
  101. create public synonym ORA_KGLR7_DEPENDENCIES for ORA_KGLR7_DEPENDENCIES
  102. /
  103. grant select on ORA_KGLR7_DEPENDENCIES to PUBLIC with grant option
  104. /
  105.  
  106. create or replace view ORA_KGLR7_IDL_UB1
  107.   (OWNER, NAME, TYPE, PART, VERSION, PIECE#, LENGTH, PIECE)
  108. as
  109. select /*+ index(i i_idl_ub11) +*/
  110.        o.owner, o.name, o.type, i.part, i.version,
  111.        i.piece#, i.length, i.piece
  112. from sys.ora_kglr7_objects o, sys.idl_ub1$ i
  113. where o.object_id = i.obj#
  114.   and (o.type = 5 /* SYNONYM */
  115.        or
  116.        o.owner_id in (userenv('SCHEMAID'), 1 /* PUBLIC */)
  117.        or
  118.        o.object_id in (select obj# from sys.objauth$
  119.                   where grantee# in (select kzsrorol from x$kzsro)
  120.                     and privilege# in (3 /* DELETE */, 6 /* INSERT */,
  121.                                        7 /* LOCK */, 9 /* SELECT */,
  122.                                        10 /* UPDATE */, 12 /* EXECUTE */))
  123.        or
  124.        exists (select null from sys.sysauth$
  125.                where grantee# in (select kzsrorol from x$kzsro)
  126.                  and (o.type in (7 /* PROCEDURE */, 8 /* FUNCTION */,
  127.                                  9 /* PACKAGE */) and
  128.                       privilege# = -144 /* EXECUTE ANY PROCEDURE */
  129.                       or
  130.                       o.type in (2 /* TABLE */, 4 /* VIEW */) and
  131.                       privilege# in (-45 /* LOCK ANY TABLE */,
  132.                                      -47 /* SELECT ANY TABLE */,
  133.                                      -48 /* INSERT ANY TABLE */,
  134.                                      -49 /* UPDATE ANY TABLE */,
  135.                                      -50 /* DELETE ANY TABLE */)
  136.                       or
  137.                       o.type = 6 /* SEQUENCE */ and
  138.                       privilege# = -109 /* SELECT ANY SEQUENCE */)))
  139. /
  140. drop public synonym ORA_KGLR7_IDL_UB1
  141. /
  142. create public synonym ORA_KGLR7_IDL_UB1 for ORA_KGLR7_IDL_UB1
  143. /
  144. grant select on ORA_KGLR7_IDL_UB1 to PUBLIC with grant option
  145. /
  146.  
  147. create or replace view ORA_KGLR7_IDL_CHAR
  148.   (OWNER, NAME, TYPE, PART, VERSION, PIECE#, LENGTH, PIECE)
  149. as
  150. select /*+ index(i i_idl_char1) +*/
  151.        o.owner, o.name, o.type, i.part, i.version,
  152.        i.piece#, i.length, i.piece
  153. from sys.ora_kglr7_objects o, sys.idl_char$ i
  154. where o.object_id = i.obj#
  155.   and (o.type = 5 /* SYNONYM */
  156.        or
  157.        o.owner_id in (userenv('SCHEMAID'), 1 /* PUBLIC */)
  158.        or
  159.        o.object_id in (select obj# from sys.objauth$
  160.                   where grantee# in (select kzsrorol from x$kzsro)
  161.                     and privilege# in (3 /* DELETE */, 6 /* INSERT */,
  162.                                        7 /* LOCK */, 9 /* SELECT */,
  163.                                        10 /* UPDATE */, 12 /* EXECUTE */))
  164.        or
  165.        exists (select null from sys.sysauth$
  166.                where grantee# in (select kzsrorol from x$kzsro)
  167.                  and (o.type in (7 /* PROCEDURE */, 8 /* FUNCTION */,
  168.                                  9 /* PACKAGE */) and
  169.                       privilege# = -144 /* EXECUTE ANY PROCEDURE */
  170.                       or
  171.                       o.type in (2 /* TABLE */, 4 /* VIEW */) and
  172.                       privilege# in (-45 /* LOCK ANY TABLE */,
  173.                                      -47 /* SELECT ANY TABLE */,
  174.                                      -48 /* INSERT ANY TABLE */,
  175.                                      -49 /* UPDATE ANY TABLE */,
  176.                                      -50 /* DELETE ANY TABLE */)
  177.                       or
  178.                       o.type = 6 /* SEQUENCE */ and
  179.                       privilege# = -109 /* SELECT ANY SEQUENCE */)))
  180. /
  181. drop public synonym ORA_KGLR7_IDL_CHAR
  182. /
  183. create public synonym ORA_KGLR7_IDL_CHAR for ORA_KGLR7_IDL_CHAR
  184. /
  185. grant select on ORA_KGLR7_IDL_CHAR to PUBLIC with grant option
  186. /
  187.  
  188. create or replace view ORA_KGLR7_IDL_UB2
  189.   (OWNER, NAME, TYPE, PART, VERSION, PIECE#, LENGTH, PIECE)
  190. as
  191. select /*+ index(i i_idl_ub21) +*/
  192.        o.owner, o.name, o.type, i.part, i.version,
  193.        i.piece#, i.length, i.piece
  194. from sys.ora_kglr7_objects o, sys.idl_ub2$ i
  195. where o.object_id = i.obj#
  196.   and (o.type = 5 /* SYNONYM */
  197.        or
  198.        o.owner_id in (userenv('SCHEMAID'), 1 /* PUBLIC */)
  199.        or
  200.        o.object_id in (select obj# from sys.objauth$
  201.                   where grantee# in (select kzsrorol from x$kzsro)
  202.                     and privilege# in (3 /* DELETE */, 6 /* INSERT */,
  203.                                        7 /* LOCK */, 9 /* SELECT */,
  204.                                        10 /* UPDATE */, 12 /* EXECUTE */))
  205.        or
  206.        exists (select null from sys.sysauth$
  207.                where grantee# in (select kzsrorol from x$kzsro)
  208.                  and (o.type in (7 /* PROCEDURE */, 8 /* FUNCTION */,
  209.                                  9 /* PACKAGE */) and
  210.                       privilege# = -144 /* EXECUTE ANY PROCEDURE */
  211.                       or
  212.                       o.type in (2 /* TABLE */, 4 /* VIEW */) and
  213.                       privilege# in (-45 /* LOCK ANY TABLE */,
  214.                                      -47 /* SELECT ANY TABLE */,
  215.                                      -48 /* INSERT ANY TABLE */,
  216.                                      -49 /* UPDATE ANY TABLE */,
  217.                                      -50 /* DELETE ANY TABLE */)
  218.                       or
  219.                       o.type = 6 /* SEQUENCE */ and
  220.                       privilege# = -109 /* SELECT ANY SEQUENCE */)))
  221. /
  222. drop public synonym ORA_KGLR7_IDL_UB2
  223. /
  224. create public synonym ORA_KGLR7_IDL_UB2 for ORA_KGLR7_IDL_UB2
  225. /
  226. grant select on ORA_KGLR7_IDL_UB2 to PUBLIC with grant option
  227. /
  228.  
  229. create or replace view ORA_KGLR7_IDL_SB4
  230.   (OWNER, NAME, TYPE, PART, VERSION, PIECE#, LENGTH, PIECE)
  231. as
  232. select /*+ index(i i_idl_sb41) +*/
  233.        o.owner, o.name, o.type, i.part, i.version,
  234.        i.piece#, i.length, i.piece
  235. from sys.ora_kglr7_objects o, sys.idl_sb4$ i
  236. where o.object_id = i.obj#
  237.   and (o.type = 5 /* SYNONYM */
  238.        or
  239.        o.owner_id in (userenv('SCHEMAID'), 1 /* PUBLIC */)
  240.        or
  241.        o.object_id in (select obj# from sys.objauth$
  242.                   where grantee# in (select kzsrorol from x$kzsro)
  243.                     and privilege# in (3 /* DELETE */, 6 /* INSERT */,
  244.                                        7 /* LOCK */, 9 /* SELECT */,
  245.                                        10 /* UPDATE */, 12 /* EXECUTE */))
  246.        or
  247.        exists (select null from sys.sysauth$
  248.                where grantee# in (select kzsrorol from x$kzsro)
  249.                  and (o.type in (7 /* PROCEDURE */, 8 /* FUNCTION */,
  250.                                  9 /* PACKAGE */) and
  251.                       privilege# = -144 /* EXECUTE ANY PROCEDURE */
  252.                       or
  253.                       o.type in (2 /* TABLE */, 4 /* VIEW */) and
  254.                       privilege# in (-45 /* LOCK ANY TABLE */,
  255.                                      -47 /* SELECT ANY TABLE */,
  256.                                      -48 /* INSERT ANY TABLE */,
  257.                                      -49 /* UPDATE ANY TABLE */,
  258.                                      -50 /* DELETE ANY TABLE */)
  259.                       or
  260.                       o.type = 6 /* SEQUENCE */ and
  261.                       privilege# = -109 /* SELECT ANY SEQUENCE */)))
  262. /
  263. drop public synonym ORA_KGLR7_IDL_SB4
  264. /
  265. create public synonym ORA_KGLR7_IDL_SB4 for ORA_KGLR7_IDL_SB4
  266. /
  267. grant select on ORA_KGLR7_IDL_SB4 to PUBLIC with grant option
  268. /
  269. create or replace view ORA_KGLR7_DB_LINKS
  270.   (OWNER, NAME, USERNAME)
  271. as
  272. select u.name, l.name, l.userid
  273. from sys.link$ l, sys.user$ u
  274. where l.owner# in (userenv('SCHEMAID'), 1 /* PUBLIC */)
  275.   and l.owner# = u.user#
  276. /
  277. drop public synonym ORA_KGLR7_DB_LINKS
  278. /
  279. create public synonym ORA_KGLR7_DB_LINKS for ORA_KGLR7_DB_LINKS
  280. /
  281. grant select on ORA_KGLR7_DB_LINKS to PUBLIC with grant option
  282. /
  283.