• <i id='6Ug5e'><tr id='6Ug5e'><dt id='6Ug5e'><q id='6Ug5e'><span id='6Ug5e'><b id='6Ug5e'><form id='6Ug5e'><ins id='6Ug5e'></ins><ul id='6Ug5e'></ul><sub id='6Ug5e'></sub></form><legend id='6Ug5e'></legend><bdo id='6Ug5e'><pre id='6Ug5e'><center id='6Ug5e'></center></pre></bdo></b><th id='6Ug5e'></th></span></q></dt></tr></i><div id='6Ug5e'><tfoot id='6Ug5e'></tfoot><dl id='6Ug5e'><fieldset id='6Ug5e'></fieldset></dl></div>

  • <tfoot id='6Ug5e'></tfoot>

      <small id='6Ug5e'></small><noframes id='6Ug5e'>

      <legend id='6Ug5e'><style id='6Ug5e'><dir id='6Ug5e'><q id='6Ug5e'></q></dir></style></legend>
      • <bdo id='6Ug5e'></bdo><ul id='6Ug5e'></ul>

        用于查找包的多级依赖项的脚本

        时间:2023-11-02

              <bdo id='RukoL'></bdo><ul id='RukoL'></ul>
              <i id='RukoL'><tr id='RukoL'><dt id='RukoL'><q id='RukoL'><span id='RukoL'><b id='RukoL'><form id='RukoL'><ins id='RukoL'></ins><ul id='RukoL'></ul><sub id='RukoL'></sub></form><legend id='RukoL'></legend><bdo id='RukoL'><pre id='RukoL'><center id='RukoL'></center></pre></bdo></b><th id='RukoL'></th></span></q></dt></tr></i><div id='RukoL'><tfoot id='RukoL'></tfoot><dl id='RukoL'><fieldset id='RukoL'></fieldset></dl></div>

                  <tbody id='RukoL'></tbody>

                <legend id='RukoL'><style id='RukoL'><dir id='RukoL'><q id='RukoL'></q></dir></style></legend>
                • <tfoot id='RukoL'></tfoot>
                • <small id='RukoL'></small><noframes id='RukoL'>

                  本文介绍了用于查找包的多级依赖项的脚本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我有一个包,它从相同的模式和其他模式中引用了许多对象.我想找到包的所有依赖项.我只能从 user_dependencies 获取第一级依赖项.另外 utldtree 会给我依赖于我当前对象的对象.utldtree 也只给出相同模式中的引用对象.

                  I've a package which references many objects from the same schema and other schemas. I want to find all the dependencies of the package. I can get only first level dependencies from user_dependencies. Also utldtree would give me the objects which are dependent on my current object.utldtree also gives only the referenced objects in the same schema.

                  当我试图在网上找到解决方案时,我遇到了以下链接http://rodgersnotes.wordpress.com/2012/01/05/树上笔记/在他提到的地方,他使用自己的脚本来查找对象的多级依赖关系.

                  While I'm trying to find the solution for this on the net, I came across the following link http://rodgersnotes.wordpress.com/2012/01/05/notes-on-deptree/ where he mentioned that, he uses his own script to find the multi level dependencies of an object.

                  你能帮我吗,如何处理这样一个脚本,它会让我们得到一个对象的多级依赖关系,(例如,如果包正在引用视图,那么我们的脚本应该提到视图和表/views 当我们进入 deptree) 时,我们的视图就建立在这个/views 之上

                  Could you please help me out, how to proceed for such a script which will get us the multi-level dependencies of an object,(for example if the package is referencing views, then our script should mention the views and the tables/views upon which our view is build as we get in deptree)

                  推荐答案

                  在大多数情况下,您可以在 user_dependencies 上使用 connect by.

                  You can use a connect by on user_dependencies for most cases.

                  适用于任何 Oracle 用户的示例,因为 PUBLIC 已被授予对 user_dependencies 的选择访问权限:

                  Sample which works for any Oracle user since PUBLIC has been granted select access on user_dependencies:

                  select name
                  ,      type
                  ,      prior name
                  ,      prior type
                  from   user_dependencies
                  start 
                  with   name='BUBS#MUNT_EENHEDEN'
                  and    type='PACKAGE'
                  connect 
                  by     nocycle 
                         name = prior referenced_name
                  and    type = prior referenced_type
                  

                  示例输出

                  Level 1: BUBS#MUNT_EENHEDEN   PACKAGE
                  Level 2: BUBS_MUNT_EENHEDEN_V VIEW    BUBS#MUNT_EENHEDEN    PACKAGE
                  Level 3: BUBS#VERTALINGEN     PACKAGE BUBS_MUNT_EENHEDEN_V  VIEW
                  Level 4: ITGEN_LANGUAGES_V    VIEW    BUBS#VERTALINGEN      PACKAGE
                  

                  复杂的场景

                  对于复杂的场景,我发现有必要直接在数据字典上使用自己的视图.仅当您知道自己在做什么以及要支持什么 RDBMS 版本时才执行此操作!例如,数据模型版本在数据字典中引入了重大变化.

                  Complex scenarios

                  For complex scenarios I've found it necessary to use an own view directly on the data dictionary. Do this only when you know what you are doing and what RDBMS version you want to support! For instance, datamodel versions introduced major changes in the data dictionary.

                  示例:

                  create or replace force view itgen_object_tree_changes_r
                  as 
                  select o_master.obj#        ojt#
                  ,      o_master.name        ojt_name
                  ,      o.mtime              ojt_ref_mtime
                  ,      o.name               ojt_ref_name
                  ,      o.owner#             ojt_ref_owner#
                  ,      decode
                         ( o.type#
                         , 0, 'NEXT OBJECT'
                         , 1, 'INDEX'
                         , 2, 'TABLE'
                         , 3, 'CLUSTER'
                         , 4, 'VIEW'
                         , 5, 'SYNONYM'
                         , 6, 'SEQUENCE'
                         , 7, 'PROCEDURE'
                         , 8, 'FUNCTION'
                         , 9, 'PACKAGE'
                         , 11, 'PACKAGE BODY'
                         , 12, 'TRIGGER'
                         , 13, 'TYPE'
                         , 14, 'TYPE BODY'
                         , 19, 'TABLE PARTITION'
                         , 20, 'INDEX PARTITION'
                         , 21, 'LOB'
                         , 22, 'LIBRARY'
                         , 23, 'DIRECTORY'
                         , 24, 'QUEUE'
                         , 28, 'JAVA SOURCE'
                         , 29, 'JAVA CLASS'
                         , 30, 'JAVA RESOURCE'
                         , 32, 'INDEXTYPE'
                         , 33, 'OPERATOR'
                         , 34, 'TABLE SUBPARTITION'
                         , 35, 'INDEX SUBPARTITION'
                         , 40, 'LOB PARTITION'
                         , 41, 'LOB SUBPARTITION'
                         , 42, nvl
                         ( ( select 'REWRITE EQUIVALENCE'
                         from    sys.sum$ s
                         where   s.obj# = o.obj#
                         and     bitand ( s.xpflags, 8388608 ) = 8388608 ), 'MATERIALIZED VIEW'
                         )
                         , 43, 'DIMENSION'
                         , 44, 'CONTEXT'
                         , 46, 'RULE SET'
                         , 47, 'RESOURCE PLAN'
                         , 48, 'CONSUMER GROUP'
                         , 51, 'SUBSCRIPTION'
                         , 52, 'LOCATION'
                         , 55, 'XML SCHEMA'
                         , 56, 'JAVA DATA'
                         , 57, 'EDITION'
                         , 59, 'RULE'
                         , 60, 'CAPTURE'
                         , 61, 'APPLY'
                         , 62, 'EVALUATION CONTEXT'
                         , 66, 'JOB'
                         , 67, 'PROGRAM'
                         , 68, 'JOB CLASS'
                         , 69, 'WINDOW'
                         , 72, 'WINDOW GROUP'
                         , 74, 'SCHEDULE'
                         , 79, 'CHAIN'
                         , 81, 'FILE GROUP'
                         , 82, 'MINING MODEL'
                         , 87, 'ASSEMBLY'
                         , 90, 'CREDENTIAL'
                         , 92, 'CUBE DIMENSION'
                         , 93, 'CUBE'
                         , 94, 'MEASURE FOLDER'
                         , 95, 'CUBE BUILD PROCESS'
                         , 'UNDEFINED'
                         )
                         ojt_ref_type
                  from   sys.obj$ o
                  ,      ( /* All dependencies from the object if there are any. */
                                    select distinct connect_by_root d_obj# obj#, dep.p_obj# obj_ref#
                           from   sys.dependency$ dep
                           connect
                           by     nocycle dep.d_obj# = prior dep.p_obj#
                           start
                           with   dep.d_obj# in ( select obj.obj# from itgen_schemas_r sma, sys.obj$ obj where obj.owner# = sma.owner# )
                           union all /* Union all allowed, 'in' ignores duplicates. */
                           /* The object itself. */
                           select obj.obj#
                           ,      obj.obj#
                           from   itgen_schemas_r sma
                           ,      sys.obj$ obj
                           where  obj.owner# = sma.owner#
                         ) deps
                  ,      sys.obj$ o_master
                  where  o_master.obj# = deps.obj#
                  and    o.obj# = deps.obj_ref#
                  --
                  -- View: itgen_object_tree_changes_r
                  --
                  -- Overview of dependencies between a master object and all objects used by it. It can be used to analyze the reason why a project version views must be recalculated.
                  --
                  -- Code (alias): ote_r
                  --
                  -- Category: Hardcoded.
                  --
                  -- Example:
                  --
                  -- The object 'X' is invalid, since 'Y' is invalid.
                  --
                  

                  这篇关于用于查找包的多级依赖项的脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:是否有类似于 DETERMINISTIC 的 PL/SQL pragma,但仅针对单个 SQL SELECT 的范围? 下一篇:在 Oracle 上使用 ORDER 插入

                  相关文章

                  <legend id='4REGM'><style id='4REGM'><dir id='4REGM'><q id='4REGM'></q></dir></style></legend>

                      <i id='4REGM'><tr id='4REGM'><dt id='4REGM'><q id='4REGM'><span id='4REGM'><b id='4REGM'><form id='4REGM'><ins id='4REGM'></ins><ul id='4REGM'></ul><sub id='4REGM'></sub></form><legend id='4REGM'></legend><bdo id='4REGM'><pre id='4REGM'><center id='4REGM'></center></pre></bdo></b><th id='4REGM'></th></span></q></dt></tr></i><div id='4REGM'><tfoot id='4REGM'></tfoot><dl id='4REGM'><fieldset id='4REGM'></fieldset></dl></div>
                    1. <small id='4REGM'></small><noframes id='4REGM'>

                      • <bdo id='4REGM'></bdo><ul id='4REGM'></ul>
                      <tfoot id='4REGM'></tfoot>