Reclaim free space in datafiles

Hello:
I have taken over management of one of our test servers with Oracle 9i on Windows2000 and have noticed that there are two files that are much larger than the space that is actually being used:
D:\ORACLE\ORADATA\ORCL\SYSTEM01.DBF - 17964M - (Used 1,542M)
D:\ORACLE\ORADATA\ORCL\DATA01.DBF - 12511M - (Used 243M)
How can I reclaim all of this unused space?

Remember it is always best to reclaim space by moving all the objects to another tablespace and reclaiming all space. This will free up space within the tables and indexes as well.
I use the following script to generate the commands for me:
resizea.sql:
drop table alan99;
set pages 50
create table alan99 as
select max(block_id+blocks) block_id,file_id from dba_extents
group by file_id;
column tablespace_name format a15
column pct format 999.99
set wrap off
set lines 120
set trunc off
column file_id format 999
spool resizea.lst
select b.bytes/1024/1024-a.bytes/1024/1024 CURRENT_meg,
a.file_id,a.tablespace_Name,'alter database datafile '''||b.file_name||''' resize '
||trunc(c.block_id*8192/1024/1024+1)||'m;'
from dba_free_space a,dba_data_files b, alan99 c
where a.file_id=b.file_id
and a.block_id=c.block_id and a.file_id=c.file_id
order by current_meg;
set termout off
drop table alan99;
set termout on
spool off
select 'Your output has been saved as resizea.lst' from dual;
A script that will tell you what is inside is:
column owner format a30
column object format a30
set lines 120
set wrap off
set trunc off
set pages 50
set feedback on
column file_id format 999
select     /*+ Rule */     'free space' owner     /*"owner" of free space*/
,          ' ' object          /*blank object name*/
,          file_id                    /*file id for the extent header*/
,          block_id               /*block id for the extent header*/
,          blocks                    /*length of the extent, in blocks*/
from          dba_free_space
where          file_id=&1
union
select     /*+ Rule */ substr(owner,1,20)||' '||substr(segment_type,1,9) /*owner name (first 20 chars)*/
,          substr(segment_name,1,32)||'.'||partition_name     /*segment name*/
,          file_id                    /*file id for the extent header*/
,          block_id               /*block id for the extent header*/
,          blocks                    /*length of the extent, in blocks*/
from           dba_extents
where          file_id=&1
order by     3,4
/

Similar Messages

  • How to find free space in datafiles of perticular schema?

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

    There are lots of scripts available on Metalink which report free space in tablespaces/datafiles.
    Note: 1019999.6 - Script: To List Tablespace, Datafiles and Free Space
    https://metalink.oracle.com/metalink/plsql/ml2_documents.showDocument?p_database_id=NOT&p_id=1019999.6
    Note: 145531.1 - How to Determine Which Tablespaces Do Not Have Enough Free Space
    https://metalink.oracle.com/metalink/plsql/ml2_documents.showDocument?p_database_id=NOT&p_id=145531.1

  • Script for Free Space in Datafiles

    Hi
    Got the below script from metalink [130866.1] to identify free space within a data file.Couple of questions
    1)Is dba_Free_Space an exact indicator of how much space is available in a file.
    2) What is the significance of using blocks in vs using bytes.
    cursor c_freespace(v_file_id in number) is
    select block_id, block_id+blocks max_block
    from dba_free_space
    where file_id = v_file_id
    order by block_id desc;
    Thanks in advance for you help.
    Script for checking backwards for free space at end of file
    REM Script is meant for Oracle version 9 and higher
    REM -----------------------------------------------
    set serveroutput on
    exec dbms_output.enable(1000000);
    declare
    cursor c_dbfile is
    select f.tablespace_name,f.file_name,f.file_id,f.blocks,t.block_size
    from dba_data_files f,
    dba_tablespaces t
    where f.tablespace_name = t.tablespace_name
    and t.status = 'ONLINE'
    order by f.tablespace_name,f.file_id;
    cursor c_freespace(v_file_id in number) is
    select block_id, block_id+blocks max_block
    from dba_free_space
    where file_id = v_file_id
    order by block_id desc;
    /* variables to check settings/values */
    dummy number;
    checkval varchar2(10);
    block_correction number;
    /* running variable to show (possible) end-of-file */
    file_min_block number;
    /* variables to check if recycle_bin is on and if extent as checked is in ... */
    recycle_bin boolean:=false;
    extent_in_recycle_bin boolean;
    /* exception handler needed for non-existing tables note:344940.1 */
    sqlstr varchar2(100);
    table_does_not_exist exception;
    pragma exception_init(table_does_not_exist,-942);
    begin
    /* recyclebin is present in Oracle 10.2 and higher and might contain extent as checked */
    begin
    select value into checkval from v$parameter where name = 'recyclebin';
    if checkval = 'on'
    then
    recycle_bin := true;
    end if;
    exception
    when no_data_found
    then
    recycle_bin := false;
    end;
    /* main loop */
    for c_file in c_dbfile
    loop
    /* initialization of loop variables */
    dummy :=0;
    extent_in_recycle_bin := false;
    file_min_block := c_file.blocks;
    begin
    <<check_free>>
    for c_free in c_freespace(c_file.file_id)
    loop
    /* if blocks is an uneven value there is a need to correct with -1 to compare with end-of-file which is even */
    block_correction := (0-mod(c_free.max_block,2));
    if file_min_block = c_free.max_block+block_correction
    then
    /* free extent is at end so file can be resized */
    file_min_block := c_free.block_id;
    else
    /* no more free extent at end of file, file cannot be further resized */
    exit check_free;
    end if;
    end loop;
    end;
    /* check if file can be resized, minimal size of file 16 blocks */
    if (file_min_block = c_file.blocks) or (c_file.blocks <= 16)
    then
    dbms_output.put_line('Tablespace: '||c_file.tablespace_name||' Datafile: '||c_file.file_name);
    dbms_output.put_line('cannot be resized no free extents found');
    dbms_output.put_line('.');
    else
    /* file needs minimal no of blocks which does vary over versions */
    if file_min_block < 16
    then
    file_min_block := 16;
    end if;
    dbms_output.put_line('Tablespace: '||c_file.tablespace_name||' Datafile: '||c_file.file_name);
    dbms_output.put_line('current size: '||(c_file.blocks*c_file.block_size)/1024||'K'||' can be resized to: '||round((file_min_block*c_file.block_size)/1024)||'K (reduction of: '||round(((c_file.blocks-file_min_block)/c_file.blocks)*100,2)||' %)');
    /* below is only true if recyclebin is on */
    if recycle_bin
    then
    begin
    sqlstr:='select distinct 1 from recyclebin$ where file#='||c_file.file_id;
    execute immediate sqlstr into dummy;
    if dummy > 0
    then
    dbms_output.put_line('Extents found in recyclebin for above file/tablespace');
    dbms_output.put_line('Implying that purge of recyclebin might be needed in order to resize');
    dbms_output.put_line('SQL> purge tablespace '||c_file.tablespace_name||';');
    end if;
    exception
    when no_data_found
    then null;
    when table_does_not_exist
    then null;
    end;
    end if;
    dbms_output.put_line('SQL> alter database datafile '''||c_file.file_name||''' resize '||round((file_min_block*c_file.block_size)/1024)||'K;');
    dbms_output.put_line('.');
    end if;
    end loop;
    end;
    Example output for Oracle version 9 and higher:
    Tablespace: TEST Datafile: /oradata/v112/test01.dbf
    cannot be resized no free extents found
    Tablespace: UNDOTBS1 Datafile: /oradata/v112/undotbs01.dbf
    current size: 9384960K can be resized to: 106496K (reduction of: 98.87 %)
    SQL> alter database datafile '/oradata/v112/undotbs01.dbf' resize 106496K;
    Tablespace: USERS Datafile: /oradata/v112/users01.dbf
    current size: 328960K can be resized to: 117248K (reduction of: 64.36 %)
    Extents found in recyclebin for above file/tablespace
    Implying that purge of recyclebin might be needed in order to resize
    SQL> purge tablespace USERS;
    SQL> alter database datafile '/oradata/v112/users01.dbf' resize 117248K

    Hi
    Got the below script from metalink [130866.1] to identify free space within a data file.Couple of questions
    1)Is dba_Free_Space an exact indicator of how much space is available in a file.
    2) What is the significance of using blocks in vs using bytes.
    cursor c_freespace(v_file_id in number) is
    select block_id, block_id+blocks max_block
    from dba_free_space
    where file_id = v_file_id
    order by block_id desc;
    Thanks in advance for you help.
    Script for checking backwards for free space at end of file
    REM Script is meant for Oracle version 9 and higher
    REM -----------------------------------------------
    set serveroutput on
    exec dbms_output.enable(1000000);
    declare
    cursor c_dbfile is
    select f.tablespace_name,f.file_name,f.file_id,f.blocks,t.block_size
    from dba_data_files f,
    dba_tablespaces t
    where f.tablespace_name = t.tablespace_name
    and t.status = 'ONLINE'
    order by f.tablespace_name,f.file_id;
    cursor c_freespace(v_file_id in number) is
    select block_id, block_id+blocks max_block
    from dba_free_space
    where file_id = v_file_id
    order by block_id desc;
    /* variables to check settings/values */
    dummy number;
    checkval varchar2(10);
    block_correction number;
    /* running variable to show (possible) end-of-file */
    file_min_block number;
    /* variables to check if recycle_bin is on and if extent as checked is in ... */
    recycle_bin boolean:=false;
    extent_in_recycle_bin boolean;
    /* exception handler needed for non-existing tables note:344940.1 */
    sqlstr varchar2(100);
    table_does_not_exist exception;
    pragma exception_init(table_does_not_exist,-942);
    begin
    /* recyclebin is present in Oracle 10.2 and higher and might contain extent as checked */
    begin
    select value into checkval from v$parameter where name = 'recyclebin';
    if checkval = 'on'
    then
    recycle_bin := true;
    end if;
    exception
    when no_data_found
    then
    recycle_bin := false;
    end;
    /* main loop */
    for c_file in c_dbfile
    loop
    /* initialization of loop variables */
    dummy :=0;
    extent_in_recycle_bin := false;
    file_min_block := c_file.blocks;
    begin
    <<check_free>>
    for c_free in c_freespace(c_file.file_id)
    loop
    /* if blocks is an uneven value there is a need to correct with -1 to compare with end-of-file which is even */
    block_correction := (0-mod(c_free.max_block,2));
    if file_min_block = c_free.max_block+block_correction
    then
    /* free extent is at end so file can be resized */
    file_min_block := c_free.block_id;
    else
    /* no more free extent at end of file, file cannot be further resized */
    exit check_free;
    end if;
    end loop;
    end;
    /* check if file can be resized, minimal size of file 16 blocks */
    if (file_min_block = c_file.blocks) or (c_file.blocks <= 16)
    then
    dbms_output.put_line('Tablespace: '||c_file.tablespace_name||' Datafile: '||c_file.file_name);
    dbms_output.put_line('cannot be resized no free extents found');
    dbms_output.put_line('.');
    else
    /* file needs minimal no of blocks which does vary over versions */
    if file_min_block < 16
    then
    file_min_block := 16;
    end if;
    dbms_output.put_line('Tablespace: '||c_file.tablespace_name||' Datafile: '||c_file.file_name);
    dbms_output.put_line('current size: '||(c_file.blocks*c_file.block_size)/1024||'K'||' can be resized to: '||round((file_min_block*c_file.block_size)/1024)||'K (reduction of: '||round(((c_file.blocks-file_min_block)/c_file.blocks)*100,2)||' %)');
    /* below is only true if recyclebin is on */
    if recycle_bin
    then
    begin
    sqlstr:='select distinct 1 from recyclebin$ where file#='||c_file.file_id;
    execute immediate sqlstr into dummy;
    if dummy > 0
    then
    dbms_output.put_line('Extents found in recyclebin for above file/tablespace');
    dbms_output.put_line('Implying that purge of recyclebin might be needed in order to resize');
    dbms_output.put_line('SQL> purge tablespace '||c_file.tablespace_name||';');
    end if;
    exception
    when no_data_found
    then null;
    when table_does_not_exist
    then null;
    end;
    end if;
    dbms_output.put_line('SQL> alter database datafile '''||c_file.file_name||''' resize '||round((file_min_block*c_file.block_size)/1024)||'K;');
    dbms_output.put_line('.');
    end if;
    end loop;
    end;
    Example output for Oracle version 9 and higher:
    Tablespace: TEST Datafile: /oradata/v112/test01.dbf
    cannot be resized no free extents found
    Tablespace: UNDOTBS1 Datafile: /oradata/v112/undotbs01.dbf
    current size: 9384960K can be resized to: 106496K (reduction of: 98.87 %)
    SQL> alter database datafile '/oradata/v112/undotbs01.dbf' resize 106496K;
    Tablespace: USERS Datafile: /oradata/v112/users01.dbf
    current size: 328960K can be resized to: 117248K (reduction of: 64.36 %)
    Extents found in recyclebin for above file/tablespace
    Implying that purge of recyclebin might be needed in order to resize
    SQL> purge tablespace USERS;
    SQL> alter database datafile '/oradata/v112/users01.dbf' resize 117248K

  • Oracle 11g - How to repair block corruption(on free space) in datafile

    Hi,
    I have a tablesopace with 3 datafiles, out of which one datafile has corrupted block. But no objects or data is affected as the corrupted block os in free space. This was shown in the alert logs.
    Please see below the details:
    Wed Apr 06 15:30:04 2011
    SMON: Restarting fast_start parallel rollback
    SMON: ignoring slave err,downgrading to serial rollback
    ORACLE Instance geooap (pid = 12) - Error 1578 encountered while recovering transaction (10, 6) on object 149755.
    Errors in file f:\oracle11g\diag\rdbms\geooap\geooap\trace\geooap_smon_5540.trc:
    ORA-01578: ORACLE data block corrupted (file # 7, block # 54053)
    ORA-01110: data file 7: 'F:\ORACLE11G\ORADATA\GEOOAP\ORDER_DATA_01.DBF'
    GEOAP:
    Fri Apr 01 14:57:48 2011
    Errors in file f:\oracle11g\diag\rdbms\geop\geop\trace\geop_arc1_2156.trc:
    ORA-00235: control file read without a lock inconsistent due to concurrent update
    Fri Apr 01 14:57:58 2011
    ================================================================
    The corruption is being reported in a free space block of the ORDER_DATA_01.DBF.
    I’ve checked all the tables (and indexes) in this tablespace and none report corruption.
    =====================================================Is there any action I need to take to remove corruption at this point?It is not affected any operation on the database yet.
    What is the best way to do get rid of the corrupt block, without dropping and rebuillding the full tablespace(which is around 6 GB -total of 3 datafiles)
    Thanks a lot

    Can RMAN recover the datablock from this cold backup(which is a week old, the data file was not corrupted then) ?Please note that to do the recovery, you would need the backup and the archivelog files since the backup. Think about what you are asking to do. Its a single block whose recovery you are asking from a week old backup which obviously would be on an much older SCN compared to the rest of the database. How would you make that block consistent with the rest of the datafile. If you don't have archivelog in that db whose block is corrupted, you may forget that block and any data that it might ever had. Also, please read the documentation about the block recovery which explains the requirements very clearly,
    http://download.oracle.com/docs/cd/E11882_01/backup.112/e10642/rcmblock.htm#BRADV89784
    From the above link, 1st point,
    The target database must run in ARCHIVELOG mode and be open or mounted with a current control file.HTH
    Aman....

  • Unable to reclaim free space

    tablespace size: 62G, 14 4G files and 1 6G file, freespace =51G
    When I try to resize datafiles, I get an error; the max free space per file =1G --- not sure what is using up the space.
    environment: 10.2.0.3 2-node RAC cluster on Red Hat Linux 4
    Can someone please help me in resolving this issue?

    Hi,
    Read that from Tom Kyte :
    http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:1065432640718
    http://asktom.oracle.com/pls/asktom/f?p=100:11:2491978564332050::::P11_QUESTION_ID:153612348067
    Best regards
    Phil

  • How to reclaim "free space" on TM drive?

    I had 2 partitions on my external drive. I've deleted one of them as it is no longer need. Is there a way I can tell my TM partition to reclaim this new "free space" without having to erase the entire disk?
    Thanks

    Dryvlyne wrote:
    That's exactly what I did to erase the partition, however, that partition is/was positioned first on the drive, above the TM partition. Hopefully that makes sense, but that's where I'm stuck at.
    Thanks
    in that case you can not absorb it into the other partition without reformatting the whole drive (that will wipe all the data off it). At least you can not do it with disk utility. Using disk utility you can only adjust the size of a partition by dragging its lower right end up or down.

  • Cant reclaim free space from deleted trace file in bdump

    Hi ,
    Os : IBM aix 5.3
    Oracle : oracle 10.2.0.3 enterprise edition
    My /oracle space is only 2gb remaining .
    i deleted more 2gb trace files from bdump folder but when i check on os for free space its still showing that only 2gb is remaining for /oracle
    plz help me guys................

    Hi,
    You need to kill the OS PID's accessing the dump directory FS to get space released ..Refer below, how it can be done
    [oracle9i@M6UAT-DB:/home/oracle9i>]pwd
    /oracle/product/admin/M6CORP/udump
    [oracle9i@M6UAT-DB:/home/oracle9i>]fuser -c /oracle/product/admin/M6CORP/udump
    /oracle/product/admin/M6CORP/udump:   102612c  213018c  278544  327850c  340170c  356426c  466986c  495782c  516276c  565368c  610416c  626822c  647266c  696352c  704692c  708632c  745654c  753666c  766036c  778448c  794750c  798966c  852002c  864438c  880678c  884826c  892980c  905248c  925944c  938066c  950490c  958478c  966900c  974924c  979180c  991400c 1007816c 1015990c 1028342c 1032316c 1040494c 1044584c 1048790c 1064962c 1069198c 1077448c 1114204c 1130594c 1143014c 1146978c 1175638c 1191982c 1196276c 1216524c 1241106c 1249470c 1253520c 1261794c 1278186c 1290380c 1302720c 1306640c 1343604c 1347682c 1351874c 1355950c 1359928c 1372280c 1380602c 1384452c 1405106c 1454216c 1458424c 1462418c 1474594c 1482906c 1511456c 1515552c 1523846c 1527914c 1544408c 1548308c 1552392c 1560670c 1564732c 1568938c 1581288c 1597468c 1601616c 1630268c 1634464c 1650836c 1654816c 1667186c 1679502c 1683656c 1687722c 1695962c 1700028c 1703952c 1712276c 1720546c 1728524c 1732832c 1736736c 1744946c 1749098c 1757358c 1761474c 1769496c 1777784c 1781850c 1785944c 1789966c 1798162c 1806568c 1822912c 1851628c 1855700c 1867794c 1871934c 1892562c 1900660c 1904794c 1908936c 1917174c 1921244 1929398c 1937446c 1945762c 1957936c 1962036c 1994984c 1998914c 2039896c 2044122c 2060456c 2064548c 2068632c 2072672c 2076892c 2084908c 2089162c 2101466c 2105384c 2109494c 2125952c 2130136c 2134050c
    [oracle9i@M6UAT-DB:/home/oracle9i>]kill -9 102612  213018  278544  327850  340170  356426  466986  495782  516276  565368  610416  626822  647266Thanks,
    Ajay More
    http://moreajays.blogspot.com

  • Free space in datafile

    hi guys,
    how to find the freespace in a datafile.
    Thanx,

            File Id File Name                                                                                                                                                                                                                                                         Tablespace Name                                                               Current(MB)    Smallest(MB)        Save(MB)
                  6 /dbdev/LIVE/D_DEV01.dbf                                                                                                                                                                                                                                       D_DEV (8192)                                                                          512             512               0
                 12 /dbprod6/LIVE/D_DYN106.dbf                                                                                                                                                                                                                                    D_DYN1 (8192)                                                                        1024            1024               1
                 11 /dbprod6/LIVE/D_DYN105.dbf                                                                                                                                                                                                                                    D_DYN1 (8192)                                                                        1024            1024               1
                 25 /db_prod2/LIVE/I_DYN104.dbf                                                                                                                                                                                                                                   I_DYN1 (8192)                                                                        1024            1024               1
                 13 /dbprod6/LIVE/D_DYN107.dbf                                                                                                                                                                                                                                    D_DYN1 (8192)                                                                        1024            1024               1
                  7 /dbprod4/LIVE/D_DYN101.dbf                                                                                                                                                                                                                                    D_DYN1 (8192)                                                                        1024            1024               1
                 26 /db_prod2/LIVE/I_DYN105.dbf                                                                                                                                                                                                                                   I_DYN1 (8192)                                                                        1024            1024               1
                 29 /db_prod3/LIVE/I_PARTN02.dbf                                                                                                                                                                                                                                  I_PARTN (8192)                                                                       1024            1024               1
                  9 /dbprod4/LIVE/D_DYN103.dbf                                                                                                                                                                                                                                    D_DYN1 (8192)                                                                        1024            1024               1
                  8 /dbprod4/LIVE/D_DYN102.dbf                                                                                                                                                                                                                                    D_DYN1 (8192)                                                                        1024            1024               1
                  5 /dbarch/LIVE/D_ARCH01.dbf                                                                                                                                                                                                                                     D_ARCH (8192)                                                                        1024            1024               1
                 10 /dbprod4/LIVE/D_DYN104.dbf                                                                                                                                                                                                                                    D_DYN1 (8192)                                                                        1536            1536               1
                  3 /dbprod1/LIVE/sysaux01.dbf                                                                                                                                                                                                                                    SYSAUX (8192)                                                                         420             419               2
                 48 /db_prod3/LIVE/undotbs02.dbf                                                                                                                                                                                                                                  UNDOTBS1 (8192)                                                                        20              19               2
                  4 /dbprod1/LIVE/users01.dbf                                                                                                                                                                                                                                     USERS (8192)                                                                            5               1               5
                 19 /dbprod4/LIVE/D_STAT101.dbf                                                                                                                                                                                                                                   D_STAT1 (8192)                                                                         50              41              10
                  1 /dbprod1/LIVE/system01.dbf                                                                                                                                                                                                                                    SYSTEM (8192)                                                                         647             619              29
                 18 /dbprod4/LIVE/D_PAYROLL01.dbf                                                                                                                                                                                                                                 D_PAYROLL (8192)                                                                       50              22              29
                 31 /db_prod2/LIVE/I_STAT101.dbf                                                                                                                                                                                                                                  I_STAT1 (8192)                                                                         50              14              37
                 27 /db_prod2/LIVE/I_ENV01.dbf                                                                                                                                                                                                                                    I_ENV (8192)                                                                           50               2              49
                 15 /dbprod6/LIVE/D_ENV01.dbf                                                                                                                                                                                                                                     D_ENV (8192)                                                                           50               2              49
                 20 /db_prod3/LIVE/D_TMS.dbf                                                                                                                                                                                                                                      D_TMS (8192)                                                                          150             102              49
                 30 /dbprod5/LIVE/I_PAYROLL1.dbf                                                                                                                                                                                                                                  I_PAYROLL (8192)                                                                       50               1              50
                 21 /dbprod6/LIVE/D_WORK01.dbf                                                                                                                                                                                                                                    D_WORK (8192)                                                                        1024             927              98
                  2 /dbprod1/LIVE/undotbs01.dbf                                                                                                                                                                                                                                   UNDOTBS1 (8192)                                                                       610             361             250
                 28 /db_prod3/LIVE/I_PARTN01.dbf                                                                                                                                                                                                                                  I_PARTN (8192)                                                                       1536            1176             361
                 24 /db_prod2/LIVE/I_DYN103.dbf                                                                                                                                                                                                                                   I_DYN1 (8192)                                                                        1536            1154             383
                 22 /db_prod2/LIVE/I_DYN101.dbf                                                                                                                                                                                                                                   I_DYN1 (8192)                                                                        1536            1131             406
                 14 /dbprod6/LIVE/D_DYN108.dbf                                                                                                                                                                                                                                    D_DYN1 (8192)                                                                        1024             616             409
                 17 /db_prod3/LIVE/D_PARTN02.dbf                                                                                                                                                                                                                                  D_PARTN (8192)                                                                       1024             567             458
                 16 /db_prod3/LIVE/D_PARTN01.dbf                                                                                                                                                                                                                                  D_PARTN (8192)                                                                       1024             555             470
                 32 /db_prod2/LIVE/I_WORK.dbf                                                                                                                                                                                                                                     I_WORK (8192)                                                                        1024             511             514
                 23 /db_prod2/LIVE/I_DYN102.dbf                                                                                                                                                                                                                                   I_DYN1 (8192)                                                                        1536             977             560Nice.
    Adith

  • 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;

  • 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

  • How much free space will be left after import ?

    Hallo. I need to replace all schemas on integration server using those on production server. I want to know how much free space will be left on /data at integration server after this kind of refresh. Both databases 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?
    SELECT 'TOTAL :'||SUM(ALLOCATED_MB),
    'USED :'||SUM(USED_MB) USED,
    'FREE :'||SUM(FREE_SPACE_MB)
    FROM (SELECT SUBSTR (df.NAME, 1, 40) file_name, df.bytes / 1024 / 1024 allocated_mb,
    ((df.bytes / 1024 / 1024) - NVL (SUM (dfs.bytes) / 1024 / 1024, 0)) used_mb,
    NVL (SUM (dfs.bytes) / 1024 / 1024, 0) free_space_mb
    FROM v$datafile df, dba_free_space dfs
    WHERE df.file# = dfs.file_id(+)
    GROUP BY dfs.file_id, df.NAME, df.file#, df.bytes
    ORDER BY file_name);
    SOURCE_DB@Server1
    TOTAL(MB) :170860.984375
    USED(MB) :152777.859375
    FREE(MB) :18083.125
    TARGET_DB@Server2
    TOTAL(MB) :121634,984375
    USED(MB) :92853,109375
    FREE(MB) :28781,875
    Edited by: Przemek P on Oct 9, 2012 10:48 AM

    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

  • 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/

  • Table Partitions and Rolling Window: free space not reclaimed

    I have a couple of processes that involve the rolling window scenario where we drop an old partition and add a new partition monthly. We are seeing, however, that free space is not being reclaimed, and so I keep having to feed new datafiles into the tablespace (which is LMT). I was (mistakenly, it seems) under the impression that dropping a partition frees up that space for re-use.
    We're currently on Oracle 10gR2 (10.2.0.2), but these tablespaces were orginally created in 9i. I've read that one solution is to implement "table shrinking," however I also see that is only available on tables in an ASSM tablespace. I see that ASSM is the default for tablespaces in 10gR2, but since my tablespaces were created in 9i, I assume they are not ASSM.
    I'd like to see what other people think of this scenario. Surely a lot of people do the rolling window scenario and need space reclaimed.

    No, it is of concern because Sanadra was messing with the partitions. She could have inadvertantly caused something to happen, in this case the free-space issue, and it's imperative to get all of the details.
    My iMac 27' Late-2012 does not have a fusion drive, yet shows that the type is "internal" the original poster doesn't indicate that.

  • Block Corruption In Free Space Chuck Of A Datafile

    Hi all,
    I have run into this issue where both dbv and rman have caught a block corruption on one of the datafiles. When I checked these blocks, they did not belong to any segments and I was able to verify that this block ID falls in the block_id + blocks range in the dba_free_space where file_id = 41.
    My questions are ...
    - why is rman complaining about a bad block in free space? It will never need to back it up any way?
    - According to note 28814.1, this type of corruption can be ignored and if when oracle needs to use this block, it will simply create/rewrite a new image without the corrupted data. Have you been affected by this issue? If yes, what did you do?
    Thank you

    1. "why is rman complaining about a bad block in free space? It will never need to back it up any way?"
    Because it is doing its job.
    2. "Have you been affected by this issue? If yes, what did you do?"
    In what version? I generally find it helpful to read the docs and check discussions of issues on metalink.

  • After i empty trash (the secure empty doesn't work either), the system does not reclaim the free space.

    After i empty trash (the secure empty doesn't work either), the system does not reclaim the free space.
    I need to run the erase free space option from the disk utility every time...which is really annoying and time consuming.
    Any ideas how to solve this?
    Thanks in advance =)

    There is a thing in iPhoto whereby the first time you delete a photo it asks if you want to delete or just remove from the album, something like that.  Unfortunately it is one of these things with a "don't ask me again" checkbox.  Now, "deleting" photos only removes them from the album they are in.  To actually trash them I must then go to "all photos" and find them, to send them to the trash.   To help find them, what I do is rename them zzz or something, so sorting them will get them to the bottom of my collection.  Just maybe your photos are still lurking around?

Maybe you are looking for

  • RUNTIME_EXCEPTION NullPointerException: at com.sap.guid.GUID.parseHexGUID

    I have just started testing an end to end process that uses RFC Lookups on PI 7.1 ... when testing the mapping from the ESR in both message mapping and operational mapping, it works fine.. when i run it end to end i get the following error:   <?xml v

  • Can i use java scripts in d2k forms and reports

    Good day all, Can i use the above said, if yes any assistance or eg. thanks in advance.

  • Material Level budgeting

    Dear Experts , Can the system fix a budget for a particular material ? I want the system to stop all the procurements for a particular POrg/Plant once its Purchase value has exceeded a certain value . Is it possible in SAP ? If yes in which module ?

  • [SOLVED] Can't connect to internet after installation

    Hello, I just installed Arch, and during the installation I connected to wifi (obviously, since I had to download the packages) with iwconfig and all the other tools on the installer, but after the installation I wasn't connected any more. I have no

  • Re-install my macbook and than sync with iphone

    hello, my hd on the macbook crashed yesterday, i have installed a new 120Gig. now my problem, i have the me-account and it's activated, now i want sync my iphone again with my music,photos etc with my macbook, i have install the same tiger system wit