<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	
	>
<channel>
	<title>《oracle查看object对象使用空间》的评论</title>
	<atom:link href="https://www.xifenfei.com/2010/10/oracle%e6%9f%a5%e7%9c%8bobject%e5%af%b9%e8%b1%a1%e4%bd%bf%e7%94%a8%e7%a9%ba%e9%97%b4.html/feed" rel="self" type="application/rss+xml" />
	<link>https://www.xifenfei.com/2010/10/oracle%e6%9f%a5%e7%9c%8bobject%e5%af%b9%e8%b1%a1%e4%bd%bf%e7%94%a8%e7%a9%ba%e9%97%b4.html</link>
	<description>提供7*24专业数据库(Oracle,SQL Server,MySQL,PostgreSQL等)恢复和技术支持@Tel:17813235971</description>
	<lastBuildDate>Thu, 11 Dec 2025 02:46:14 +0000</lastBuildDate>
		<sy:updatePeriod>hourly</sy:updatePeriod>
		<sy:updateFrequency>1</sy:updateFrequency>
	
	<item>
		<title>作者：惜分飞</title>
		<link>https://www.xifenfei.com/2010/10/oracle%e6%9f%a5%e7%9c%8bobject%e5%af%b9%e8%b1%a1%e4%bd%bf%e7%94%a8%e7%a9%ba%e9%97%b4.html/comment-page-1#comment-789</link>
		<dc:creator><![CDATA[惜分飞]]></dc:creator>
		<pubDate>Sat, 21 Apr 2012 01:44:19 +0000</pubDate>
		<guid isPermaLink="false">https://www.xifenfei.com/?p=540#comment-789</guid>
		<description><![CDATA[表空间大小估算
[sql]
select a.tablespace_name,
       round(a.s,2) &quot;CURRENT_TOTAL(MB)&quot;,
       round((a.s - f.s),2) &quot;USED(MB)&quot;,
       f.s &quot;FREE(MB)&quot;,
       round(f.s / a.s * 100, 2) &quot;FREE%&quot;,
       g.autoextensible,
       round(a.ms,2) &quot;MAX_TOTAL(MB)&quot;
  from (select d.tablespace_name,
               sum(bytes / 1024 / 1024) s,
               sum(decode(maxbytes, 0, bytes, maxbytes) / 1024 / 1024) ms
          from dba_data_files d
         group by d.tablespace_name) a,
       (select f.tablespace_name, sum(f.bytes / 1024 / 1024) s
          from dba_free_space f
         group by f.tablespace_name) f,
       (select distinct tablespace_name, autoextensible
          from DBA_DATA_FILES
         where autoextensible = &#039;YES&#039;
        union
        select distinct tablespace_name, autoextensible
          from DBA_DATA_FILES
         where autoextensible = &#039;NO&#039;
           and tablespace_name not in
               (select distinct tablespace_name
                  from DBA_DATA_FILES
                 where autoextensible = &#039;YES&#039;)) g
 where a.tablespace_name = f.tablespace_name
   and g.tablespace_name = f.tablespace_name order by &quot;FREE%&quot;;
[/sql]
准确计算表空间大小
[sql]
SELECT F.TABLESPACE_NAME,
       A.ALL_TOTAL &quot;总空间&quot;,
       A.ALL_USED &quot;总使用空间&quot;,
       A.ALL_TOTAL - A.ALL_USED &quot;总剩余空间&quot;,
       (A.ALL_TOTAL - A.ALL_USED) / A.ALL_TOTAL * 100 &quot;总剩余比例&quot;,
       A.TOTAL &quot;当前大小&quot;,
       U.USED &quot;当前使用空间&quot;,
       F.FREE &quot;当前剩余空间&quot;,
       (U.USED / A.TOTAL) * 100&quot;当前使用比例&quot;,
       (F.FREE / A.TOTAL) * 100 &quot;当前剩余比例&quot;
  FROM (SELECT TABLESPACE_NAME,
               SUM(BYTES / (1024 * 1024 * 1024)) TOTAL,
               SUM(DECODE(AUTOEXTENSIBLE, &#039;YES&#039;, MAXBYTES, BYTES) /
                   (1024 * 1024 * 1024)) ALL_TOTAL,
               SUM(USER_BYTES) / (1024 * 1024 * 1024) ALL_USED
          FROM DBA_DATA_FILES
         GROUP BY TABLESPACE_NAME) A,
       (SELECT TABLESPACE_NAME, SUM(BYTES / (1024 * 1024 * 1024)) USED
          FROM DBA_EXTENTS
         GROUP BY TABLESPACE_NAME) U,
       (SELECT TABLESPACE_NAME, SUM(BYTES / (1024 * 1024 * 1024)) FREE
          FROM DBA_FREE_SPACE
         GROUP BY TABLESPACE_NAME) F
 WHERE A.TABLESPACE_NAME = F.TABLESPACE_NAME(+)
   AND A.TABLESPACE_NAME = U.TABLESPACE_NAME(+)
 ORDER BY (A.ALL_TOTAL - A.ALL_USED) / A.ALL_TOTAL,F.FREE / A.TOTAL ASC;
[/sql]]]></description>
		<content:encoded><![CDATA[<p>表空间大小估算</p>
<pre class="brush: sql; title: ; notranslate">
select a.tablespace_name,
       round(a.s,2) &quot;CURRENT_TOTAL(MB)&quot;,
       round((a.s - f.s),2) &quot;USED(MB)&quot;,
       f.s &quot;FREE(MB)&quot;,
       round(f.s / a.s * 100, 2) &quot;FREE%&quot;,
       g.autoextensible,
       round(a.ms,2) &quot;MAX_TOTAL(MB)&quot;
  from (select d.tablespace_name,
               sum(bytes / 1024 / 1024) s,
               sum(decode(maxbytes, 0, bytes, maxbytes) / 1024 / 1024) ms
          from dba_data_files d
         group by d.tablespace_name) a,
       (select f.tablespace_name, sum(f.bytes / 1024 / 1024) s
          from dba_free_space f
         group by f.tablespace_name) f,
       (select distinct tablespace_name, autoextensible
          from DBA_DATA_FILES
         where autoextensible = 'YES'
        union
        select distinct tablespace_name, autoextensible
          from DBA_DATA_FILES
         where autoextensible = 'NO'
           and tablespace_name not in
               (select distinct tablespace_name
                  from DBA_DATA_FILES
                 where autoextensible = 'YES')) g
 where a.tablespace_name = f.tablespace_name
   and g.tablespace_name = f.tablespace_name order by &quot;FREE%&quot;;
</pre>
<p>准确计算表空间大小</p>
<pre class="brush: sql; title: ; notranslate">
SELECT F.TABLESPACE_NAME,
       A.ALL_TOTAL &quot;总空间&quot;,
       A.ALL_USED &quot;总使用空间&quot;,
       A.ALL_TOTAL - A.ALL_USED &quot;总剩余空间&quot;,
       (A.ALL_TOTAL - A.ALL_USED) / A.ALL_TOTAL * 100 &quot;总剩余比例&quot;,
       A.TOTAL &quot;当前大小&quot;,
       U.USED &quot;当前使用空间&quot;,
       F.FREE &quot;当前剩余空间&quot;,
       (U.USED / A.TOTAL) * 100&quot;当前使用比例&quot;,
       (F.FREE / A.TOTAL) * 100 &quot;当前剩余比例&quot;
  FROM (SELECT TABLESPACE_NAME,
               SUM(BYTES / (1024 * 1024 * 1024)) TOTAL,
               SUM(DECODE(AUTOEXTENSIBLE, 'YES', MAXBYTES, BYTES) /
                   (1024 * 1024 * 1024)) ALL_TOTAL,
               SUM(USER_BYTES) / (1024 * 1024 * 1024) ALL_USED
          FROM DBA_DATA_FILES
         GROUP BY TABLESPACE_NAME) A,
       (SELECT TABLESPACE_NAME, SUM(BYTES / (1024 * 1024 * 1024)) USED
          FROM DBA_EXTENTS
         GROUP BY TABLESPACE_NAME) U,
       (SELECT TABLESPACE_NAME, SUM(BYTES / (1024 * 1024 * 1024)) FREE
          FROM DBA_FREE_SPACE
         GROUP BY TABLESPACE_NAME) F
 WHERE A.TABLESPACE_NAME = F.TABLESPACE_NAME(+)
   AND A.TABLESPACE_NAME = U.TABLESPACE_NAME(+)
 ORDER BY (A.ALL_TOTAL - A.ALL_USED) / A.ALL_TOTAL,F.FREE / A.TOTAL ASC;
</pre>
]]></content:encoded>
	</item>
</channel>
</rss>
