索引構成列を確認する

Pocket

出力結果の説明:

所有者(表) :表の所有者
所有者(索引) :索引の所有者
表名 :表の名前
索引名 :索引の名前
列名 :表の列名
索引タイプ :索引の種類
一意性 :索引の一意性
UNIQUE ==> Y
NONUNIQUE ==> N
定義順序 :列の定義順序
ソート方法 :ソート方法

 

set echo off
set lines 120
set pages 1000

clear col
ttitle off

col TABLE_OWNER form a12 head “所有者|(表)”
col index_owner form a12 head “所有者|(索引)”
col table_name form a25 head “表名”
col index_name form a25 head “索引名”
col column_name form a16 head “列名”
col index_type form a8 head “索引タイプ”
col UNIQUENESS form a5 head “一意?”
col column_position form 999 head “定義|順序”
col descend form a5 head “ソート|方法”

break on table_owner on index_owner on table_name on index_name nodup

ttitle left ‘■■■■ 索引構成列一覧 ■■■■’
spool 索引構成列.lis
select
dt.owner TABLE_OWNER,
dic.index_owner,
dt.table_name,
dic.index_name,
dic.column_name,
dic.column_position,
di.index_type,
decode(di.uniqueness,’UNIQUE’,’Y’,’NONUNIQUE’,’N’) UNIQUENESS,
dic.descend
from
dba_ind_columns dic,
dba_indexes di,
dba_tables dt
where dic.index_owner not in
(‘SYS’,’SYSTEM’,’ORDSYS’,’CTXSYS’,’MDSYS’,’AURORA$JIS$UTILITY$’,’OUTLN’)
and dic.index_name = di.index_name
and dic.table_name = dt.table_name(+)
and dt.table_name = di.table_name(+)
order by TABLE_OWNER,table_name,index_name,column_position
/
spool off

clear col
ttitle off
set echo on

 

投稿者:

oracledba

長年Oracleエンジニアを中心として、業務に携わってきました。 このサイトが少しでもお役に立てれば幸いです。

コメントを残す