<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
		>
<channel>
	<title>Comments on: Tablespace HWM</title>
	<atom:link href="http://jonathanlewis.wordpress.com/tablespace-hwm/feed/" rel="self" type="application/rss+xml" />
	<link>http://jonathanlewis.wordpress.com</link>
	<description>Just another Oracle weblog</description>
	<lastBuildDate>Fri, 24 May 2013 13:27:07 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
	<item>
		<title>By: Jonathan Lewis</title>
		<link>http://jonathanlewis.wordpress.com/tablespace-hwm/#comment-42355</link>
		<dc:creator><![CDATA[Jonathan Lewis]]></dc:creator>
		<pubDate>Sun, 13 Nov 2011 15:37:43 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/?page_id=3002#comment-42355</guid>
		<description><![CDATA[Hersch,

I don&#039;t understand where the problem might be with this - unless Exadata does something strange. 

The basic command for each file would be something like:
[sourcecode]
alter database datafile &#039;+DATA/linux/datafile/fpw_idx.277.766339579&#039; resize 200M;
[/sourcecode]

If this works you need only do something like:
[sourcecode]
begin
    for r in (
        select  file_name
        from    dba_data_files
        where   tablespace_name = &#039;FPW_IDX&#039;
    ) loop
        execute immediate
            &#039;alter database datafile &#039;&#039;&#039; &#124;&#124; r.file_name &#124;&#124; &#039;&#039;&#039; resize 50M&#039;;
    end loop;
end;
/
[/sourcecode]

Obviously you may want to add an exception handler to trap and report error &lt;b&gt;ORA-03297&lt;/b&gt; (file contains used data beyond requested RESIZE value)]]></description>
		<content:encoded><![CDATA[<p>Hersch,</p>
<p>I don&#8217;t understand where the problem might be with this &#8211; unless Exadata does something strange. </p>
<p>The basic command for each file would be something like:</p>
<pre class="brush: plain; title: ; notranslate">
alter database datafile '+DATA/linux/datafile/fpw_idx.277.766339579' resize 200M;
</pre>
<p>If this works you need only do something like:</p>
<pre class="brush: plain; title: ; notranslate">
begin
    for r in (
        select  file_name
        from    dba_data_files
        where   tablespace_name = 'FPW_IDX'
    ) loop
        execute immediate
            'alter database datafile ''' || r.file_name || ''' resize 50M';
    end loop;
end;
/
</pre>
<p>Obviously you may want to add an exception handler to trap and report error <b>ORA-03297</b> (file contains used data beyond requested RESIZE value)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Hersch</title>
		<link>http://jonathanlewis.wordpress.com/tablespace-hwm/#comment-42257</link>
		<dc:creator><![CDATA[Hersch]]></dc:creator>
		<pubDate>Wed, 02 Nov 2011 21:37:43 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/?page_id=3002#comment-42257</guid>
		<description><![CDATA[Thanks for this post. I am trying to write a script to shrink un-used files in a particular Table Space to 50MB. The file system is ASM shared storage on exadata environment. If you could share your thoughts with a sample script, it would be grateful.

Appreciate your help.]]></description>
		<content:encoded><![CDATA[<p>Thanks for this post. I am trying to write a script to shrink un-used files in a particular Table Space to 50MB. The file system is ASM shared storage on exadata environment. If you could share your thoughts with a sample script, it would be grateful.</p>
<p>Appreciate your help.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: OraExplorer &#187; RMAN Duplicate Failed &#8211; Need to Format Corrupt Block Not Part of Any Segment</title>
		<link>http://jonathanlewis.wordpress.com/tablespace-hwm/#comment-39146</link>
		<dc:creator><![CDATA[OraExplorer &#187; RMAN Duplicate Failed &#8211; Need to Format Corrupt Block Not Part of Any Segment]]></dc:creator>
		<pubDate>Wed, 12 Jan 2011 03:56:49 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/?page_id=3002#comment-39146</guid>
		<description><![CDATA[[...] other way to confirm is to use Jonathan Lewis&#8217;s query from this post to list all the used extents and free space in a [...]]]></description>
		<content:encoded><![CDATA[<p>[...] other way to confirm is to use Jonathan Lewis&#8217;s query from this post to list all the used extents and free space in a [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nooresh Bajracharya</title>
		<link>http://jonathanlewis.wordpress.com/tablespace-hwm/#comment-39060</link>
		<dc:creator><![CDATA[Nooresh Bajracharya]]></dc:creator>
		<pubDate>Wed, 05 Jan 2011 21:36:25 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/?page_id=3002#comment-39060</guid>
		<description><![CDATA[Thank you for the Clarification. 

Regards, 
Nooresh]]></description>
		<content:encoded><![CDATA[<p>Thank you for the Clarification. </p>
<p>Regards,<br />
Nooresh</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jonathan Lewis</title>
		<link>http://jonathanlewis.wordpress.com/tablespace-hwm/#comment-39059</link>
		<dc:creator><![CDATA[Jonathan Lewis]]></dc:creator>
		<pubDate>Wed, 05 Jan 2011 21:31:27 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/?page_id=3002#comment-39059</guid>
		<description><![CDATA[Nooresh,

Thanks for coming back on this.
&quot;shrink space compact&quot; moves the rows from the end of the table to the beginning of the table, but doesn&#039;t drop the highwater mark. &quot;shrink space&quot; drops the highwater mark after compacting. (This also requires a lock to be taken on the table, of course).

When you used &quot;shrink space cascade&quot; you were explicitly requesting that oracle tidy up the indexes as well, but implicitly (because there was no compact) telling it to drop the highwater mark.]]></description>
		<content:encoded><![CDATA[<p>Nooresh,</p>
<p>Thanks for coming back on this.<br />
&#8220;shrink space compact&#8221; moves the rows from the end of the table to the beginning of the table, but doesn&#8217;t drop the highwater mark. &#8220;shrink space&#8221; drops the highwater mark after compacting. (This also requires a lock to be taken on the table, of course).</p>
<p>When you used &#8220;shrink space cascade&#8221; you were explicitly requesting that oracle tidy up the indexes as well, but implicitly (because there was no compact) telling it to drop the highwater mark.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nooresh Bajracharya</title>
		<link>http://jonathanlewis.wordpress.com/tablespace-hwm/#comment-39055</link>
		<dc:creator><![CDATA[Nooresh Bajracharya]]></dc:creator>
		<pubDate>Wed, 05 Jan 2011 15:58:54 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/?page_id=3002#comment-39055</guid>
		<description><![CDATA[My initial thought was reclaming the unused space and when i ran &quot;shrink space compact&quot; i found that it delete and reinsert the rows but it doesn&#039;t reclaim the unused space. At the same time if i use the &quot;cascade&quot; option it will reclaim the spaces. 
[sourcecode gutter=&quot;false&quot;]
SQL&gt; exec dbms_stats.gather_table_stats(&#039;NOORESH&#039;,&#039;G1&#039;);

PL/SQL procedure successfully completed.

SQL&gt; select blocks,empty_blocks,num_rows from dba_tables where table_name=&#039;G1&#039;;

    BLOCKS EMPTY_BLOCKS   NUM_ROWS
---------- ------------ ----------
      7068            0     508592

SQL&gt; select blocks, extents from dba_segments where segment_name=&#039;G1&#039;;

    BLOCKS    EXTENTS
---------- ----------
      7168         71

SQL&gt; select count (distinct dbms_rowid.rowid_block_number(rowid)) &quot;used blocks&quot; from G1;

used blocks
-----------
       6999

SQL&gt; DELETE FROM G1 WHERE ROWNUM  select count (distinct dbms_rowid.rowid_block_number(rowid)) &quot;used blocks&quot; from G1;

used blocks
-----------
       4127

SQL&gt; select blocks, extents from dba_segments where segment_name=&#039;G1&#039;;

    BLOCKS    EXTENTS
---------- ----------
      7168         71

SQL&gt; ALTER TABLE G1 ENABLE ROW MOVEMENT;

Table altered.

SQL&gt; ALTER TABLE G1 SHRINK SPACE COMPACT;

Table altered.

SQL&gt; select count (distinct dbms_rowid.rowid_block_number(rowid)) &quot;used blocks&quot; from G1;

used blocks
-----------
       4129

SQL&gt; exec dbms_stats.gather_table_stats(&#039;NOORESH&#039;,&#039;G1&#039;);

PL/SQL procedure successfully completed.

SQL&gt; select blocks, extents from dba_segments where segment_name=&#039;G1&#039;;

    BLOCKS    EXTENTS
---------- ----------
      7168         71

----- While using Cascade Option

SQL&gt; TRUNCATE TABLE G1;

Table truncated.

SQL&gt; insert into g1 select * from  g1

816560 rows created.

SQL&gt; exec dbms_stats.gather_table_stats(&#039;NOORESH&#039;,&#039;G1&#039;);

PL/SQL procedure successfully completed.

SQL&gt; select blocks, extents from dba_segments where segment_name=&#039;G1&#039;;

    BLOCKS    EXTENTS
---------- ----------
     23552         94

SQL&gt; select count (distinct dbms_rowid.rowid_block_number(rowid)) &quot;used blocks&quot; from G1;

used blocks
-----------
      22383

SQL&gt; delete from g1 where rownum  commit;

Commit complete.

SQL&gt; select count (distinct dbms_rowid.rowid_block_number(rowid)) &quot;used blocks&quot; from G1;

used blocks
-----------
      15531

SQL&gt; alter table g1 shrink space cascade;

Table altered.

SQL&gt; exec dbms_stats.gather_table_stats(&#039;NOORESH&#039;,&#039;G1&#039;);

PL/SQL procedure successfully completed.

SQL&gt; select blocks, extents from dba_segments where segment_name=&#039;G1&#039;;

    BLOCKS    EXTENTS
---------- ----------
     15704         87
[/sourcecode]]]></description>
		<content:encoded><![CDATA[<p>My initial thought was reclaming the unused space and when i ran &#8220;shrink space compact&#8221; i found that it delete and reinsert the rows but it doesn&#8217;t reclaim the unused space. At the same time if i use the &#8220;cascade&#8221; option it will reclaim the spaces. </p>
<pre class="brush: plain; gutter: false; title: ; notranslate">
SQL&amp;gt; exec dbms_stats.gather_table_stats('NOORESH','G1');

PL/SQL procedure successfully completed.

SQL&amp;gt; select blocks,empty_blocks,num_rows from dba_tables where table_name='G1';

    BLOCKS EMPTY_BLOCKS   NUM_ROWS
---------- ------------ ----------
      7068            0     508592

SQL&amp;gt; select blocks, extents from dba_segments where segment_name='G1';

    BLOCKS    EXTENTS
---------- ----------
      7168         71

SQL&amp;gt; select count (distinct dbms_rowid.rowid_block_number(rowid)) &quot;used blocks&quot; from G1;

used blocks
-----------
       6999

SQL&amp;gt; DELETE FROM G1 WHERE ROWNUM  select count (distinct dbms_rowid.rowid_block_number(rowid)) &quot;used blocks&quot; from G1;

used blocks
-----------
       4127

SQL&amp;gt; select blocks, extents from dba_segments where segment_name='G1';

    BLOCKS    EXTENTS
---------- ----------
      7168         71

SQL&amp;gt; ALTER TABLE G1 ENABLE ROW MOVEMENT;

Table altered.

SQL&amp;gt; ALTER TABLE G1 SHRINK SPACE COMPACT;

Table altered.

SQL&amp;gt; select count (distinct dbms_rowid.rowid_block_number(rowid)) &quot;used blocks&quot; from G1;

used blocks
-----------
       4129

SQL&amp;gt; exec dbms_stats.gather_table_stats('NOORESH','G1');

PL/SQL procedure successfully completed.

SQL&amp;gt; select blocks, extents from dba_segments where segment_name='G1';

    BLOCKS    EXTENTS
---------- ----------
      7168         71

----- While using Cascade Option

SQL&amp;gt; TRUNCATE TABLE G1;

Table truncated.

SQL&amp;gt; insert into g1 select * from  g1

816560 rows created.

SQL&amp;gt; exec dbms_stats.gather_table_stats('NOORESH','G1');

PL/SQL procedure successfully completed.

SQL&amp;gt; select blocks, extents from dba_segments where segment_name='G1';

    BLOCKS    EXTENTS
---------- ----------
     23552         94

SQL&amp;gt; select count (distinct dbms_rowid.rowid_block_number(rowid)) &quot;used blocks&quot; from G1;

used blocks
-----------
      22383

SQL&amp;gt; delete from g1 where rownum  commit;

Commit complete.

SQL&amp;gt; select count (distinct dbms_rowid.rowid_block_number(rowid)) &quot;used blocks&quot; from G1;

used blocks
-----------
      15531

SQL&amp;gt; alter table g1 shrink space cascade;

Table altered.

SQL&amp;gt; exec dbms_stats.gather_table_stats('NOORESH','G1');

PL/SQL procedure successfully completed.

SQL&amp;gt; select blocks, extents from dba_segments where segment_name='G1';

    BLOCKS    EXTENTS
---------- ----------
     15704         87
</pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jonathan Lewis</title>
		<link>http://jonathanlewis.wordpress.com/tablespace-hwm/#comment-39053</link>
		<dc:creator><![CDATA[Jonathan Lewis]]></dc:creator>
		<pubDate>Wed, 05 Jan 2011 10:12:40 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/?page_id=3002#comment-39053</guid>
		<description><![CDATA[Nooresh,

Could you clarify what you mean - as far as I recall the &quot;cascade&quot; option applies when shrinking tables and directs Oracle to shrink dependent objects. It&#039;s not relevant to the question from Rajkumar.

A late thought on his question though is whether the shrink command did anything, or whether it was silently ignored. There are several restrictions on it, and it&#039;s possible that some restrictions don&#039;t report an error. From the 10.2 SQL Reference manual:

Restrictions on the shrink_clause The shrink_clause is subject to the following restrictions:
&lt;ul&gt;
- You cannot specify this clause for a cluster, a clustered table, or any object with a LONG column.
- Segment shrink is not supported for tables with function-based indexes or bitmapjoin indexes.
- This clause does not shrink mapping tables of index-organized tables, even if you specify CASCADE.
- You cannot specify this clause for a compressed table.
- You cannot shrink a table that is the master table of an ON COMMIT materialized view. Rowid materialized views must be rebuilt after the shrink operation.
&lt;/ul&gt;]]></description>
		<content:encoded><![CDATA[<p>Nooresh,</p>
<p>Could you clarify what you mean &#8211; as far as I recall the &#8220;cascade&#8221; option applies when shrinking tables and directs Oracle to shrink dependent objects. It&#8217;s not relevant to the question from Rajkumar.</p>
<p>A late thought on his question though is whether the shrink command did anything, or whether it was silently ignored. There are several restrictions on it, and it&#8217;s possible that some restrictions don&#8217;t report an error. From the 10.2 SQL Reference manual:</p>
<p>Restrictions on the shrink_clause The shrink_clause is subject to the following restrictions:</p>
<ul>
- You cannot specify this clause for a cluster, a clustered table, or any object with a LONG column.<br />
- Segment shrink is not supported for tables with function-based indexes or bitmapjoin indexes.<br />
- This clause does not shrink mapping tables of index-organized tables, even if you specify CASCADE.<br />
- You cannot specify this clause for a compressed table.<br />
- You cannot shrink a table that is the master table of an ON COMMIT materialized view. Rowid materialized views must be rebuilt after the shrink operation.
</ul>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jonathan Lewis</title>
		<link>http://jonathanlewis.wordpress.com/tablespace-hwm/#comment-39052</link>
		<dc:creator><![CDATA[Jonathan Lewis]]></dc:creator>
		<pubDate>Wed, 05 Jan 2011 09:56:23 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/?page_id=3002#comment-39052</guid>
		<description><![CDATA[Orawiss,

Sorry, I missed this comment when you first posted it. There&#039;s probably no standard answer to your question since different strategies have different costs, risks, and side effects. You may find some relevant comments in one of my fragmentation notes: 
http://jonathanlewis.wordpress.com/2010/07/16/fragmentation-2/

If shrink is not appropriate then a complete rebuild somewhere else (thinking about options for parallelism, nologging, properly backups etc.) could be the next best thing. Here&#039;s another reference that supplies a warning about the problems of rebuildling tables, though: http://jonathanlewis.wordpress.com/2007/11/23/table-rebuilds/]]></description>
		<content:encoded><![CDATA[<p>Orawiss,</p>
<p>Sorry, I missed this comment when you first posted it. There&#8217;s probably no standard answer to your question since different strategies have different costs, risks, and side effects. You may find some relevant comments in one of my fragmentation notes:<br />
<a href="http://jonathanlewis.wordpress.com/2010/07/16/fragmentation-2/" rel="nofollow">http://jonathanlewis.wordpress.com/2010/07/16/fragmentation-2/</a></p>
<p>If shrink is not appropriate then a complete rebuild somewhere else (thinking about options for parallelism, nologging, properly backups etc.) could be the next best thing. Here&#8217;s another reference that supplies a warning about the problems of rebuildling tables, though: <a href="http://jonathanlewis.wordpress.com/2007/11/23/table-rebuilds/" rel="nofollow">http://jonathanlewis.wordpress.com/2007/11/23/table-rebuilds/</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nooresh Bajracharya</title>
		<link>http://jonathanlewis.wordpress.com/tablespace-hwm/#comment-39040</link>
		<dc:creator><![CDATA[Nooresh Bajracharya]]></dc:creator>
		<pubDate>Tue, 04 Jan 2011 15:29:05 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/?page_id=3002#comment-39040</guid>
		<description><![CDATA[If you run the shrink command with cascade it will reclaim the free space. 

Regards, 
Nooresh]]></description>
		<content:encoded><![CDATA[<p>If you run the shrink command with cascade it will reclaim the free space. </p>
<p>Regards,<br />
Nooresh</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: orawiss</title>
		<link>http://jonathanlewis.wordpress.com/tablespace-hwm/#comment-37390</link>
		<dc:creator><![CDATA[orawiss]]></dc:creator>
		<pubDate>Sat, 25 Sep 2010 09:16:35 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/?page_id=3002#comment-37390</guid>
		<description><![CDATA[Hello Jonathan ,
What solution you may suggest if the Shrink operation is not the best solution?
Moving the data into another tablespace and then drop the original tablespace ?

Thank you for your help,
Wissem]]></description>
		<content:encoded><![CDATA[<p>Hello Jonathan ,<br />
What solution you may suggest if the Shrink operation is not the best solution?<br />
Moving the data into another tablespace and then drop the original tablespace ?</p>
<p>Thank you for your help,<br />
Wissem</p>
]]></content:encoded>
	</item>
</channel>
</rss>
