注册

如何只用sql语句查询HUGE表空间数据文件的使用大小等情况

xxg 2023/11/02 677 1 已解决

为提高效率,提问时请提供以下信息,问题描述清晰可优先响应。
【DM版本】:
【操作系统】:
【CPU】:
【问题描述】*:

drop table if exists orders;
drop huge tablespace if exists "HTEST" ;
create huge tablespace "HTEST" path '/home/dmdba/data1010/DAMENG/HTEST' ;

CREATE HUGE TABLE orders
(
o_orderkey INT,
o_comment VARCHAR(79) STORAGE(stat none)
)STORAGE(SECTION(65536) , FILESIZE(64), WITH DELTA, ON HTEST) COMPRESS LEVEL 9 FOR
'QUERY HIGH' (o_comment);

begin
for i in 1..300000 loop
insert into orders values(1,to_char(i)||': '||dbms_random.string('P',36) );
if mod(1,100)=0 then commit;
else null ;
end if;

end loop;
end;
/
commit;

select table_used_space('SYSDBA','ORDERS')*page/1024/1024.0
用table_used_space能查到单个HUGE表的使用大小,那么如何只通过sql语句查询整个HUGE表空间的使用大小等情况?

试过select name ,path,round(d.total_size*page/1024/1024.0,3) || 'M' as total_size,round( (d.total_size-d.free_size)*page/1024/1024.0,3) || 'M' as used_size,auto_extend, d.max_size||'M' 扩展上限,
round((d.total_size-d.free_size)*100.0/d.total_size,3) ||'%' per from V$datafile d,V$tablespace t
where t.id=d.group_id order by name ; 这种不行,如下三个图片,HTEST.dbf的used_size值和HUGE表占用空间对不上。
1698908311358.png
1698908362681.png
1698908386293.png

回答 0
暂无回答
扫一扫
联系客服