Reduce datafiles size

hello please guide me
how i can find out what unused space is in tablespaces or datafiles
and how i can delete unused space for reduce datafiles size
thank you

This topic was discussed some yesterday. Take a look at the thread below to see if contains what you are looking for.
Reclaim undused space

Similar Messages

  • Reducing datafile size

    Hi guys,
    I have one tablespace with 6 datafiles. each datafile has 5GB size, but only 2 GB is being used.
    So I really need to reduce this datafile size to 3GB each.
    unfortunatelly, when I try to reduce the datafile I get the following message :
    ORA-03297: file contains used data beyond requested RESIZE value
    How can I see wich schema and tables are being used in the end of the datafile ? So I´ll be able to move it and reduce the datafile size.
    Thank you in advance,
    Felipe

    Below query can help you to show how much you cna reduce the datafile, without
    move / rebuild command
    column "File Name" format a45
    column "Tablespace Name" format a25
    select ff.file_id "File Id", ff.file_name "File Name",
    ff.tablespace_name || ' (' || ff.block_size || ')' "Tablespace Name",
    ceil (ff.blocks * ff.block_size / 1024 / 1024) "Current(MB)",
    ceil (nvl(max_hwm.hwm,1) * ff.block_size / 1024 / 1024) "Smallest(MB)",
    ceil ( ((ff.blocks * ff.block_size) - (nvl(max_hwm.hwm,1) * ff.block_size)) / 1024 / 1024) "Save(MB)"
    from (select file_id, file_name, blocks,ts.tablespace_name tablespace_name, ts.block_size block_size
    from dba_data_files f, dba_tablespaces ts
    where f.tablespace_name = ts.tablespace_name) ff,
    (select file_id, max(block_id + blocks - 1) hwm
    from dba_extents
    group by file_id) max_hwm
    where ff.file_id = max_hwm.file_id(+)
    order by ceil ( ((ff.blocks * ff.block_size) - (nvl(max_hwm.hwm,1) * ff.block_size)) / 1024 / 1024)
    You can modify the query to show the objects located beyond 3GB.
    Best Regards
    Krystian Zieja / mob

  • Can we reduce datafile size for tablespce ??

    Hi,
    I have two tablespace with 8GB datafile ..
    Used of datafile size is 750 MB for each datafile ...
    Can we reduce a datafile size from 8GB to 2GB !
    while it is use to store data around 750 MB data ..
    If it allow will impcat on my data ???
    SSM

    If used amount is 750MB then yes you can resize to 2G.
    Try issueing the following (example)
    SQL> alter database datafile 'c:\oracle\ora92\ORCL\userdata01.dbf' resize 2000m;
    If it is not possible, oracle will complain with error number ORA-03297.

  • Why datafile size not reduced ?

    Hi,
    I do not see the datafile size reduced after I drop tables in the tablespace of that datafile although the free table space reduced.
    Question:
    How to reduce the datafile without using alter datafile resize?
    James.

    I tried the exact proceedure you suggest and get exactly the same effect I mentioned previously. With this recent test all saves were  with the save options Layers box checked.  Here are the file size results.  The only difference in size, as expected, is from the compatibility setting.
    Header 1
    Both layers visible
    No layers visible
    Compatibility  Max
    32.3
    21.8
    Compatibility  Off
    21.8
    21.8
    Paulo

  • How to shrink the system tablespace datafile Size

    iam using oracle 9i R2 and i want to reduce my datafile size but it's show's that error when i try to resize it. ORA-03297

    Hi,
    We can directly resize datafilesTEST.SQL>SELECT FILE_NAME, BYTES FROM DBA_DATA_FILES WHERE TABLESPACE_NAME='SYSTEM';
    FILE_NAME
         BYTES
    /.../dbsGNX.dbf
    419430400
    TEST.SQL>ALTER DATABASE DATAFILE '/.../dbsGNX.dbf' RESIZE 390M;
    Database altered.
    TEST.SQL>SELECT FILE_NAME, BYTES FROM DBA_DATA_FILES WHERE TABLESPACE_NAME='SYSTEM';
    FILE_NAME
         BYTES
    /.../dbsGNX.dbf
    408944640But the minimum file size is the size of the extend the furthest in the datafile:TEST.SQL>SELECT FILE_ID,FILE_NAME FROM DBA_DATA_FILES WHERE TABLESPACE_NAME='SYSTEM';
       FILE_ID
    FILE_NAME
             1
    /.../dbsGNX.dbf
    TEST.SQL>SELECT MAX(BLOCK_ID) MBID FROM DBA_EXTENTS WHERE FILE_ID=1;
          MBID
         25129
    TEST.SQL>SELECT SEGMENT_NAME,OWNER,SEGMENT_TYPE FROM DBA_EXTENTS WHERE FILE_ID=1 AND BLOCK_ID=25129;
    SEGMENT_NAME                                                                      OWNER                          SEGMENT_TYPE
    I_OBJAUTH2                                                                        SYS                            INDEX
    TEST.SQL>SHOW PARAMETER BLOCK_SIZE
    NAME                                 TYPE                             VALUE
    db_block_size                        integer                          8192
    TEST.SQL>SELECT 8192*25129 FROM DUAL;
    8192*25129
    205856768about 200M.
    Regards,
    Yoann.

  • How to reduce the size of Temporary Tablespace - URGENT

    Hi all,
    I need your help urgently. I have one Default Temporary Tablespace TEMP in my Oracle 9i database. There are two files in the tablespace each of size 32GB. I need to reduce the size or if possible i need to remove on datafile from the tablespace.
    Could you please provide me with the solution of this?
    This is really very urgent.
    Thanks in advance
    Himanshu

    Add a new temporary tablespace.
    Set this to default database temp tablespace.
    Then you can drop the old TS when all the pending transactions are complete if they are using temp space.
    Also, you need to investigate as to why your temp tablespace files were 32 GB in size. Looks like your application is doing too much sorting.

  • Want to reduce the size of database

    Hi Guys,
    We have Oracle 10G database over Unix platform, Customer want to reduce the size of database as much as possible and the ami of customer to move the storage area of this database to other one. so we resize some datafiles and get lots of free space at mount point but while checking the utilzation of table is showing somw what different as other . kindly the below O/P:
                                                                                        %                         MaxPoss    Max
    Tablespace Name                         KBytes            Used            Free   Used         Largest          Kbytes   Used
    *a DATA                             45,875,200       8,740,992      37,134,208   19.1       1,728,512     100,663,248   45.6
    *a HIGH_S_DATA                      21,504,000       1,331,520      20,172,480    6.2       3,048,704               0     .0
    *a HIGH_S_IND                       15,360,000         853,568      14,506,432    5.6       1,661,504               0     .0
    *a IND_DATA                         57,241,600       3,512,832      53,728,768    6.1       3,995,648     100,663,248   56.9
    *a LOW_S_DATA                      357,376,000      28,436,736     328,939,264    8.0       4,063,232     167,772,080  213.0
    *a LOW_S_IND                       268,902,400      12,148,352     256,754,048    4.5       4,063,232      67,108,832  400.7
    *a SYSAUX                            1,433,600         897,152         536,448   62.6         485,312      33,554,416    4.3
    *a UNPARSED_DATA                       102,400             128         102,272     .1         102,272               0     .0
    *a USERS                             4,096,000              64       4,095,936     .0       4,063,232      33,554,416   12.2
    *m SYSTEM                            1,433,600         835,520         598,080   58.3         597,952      33,554,416    4.3
    *m TEMP                             54,033,408      54,033,408               0  100.0               0      33,554,416  161.0
    *m UNDOTBS1                         37,650,416         426,416      37,224,000    1.1       4,063,232      33,554,416  112.2
    sum                                865,008,624     111,216,688     753,791,936
    SQL> select sum(bytes/1024/1024/1024) from dba_segments;
    SUM(BYTES/1024/1024/1024)
                   54.5392456
    SQL> select sum(bytes/1024/1024/1024) from dba_data_files;
    SUM(BYTES/1024/1024/1024)
                   773.406235above all o/p is different, no able to understand it. please help me in this .
    Could you please tell me is there any way to reset the HWM at Datafile level and how we reset the HWM of those tables having Materlized view?

    Hello,
    I'm not really sure what is the problem here? Everything seems to be OK. From what I have seen ,your database can stand to be resized down quite a bit.
    The actual amount it can be resized down depends on the highet HWM for the segments in the datafile, as in:
    set line 200col file_name format a90
    select file_name,
    ceil( (nvl(hwm,1)*&&blksize)/1024/1024 ) USED_SPACE,
    ceil( blocks*&&blksize/1024/1024) SIZE,
    ceil( blocks*&&blksize/1024/1024) -
    ceil( (nvl(hwm,1)*&&blksize)/1024/1024 ) ECONOMY --how much of the space can be reclaimed
    from dba_data_files a,
    ( select file_id, max(block_id+blocks-1) hwm -- here we get the max hwm for the datafile from the extents residing within it
    from dba_extents
    group by file_id ) b
    where a.file_id = b.file_id(+)
    and ceil( blocks*&&blksize/1024/1024) -
    ceil( (nvl(hwm,1)*&&blksize)/1024/1024 ) > 2000
    >
    You can also do a reorganization of the segment you suspect has a high degree of reclaimable space within its extents (high HWM and low actual space used). You can run segment advisor to help with that.
    Hope it helps,

  • How to reduce the size of exising tablespace?

    Hi,
    I assigned 2GB dbsize to a tablespace.
    Now I would like to reduce the table space to 1GB.
    The tablespace used is 60MB.
    When I try to reduce the size to 1GB its showing a message as follows.
    "ORA-03297: file contains used data beyond requested RESIZE value".
    Even I truncated all the data from all tables to which this table space is allocated. However, its not allowing me to resize it.
    How can I do this? Is there any other way to do this?
    Thank you,
    Regards,
    Gowtham Sen.

    You may not be able to reduce the size of your datafile just by truncating tables. It does not matter if it is 9i or 10g. TRUNCATE just resets the high watermark of your tables, it leaves the first extent in place. So if you have tables whose first extents reside in the last part of a datafile you cannot resize it below that level.
    See this:
    SQL> create tablespace test2 datafile size 10m autoextend off;
    Tablespace created.
    SQL> create table t1 tablespace test2 as select * from all_objects;
    Table created.
    SQL> insert into t1 select * from t1;
    insert into t1 select * from t1
    ERROR at line 1:
    ORA-01653: unable to extend table YAS.T1 by 128 in tablespace TEST2
    SQL> create table t2(a number) tablespace test2;
    Table created.
    SQL> r
      1  select segment_name,file_id,block_id,blocks from dba_Extents
      2* where TABLESPACE_NAME='TEST2'
    SEGMENT_NA    FILE_ID   BLOCK_ID     BLOCKS
    T1                  9          9          8
    T1                  9         17          8
    T1                  9         25          8
    T1                  9         33          8
    T1                  9         41          8
    T1                  9         49          8
    T1                  9         57          8
    T1                  9         65          8
    T1                  9         73          8
    T1                  9         81          8
    T1                  9         89          8
    SEGMENT_NA    FILE_ID   BLOCK_ID     BLOCKS
    T1                  9         97          8
    T1                  9        105          8
    T1                  9        113          8
    T1                  9        121          8
    T1                  9        129          8
    T1                  9        137        128
    T1                  9        265        128
    T1                  9        393        128
    T1                  9        521        128
    T1                  9        649        128
    T1                  9        777        128
    SEGMENT_NA    FILE_ID   BLOCK_ID     BLOCKS
    T1                  9        905        128
    T1                  9       1033        128
    T2                  9       1161          8As you can see we now have an extent in block 1161 of this datafile.
    Let's try to resize it to half.
    SQL> select file_name from dba_data_files
      2  where TABLESPACE_NAME='TEST2';
    FILE_NAME
    /disk1/oradata/10G/datafile/o1_mf_test2_3qpzcz0z_.dbf
    SQL> alter database datafile '/disk1/oradata/10G/datafile/o1_mf_test2_3qpzcz0z_.dbf' resize 5m;
    alter database datafile '/disk1/oradata/10G/datafile/o1_mf_test2_3qpzcz0z_.dbf' resize 5m
    ERROR at line 1:
    ORA-03297: file contains used data beyond requested RESIZE valueTruncate the tables and try again.
    SQL> truncate table t1;
    Table truncated.
    SQL> truncate table t2;
    Table truncated.
    SQL> alter database datafile '/disk1/oradata/10G/datafile/o1_mf_test2_3qpzcz0z_.dbf' resize 5m;
    alter database datafile '/disk1/oradata/10G/datafile/o1_mf_test2_3qpzcz0z_.dbf' resize 5m
    ERROR at line 1:
    ORA-03297: file contains used data beyond requested RESIZE valueThe reason is:
    SQL> r
      1  select segment_name,file_id,block_id,blocks from dba_Extents
      2* where TABLESPACE_NAME='TEST2'
    SEGMENT_NA    FILE_ID   BLOCK_ID     BLOCKS
    T1                  9          9          8
    T2                  9       1161          8We have an extent at block 1161. Because of that we cannot reduce the size to 5M.
    Let's move the table and try again.
    SQL> alter table t2 move tablespace test2;
    Table altered.
    SQL> r
      1  select segment_name,file_id,block_id,blocks from dba_Extents
      2* where TABLESPACE_NAME='TEST2'
    SEGMENT_NA    FILE_ID   BLOCK_ID     BLOCKS
    T1                  9          9          8
    T2                  9         17          8
    SQL> alter database datafile '/disk1/oradata/10G/datafile/o1_mf_test2_3qpzcz0z_.dbf' resize 5m;
    Database altered.Message was edited by:
    Yas

  • How to reduce the size of datatop.

    Hello Experts,
    I need to reduce the size of datatop as I have space concern on filesystem.
    O.S. :- SunOS 5.10
    Database :-Enterprise Edition Release 11.2.0.2.0
    Regard
    Rahul

    Hi Rahul
    Move some datafiles on different mount point and update the controlfiles . Check the below link for moving the datafiles .
    http://www.oracle-base.com/articles/misc/renaming-or-moving-oracle-files.php
    --neeraj                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Reducing undotbs size

    hi,
    i need to reduce the size of undotbs.
    what are the steps?
    here is the property of my undotbs.
    plz advice.
    Tablespace Name     FREE_SPACE USED_SPACE     TOTAL_SPACE
    UNDOTBS1     32480(mb) 288(mb)     32768(mb)

    hi bon,
    you can resize the datafile to reduce the undotbs tablespace. make sure the datafile is having autoextend on for future growth. suggest you to go for optimal sizing for UNDO.
    ## Bhupi nice to see you here ###
    Thanks
    --Raman                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Reducing datafiles/tablespace after moving several tables out

    I have moved several large tables from one tablespace to another. The original one now shows about 50% used, from 88%.
    Of course, I would like to reclaim the 38% of the tablespace in terms of disc space.
    We use 1025M datafiles within each tablespace but I appreciate Oracle spreads data across them, so it's unlikely any one datafile is even empty.
    However, is there a way to "shrink" the tablespace so that we can resize it more appropriately (so it's nearer 80% used not 50%) ?
    Thanks

    Hi,
    To fully reduce the size of the tablespace to 50%, you will need to move the rest of the tables also to some other tablespace and shrink the datafiles and then move back those tables to this tablespace. This is the only option.
    Otherwise, you can try to shrink each of the datafile to the extent possible. May be, you will be able to claim back 1 to 38%.
    HTH
    Regards,
    Badri.

  • How do I reduce the size of photos to use on website?

    Thanks to the helpful person who recommended I use Rapidweaver to build a website, I am slowly getting somewhere. It is so simple and just like Apple applications that I think I can do this.
    My problem now is that when I tried to transfer a photo from iPhoto to the draft website page it comes across so large it fills the page.
    How do I reduce the size of photos so that I can bring them across? I need to show about 20 photos on the web pages. Do they need to be in a different format and if so how do I change it to the appropriate one?
    Many thanks.
    ibook   Mac OS X (10.3.9)  

    Hi Casuarina,
    Go to this site and click on the Desktop Version Quicktime movie for a small tutorial. It will explain everything to you and you can see how you resize right within Rapid Weaver. It's really quite nifty.
    http://donmc.libsyn.com/index.php?post_id=37133
    Lori

  • How can I print a pdf doc of size A3 (one page only) on A4 (on one page) front and back (actual size duplex printing) without reducing the size?

    The printing should come of actual size half on front and half on back of A4 paper.

    Hi Fakhar,
    That is not possible without reducing the size. It cant be possible at all.
    Regards,
    Ajlan Huda.

  • How do I reduce the size of a graphic in Preview and maintain resolution?

    Preview 6.0.1
    Hi,
    I have a graphic in Preview. The largest file is a .jpg at 77 KB. Information about the graphic is in the attached "Adjust Size ScreenPreview Galleon 77.
    I find that when I reduce the size of the file using Previews menu bar functions that I usually use — Screenshot>Zoom reduce>Select the smaller picture>Screenshot — that the result is an image that has lost the focus, the resolution of the original graphic.
    How do I reduce the size of a graphic and maintain resolution? I've never used the Adjust Size Screen functions.
    I'm not stuck on having to use Preview to accomplish this, but I do use Preview a lot.
    Thanks,
    Rafael
    KB.jpg".

    Choose a smaller width, the height will adjust appropriately, and the resolution will stay the same.

  • When i use pogo, on the risk game for instance, when i click on a game room, a window pops up and immdediately reduces in size, this size only shows part of the battle screen; i have tried resetting the zoom feature, no luck.

    i have seen this before on my home PC (on a lap top now) it is impossible for me to correct so i have to use IE to play pogo (i dont like IE it is slower) i click on a game, i go to a game room, and a window normally pops up showing the tables. normally i click on a seat and it takes me to a new window and the game board. NOW, when this first window pops up, it is aboout 1/4 size of my screen, but immediately reduces in size to about 1/6 of my screen. wnen the game loads, i cannot view the whole screen only part of the screen, as if it is zoomed in. I tried your suggestion and reset the zoom, no help.... i changed the zoom level manally.... no help.
    this also happens in scrabble and most other games. it is related to the java i am sure, but it only happens on firefox. How do i correct this. I have uninstalled, and reinstalled firefox. i have had this happen on the older version of firefox. it happens on multiple computers so it isnt just one computer.
    HELP!!!!!
    please

    I should have explained further. The game opens in a new window over to the upper left of my screen, leaving the original page underneath. I tried minimizing it so that I could get to my toolbar and did the View > Zoom > Reset. This has no effect. The lower portion of the game is still not showing. Using other browsers the window or frame of the game is much larger, therefore everything shows.

Maybe you are looking for

  • Some web-sites won't let me in, or send me in loops.

    I hope this is the correct place to post this question. I have developed a problem with some web-sites that won't let me in. They used to, and I don't really know when the problems started, and it is only some sites. Most are well-behaved, and the sa

  • PLS files as web links won't open in ITunes; still say Winamp

                                                                                                                   Hello.  I apologize if this has been answered, but I searched to the best of my ability, and none of the answers I saw applied to this ques

  • Open QT window in middle of screen?

    I want quicktime movies to stop opening in the far left uppermost corner of my monitor. I have a 32 inch screen and always have to drag it to a more coomfortable viewing area. Somoen told me to use applescript but I can't get this to work. Besides, I

  • Drop-Down, what else can be inserted other than text

    Hello, I have a requirement, where I need to insert Group UI Element (this will show the details of what ever I select on the table row). Is it possible?. So that the pop-up wont occupy any space, and it will be closed if I move away from the drop-do

  • Problem with Task Aggregation from Project Server with old Project Server permissions mode.

    Hi, I have installed Sharepoint 2013 with all CU, and Project Server 2013 with June CU update. Later, I attached database from old Project Server 2010 database, all was OK, but now I have my PWA with old Project Server permissions mode. After that I