ITPub博客

首页 > 数据库 > Oracle > 表相关

表相关

原创 Oracle 作者:aidway 时间:2014-04-11 10:50:42 0 删除 编辑

--1.查看表大小情况
--记录的大小
select count(*) from t1;
 
--物理的大小
select segment_name, sum(bytes) / 1024 / 1024
  from user_segments
 where segment_name in ('t1')
 group by segment_name;

select segment_name, partition_name,bytes / 1024 / 1024
  from user_segments
 where segment_name in ('t1');


--2.查看表是否有触发器

select OWNER, TRIGGER_NAME, TABLE_NAME, STATUS
  from dba_triggers
 where table_name in  ('t1');  
 
---3.查看表结构情况
--查看表信息

select  t.table_name,
        t.num_rows,
        t.blocks,
        t.degree,
        t.last_analyzed,
        t.temporary,
        t.partitioned,
        t.iot_type,
        t.pct_free,
        t.tablespace_name
from user_tables t
where table_name in ('t1')   ;                   
                     
--查看分区表相关信息(user_part_tables记录分区的表的信息,user_tab_partitions记录表的分区的信息)

--了解这些表的分区是什么类型的,有多少个分区
select t.table_name,                                            
       t.partitioning_type,                                           
       t.partition_count                                              
  from user_part_tables t                                              
 where table_name in ('t1') ;
                                   
--了解这些表以什么列作为分区                               
select name,object_type, column_name                                                                                                                  
  from user_part_key_columns                                                                                
 where name in ('t1') ;                

        
--了解这些表的分区范围是多少
SELECT table_name,partition_name, high_value, tablespace_name
  FROM user_tab_partitions t
 where table_name in ('t1')
 order by table_name,t.partition_position;

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/28675539/viewspace-1139998/ ,如需转载,请注明出处,否则将追究法律责任。

上一篇: 控制文件
下一篇: 索引相关
请登录后发表评论 登录
全部评论

注册时间:2013-12-04

  • 博文量
    28
  • 访问量
    96449