Sunday, June 20, 2021

sql_relative_card

col OBJECT_NAME for a30
col OBJECT_OWNER for a15
col OBJECT_TYPE for a15

col OPERATION for a20
col DEGREE for a15

select distinct plan_hash_value, object_name, object_owner, Object_type, operation,options,cardinality,timestamp,degree
from dba_hist_sql_plan a, dba_tables b
where sql_id ='&&sql_id' and object_owner is not null and object_type = 'TABLE' and object_name = table_name and object_owner = b.owner union
select distinct plan_hash_value, object_name, object_owner, Object_type,operation,options, cardinality,timestamp,degree
from dba_hist_sql_plan, dba_Indexes b
where sql_id ='&&sql_id' and object_owner is not null and object_type = 'INDEX' and object_name = index_name and object_owner = b.owner order by timestamp,plan_hash_value, cardinality,object_type

No comments:

Post a Comment