Free space in temport tablespaces

Hi. In my database i have TEMP tablespace with extent management LOCAL.
In DBA studio it shows total space 8000M and free space 7996
when i query v$sort_segment
select substr(TABLESPACE_NAME,1,10) ts_name,EXTENT_SIZE,CURRENT_USERS,
TOTAL_EXTENTS,TOTAL_BLOCKS,FREE_EXTENTS,FREE_BLOCKS
from v$sort_segment;
it shows
TS_NAME EXTENT_SIZE CURRENT_USERS TOTAL_EXTENTS TOTAL_BLOCKS FREE_EXTENTS
FREE_BLOCKS
TEMP 128 0 7996 1023488 7996
1023488
where as when i query v$temp_space_header
select TABLESPACE_NAME,BYTES_USED,BLOCKS_USED,BYTES_FREE,BLOCKS_FREe
FROM v$temp_space_header;
TABLESPACE_NAME BYTES_USED BLOCKS_USED BYTES_FREE BLOCKS_FREE
TEMP 2097152000 256000 0 0
TEMP 2097152000 256000 0 0
TEMP 2097152000 256000 0 0
TEMP 2097152000 256000 0 0
I have no active queries going on in database.
i would like to know few things..
a). why there is a discrepency between free_extents,free_blocks of v$sort_segment
and bytes_free_blocks_free of v$temp_space_header.
b). if i shutdown the database and restart will this v$emp_space_header view gets updated and thus shows actual free space.
please let me have the answers at the earliest.
thanks in advance..

Hi. In my database i have TEMP tablespace with extent management LOCAL.
In DBA studio it shows total space 8000M and free space 7996
when i query v$sort_segment
select substr(TABLESPACE_NAME,1,10) ts_name,EXTENT_SIZE,CURRENT_USERS,
TOTAL_EXTENTS,TOTAL_BLOCKS,FREE_EXTENTS,FREE_BLOCKS
from v$sort_segment;
it shows
TS_NAME EXTENT_SIZE CURRENT_USERS TOTAL_EXTENTS TOTAL_BLOCKS FREE_EXTENTS
FREE_BLOCKS
TEMP 128 0 7996 1023488 7996
1023488
where as when i query v$temp_space_header
select TABLESPACE_NAME,BYTES_USED,BLOCKS_USED,BYTES_FREE,BLOCKS_FREe
FROM v$temp_space_header;
TABLESPACE_NAME BYTES_USED BLOCKS_USED BYTES_FREE BLOCKS_FREE
TEMP 2097152000 256000 0 0
TEMP 2097152000 256000 0 0
TEMP 2097152000 256000 0 0
TEMP 2097152000 256000 0 0
I have no active queries going on in database.
i would like to know few things..
a). why there is a discrepency between free_extents,free_blocks of v$sort_segment
and bytes_free_blocks_free of v$temp_space_header.
b). if i shutdown the database and restart will this v$emp_space_header view gets updated and thus shows actual free space.
please let me have the answers at the earliest.
thanks in advance..

Similar Messages

  • How to find free space in a Tablespace?

    Hi,
    I have a limited access to objects in my database ( do not have access to many tables).
    I have been allocated 300GB of size in my tablespace which allows me to create my objects.
    Now, I want to find out how much of this tablespace size allocated to me have been used up. I do not have access to dba_data_files or dba_segments.
    Is there a way out for me? Could anyone show me a way please?

    This query will give you the required information but it makes use of DBA tables.
    SELECT B.TABLESPACE_NAME, TBS_SIZE SIZEGB, A.FREE_SPACE FREEGB
    from  (select tablespace_name, round(sum(bytes)/1024/1024/1024 ,2) as free_space
           from dba_free_space
           GROUP BY TABLESPACE_NAME) A,
          (select tablespace_name, sum(bytes)/1024/1024/1024 as tbs_size
           from dba_data_files
           group by tablespace_name) b
    where a.tablespace_name(+)=b.tablespace_name;
    However, you said that you are aware of your tablespace details so the above query can be modified to get the free space in your tablespace. Now I am using user_frees_space and not dba_free_space. Generally user* tables are and should be made accessible to the users.
    select  tablespace_name, round(sum(bytes)/1024/1024/1024 ,2) as free_space
    from    user_free_space
    where   tablespace_name = 'Your tablespace name'
    GROUP BY TABLESPACE_NAME;
    Ishan

  • Free space in UNDO tablespace

    Hi,
    in DB version 9.2.0, after all transactions are committed, the occupied blocks in UNDO tablespace will be free or not ?
    The same just after startup, before any transaction the free space in UNDO tablespace would be at max ?
    Many thanks.

    Hello Dear copy this script and paste in the sql prompt and it will show your how much total space table have, or how much is used and how much it is free
    SELECT Total.name "Tablespace Name",
    nvl(Free_space, 0) Free_space,
    nvl(total_space-Free_space, 0) Used_space,
    total_space
    FROM
    (select tablespace_name, sum(bytes/1024/1024) Free_Space
    from sys.dba_free_space
    group by tablespace_name
    ) Free,
    (select b.name, sum(bytes/1024/1024) TOTAL_SPACE
    from sys.v_$datafile a, sys.v_$tablespace B
    where a.ts# = b.ts#
    group by b.name
    ) Total
    WHERE Free.Tablespace_name(+) = Total.name
    ORDER BY Total.name

  • To know the amount of free space in a tablespace

    hi,
    I'm learning oracle 9i release 9.2.0.1.0 .I'd created a tablespace 'TOOLS' for being used as the default tablespace for Statspack.
    I wish to know the amount of free space available in this tablespace. For this purpose I ran the following query but there was no rows selected :-
    SQL> select tablespace_name,bytes from dba_free_space
    2 where tablespace_name='TOOLS';
    no rows selected
    SQL> select name from v$tablespace;
    NAME
    CWMLITE
    DRSYS
    EXAMPLE
    INDX
    ODM
    SYSTEM
    TOOLS
    UNDOTBS1
    USERS
    XDB
    TEMP
    Can anyone tell the reason for this.

    I tried your query
    SQL> select TABLESPACE_NAME,
    2 sum(BYTES) Total_free_space,
    3 max(BYTES) largest_free_extent
    4 from dba_free_space
    5 group by TABLESPACE_NAME;
    ♀TABLESPACE_NAME TOTAL_FREE_SPACE LARGEST_FREE_EXTENT
    CWMLITE 11141120 10878976
    DRSYS 10813440 10813440
    EXAMPLE 131072 131072
    INDX 26148864 26148864
    ODM 11206656 11206656
    SYSTEM 3211264 3080192
    UNDOTBS1 199229440 196149248
    USERS 26083328 26083328
    XDB 196608 196608
    9 rows selected.
    Again there were no rows for TOOLS tablespace.

  • Free space in temp tablespace

    SQL> show parameter block
    NAME                                 TYPE        VALUE
    db_block_buffers                     integer     0
    db_block_checking                    boolean     FALSE
    db_block_checksum                    boolean     TRUE
    db_block_size                        integer     8192
    db_file_multiblock_read_count        integer     8
    SQL> SELECT tablespace_name,
           total_blocks,
           used_blocks,
           free_blocks,
        (total_blocks*8)/1024 as total_MB,
        (used_blocks*8)/1024  as used_MB,
        (free_blocks*8)/1024  as free_MB
    FROM   v$sort_segment;
       2    3    4    5    6    7    8 
    TABLESPACE_NAME                 TOTAL_BLOCKS USED_BLOCKS FREE_BLOCKS   TOTAL_MB    USED_MB    FREE_MB
    TEMP                                   72704        2944       69760        568         23        545
    SQL>  select (sum(bytes_free)/1024/1024) Size_MB from v$temp_space_header
    order by file_id  2 
      3  /
       SIZE_MB
          1479
    SQL>
    My version is 9.2.0.7
    why temp free space is different in both queries above..
    which one is correct.....

    why temp free space is different in both queries above..Because you are looking at two different values.
    V$SORT_SEGMENT gives details about the sort segment created in a temporary tablespace. The sort segment created may or may not be of the same size as the complete temporary tablespace. In your case, the sort segment has a total size of 568 MB but only 23 MB is being used.
    V$TEMP_SPACE_HEADER refers to the physical files allocated to the temporary tablespace; so the other query is giving you the free bytes in those files.

  • Free space available in tablespace

    Hi, Any one help me how to check how much free space available on a particular Tablespace. Appreciate if you provide query.
    Thanks & Regards
    Bhaskara

    This SQL will return free space by datafile in the tablespace.
    SELECT a.name FileName, a.status, c.bytes/1024 CurrentSize, a.create_bytes/1024 SizeCreated,
    sum(b.bytes/1024) FreeSpace, max(b.bytes/1024) LargeFragment
    from sys.v_$datafile a, sys.dba_free_space b, sys.dba_data_files c
    where a.file# = b.file_id(+)
    and a.file#=c.file_id
    and c.tablespace_name='XXXXXXXXXXXXXXXXX'
    group by a.name, a.status, c.bytes, a.create_bytes
    ORDER BY a.name;
    I just posted an integrated set of GUI tools to administer the Oracle database.
    One of the many functions is to view and maintain all database objects including tablespaces and datafiles. It also has a graphical function to monitor space allocation for tablespaces. You may need same help to get started, so feel free to contact me ([email protected]). The link is http://www.barsoft.net/

  • How does repeated snapshot import impact tablespace free space?

    Hello,
    Our client is doing DEC-2014 reconciliation in FCM. Every time he changes profile mappings he has to do snapshot import again. So far he did at least ten times snapshot import for DEC-2014 period. In our FCM database Tablespace FCM_TX_TS_DATA free space is reduced 7 GB for this period already by querrying dba_free_space table.
    By my understanding during the repeated snapshot import for the same period, the previous load data is deleted and the current load data is inserted. After data delete the table space will not be set free, and high water mark will not be reset.
    During snapshot import will the deleted blocks from the previous load be reclaimed when new load data is inserted in the table? If not, what is the best way to reclaim the free space in FCM_TX_TS_DATA tablespace?
    Thanks,
    Hongfei Liu (AT&T)

    Przemek P wrote:
    Hallo. I need to replace all schemas from one server to another. I want to know how much free space will be left on /data after this kind of refresh. Both servers are Oracle 9 so I will use exp/imp. Here is how I do it. Could you check if I think good? On target server there is 72 GB free space on /data.
    Filesystem Size Used Avail Capacity Mounted
    /dev/vgsmxdata/lvsmxcopy 194.74G 122.56G 72.18G 63% /data
    Overall size of schemas to be exported from SOURCE_DB is 150 GB. The same schemas on TARGET_DB takes 90GB. So difference is 60GB. Free space in datafiles in TARGET_DB is 30GB. Does it mean that in first place the free space in datafiles will be filled and after that datafiles would be extended? That would mean that a database would extend to 150GB and free space on /data would be 40 GB after refresh. Am I right?
    yes

  • Calculating free space in tablespace

    Oracle 11.0.1.7:
    I am trying to calculate free space in the tablespace but I am not sure if Allocated Space (bytes_used) also has some free space that doesn't get reflected in the query below. Is it correct to assume that bytes_used is the space allocated to extents but may not have been really used (no data or LOB) yet? How do I calculate space that's currently been used by row data, index data or blob data?
    I am currently using below query:
    select     a.TABLESPACE_NAME,
         a.BYTES bytes_used,
         b.BYTES bytes_free,
         b.largest,
         round(((a.BYTES-b.BYTES)/a.BYTES)*100,2) percent_used
    from      
              select      TABLESPACE_NAME,
                   sum(BYTES) BYTES
              from      dba_data_files
              group      by TABLESPACE_NAME
         a,
              select      TABLESPACE_NAME,
                   sum(BYTES) BYTES ,
                   max(BYTES) largest
              from      dba_free_space
              group      by TABLESPACE_NAME
         b
    where      a.TABLESPACE_NAME=b.TABLESPACE_NAME
    order      by ((a.BYTES-b.BYTES)/a.BYTES) desc

    DBA_FREE_SPACE give you the free space information which has not been allocated to any segment. The segments can also have free space in their allocated space and in order to find that, use DBMS_SPACE.SPACE_USAGE procedure. To find out free space in LOB segments refer to metalink doc: 386341.1
    Thanks
    Daljit Singh

  • Checking space in a tablespace ... yes, that one again

    I know this has been done to death, but I wanted to just go over what I do when OEM alerts me to a tablespace running out of space.
    First, I check the free space of the tablespace using this query:
    SET LINESIZE 100
    COLUMN TABLESPACE FORMAT A15
    select t.tablespace,  t.totalspace as " Totalspace(MB)",
    round((t.totalspace-fs.freespace),2) as "Used Space(MB)",
    fs.freespace as "Freespace(MB)",
    round(((t.totalspace-fs.freespace)/t.totalspace)*100,2) as "% Used",
    round((fs.freespace/t.totalspace)*100,2) as "% Free"
    from
    (select round(sum(d.bytes)/(1024*1024)) as totalspace, d.tablespace_name tablespace
    from dba_data_files d
    group by d.tablespace_name) t,
    (select round(sum(f.bytes)/(1024*1024)) as freespace, f.tablespace_name tablespace
    from dba_free_space f
    group by f.tablespace_name) fs
    where t.tablespace=fs.tablespace
    order by t.tablespace;
    Secondly, I check if it is autoextendible and what the MAXBYTES is.
    select file_name, bytes/1024/1024 size_MB, AUTOEXTENSIBLE, maxbytes/1024/1024 maxsize_MB from dba_data_files where tablespace_name = 'RBPTAB';
    To my understanding, if you don't do this you wont allow for what the datafile has been allowed to autoextend up to.  The first query will only give allocated size, not the real, actual, TOTAL size that it can grow to.
    Once you know that, from query 1, there is no space left, and from 2 it is really hitting its MAXSIZE,  (compare the MAXSIZE of 2 with the Used Space(MB) column from 1) ... then add a new one.
    Does this make sense?

    so much titles included, i think you should have to reduce the size of the sql query, to understand in a meaningful way,  

  • Query to find out pertcular schema related datafiles free space????

    hai,
    whats the query to find out free space in datafiles and index files related free space for perticular schmea?
    Regards
    dba

    If you wish to get free space in index tablespace then use following query:
    select b.tablespace_name, tbs_size SizeMb, a.free_space FreeMb
    from
    (select tablespace_name, round(sum(bytes)/1024/1024 ,2) as free_space
    from dba_free_space group by tablespace_name) a,
    (select tablespace_name, sum(bytes)/1024/1024 as tbs_size
    from dba_data_files group by tablespace_name
    UNION
    select tablespace_name, sum(bytes)/1024/1024 tbs_size
    from dba_temp_files
    group by tablespace_name ) b
    where a.tablespace_name(+)=b.tablespace_name
    and a.tablespace_name='INDX';
    and if you get info for all tablespace then :
    select b.tablespace_name, tbs_size SizeMb, a.free_space FreeMb
    from
    (select tablespace_name, round(sum(bytes)/1024/1024 ,2) as free_space
    from dba_free_space group by tablespace_name) a,
    (select tablespace_name, sum(bytes)/1024/1024 as tbs_size
    from dba_data_files group by tablespace_name
    UNION
    select tablespace_name, sum(bytes)/1024/1024 tbs_size
    from dba_temp_files
    group by tablespace_name ) b
    where a.tablespace_name(+)=b.tablespace_name;

  • Partition drop  not increasing free space in dba_free_spaces

    I am Using Oracle 11.2.0.3.
    I had a script that droped partitions for a table which should have dropped nearly 30 gb of data. We have data and index tablespace.
    Query of dba_free_space showed no change on data tablespace. However, index tablespace showed increase in free space.
    select  sum(bytes / (1024 * 1024 * 1024)) "Size (GB)"  from dba_free_space where tablespace_name ='&tbs_name'I am using following command to drop partition
    ALTER TABLE table_name
    DROP PARTITION "partition_name"
    UPDATE GLOBAL INDEXES;What should be done to increase free space shown for tablespace after partition drop ?
    Thanks for the time.

    >
    http://docs.oracle.com/cd/E11882_01/server.112/e26088/statements_3001.htm#i2131064
    ALTER TABLE table_name DROP PARTITION "partition_name" drop storage UPDATE GLOBAL INDEXES
    >
    Incorrect - the DROP STORAGE option applies to TRUNCATE PARTITION not to DROP PARTITION as the doc explains. A simple test will confirm that.
    alter table emp_part_test drop partition sys_p341 drop storage
    ORA-14048: a partition maintenance operation may not be combined with other operations

  • Free space discrepancy

    Hi,
    For a particular tablespace I am querying dba_segments view to calculate the utilized space size of that tablespace:
    SQL> select tablespace_name,sum(bytes)/1024/1024/1024 gb
    from dba_segments
    where tablespace_name='TBS1'
    group by tablespace_name;
    The output is: *74.48*
    To find out the total allocated size of this tablespace I have used this:
    SQL>select tablespace_name, sum(bytes)/1024/1024/1024 gb
    from dba_data_files
    where tablespace_name='TBS1'
    group by tablespace_name;
    The output is: *77.43*
    Then I queried dba_free_space to find out the free space of that tablespace using this:
    SQL> select tablespace_name,sum(bytes)/1024/1024/1024 gb
    from dba_free_space
    where tablespace_name='TBS1'
    group by tablespace_name;
    The output is: *21.8*
    Now here I am not able to understand that, why dba_free_space returned 21.8 GB as free space instead of 2.95 GB (calculated by subtracting the value returned by dba_segments from dba_data_files).
    DB Version: 10.2.0.1, 64 bit
    OS Platform: Linux
    Thanks for your time.
    Regards,
    Joy

    Hi,
    Here i will give the approach how to troubleshoot this kind of issue.
    find the dba_segments definination:
    ======================
    SQL> set long 100000
    SQL> select dbms_metadata.get_ddl('VIEW','DBA_SEGMENTS','SYS') FROM DUAL;
    CREATE OR REPLACE FORCE VIEW "SYS"."DBA_SEGMENTS" ("OWNER", "SEGMENT_NAME", "P
    ARTITION_NAME", "SEGMENT_TYPE", "TABLESPACE_NAME", "HEADER_FILE", "HEADER_BLOCK"
    , "BYTES", "BLOCKS", "EXTENTS", "INITIAL_EXTENT", "NEXT_EXTENT", "MIN_EXTENTS",
    "MAX_EXTENTS", "PCT_INCREASE", "FREELISTS", "FREELIST_GROUPS", "RELATIVE_FNO", "
    BUFFER_POOL") AS
    select owner, segment_name, partition_name, segment_type, tablespace_name,
    header_file, header_block,
    decode(bitand(segment_flags, 131072), 131072, blocks,
    (decode(bitand(segment_flags,1),1,
    dbms_space_admin.segment_number_blocks(tablespace_id, relative_fno,
    header_block, segment_type_id, buffer_pool_id, segment_flags,
    segment_objd, blocks), blocks)))*blocksize,
    decode(bitand(segment_flags, 131072), 131072, blocks,
    (decode(bitand(segment_flags,1),1,
    dbms_space_admin.segment_number_blocks(tablespace_id, relative_fno,
    header_block, segment_type_id, buffer_pool_id, segment_flags,
    segment_objd, blocks), blocks))),
    decode(bitand(segment_flags, 131072), 131072, extents,
    (decode(bitand(segment_flags,1),1,
    dbms_space_admin.segment_number_extents(tablespace_id, relative_fno,
    header_block, segment_type_id, buffer_pool_id, segment_flags,
    segment_objd, extents) , extents))),
    initial_extent, next_extent, min_extents, max_extents, pct_increase,
    freelists, freelist_groups, relative_fno,
    decode(buffer_pool_id, 0, 'DEFAULT', 1, 'KEEP', 2, 'RECYCLE', NULL)
    from sys_dba_segs
    find the dba_free-space definination:
    ======================
    SQL>
    SQL> select dbms_metadata.get_ddl('VIEW','DBA_FREE_SPACE','SYS') FROM DUAL;
    CREATE OR REPLACE FORCE VIEW "SYS"."DBA_FREE_SPACE" ("TABLESPACE_NAME", "FILE_
    ID", "BLOCK_ID", "BYTES", "BLOCKS", "RELATIVE_FNO") AS
    select ts.name, fi.file#, f.block#,
    f.length * ts.blocksize, f.length, f.file#
    from sys.ts$ ts, sys.fet$ f, sys.file$ fi
    where ts.ts# = f.ts#
    and f.ts# = fi.ts#
    and f.file# = fi.relfile#
    and ts.bitmapped = 0
    union all
    select /*+ ordered use_nl(f) use_nl(fi) */
    ts.name, fi.file#, f.ktfbfebno,
    f.ktfbfeblks * ts.blocksize, f.ktfbfeblks, f.ktfbfefno
    from sys.ts$ ts, sys.x$ktfbfe f, sys.file$ fi
    where ts.ts# = f.ktfbfetsn
    and f.ktfbfetsn = fi.ts#
    and f.ktfbfefno = fi.relfile#
    and ts.bitmapped <> 0 and ts.online$ in (1,4) and ts.contents$ = 0
    union all
    select /*+ ordered use_nl(u) use_nl(fi) */
    ts.name, fi.file#, u.ktfbuebno,
    u.ktfbueblks * ts.blocksize, u.ktfbueblks, u.ktfbuefno
    from sys.recyclebin$ rb, sys.ts$ ts, sys.x$ktfbue u, sys.file$ fi
    where ts.ts# = rb.ts#
    and rb.ts# = fi.ts#
    and u.ktfbuefno = fi.relfile#
    and u.ktfbuesegtsn = rb.ts#
    and u.ktfbuesegfno = rb.file#
    and u.ktfbuesegbno = rb.block#
    and ts.bitmapped <> 0 and ts.online$ in (1,4) and ts.contents$ = 0
    union all
    select ts.name, fi.file#, u.block#,
    u.length * ts.blocksize, u.length, u.file#
    from sys.ts$ ts, sys.uet$ u, sys.file$ fi, sys.recyclebin$ rb
    where ts.ts# = u.ts#
    and u.ts# = fi.ts#
    and u.segfile# = fi.relfile#
    and u.ts# = rb.ts#
    and u.segfile# = rb.file#
    and u.segblock# = rb.block#
    and ts.bitmapped = 0
    DBA_FREE_SPACE is taking value from sys.recyclebin$ rb, sys.ts$ ts, sys.x$ktfbue u, sys.file$ fi
    DBA_SGEMNETS taking value from sys_dba_segs
    Solution:
    =====
    1) How the value will be populated to these view ?
    When you collect the stats then the value will be populated to those table.
    2) From where these view DBS_SEGMENTS derived ?
    From base tables
    So, Please collect the stats on fixed table then let me know the result
    Kind Regards,
    Rakesh jayappa

  • Performance problem - Tablespace Free Space

    Hi,
    Version 10204
    I am running the following statment in order to monitor tablespace free space.
    There are some tablespaces that i am not interesting to monitor , and i also whant to be alert
    only when less than 4 GB left in the tablespace.
    I build the following statment.
    Using the hint : /*+ NO_CPU_COSTING */ gave me the best performance but there are alot of time
    that its took to this statment few minute to run befor it finished.
    Could one help to improve its performance ?
    Please note that it performe even less good when i used the RULE hint or not using hint at all.
    SELECT  /*+ gather_plan_statistics */  'tablespace_free_space;'||to_char(pct_used,'999.99')||','||TBSNAME
    FROM( SELECT *
          FROM( SELECT NVL(b.tablespace_name, NVL(a.tablespace_name,'UNKOWN')) TBSNAME,
                       MBytes_alloc,
                           maxbytes,
                           MBytes_max,
                       ROUND(MBytes_alloc-NVL(MBytes_free,0),2) used,
                       ROUND(NVL(MBytes_free,0),2) free,
                       MBytes_free,
                       ROUND(DECODE( MBytes_max, 0,((MBytes_alloc-NVL(MBytes_free,0))/MBytes_alloc)*100,100*(MBytes_alloc) / maxbytes),2)PCT_USED
                FROM ( SELECT /*+ NO_CPU_COSTING */  SUM(bytes)/1024/1024 MBytes_free,
                              MAX(bytes)/1024/1024 largest,
                              tablespace_name
                       FROM   sys.DBA_FREE_SPACE
                       WHERE  TABLESPACE_NAME NOT IN
                              ('Q405_CALLS_TS','Q405_ICALLS_TS',
                               'Q305_CALLS_TS','Q305_ICALLS_TS',
                               'Q205_ICALLS_TS','Q306_CALLS_TS',
                               'Q406_CALLS_TS','Q206_CALLS_TS',
                               'Q205_CALLS_TS','Q105_CALLS_TS',
                               'Q105_ICALLS_TS','Q206_CALLS_TS','Q106_CALLS_TS',
                               'Q306_ICALLS_TS','Q107_ICALLS_TS','Q406_ICALLS_TS',
                               'Q206_ICALLS_TS','UNLMT_INTERNET_CALLS_2006_TS',
                               'UNLMT_INTERNET_CALLS_2007_TS',
                               'UNLMT_INTERNET_CALLS_2008_TS',
                               'Q107_ICALLS_TBS','Q107_CALLS_TBS',
                               'Q207_ICALLS_TBS','Q207_CALLS_TBS',
                               'Q307_ICALLS_TBS','Q307_CALLS_TBS',
                               'Q407_ICALLS_TBS','Q407_CALLS_TBS',
                               'Q408_ICALLS_TS','Q408_CALLS_TS',
                               'Q308_ICALLS_TS','Q308_CALLS_TS',
                               'Q208_ICALLS_TS','Q208_CALLS_TS',
                               'Q108_ICALLS_TS','Q108_CALLS_TS',
                               'Q109_ICALLS_TS','Q109_CALLS_TS',
                               'UNLMT_INT_CALLS_Q308_TS',
                               'UNLMT_INT_ICALLS_Q308_TS',
                               'UNLMT_INT_CALLS_Q408_TS',
                               'UNLMT_INT_ICALLS_Q408_TS'
                       GROUP BY tablespace_name ) a,
                     ( SELECT  SUM(bytes)/1024/1024 MBytes_alloc,
                              SUM(maxbytes)/1024/1024 MBytes_max,
                              SUM(DECODE (autoextensible,'YES',maxbytes/1024/1024,'NO', BYTES/1024/1024 )) maxbytes,
                              tablespace_name
                       FROM   DBA_DATA_FILES
                       WHERE  TABLESPACE_NAME NOT IN
                              ('Q405_CALLS_TS','Q405_ICALLS_TS',
                               'Q305_CALLS_TS','Q305_ICALLS_TS',
                               'Q205_ICALLS_TS','Q306_CALLS_TS',
                               'Q406_CALLS_TS','Q206_CALLS_TS',
                               'Q205_CALLS_TS','Q105_CALLS_TS',
                               'Q105_ICALLS_TS','Q206_CALLS_TS',
                               'Q106_CALLS_TS','Q306_ICALLS_TS',
                               'Q107_ICALLS_TS','Q406_ICALLS_TS',
                               'Q206_ICALLS_TS','UNLMT_INTERNET_CALLS_2006_TS',
                               'UNLMT_INTERNET_CALLS_2007_TS',
                               'UNLMT_INTERNET_CALLS_2008_TS',
                               'Q107_ICALLS_TBS','Q107_CALLS_TBS',
                               'Q207_ICALLS_TBS','Q207_CALLS_TBS',
                               'Q307_ICALLS_TBS','Q307_CALLS_TBS',
                               'Q407_ICALLS_TBS','Q407_CALLS_TBS',
                               'Q408_ICALLS_TS','Q408_CALLS_TS',
                               'Q308_ICALLS_TS','Q308_CALLS_TS',
                               'Q208_ICALLS_TS','Q208_CALLS_TS',
                               'Q108_ICALLS_TS','Q108_CALLS_TS',
                               'Q109_ICALLS_TS','Q109_CALLS_TS',
                               'UNLMT_INT_CALLS_Q308_TS',
                               'UNLMT_INT_ICALLS_Q308_TS',
                               'UNLMT_INT_CALLS_Q408_TS',
                               'UNLMT_INT_ICALLS_Q408_TS'
                       GROUP BY tablespace_name) b
                WHERE a.tablespace_name (+) = b.tablespace_name
                AND (a.MBytes_free<4000 or a.MBytes_free is null)
             ORDER BY PCT_USED DESC
    WHERE TBSNAME not in (select tablespace_name from dba_tablespaces where contents in ('UNDO'))
    and ROWNUM =1;
    select * from table(dbms_xplan.display_cursor('42hppgtx2h1gb',0,'ALLSTATS LAST'));
    Plan hash value: 2979461796
    PLAN_TABLE_OUTPUT
    | Id  | Operation                               | Name             | Starts | E-Rows | A-Rows |   A-Time   | Buffers | Reads  |  OMem |  1Mem | Used-Mem |
    |*  1 |  COUNT STOPKEY                          |                  |      1 |        |      1 |00:00:15.52 |     146K|   8927 |       |       |      |
    |*  2 |   FILTER                                |                  |      1 |        |      1 |00:00:15.52 |     146K|   8927 |       |       |      |
    |   3 |    VIEW                                 |                  |      1 |      3 |      1 |00:00:15.52 |     146K|   8927 |       |       |      |
    |   4 |     SORT ORDER BY                       |                  |      1 |      3 |      1 |00:00:15.52 |     146K|   8927 |  2048 |  2048 | 2048  (0)|
    |*  5 |      FILTER                             |                  |      1 |        |     16 |00:00:15.52 |     146K|   8927 |       |       |      |
    |*  6 |       HASH JOIN OUTER                   |                  |      1 |      3 |     25 |00:00:15.52 |     146K|   8927 |   561K|   561K|  982K (0)|
    |   7 |        VIEW                             |                  |      1 |      2 |     25 |00:00:02.95 |     105K|      0 |       |       |      |
    |   8 |         HASH GROUP BY                   |                  |      1 |      2 |     25 |00:00:02.95 |     105K|      0 |   447K|   447K|  977K (0)|
    |   9 |          VIEW                           | DBA_DATA_FILES   |      1 |      2 |    217 |00:00:03.25 |     105K|      0 |       |       |      |
    |  10 |           UNION-ALL                     |                  |      1 |        |    217 |00:00:03.25 |     105K|      0 |       |       |      |
    |  11 |            NESTED LOOPS                 |                  |      1 |      1 |      0 |00:00:00.67 |     219 |      0 |       |       |      |
    |  12 |             NESTED LOOPS                |                  |      1 |      1 |      0 |00:00:00.67 |     219 |      0 |       |       |      |
    |  13 |              MERGE JOIN CARTESIAN       |                  |      1 |      1 |  52297 |00:00:00.22 |       0 |      0 |       |       |      |
    |* 14 |               FIXED TABLE FULL          | X$KCCFN          |      1 |      1 |    217 |00:00:00.01 |       0 |      0 |       |       |      |
    |  15 |               BUFFER SORT               |                  |    217 |    100 |  52297 |00:00:00.06 |       0 |      0 | 11264 | 11264 |10240  (0)|
    |  16 |                FIXED TABLE FULL         | X$KCCFE          |      1 |    100 |    241 |00:00:00.01 |       0 |      0 |       |       |      |
    |* 17 |              TABLE ACCESS BY INDEX ROWID| FILE$            |  52297 |      1 |      0 |00:00:00.52 |     219 |      0 |       |       |      |
    |* 18 |               INDEX UNIQUE SCAN         | I_FILE1          |  52297 |      1 |    217 |00:00:00.24 |       2 |      0 |       |       |      |
    |* 19 |             TABLE ACCESS CLUSTER        | TS$              |      0 |      1 |      0 |00:00:00.01 |       0 |      0 |       |       |      |
    |* 20 |              INDEX UNIQUE SCAN          | I_TS#            |      0 |      1 |      0 |00:00:00.01 |       0 |      0 |       |       |      |
    |  21 |            NESTED LOOPS                 |                  |      1 |      1 |    217 |00:00:02.58 |     105K|      0 |       |       |      |
    |  22 |             NESTED LOOPS                |                  |      1 |      1 |  52297 |00:00:01.89 |     104K|      0 |       |       |      |
    |  23 |              MERGE JOIN CARTESIAN       |                  |      1 |      1 |  52297 |00:00:00.22 |     217 |      0 |       |       |      |
    |  24 |               NESTED LOOPS              |                  |      1 |      1 |    217 |00:00:00.02 |     217 |      0 |       |       |      |
    |* 25 |                FIXED TABLE FULL         | X$KCCFN          |      1 |      1 |    217 |00:00:00.01 |       0 |      0 |       |       |      |
    |* 26 |                FIXED TABLE FIXED INDEX  | X$KTFBHC (ind:1) |    217 |      1 |    217 |00:00:00.01 |     217 |      0 |       |       |      |
    |  27 |               BUFFER SORT               |                  |    217 |    100 |  52297 |00:00:00.11 |       0 |      0 | 11264 | 11264 |10240  (0)|
    |  28 |                FIXED TABLE FULL         | X$KCCFE          |      1 |    100 |    241 |00:00:00.01 |       0 |      0 |       |       |      |
    |* 29 |              TABLE ACCESS CLUSTER       | TS$              |  52297 |      1 |  52297 |00:00:01.41 |     104K|      0 |       |       |      |
    |* 30 |               INDEX UNIQUE SCAN         | I_TS#            |  52297 |      1 |  52297 |00:00:00.37 |       2 |      0 |       |       |      |
    |* 31 |             TABLE ACCESS BY INDEX ROWID | FILE$            |  52297 |      1 |    217 |00:00:00.57 |     219 |      0 |       |       |      |
    |* 32 |              INDEX UNIQUE SCAN          | I_FILE1          |  52297 |      1 |    217 |00:00:00.28 |       2 |      0 |       |       |      |
    |  33 |        VIEW                             |                  |      1 |   1401 |     25 |00:00:12.56 |   40846 |   8927 |       |       |      |
    |  34 |         HASH GROUP BY                   |                  |      1 |   1401 |     25 |00:00:12.56 |   40846 |   8927 |   465K|   465K|  982K (0)|
    |  35 |          VIEW                           | DBA_FREE_SPACE   |      1 |   1401 |  73133 |00:00:14.19 |   40846 |   8927 |       |       |      |
    |  36 |           UNION-ALL                     |                  |      1 |        |  73133 |00:00:14.04 |   40846 |   8927 |       |       |      |
    |  37 |            NESTED LOOPS                 |                  |      1 |      1 |      0 |00:00:00.01 |      45 |      0 |       |       |      |
    |  38 |             NESTED LOOPS                |                  |      1 |      1 |      0 |00:00:00.01 |      45 |      0 |       |       |      |
    |  39 |              TABLE ACCESS FULL          | FET$             |      1 |      1 |      0 |00:00:00.01 |      45 |      0 |       |       |      |
    |* 40 |              INDEX UNIQUE SCAN          | I_FILE2          |      0 |      1 |      0 |00:00:00.01 |       0 |      0 |       |       |      |
    |* 41 |             TABLE ACCESS CLUSTER        | TS$              |      0 |      1 |      0 |00:00:00.01 |       0 |      0 |       |       |      |
    |  42 |            NESTED LOOPS                 |                  |      1 |      5 |   7271 |00:00:00.20 |    1156 |      0 |       |       |      |
    |  43 |             NESTED LOOPS                |                  |      1 |      6 |   7271 |00:00:00.14 |    1154 |      0 |       |       |      |
    |* 44 |              TABLE ACCESS FULL          | TS$              |      1 |      2 |     25 |00:00:00.01 |      45 |      0 |       |       |      |
    |* 45 |              FIXED TABLE FIXED INDEX    | X$KTFBFE (ind:1) |     25 |      3 |   7271 |00:00:00.11 |    1109 |      0 |       |       |      |
    |* 46 |             INDEX UNIQUE SCAN           | I_FILE2          |   7271 |      1 |   7271 |00:00:00.04 |       2 |      0 |       |       |      |
    |  47 |            NESTED LOOPS                 |                  |      1 |   1394 |  65862 |00:00:17.73 |   39476 |   8927 |       |       |      |
    |  48 |             NESTED LOOPS                |                  |      1 |  30528 |  65862 |00:00:16.94 |   39474 |   8927 |       |       |      |
    |* 49 |              HASH JOIN                  |                  |      1 |   2540 |   8927 |00:00:00.03 |      90 |      0 |   811K|   811K| 1397K (0)|
    |  50 |               TABLE ACCESS FULL         | RECYCLEBIN$      |      1 |   8319 |   8935 |00:00:00.01 |      45 |      0 |       |       |      |
    |* 51 |               TABLE ACCESS FULL         | TS$              |      1 |      2 |     25 |00:00:00.01 |      45 |      0 |       |       |      |
    |* 52 |              FIXED TABLE FIXED INDEX    | X$KTFBUE (ind:1) |   8927 |     12 |  65862 |00:00:11.66 |   39384 |   8927 |       |       |      |
    |* 53 |             INDEX UNIQUE SCAN           | I_FILE2          |  65862 |      1 |  65862 |00:00:00.45 |       2 |      0 |       |       |      |
    |* 54 |            TABLE ACCESS BY INDEX ROWID  | RECYCLEBIN$      |      1 |      1 |      0 |00:00:00.01 |     169 |      0 |       |       |      |
    |  55 |             NESTED LOOPS                |                  |      1 |      1 |      1 |00:00:00.01 |     169 |      0 |       |       |      |
    |  56 |              NESTED LOOPS               |                  |      1 |      1 |      0 |00:00:00.01 |     169 |      0 |       |       |      |
    |  57 |               NESTED LOOPS              |                  |      1 |      1 |      0 |00:00:00.01 |     169 |      0 |       |       |      |
    |  58 |                TABLE ACCESS FULL        | UET$             |      1 |      1 |      0 |00:00:00.01 |     169 |      0 |       |       |      |
    |* 59 |                INDEX UNIQUE SCAN        | I_FILE2          |      0 |      1 |      0 |00:00:00.01 |       0 |      0 |       |       |      |
    |* 60 |               TABLE ACCESS CLUSTER      | TS$              |      0 |      1 |      0 |00:00:00.01 |       0 |      0 |       |       |      |
    |* 61 |                INDEX UNIQUE SCAN        | I_TS#            |      0 |      1 |      0 |00:00:00.01 |       0 |      0 |       |       |      |
    |* 62 |              INDEX RANGE SCAN           | RECYCLEBIN$_TS   |      0 |   1188 |      0 |00:00:00.01 |       0 |      0 |       |       |      |
    |* 63 |    TABLE ACCESS FULL                    | TS$              |      1 |      1 |      0 |00:00:00.01 |      45 |      0 |       |       |      |
    Predicate Information (identified by operation id):
       1 - filter(ROWNUM=1)
       2 - filter( IS NULL)
       5 - filter(("A"."MBYTES_FREE"<4000 OR "A"."MBYTES_FREE" IS NULL))
       6 - access("A"."TABLESPACE_NAME"="B"."TABLESPACE_NAME")
      14 - filter(("INST_ID"=USERENV('INSTANCE') AND "FNNAM" IS NOT NULL AND BITAND("FNFLG",4)<>4 AND "FNTYP"=4))
    PLAN_TABLE_OUTPUT
      17 - filter(("F"."SPARE1" IS NULL AND "F"."TS#" IS NOT NULL))
      18 - access("FE"."FENUM"="F"."FILE#")
           filter("FNFNO"="F"."FILE#")
      19 - filter(("TS"."NAME"<>'Q405_CALLS_TS' AND "TS"."NAME"<>'Q405_ICALLS_TS' ... AND "TS"."NAME"<>'UNLMT_INT_ICALLS_Q408_TS'))
      20 - access("F"."TS#"="TS"."TS#")
      25 - filter(("INST_ID"=USERENV('INSTANCE') AND "FNNAM" IS NOT NULL AND BITAND("FNFLG",4)<>4 AND "FNTYP"=4))
      26 - filter("FNFNO"="HC"."KTFBHCAFNO")
      29 - filter(("TS"."NAME"<>'Q405_CALLS_TS' AND "TS"."NAME"<>'Q405_ICALLS_TS' AND ... AND "TS"."NAME"<>'UNLMT_INT_ICALLS_Q408_TS'))
      30 - access("HC"."KTFBHCTSN"="TS"."TS#")
      31 - filter("F"."SPARE1" IS NOT NULL)
      32 - access("FE"."FENUM"="F"."FILE#")
           filter("FNFNO"="F"."FILE#")
      40 - access("F"."TS#"="FI"."TS#" AND "F"."FILE#"="FI"."RELFILE#")
    PLAN_TABLE_OUTPUT
           filter(("FI"."TS#" IS NOT NULL AND "FI"."RELFILE#" IS NOT NULL))
      41 - filter(("TS"."TS#"="F"."TS#" AND "TS"."BITMAPPED"=0 AND "TS"."NAME"<>'Q405_CALLS_TS' AND "TS"."NAME"<>'Q405_ICALLS_TS' AND
                  "TS"."NAME"<>'Q305_CALLS_TS' AND "TS"."NAME"<>'Q305_ICALLS_TS' AND ... "TS"."NAME"<>'UNLMT_INT_ICALLS_Q408_TS'))
      44 - filter(("TS"."BITMAPPED"<>0 AND INTERNAL_FUNCTION("TS"."ONLINE$") AND .... "TS"."NAME"<>'UNLMT_INT_ICALLS_Q408_TS'))
      45 - filter("TS"."TS#"="F"."KTFBFETSN")
      46 - access("F"."KTFBFETSN"="FI"."TS#" AND "F"."KTFBFEFNO"="FI"."RELFILE#")
           filter(("FI"."TS#" IS NOT NULL AND "FI"."RELFILE#" IS NOT NULL))
      49 - access("TS"."TS#"="RB"."TS#")
      51 - filter(("TS"."BITMAPPED"<>0 AND INTERNAL_FUNCTION("TS"."ONLINE$") AND...."TS"."NAME"<>'UNLMT_INT_ICALLS_Q408_TS'))
      52 - filter(("U"."KTFBUESEGTSN"="RB"."TS#" AND "U"."KTFBUESEGFNO"="RB"."FILE#" AND "U"."KTFBUESEGBNO"="RB"."BLOCK#"))
      53 - access("RB"."TS#"="FI"."TS#" AND "U"."KTFBUEFNO"="FI"."RELFILE#")
           filter(("FI"."TS#" IS NOT NULL AND "FI"."RELFILE#" IS NOT NULL))
    PLAN_TABLE_OUTPUT
      54 - filter(("U"."SEGFILE#"="RB"."FILE#" AND "U"."SEGBLOCK#"="RB"."BLOCK#"))
      59 - access("U"."TS#"="FI"."TS#" AND "U"."SEGFILE#"="FI"."RELFILE#")
           filter(("FI"."TS#" IS NOT NULL AND "FI"."RELFILE#" IS NOT NULL))
      60 - filter(("TS"."BITMAPPED"=0 AND "TS"."NAME"<>'Q405_CALLS_TS' AND .... AND "TS"."NAME"<>'UNLMT_INT_CALLS_Q408_TS' AND
                  "TS"."NAME"<>'UNLMT_INT_ICALLS_Q408_TS'))
      61 - access("TS"."TS#"="U"."TS#")
      62 - access("U"."TS#"="RB"."TS#")
      63 - filter((DECODE("TS"."CONTENTS$",0,DECODE(BITAND("TS"."FLAGS",16),16,'UNDO','PERMANENT'),1,'TEMPORARY')='UNDO' AND "TS"."ONLINE$"<>3 AND
                  BITAND("FLAGS",2048)<>2048 AND LNNVL("TS"."NAME"<>:B1)))
    Note
    PLAN_TABLE_OUTPUT
       - cpu costing is off (consider enabling it)

    Version 10204
    I am running the following statment in order to monitor tablespace free space.
    There are some tablespaces that i am not interesting to monitor , and i also whant to be alert
    only when less than 4 GB left in the tablespace.
    And just adding to Dan's reply, if you are on 10g as you mentioned, why not to use the built in Alert mechanism to monitor and get alerts about the tablespace usage using the GC or Database Console than creating a home grown solution like the one you have posted?
    Aman....

  • Free space in tablespaces

    Hi All,
    Is it possible to collect data about free space in tablespaces in GC (in some table)?
    I'd like to have history of free space in tablespaces. Now I have some sql script which is triggered once per day and store output in the file.

    Hi All,
    Is it possible to collect data about free space in tablespaces in GC (in some table)?
    I'd like to have history of free space in tablespaces. Now I have some sql script which is triggered once per day and store output in the file.

  • Checking tablespace used space, free space in ASM

    Hi,
    I want to find the tablespace used space, free space, total space in an ASM (Automatic Storage Management) environment. What is the query for that ?
    Thanks

    want to find the tablespace used space, free spaceUse same script that u are used in non-asm environment.
    dba_data_files
    dba_free_space
    total space in an ASM (Automatic Storage Management) environment.select name, type, total_mb, free_mb, required_mirror_free_mb,
    usable_file_mb from v$asm_diskgroup;
    Thanks
    Kuljeet

Maybe you are looking for

  • Can I use multiple Album Artworks in iTunes?

    Hi everyone. So I have a 5 disc Album in my iTunes library. & I have artwork for each disc & then the album itself. I'd like to be able to use the artwork for each disc, so that every track has the corresponding artwork for the disc that its from. Bu

  • Maximum length of SQL*Plus Command?

    I'm typing a long query into SQL*Plus (Linux, version 9.2.0.1... yes, I know it's ancient). If I run this query, all works fine: select 'update myauditing_table set test_details='''||grantee||''' where myaudit_refno=''A.FE'';' from (select case when

  • Problem with a signed applet and a user machine.

    Hello. I´m having some problems with a signed applet with some dependences. In one particular computer the applet doesn´t load. The java version installed in that computer is 1.6.0_25. The invocation tag: <applet name=applet id="applet" code=Applet/R

  • How to use CLIENT-CERT authentication?

    Hi, I would like to know how to use client authentication. I used a web application with CLIENT-CERT authentication. And I accessed to the application from browser, then I had the following error message: Incorrect or missing client certificate. I us

  • Black Gradients!!

    Hi, I've ripped a footage from DVD (not copyrighted) and it's fine in quicktime player, VLC etc. But once I inport it into Final Cut Pro it placed black gradients on both the left and right side of the video. Whats gone wrong?