Oracle之获取SQL对应表的信息
2017-10-27 22:01
323 查看
SET LINESIZE 666
set pagesize 5000
column index_name format a30
column table_name format a26
column num_rows format 999999999
column index_type format a24
column num_rows format 999999999
column status format a8
column clustering_factor format 999999999
column degree format a10
column blevel format 9
column distinct_keys format 9999999999
column leaf_blocks format 9999999
column last_analyzed format a10
column column_name format a25
column column_position format 9
column temporary format a2
column partitioned format a5
column partitioning_type format a7
column partition_count format 999
--1.查看表大小情况
--记录的大小
select count(*) from T1;
select count(*) from T2;
--物理的大小
select segment_name,sum(bytes)/1024/1024
from user_segments
where segment_name in ('T1',
'T2')
group by segment_name;
--2.查看表是否有触发器
select OWNER, TRIGGER_NAME, TABLE_NAME, STATUS
from dba_triggers
where table_name in ('T1',
'T2');
---3.查看表结构情况
--查看表信息
/*
通过temporary,partitioned,iot_type三个字段可知表的类型是否是全局临时表、是否是分区表、是否是索引组织表
通过degree字段可得是否有被设置为并行度的属性(值大于1)
通过观察last_analyzed字段值可知是否有正常收集,看有无值,或者是看时间是否很久以前的。
*/
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',
'T2') ;
--查看分区表相关信息(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',
'T2') ;
--了解这些表以什么列作为分区
select name,object_type, column_name
from user_part_key_columns
where name in ('T1',
'T2') ;
--了解这些表的分区范围是多少
4000
SELECT table_name,partition_name, high_value, tablespace_name
FROM user_tab_partitions t
where table_name in ('T1',
'T2')
order by table_name,t.partition_position;
set pagesize 5000
column index_name format a30
column table_name format a26
column num_rows format 999999999
column index_type format a24
column num_rows format 999999999
column status format a8
column clustering_factor format 999999999
column degree format a10
column blevel format 9
column distinct_keys format 9999999999
column leaf_blocks format 9999999
column last_analyzed format a10
column column_name format a25
column column_position format 9
column temporary format a2
column partitioned format a5
column partitioning_type format a7
column partition_count format 999
--1.查看表大小情况
--记录的大小
select count(*) from T1;
select count(*) from T2;
--物理的大小
select segment_name,sum(bytes)/1024/1024
from user_segments
where segment_name in ('T1',
'T2')
group by segment_name;
--2.查看表是否有触发器
select OWNER, TRIGGER_NAME, TABLE_NAME, STATUS
from dba_triggers
where table_name in ('T1',
'T2');
---3.查看表结构情况
--查看表信息
/*
通过temporary,partitioned,iot_type三个字段可知表的类型是否是全局临时表、是否是分区表、是否是索引组织表
通过degree字段可得是否有被设置为并行度的属性(值大于1)
通过观察last_analyzed字段值可知是否有正常收集,看有无值,或者是看时间是否很久以前的。
*/
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',
'T2') ;
--查看分区表相关信息(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',
'T2') ;
--了解这些表以什么列作为分区
select name,object_type, column_name
from user_part_key_columns
where name in ('T1',
'T2') ;
--了解这些表的分区范围是多少
4000
SELECT table_name,partition_name, high_value, tablespace_name
FROM user_tab_partitions t
where table_name in ('T1',
'T2')
order by table_name,t.partition_position;
相关文章推荐
- 用SQL快捷的获取Oracle版本信息
- oracle常用的修改表信息及其获取系统日期时间的sql语句
- oracle获取当前用户表、字段详细信息SQL
- oracle获取当前用户表、字段等详细信息SQL
- oracle 获取表结构信息的SQL
- oracle 获取客户端ip与执行sql信息
- java获取sql,oracle的字段详细信息(字段类型,长度,精度)
- Oracle SQL获取简单的数据表目录信息,列信息
- 获取数据库系统信息的SQL语句(Mysql,Oracle)
- ^全^ 获取SQL SERVER2000/2005、MySql、Oracle元数据的SQL语句(1)
- SQL 利用INFORMATION_SCHEMA系统视图如何一步一步获取表的主外键信息
- oracle的错误代码如何查看对应的错误信息
- 使用GeoIP获取IP地址对应的信息(安装)
- 如何用SQL语句获取Oracle表结构
- struts+hibernate+oracle+easyui实现lazyout组件的简单案例——Emp实体类和对应的配置信息
- Oracle查询数据库表信息SQL
- 无法获取有关Windows NT 组\用户‘组\用户’的信息,错误代码0x5(Microsoft SQL Server,错误:15404)
- SQL获取数据库行列信息
- 00054.Oracle重做日志信息获取