select
t.tablespace_name,
round(sum(bytes/(1024*1024)),0)
ts_size
from
dba_tablespaces
t,
dba_data_files
d
where
t.tablespace_name
=
d.tablespace_name
group
by
t.tablespace_name
--2、查看表空间物理文件的名称及大小
select
tablespace_name,
file_id,
file_name,
round(bytes/(1024*1024),0)
total_space
from
dba_data_files
order
by
tablespace_name
3.查看所有表空间使用情况
select
b.file_id
文件ID号,
b.tablespace_name
表空间名,
b.bytes/1024/1024||'M'字节数,
(b.bytes-sum(nvl(a.bytes,0)))/1024/1024||'M'
已使用,
sum(nvl(a.bytes,0))/1024/1024||'M'
剩余空间,
round(100
-
sum(nvl(a.bytes,0))/(b.bytes)*100,2)||
'%'
占用百分比
from
dba_free_space
a,dba_data_files
b
where
a.file_id=b.file_id
group
by
b.tablespace_name,b.file_id,b.bytes
order
by
b.file_id
总有一款适合你!
1、查询整个mysql数据库,整个库的大小;单位转换为MB。
select concat(round(sum(DATA_LENGTH/1024/1024),2),'MB') as data from information_schema.TABLES
2、查询mysql数据库,某个库的大小;
select concat(round(sum(DATA_LENGTH/1024/1024),2),'MB') as data
from information_schema.TABLES
where table_schema = 'testdb'
3、查看库中某个表的大小;
select concat(round(sum(DATA_LENGTH/1024/1024),2),'MB') as data
from information_schema.TABLES
where table_schema = 'testdb'
and table_name = 'test_a'
4、查看mysql库中,test开头的表,所有存储大小;
select concat(round(sum(DATA_LENGTH/1024/1024),2),'MB') as data
from information_schema.TABLES
where table_schema = 'testdb'
and table_name like 'test%'
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)