15
14

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

ORACLEの機能を使って、オブジェクト間の依存関係を調べる

Posted at

ORACLEの機能を使って、オブジェクト間の依存関係を調べる

  • 各DBオブジェクトがどのような依存関係を持っているか調べるスクリプト
  • hogehoge_tbl が依存関係を調べたいテーブルの名前、のパターンのSQL
SQL

select
  referenced_owner || '.' || referenced_name as RefObj
, type, owner || '.' || name                 as Object
, decode(Level,1,'直接','間接')              as "dependency"
, substr(sys_connect_by_path(referenced_name,'←'),2) || '←' || name as "dependency_list"
from
  all_dependencies
    start with referenced_name = upper('hogehoge_tbl') -- 依存関係を調べたいオブジェクトの名前
        connect by
              prior owner = referenced_owner        
          and prior name  = referenced_name       
          and prior type  = referenced_type 
order siblings by
  type
, owner
, name
/

15
14
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
15
14

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?