查询数据库表大小
A. 怎么查看oracle数据库表的大小
1. 查看所有表空间大小 sql> select tablespace_name,sum(bytes)/1024/1024 from dba_data_files 2 group by tablespace_name; 2. 已经使用的表空间大小 SQL> select tablespace_name,sum(bytes)/1024/1024 from dba_free_space 2 group by tablespace_name; 3. 所以使用空间可以这样计算 select a.tablespace_name,total,free,total-free used from ( select tablespace_name,sum(bytes)/1024/1024 total from dba_data_files group by tablespace_name) a, ( select tablespace_name,sum(bytes)/1024/1024 free from dba_free_space group by tablespace_name) b where a.tablespace_name=b.tablespace_name; 4. 下面这条语句查看所有segment的大小。 Select Segment_Name,Sum(bytes)/1024/1024 From User_Extents Group By Segment_Name 5. 还有在命令行情况下如何将结果放到一个文件里。 SQL> spool out.txt SQL> select * from v$database; SQL> spool off
B. oracle数据库如何查看表空间大小
1.查看Oracle数据库中表空间信息的工具方法: 使用oracle enterprise manager console工具,这是oracle的客户端工具,当安装oracle服务器或客户端时会自动安装此工具,在...
2.查看Oracle数据库中表空间信息的命令方法: 通过查询数据库系统中的数据字典表(data dictionary tables)获取表空间的相关信息,首先使用客户端工具连接到数据库,这些工具可以是SQL..
C. mysql怎么查看数据库中表的大小
查看mysql数据库大小的四种办法,分别有以下四种:
第一种:进去指定schema
数据库(存放了其他的数据库的信息)
use
information_schema
第二种:查询所有数据的大小
select
concat(round(sum(DATA_LENGTH/1024/1024),2),'MB')
as
data
from
TABLES
第三种:查看指定数据库的大小,比如说:数据库apoyl
select
concat(round(sum(DATA_LENGTH/1024/1024),2),'MB')
as
data
from
TABLES
where
table_schema='apoyl';
第四种:查看指定数据库的表的大小,比如说:数据库apoyl
中apoyl_test表
select
concat(round(sum(DATA_LENGTH/1024/1024),2),'MB')
as
data
from
TABLES
where
table_schema='apoyl'
and
table_name='apoyl_test';
D. MySQL中查询所有数据库占用磁盘空间大小和单个库中所有表的大小的sql语句
查询所有数据库占用磁盘空间大小的SQL语句:
复制代码
代码如下:
select
TABLE_SCHEMA,
concat(truncate(sum(data_length)/1024/1024,2),'
MB')
as
data_size,
concat(truncate(sum(index_length)/1024/1024,2),'MB')
as
index_size
from
information_schema.tables
group
by
TABLE_SCHEMA
order
by
data_length
desc;
查询单个库中所有表磁盘占用大小的SQL语句:
复制代码
代码如下:
select
TABLE_NAME,
concat(truncate(data_length/1024/1024,2),'
MB')
as
data_size,
concat(truncate(index_length/1024/1024,2),'
MB')
as
index_size
from
information_schema.tables
where
TABLE_SCHEMA
=
'TestDB'
group
by
TABLE_NAME
order
by
data_length
desc;
以上语句测试有效,注意替换以上的TestDB为数据库名
E. oracle中怎么查看表的大小
可用如下语句查看:
selectround(BYTES/1024/1024,2)||'M'fromuser_segmentswheresegment_name='表名';
注意:表名需要用英文大写。
如要查询数据库中emp表的大小,用如下语句:
select round(BYTES/1024/1024,2)||'M' from user_segments where segment_name='EMP';
查询结果:
查询结果代表EMP表所占空间大小为0.06M。