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

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

  • How to find free space in an ArrayList...

    Hi,
    I have an ArrayList with data randomly assigned to different indexs of the ArrayList.
    I want to find out where the "gaps" are within the ArrayList... For Example There would be data in index 0,1,2,3,5 but not in index 4 . How would I go about finding this information.
    Thanks
    Chris

    jwenting wrote:
    kajbj wrote:
    Praveen_Forum wrote:
    I don't think we have to look into the free space's for ArrayList, as it is a dynamic growing arraylist you can just keep on adding the stuff in it takes care of filling all the empty spaces
    I am i right?No, it will not fill a gap.in fact it will, after a fashion.
    When you remove an item the remaining items are reshuffled to close the gaps.
    When you try to insert an item beyond the last position (so at list.size()+2 or greater) you will get an error, and the insert will fail.I was more thinking of a situation like this:
            strings.add("One");
            strings.add("Two");
            strings.add("Three");
            strings.set(1, null);
            System.out.println(strings);The element at index 1 will be null (a gap in my view), since remove won't cause a gap.
    Kaj

  • How to find free space in ASM

    Hi experts,
    we use oracle 11.1 rac and database with asm in redhat.
    I copied two query from online.
    query 1 as
    select name,total_mb,free_mb from v$asm_diskgroup;
    NAME TOTAL_MB FREE_MB
    DATA1 511993 132092
    FLSDISK1 1638394 712233
    but query 2 shows there are no space in ASM diskgroup
    QL> select d.name disk_name,g.name group_name,d.path,d.total_mb,d.free_mb
    2 from v$asm_disk d, v$asm_diskgroup g
    3 where d.group_number = g.group_number (+)
    4 ;
    DISK_NAME GROUP_NAME PATH TOTAL_MB FREE_MB
    FBDISK1 FLSDISK1 ORCL:FBDISK1 1638394 0
    DATADISK1 DATA1 ORCL:DATADISK1 511993 0
    which query do I need to use to check free space in asm diskgroup?
    Thanks
    JIm

    Hi,
    If you're looking freespace in diskgroup i believe you can use the first one
    second script is looking freespace per each disk
    Cheers
    FZheng

  • How do I free space on my computer?

    How do I free space on my computer?

    Hello,
    Let's see if we can find out where the big users of space are first.
    How much free space is on the HD, where has all the space gone?
    OmniDiskSweeper is likely the easiest/best, and is now free...
    http://www.omnigroup.com/applications/omnidisksweeper/download/

  • How do you free space on the startup disk

    how do you free space on the startup disk

    If your disk is 80% full that is normal.  Time Machine uses up to 80% of the disk space for local snapshots.  To get rid of these snapshots simply plug in your Time Machine backup drive and run a backup. 
    If you have less than 20% disk space then it is time to roll up your sleeves and search for what you can delete and what you can offload to another disk.
    If you have less than 10 GB you definitely need to delete or offload some files.  You may want to maintain at least 20 GB of free space so when your disk starts filling again it will have some room before it hits that 10 GB mark again.  More headroom is better.  If you let the space fall much below 9 GB you might not be able to boot your machine.
    Initial easy steps to gain disk space:
    - Delete all files in the Downloads folder.
    - Empty the trash.
    - Start iPhoto, empty its trash and restart the computer.
    Deleting files:
    Run a Time Machine (or other) backup since you are about to delete and move files and you may need to recover from any inadvertent mistakes or decisions.  You will need one external hard drive for your Time Machine (or other) backup and a second one onto which you will offload some files.
    Then use the free application OmniDiskSweeper http://www.omnigroup.com/more to explore your volume in descending order by size so you can attack the problem from the top down, deleting the largest unwanted files first.  Delete with caution and do not delete any system files.  Remember to empty the trash after trashing the files.
    Moving files:
    Consider moving some of the no-often-used large files or directories to an external disk.  Use ODS again to find them. 
    As noted above this will be at least your second hard drive.  Your first one(s) is/are for your Time Machine (or other) backup(s).  Do not offload files onto a Time Machine disk.
    Format the second drive as Mac OS Extended (journaled).  Using OWS to find large files/folders and copy them from the system drive to the external hard drive and delete them from your internal drive.
    Then  > System Preferences > Time Machine > Options… > Remove the offload HD name from the exclusions list.
    Now both your system disk and your external offload disk will be backed up onto your Time Machine disk.
    For more about backups:
    Time Machine Basics: http://support.apple.com/kb/ht1427
    Most commonly used backup methods:
    https://discussions.apple.com/docs/DOC-3045
    Methodology to protect your data.  Backups vs. Archives.  Long-term data protection:
    https://discussions.apple.com/docs/DOC-6031
    From: http://www.thexlab.com/faqs/freeingspace.html
    To move your iTunes Music folder to another disk or partition:
    To change the location of your iTunes Music folder, carefully follow the instructions in the AppleCare® Knowledge Base document "iTunes for Mac: Moving your iTunes Music folder."Additional information can be found in iTunes Help.
    http://webcache.googleusercontent.com/search?q=cache:http://www.thexlab.com/105/ 00000849.html
    Laptop users may want to consider having two iTunes libraries: a small library of current favorites on their computer, while their complete library resides on an external hard drive. Utilities like iTunes Library Manager enable you to easily have multiple iTunes libraries you can use with your account.  https://www.macupdate.com/app/mac/7689/itunes-library-manager
    To move your iPhoto Library folder to another disk or partition:
    To move the iPhoto Library folder to a new location, employ the instructions in the AppleCare Knowledge Base document from http://support.apple.com/kb/PH2506 corresponding to the version of iPhoto you are using. Additional information can be found in iPhoto Help.
    Laptop users may want to consider having two iPhoto libraries: a small library of current, favorite photographs on their computer, while their complete library, or archives of older photos are saved on an external hard drive. Utilities such as iPhoto Buddy and iPhoto Library Managerenable you to have multiple iPhoto libraries that you can use with your account.
    https://www.macupdate.com/app/mac/12175/iphoto-buddy
    https://www.macupdate.com/app/mac/7158/iphoto-library-manager

  • How SMON coalesces free space in oracle 9i and 10g

    how SMON coalesces free space in oracle 9i and 10g?
    Is it doing same as it was behaving in oracle 7 like looking through free extent table every five minutes (sys.fet$) to see if there are any adjacent free extents that can be coalesced into a single extent, and on every 25th cycle (i.e. every two hours and five minutes) it looks at the segment table (sys.seg$) to see if there are any temporary segments that need to be eliminated, as explained by jonathan lewis?
    what are extent and segment tables available in oracle 9i and 10g like sys.fet$ and sys.seg$ in oracle7?

    >
    how SMON coalesces free space in oracle 9i and 10g?
    Is it doing same as it was behaving in oracle 7 like looking through free extent table every five minutes (sys.fet$) to see if there are any
    adjacent free extents that can be coalesced into a single extent, and on every 25th cycle (i.e. every two hours and five minutes) it looks
    at the segment table (sys.seg$) to see if there are any temporary segments that need to be eliminated, as explained by jonathan lewis?
    what are extent and segment tables available in oracle 9i and 10g like sys.fet$ and sys.seg$ in oracle7?I think you need to go and have a look at the Oracle 9i documentation here
    http://www.oracle.com/technology/documentation/oracle9i_arch_901.html
    and automatic segment management in 10g
    http://www.oracle.com/technology/pub/articles/10gdba/week15_10gdba.html
    HTH.
    Paul...
    Software - OS (+ version), Server,
    Hardware - CPU + Disk configuration.
    Please include all of the above information with database queries.
    This will help those who are trying to help you!
    Furthermore, please do not top-post and do try to trim your replies!

  • Can't find free space for Shared Memory (Size=83739 KB)

    Hello All,
              I have an issue. i am unable to bring up the server. It is ABAP system.
    dev_w0 log file show me memory error.
    I Fri May 01 10:11:55 2009
    I  *** ERROR => [MapOsShm] Can't find free space for Shared Memory (Size=83739 KB)
                   [shmnt.c      2174]
    I  *** ERROR => [AttachOsShm] MapViewOfFile(Key=62,Handle=0x000003FC) failed with Err=0
                   [shmnt.c      2174]
    I  *** ERROR => ShmCreate: Attach (62,85748608,2) failed [shmnt.c      422]
    Can some body help me with it.
    Thanks and regards
    Kiran

    I am running into the same issue. What exactly solved your problem?
    I will really appreciate any info., around this.
    i am trying to install CE 7.2 Developer Workplace on Windows 32 bit.
    Saurabh

  • HT1222 How do I free  space in my phones memory to down load new os

    How do I free  space in my phones memory to down load new os

    Most with iPhone4 have not been able to delete enough stuff in order to download iOS7 over-the-air.  The easiest thing for you to do is do the update via iTunes.

  • How to find the Source Table in one corresponding schema?

    Hi All,
    How to find the Source Table in one corresponding schema?
    regards,
    DB

    DB wrote:
    Hi All,
    How to find the Source Table in one corresponding schema?
    regards,
    DBHUH?
    I do not understand your question
    How do I ask a question on the forums?
    SQL and PL/SQL FAQ

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

  • How do I free space on my hard drive in Mountain Lion?

    How can I free up valuable space on my start up disk a/o hard drive space.  I use FCPX a lot and I think there are many temporary files that I could easily get rid of within finder.  I did this once with AppleCare's but as you know using Pro applications cost $100 per incident to get help using AppleCare.  Please help me. Many thanks! My specs are as follows:
                    3.5 GHz i7,
                   16bg DDR3,
                   AMD Radeon HD 6970M with 2GB of Video,
                    OSX 10.8.4,
                   2 TB hard drive with only 10.56 gb free. 

    Hard drive getting full or near full?
    Do a search for and downlaod and install OmniDisk Sweeper and OnyX.
    Here are some of my tips for deleting or archiving data off of your internal hard
    Have you emptied your iMac's Trash icon in the Dock?
    If you use iPhoto, iPhoto has its own trash that needs to be emptied, also.
    If you use Apple Mail app, Apple Mail also has its own trash area that needs to be emptied, too!
    Other things you can do to gain space.
    Delete any old or no longer needed emails and/or archive older emails you want to save to disc, Flash drive/s or to ext. hard drive.
    Look through your Documents folder and delete any type of old useless type files like "Read Me" type files.
    Again, archive to disc, Flash drive or ext. hard drive and/or delete any old documents you no longer use or immediately need.
    Uninstall apps that you no longer use. If the app has a dedicated uninstaller, use it to completely uninstall the app. If the app has no uninstaller, then just drag it to the OS X Trash icon  and empty the Trash.
    Also, if you save old downloaded  .dmg application installer  files, you can either archive and delete these or just delete the ones you think you'll never install, again.
    Download an app called OnyX for your version of OS X.
    When you install and launch it, let it do its thing initially, then go to the cleaning and maintenance tabs and run all of the processes in the tabs. Let OnyX clean out all web browser cache files, web browser histories, system cache files, delete old error log files.
    Typically, iTunes and iPhoto libraries are the biggest users of HD space.
    If you have any other large folders of personal data or projects, these should be thinned out, moved, also, to the external hard drive and then either archived to disc, Flash drive or ext. hard drive and/or deleted off your internal hard drive.
    Good Luck!

  • 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

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

  • HELP !!! - sql script to find free space in Oracle7,8,9 DB

    Hi All
    I got a PL/SQL script to find out free space in Oracle7,8,9 db. But because in Oracle 7 there is no maxbytes column in dba_data_files, so this script is not working. I am trying to use cursor and putting sql in a variable so that when program executes, it does not see maxbytes. But it still does not work.
    Please help. !!!
    Script
    set feedback off;
    set serveroutput on;
    set termout off;
    set verify off;
    spool /u01/app/oracle/admin/common/bck/log/ts.log
    declare
    v_tablespace_name varchar2(50);
    v_total_space number(12) := 0;
    v_free_space number(12);
    v_space number(12);
    v_space_used number(12);
    v_pct_free number(6,3);
    v_pct_threshold number(3) := 2;
    v_table_exist number(2) := 0;
    v_sql varchar2(300) := 'select sum(maxbytes) from dba_data_files where TABLESPACE_NAME = tablespace_rec.tablespace_name';
    TYPE t_tableref IS REF CURSOR;
    t_tablecur t_tableref;
    begin
    for tablespace_rec in (select tablespace_name from dba_tablespaces)
    loop     
    -- Get the total space for the current tablespace
    -- if this FILEXT$ view exists then some of the datafiles have autoextend on;
              select count(*) into v_table_exist from dba_tables where table_name = 'FILEXT$';
              dbms_output.put_line('table count: ' || v_table_exist);               
              if v_table_exist = 0 then
                        OPEN t_tablecur for v_sql;
                        fetch t_tablecur into v_total_space;                         
                        CLOSE t_tablecur;     
              --     select sum(maxbytes) into v_total_space from dba_data_files
              --     where TABLESPACE_NAME = tablespace_rec.tablespace_name;               
              --      v_total_space := getMaxBytes(tablespace_rec.tablespace_name);
              end if;
              select sum(bytes) into v_space from dba_data_files
              where TABLESPACE_NAME = tablespace_rec.tablespace_name;          
         if (v_total_space = 0 or v_total_space < v_space) then
              select sum(bytes) into v_total_space from dba_data_files
              where TABLESPACE_NAME = tablespace_rec.tablespace_name;
              select sum(bytes) into v_free_space from dba_free_space
              where TABLESPACE_NAME = tablespace_rec.tablespace_name;
         else
              select sum(bytes) into v_free_space from dba_free_space
              where TABLESPACE_NAME = tablespace_rec.tablespace_name;
              v_space_used := v_space - v_free_space;
              v_free_space := v_total_space - v_space_used;          
         end if;
    -- calculate the percent free for the current tablespace
    v_pct_free := (v_free_space / v_total_space) * 100;
         if (v_pct_free < v_pct_threshold) then
         dbms_output.put_line(tablespace_rec.tablespace_name|| ' - Percent Free: ' || v_pct_free      
         ||'%');
         end if;
    end loop;
    end;
    spool off;

    Hi All
    I got a PL/SQL script to find out free space in Oracle7,8,9 db. But because in Oracle 7 there is no maxbytes column in dba_data_files, so this script is not working. I am trying to use cursor and putting sql in a variable so that when program executes, it does not see maxbytes. But it still does not work.
    Please help. !!!
    Script
    set feedback off;
    set serveroutput on;
    set termout off;
    set verify off;
    spool /u01/app/oracle/admin/common/bck/log/ts.log
    declare
    v_tablespace_name varchar2(50);
    v_total_space number(12) := 0;
    v_free_space number(12);
    v_space number(12);
    v_space_used number(12);
    v_pct_free number(6,3);
    v_pct_threshold number(3) := 2;
    v_table_exist number(2) := 0;
    v_sql varchar2(300) := 'select sum(maxbytes) from dba_data_files where TABLESPACE_NAME = tablespace_rec.tablespace_name';
    TYPE t_tableref IS REF CURSOR;
    t_tablecur t_tableref;
    begin
    for tablespace_rec in (select tablespace_name from dba_tablespaces)
    loop     
    -- Get the total space for the current tablespace
    -- if this FILEXT$ view exists then some of the datafiles have autoextend on;
              select count(*) into v_table_exist from dba_tables where table_name = 'FILEXT$';
              dbms_output.put_line('table count: ' || v_table_exist);               
              if v_table_exist = 0 then
                        OPEN t_tablecur for v_sql;
                        fetch t_tablecur into v_total_space;                         
                        CLOSE t_tablecur;     
              --     select sum(maxbytes) into v_total_space from dba_data_files
              --     where TABLESPACE_NAME = tablespace_rec.tablespace_name;               
              --      v_total_space := getMaxBytes(tablespace_rec.tablespace_name);
              end if;
              select sum(bytes) into v_space from dba_data_files
              where TABLESPACE_NAME = tablespace_rec.tablespace_name;          
         if (v_total_space = 0 or v_total_space < v_space) then
              select sum(bytes) into v_total_space from dba_data_files
              where TABLESPACE_NAME = tablespace_rec.tablespace_name;
              select sum(bytes) into v_free_space from dba_free_space
              where TABLESPACE_NAME = tablespace_rec.tablespace_name;
         else
              select sum(bytes) into v_free_space from dba_free_space
              where TABLESPACE_NAME = tablespace_rec.tablespace_name;
              v_space_used := v_space - v_free_space;
              v_free_space := v_total_space - v_space_used;          
         end if;
    -- calculate the percent free for the current tablespace
    v_pct_free := (v_free_space / v_total_space) * 100;
         if (v_pct_free < v_pct_threshold) then
         dbms_output.put_line(tablespace_rec.tablespace_name|| ' - Percent Free: ' || v_pct_free      
         ||'%');
         end if;
    end loop;
    end;
    spool off;

Maybe you are looking for

  • How to setup a (ui) class in a readable way ?

    I'm pretty new to java (and java's OO model) and i can't really think of a nice way to do this : I'm creating a UI, a JFrame which has a JTabbedPane (with 8 tabs) and each of these 8 tabs contains either a few listboxes or a pretty complex form (thin

  • Using JTA enabled connection in a JSP/servlet without transaction

    Can we use a JTA enabled connection in a JSP/servlet without any transaction? Thanks

  • Where is my iTunes Setup file?

    After clicking Save on the Download prompt, it just disappeared.  I can't find any downloaded file.  Multiple repeats on two different computers have the same result.  Have it been downloaded?  Where can I find it to click on to install iTunes?

  • No DLT Machine? Writing a DL project to 2 DVD-R discs as DDP images

    There is yet another way to get a DL project to the factory if you do not have a DLT machine, and do not have access to DL discs in the correct format. Write the DDP images to 2 single layer discs instead! This requires the use of GEAR Pro Mastering

  • Os x 10.5.8 to os x 6

    My wife's 2 year old macbook is on 10.5.8 and the software update does not find 10.6,i have downloaded 10.6.2 from the apple site but cant find 10.6 on there.When i try to open the package it says i need 10.6, what can i do?