700字范文,内容丰富有趣,生活中的好帮手!
700字范文 > mysql查看表空间剩余大小_查询表空间的总大小 剩余表空间 已用空间 表占用大小 某

mysql查看表空间剩余大小_查询表空间的总大小 剩余表空间 已用空间 表占用大小 某

时间:2019-06-24 07:24:01

相关推荐

mysql查看表空间剩余大小_查询表空间的总大小 剩余表空间 已用空间 表占用大小 某

引用 :/cosio/article/details/3978747 , /question/628524115699308364.html

block 块

extent 区

segment 段

--增加USERS表空间500M空间

alter tablespace USERS add datafile '/data01/oradata/bidb96/USER_test30.bdf' size 500M;

select file_name , tablespace_name, t.* from dba_data_files t where tablespace_name = 'USERS' order by file_id;

--每个表占用的空间

select segment_name,sum(bytes )/1024/1024/1024 GB

from user_segments --where segment_name ='TR_GOV_WJ_XNH_D'

group by segment_name ;

--0530这天TW层占用的空间

select count(distinct segment_name) tb_cnt,sum(bytes)/(1024*1024*1024) GB

from user_segments t

where partition_name='P_0530'

and segment_name like 'TW%';

----查看剩余表空间 汇总

SELECT t1 表空间,z 总表空间,z-s 已用表空间,s 剩余表空间,ROUND((z-s)/z*100,2) "使用率%"

From (Select tablespace_name t1,Sum(bytes)/(1024*1024*1024) s

From DBA_FREE_SPACE Group by tablespace_name),

(Select tablespace_name t2,Sum(bytes)/(1024*1024*1024) z

From DBA_DATA_FILES Group by tablespace_name) Where t1=t2;

---表空间总共的空间

select tablespace_name,sum(bytes)/(1024*1024*1024) GB from dba_data_files

group by tablespace_name

;

--表空间剩余空间

select tablespace_name,sum(bytes)/(1024*1024*1024) GB from user_free_space

group by tablespace_name

;

--表空间占用的空间表空间所有对象的物理占用(表,分区,索引等) 这个和DBA_DATA_FILES的大小才一样

select tablespace_name,sum(bytes)/(1024*1024*1024) GB from user_segments

group by tablespace_name

;

----表实际使用大小 这个大小相加必定

select table_name,(num_rows * avg_row_len )/(1024*1024*1024) 该表大小GB

from user_tables

where table_name = '表名大写'--672699条数据 0.306965947151184GB

order by 2 desc

mysql查看表空间剩余大小_查询表空间的总大小 剩余表空间 已用空间 表占用大小 某天占用的大小...

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。