Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
Database Servers
DB2InformixIngresMS SQLOraclePervasive.SQLPostgreSQLProgressSybase
Desktop Databases
FileMakerFoxProMS AccessParadox
General
General DB TopicsDatabase Theory
Related Topics
Java Development.NET DevelopmentVB DevelopmentMore Topics ...

Database Forum / Oracle / Oracle Server / April 2008

Tip: Looking for answers? Try searching our database.

Space really used on TBS

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Mauro Pagano - 28 Apr 2008 16:42 GMT
Hi,
executing the following query

SELECT b.tablespace_name, a.*,
      TRUNC (a.segment_size / tbs_size * 100, 2) segment_perc_used,
      b.tbs_freespace,
      TRUNC (b.tbs_freespace / c.tbs_size * 100, 2) freespace_perc,
      c.tbs_size
 FROM (SELECT SUM (BYTES) / 1024 / 1024 segment_size
         FROM dba_extents
        WHERE tablespace_name = 'USER_CDC_DATA') a,
      (SELECT   tablespace_name, SUM (BYTES) / 1024 / 1024
tbs_freespace
           FROM dba_free_space
          WHERE tablespace_name = 'USER_CDC_DATA'
       GROUP BY tablespace_name) b,
      (SELECT   tablespace_name, SUM (BYTES) / 1024 / 1024 tbs_size
           FROM dba_data_files
          WHERE tablespace_name = 'USER_CDC_DATA'
       GROUP BY tablespace_name) c

I get this result

USER_CDC_DATA,112,0.72,5076.8125,32.75,15500

where 112Mb are used (0.72% of tbs total available space)
5076Mb are free (32.75% of tbs total available space)
15500Mb is the tbs size

Why I have less then 1% used and only 32.75% free?
Where I'm wasting space?
Please note that shrink objects on tbs doesn't provide any benefit.

Regards
Mauro
fitzjarrell@cox.net - 28 Apr 2008 18:56 GMT
> Hi,
> executing the following query
[quoted text clipped - 31 lines]
> Regards
> Mauro

Possibly one or more of your datafiles for that tablespace is offline;
try this modification to your query and see what is returned:

SELECT b.tablespace_name, a.*,
       TRUNC (a.segment_size / tbs_size * 100, 2) segment_perc_used,
       b.tbs_freespace,
       TRUNC (b.tbs_freespace / c.tbs_size * 100, 2) freespace_perc,
       c.tbs_size
  FROM (SELECT SUM (BYTES) / 1024 / 1024 segment_size
          FROM dba_extents
         WHERE tablespace_name = 'USER_CDC_DATA') a,
       (SELECT   tablespace_name, SUM (BYTES) / 1024 / 1024
tbs_freespace
            FROM dba_free_space
           WHERE tablespace_name = 'USER_CDC_DATA'
        GROUP BY tablespace_name) b,
       (SELECT   tablespace_name, SUM (BYTES) / 1024 / 1024 tbs_size
            FROM dba_data_files
           WHERE tablespace_name = 'USER_CDC_DATA'
           AND status = 'AVAILABLE'
        GROUP BY tablespace_name) c

David Fitzjarrell
Mauro Pagano - 29 Apr 2008 08:11 GMT
On Apr 28, 7:56 pm, "fitzjarr...@cox.net" <orat...@msn.com> wrote:

> > Hi,
> > executing the following query
[quoted text clipped - 55 lines]
>
> David Fitzjarrell

David,
thanks a lot for your reply.
Unfortunately both datafiles are online so your query returns the same
data of mine.
Have you any idea about?
Regards
Mauro
fitzjarrell@cox.net - 29 Apr 2008 14:05 GMT
> On Apr 28, 7:56 pm, "fitzjarr...@cox.net" <orat...@msn.com> wrote:
>
[quoted text clipped - 67 lines]
>
> - Show quoted text -

You might try running this query to see how that tablespace is
'mapped':

Select
    'free space' owner,
    '    ' object,
    file_id,
    block_id,
    blocks
from
    sys.dba_free_space
where
    tablespace_name = upper('&&1')
union
select
    substr(owner,1,20),
    substr(segment_name,1,32),
    file_id,
    block_id,
    blocks
from
    sys.dba_extents
where
    tablespace_name = upper('&&1')
order by 3,4;

Then, create this procedure as SYS and run it for every table in the
suspect tablespace:

create or replace
procedure show_space
( p_segname in varchar2,
 p_owner   in varchar2 default user,
 p_type    in varchar2 default 'TABLE' )
as
   l_free_blks                 number;

   l_total_blocks              number;
   l_total_bytes               number;
   l_unused_blocks             number;
   l_unused_bytes              number;
   l_LastUsedExtFileId         number;
   l_LastUsedExtBlockId        number;
   l_LAST_USED_BLOCK           number;
   procedure p( p_label in varchar2, p_num in number )
   is
   begin
       dbms_output.put_line( rpad(p_label,40,'.') ||
                             p_num );
   end;
begin
   dbms_space.free_blocks
   ( segment_owner     => p_owner,
     segment_name      => p_segname,
     segment_type      => p_type,
     freelist_group_id => 0,
     free_blks         => l_free_blks );

   dbms_space.unused_space
   ( segment_owner     => p_owner,
     segment_name      => p_segname,
     segment_type      => p_type,
     total_blocks      => l_total_blocks,
     total_bytes       => l_total_bytes,
     unused_blocks     => l_unused_blocks,
     unused_bytes      => l_unused_bytes,
     LAST_USED_EXTENT_FILE_ID => l_LastUsedExtFileId,
     LAST_USED_EXTENT_BLOCK_ID => l_LastUsedExtBlockId,
     LAST_USED_BLOCK => l_LAST_USED_BLOCK );

   p( 'Free Blocks', l_free_blks );
   p( 'Total Blocks', l_total_blocks );
   p( 'Total Bytes', l_total_bytes );
   p( 'Unused Blocks', l_unused_blocks );
   p( 'Unused Bytes', l_unused_bytes );
   p( 'Last Used Ext FileId', l_LastUsedExtFileId );
   p( 'Last Used Ext BlockId', l_LastUsedExtBlockId );
   p( 'Last Used Block', l_LAST_USED_BLOCK );
end;
/

Spool the output from the following query to a file:

select 'exec show_space('''||object_name||''','''||owner||''','''||
object_type||''')'
from dba_objects
where tablespace_name = 'USER_CDC_DATA'
and object_type in ('TABLE','INDEX','CLUSTER','PARTITION');

then run the resulting script, spooling that output to a file.  I
don't know what you'll find, but you might find what is consuming your
space.

David Fitzjarrell
joel garry - 29 Apr 2008 17:32 GMT
> On Apr 28, 7:56 pm, "fitzjarr...@cox.net" <orat...@msn.com> wrote:
>
[quoted text clipped - 65 lines]
> Regards
> Mauro

Do you have OEM?  If on version 9, it has a real informative
tablespace map graphic.  10R2 EM has something too, my brain isn't
remembering it right now, you must be on 10 if you mention shrink?
What exact (like 10.2.0.4) version are you on?  Have you done any mass
deletes?  Have you tried a coalesce?  Do you purge deleted tables?
What is your temporary tablespace?

jg
--
@home.com is bogus.
http://arstechnica.com/news.ars/post/20080415-gone-in-60-seconds-spambot-cracks-
livehotmail-captcha.html

Mauro Pagano - 29 Apr 2008 19:48 GMT
> > On Apr 28, 7:56 pm, "fitzjarr...@cox.net" <orat...@msn.com> wrote:
>
[quoted text clipped - 76 lines]
> --
> @home.com is bogus.http://arstechnica.com/news.ars/post/20080415-gone-in-60-seconds-spam...

I solved,
it was a bug related to change data capture (just solved).
Thanks to all for your attention
Regards
Mauro
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2010 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.