日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 运维知识 > 数据库 >内容正文

数据库

oracle数据库查看size,[oracle] 查看oracle数据库表空间使用率,定位数据size较大对象...

發(fā)布時間:2023/12/4 数据库 29 豆豆
生活随笔 收集整理的這篇文章主要介紹了 oracle数据库查看size,[oracle] 查看oracle数据库表空间使用率,定位数据size较大对象... 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

=========================================

1.查看表空間使用情況

=========================================

with ts as (SELECT d.tablespace_name "Name", d.status "Status",

TO_CHAR (NVL (a.MAXBYTES / 1024 / 1024 /1024, 0), '99,999,990.90') "Maxsize (G)",

TO_CHAR (NVL (a.BYTES / 1024 / 1024 /1024, 0), '99,999,990.90') "Size (G)",

TO_CHAR (NVL (a.BYTES - NVL (f.BYTES, 0), 0) / 1024 / 1024 /1024,

'99999999.99'

) USE,

TO_CHAR (NVL ((a.BYTES - NVL (f.BYTES, 0)) / a.MAXBYTES * 100, 0),

'990.00'

) "Used %"

FROM SYS.dba_tablespaces d,

(SELECT ? tablespace_name, SUM (BYTES) BYTES,SUM (greatest(BYTES,MAXBYTES)) MAXBYTES

FROM dba_data_files

GROUP BY tablespace_name) a,

(SELECT ? tablespace_name, SUM (BYTES) BYTES

FROM dba_free_space

GROUP BY tablespace_name) f

WHERE d.tablespace_name = a.tablespace_name(+)

AND d.tablespace_name = f.tablespace_name(+)

AND NOT (d.extent_management LIKE 'LOCAL' AND d.CONTENTS LIKE 'TEMPORARY')

UNION ALL

select c.tablespace_name as name,'tempts',

to_char(c.maxbytes/1024/1024/1024,'99,999.999') "Maxsize (G)",

to_char(c.bytes/1024/1024/1024,'99,999.999') "Size (G)",

to_char(d.bytes_used/1024/1024/1024,'99,999.999') USE,

to_char(d.bytes_used*100/c.maxbytes,'99.99') "Used %"

from ?(select tablespace_name,sum(bytes) bytes,sum(greatest(maxbytes,bytes)) maxbytes

from dba_temp_files GROUP by tablespace_name) c,

(select tablespace_name,sum(bytes_cached) bytes_used

from gv$temp_extent_pool GROUP by tablespace_name) d

where c.tablespace_name = d.tablespace_name)

select * from ts order by 6 desc;

=========================================

2.查看segment使用情況

=========================================

col segment_name for a50

select

tablespace_name,segment_name,round(sum(bytes/1024/1024/1024),1) as

sizeG from ?dba_segments where tablespace_name in

('OLS_DATA','OLS_LOB','OLS_BAT') group by segment_name,tablespace_name

order by 3;

=========================================

3.查看具體表空間lob使用情況

=========================================

col segment_name for a50

col table_name for a50

select

l.table_name,l.segment_name,round(sum(s.bytes/1024/1024/1024),1) as

sizeG from ?dba_segments s,dba_lobs l where s.segment_name =

l.segment_name and s.tablespace_name = 'OLS_LOB' group by

l.table_name,l.segment_name order by

round(sum(s.bytes/1024/1024/1024),1);

總結

以上是生活随笔為你收集整理的oracle数据库查看size,[oracle] 查看oracle数据库表空间使用率,定位数据size较大对象...的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。