How to free up space in Tablespace?

My SQL is quite decent but not perfect.
I'm using the following sql query to find out the tablespace's free space:
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) b
where a.tablespace_name(+)=b.tablespace_name;
I can see that one tablespace (custom made) is using up a lot of space so i want to free up some space. How can i do that?
I tried the following but still when running that query it still outputs the same:
- delete rows (tried using both delete & truncate commands) from schemas (tables) that belong to that tablespace
- drop unused schemas (tables) that belong to that tablespace
even tried disconnecting my session and reconnecting again but running that query still returns teh same results :s
Help much appreciated!
regards,
cheers

911802 wrote:
My SQL is quite decent but not perfect.
I'm using the following sql query to find out the tablespace's free space:
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) b
where a.tablespace_name(+)=b.tablespace_name;
I can see that one tablespace (custom made) is using up a lot of space so i want to free up some space. How can i do that?
I tried the following but still when running that query it still outputs the same:
- delete rows (tried using both delete & truncate commands) from schemas (tables) that belong to that tablespace
- drop unused schemas (tables) that belong to that tablespace
even tried disconnecting my session and reconnecting again but running that query still returns teh same results :s
Help much appreciated!
regards,
cheersOracle NEVER shrinks datafiles automagically.
You must do so manually.
http://www.lmgtfy.com/?q=oracle+shrink+datafile

Similar Messages

  • How can free + used space tbs size, can someone explain

    Hi Gurus
    Can someone explain this, How can free + used space in a tablespace can be greater than size of a tablespace. What am I missing here . Thanks a lot .
    I am on 10.2.0.1, HP-UX
    14:38:52 SQL> select owner,sum(bytes), sum(BYTES) /1024/1024 "MB" from dba_segments where tablespace
    name='USERDB1ADATA' group by owner;
    OWNER SUM(BYTES) MB
    USERDB1A 839680000 800.78125
    1 row selected.
    14:40:42 SQL> select bytes, BYTES /1024/1024 "MB" from dba_data_files where tablespace_name='USERDB1
    A_DATA';
    BYTES MB
    3758096384 3584
    1 row selected.
    14:40:42 SQL> select sum(bytes) , sum(BYTES) /1024/1024 "MB"from dba_free_space where tablespace_nam
    e='USERDB1A_DATA';
    SUM(BYTES) MB
    3067412480 2925.3125
    1 row selected.
    14:40:43 SQL> select 839680000 + 3067412480 "used + free space" from dual;
    used + free space
    3907092480
    1 row selected.
    New DBA

    Good point, Howard, about the recycle bin. So I cleaned up, recreated the table, filled it, dropped it but did not purge it, and ...
    SQL> create table test.x tablespace test as select * from dba_objects where 1=2;
    Table created.
    SQL> insert into test.x select * from dba_objects;
    12617 rows created.
    SQL> commit;
    Commit complete.
    SQL> drop table test.x;
    Table dropped.
    SQL> with
      2  dbf_size as (select sum(bytes) size_
      3                 from dba_data_files where tablespace_name='TEST'),
      4  dbf_free as (select sum(bytes) free_
      5                 from dba_free_space where tablespace_name='TEST'),
      6  dbf_used as (select sum(bytes) used_
      7                 from dba_segments where tablespace_name='TEST')
      8  select size_, free_, used_, (size_ - free_ - used_) left_
      9         from dbf_size, dbf_free, dbf_used
    10  /
         SIZE_      FREE_      USED_      LEFT_
       5242880    5177344    2162688   -2097152
    SQL>and then I played around with my SQL and came up with
    WITH
    dbf_size AS (SELECT SUM(bytes) size_
                   FROM dba_data_files
                  WHERE tablespace_name='TEST'),
    dbf_free AS (SELECT SUM(bytes) free_
                   FROM dba_free_space
                  WHERE tablespace_name='TEST'),
    dbf_used AS (SELECT SUM(bytes) used_
                   FROM dba_segments
                  WHERE tablespace_name='TEST'),
    dbf_fbin AS (SELECT SUM(bytes) fbin_
                   FROM dba_segments
                  INNER JOIN
                        dba_recyclebin
                     ON (tablespace_name=ts_name
                         AND segment_name=object_name)
                  WHERE tablespace_name='TEST')
    SELECT      size_, -- tablespace size
         free_, -- free space reported
         used_, -- segment space used
         fbin_, -- segment space in recycle bin
         (size_ - free_ - used_ + fbin_) left_ -- 64K overhead per data file
      FROM      dbf_size, dbf_free, dbf_used, dbf_fbin
    /which does
    SQL> WITH
      2  dbf_size AS (SELECT SUM(bytes) size_
      3                 FROM dba_data_files
      4                WHERE tablespace_name='TEST'),
      5  dbf_free AS (SELECT SUM(bytes) free_
      6                 FROM dba_free_space
      7                WHERE tablespace_name='TEST'),
      8  dbf_used AS (SELECT SUM(bytes) used_
      9                 FROM dba_segments
    10                WHERE tablespace_name='TEST'),
    11  dbf_fbin AS (SELECT SUM(bytes) fbin_
    12                 FROM dba_segments
    13                INNER JOIN
    14                      dba_recyclebin
    15                   ON (tablespace_name=ts_name
    16                       AND segment_name=object_name)
    17                WHERE tablespace_name='TEST')
    18  SELECT     size_,
    19     free_,
    20     used_,
    21     fbin_,
    22     (size_ - free_ - used_ + fbin_) left_
    23    FROM     dbf_size, dbf_free, dbf_used, dbf_fbin
    24  /
         SIZE_      FREE_      USED_      FBIN_      LEFT_
       5242880    5177344    2162688    2162688      65536
    SQL> alter tablespace test add datafile 'C:\ORACLE\ORADATA\XE\TEST2.DBF' size 5m;
    Tablespace altered.
    SQL> WITH
      2  dbf_size AS (SELECT SUM(bytes) size_
      3                 FROM dba_data_files
      4                WHERE tablespace_name='TEST'),
      5  dbf_free AS (SELECT SUM(bytes) free_
      6                 FROM dba_free_space
      7                WHERE tablespace_name='TEST'),
      8  dbf_used AS (SELECT SUM(bytes) used_
      9                 FROM dba_segments
    10                WHERE tablespace_name='TEST'),
    11  dbf_fbin AS (SELECT SUM(bytes) fbin_
    12                 FROM dba_segments
    13                INNER JOIN
    14                      dba_recyclebin
    15                   ON (tablespace_name=ts_name
    16                       AND segment_name=object_name)
    17                WHERE tablespace_name='TEST')
    18  SELECT     size_, -- tablespace size
    19     free_, -- free space reported
    20     used_, -- segment space used
    21     fbin_, -- segment space used in recycle bin
    22     (size_ - free_ - used_ + fbin_) left_
    23    FROM     dbf_size, dbf_free, dbf_used, dbf_fbin
    24  /
         SIZE_      FREE_      USED_      FBIN_      LEFT_
      10485760   10354688    2162688    2162688     131072Message was edited by:
    Hans Forbrich
    Cleaned up the script and tested with second data file added to verify LMT overhead.

  • How many free disk space after install OS X lion (10.7) ?

    Hi,
    I would like to know that how many free disk space after install OS X lion (10.7) on MBA i5.
    Many Thanks,
    Eric

    I want to buy MBA i5, I would like to free disk space of MBA 13" i5, Could anyone tell it to me? Thanks
    As you're buing a new MacBook Air, it will come pre-installed with Lion.  The actual installation will be somewhat larger than a "clean" Lion install as it will come with iLife preinstalled.  Obviously, with an Air's limited storage space, you want to be sure that you have enough room for any applications and data that you'll want to keep on the SSD as well.  It is fairly easy to upgrade the SSD on an Air:
    http://eshop.macsales.com/shop/SSD/OWC/Aura_Pro_Express
    The amount of RAM you have installed is probably more important.  Fortunately, the newest 13" MacBook Airs all come with 4GB standard now.

  • Ikeep getting a message that my start up disc is full and i don't know how to free up space..  also when i o to download some files i am told there is no space left to download     i bought this macbook pro used an receiver no discs..  what can i do??   t

    ikeep getting a message that my start up disc is full and i don't know how to free up space..  also when i o to download some files i am told there is no space left to download     i bought this macbook pro used an receiver no discs..  what can i do??  

    You need to purchase an external drive and start moving some files to it or you can try trashing some files that you no longer need.
    Download OmniDiskSweeper and see where your larger files are... you can move them to an external drive or trash them: it's up to you.
    I would also begin, since it's obviously don't have backups, a backup scheme or two. See Most commonly used backup methods.
    Good luck,
    Clinton

  • Apple TV (1st gen): how to free up space?

    how do i delete some of the content to free up space for new content?, Apple TV (1st gen) : how do i delete some of the content to free up space for new content?

    If you want more space or take certain things off then just manualy select what you want on it. I just check the shows I want on it the when I want them off I uncheck them and then resync he ATv to get them off etc.. Easy as pie....pi !
    As for the purchased items not going away, scroll down to make sure that playlist is not checked on the computer under movies or shows etc...

  • I've just upgraded to Lion and finder no longer shows how much free disk space I have left

    Hi I've just upgraded to Lion and when im now in finder i can no longer see how much free or used hard disk space i have. anyone know how to turn this back on?

    Hi Alan,
    I think you are looking for this:
    From the Finder, select View > Show Status Bar and like magic, your info is revealed like how it was with snow leopard at the bottom of the finder window.
    If you have the finder window at the bottom of your screen then it might be below the screen, just move the window up. That happened for me when I revealed it.
    Hope this helps.
    /svenskdod

  • How to free up space on internal hard drive

    How do I free up space on my internal hard disc?
    I have only about 40 gig of information on my macbook however it says I don't have space while I'm working on photoshop. I have deleted a lot of files on my mac that are already saved in my external hard disc but when I check my memory it says I have  only 1.3gig space available out of a 120gig memory. This data is distributed between audio, apps, movies, pictures and other. I don't understand what 'other' is and it says I have about 76gig worth of data in the other part. Please I would need help on how to delete files from this 'other'. Cheers!

    All Mac operating systems use any free space on your hard drive as virtual memory, and this virtual memory plays a part in how well your computer performs. Because of this, the more data you have on your hard drive, the less virtual memory becomes available. Therefore, in order to help increase your Mac boot time, and keep your computer running smoothly, periodically cleaning your hard drive is necessary. To clean it up you want to get rid of any old or unnecessary files. You can do this manually by removing unused applications, emptying your trash etc.,

  • HT3680 how to free up space if startup disk is full

    How do I free up space when the startup disk is full?

    O Trejo, greetings;
    I am not the Wizard but a mere citizen of Oz who wears green tinted glasses as all others do.
    DaisyDisk appears to perform a similar function as OmniDiskSweeper which I still prefer due probably due to my familiarity with it.
    I am not familiar with OSX Server, so I am off the hook on this one.  If you go to the OSX Server forum, there will be forum members who will be able to address your query.  This is the link:
    https://discussions.apple.com/community/servers_enterprise_software/os_x_server
    If you are really nice to them, they may give you a Dog Yummy. 
    Ciao.

  • What is "other" on iphone sync? How to free up space?

    Upgraded to Lion, iOS5, and cloud. Now I can't sync iPhone. Half the space is "other". How can I free up the space?

    Other is the iPhone operating system. Free up space by moving pictures and music off the phone to the computer.

  • Md1500h how to free up space

    I have a SimpleSave md1500h back-up hard drive that is getting full.  I suspect it is copying my harddrive in total.  I am afraid I need more room on it.  How do I free up space on it?  Can I simply Control A, Delete?  I have looked in the manual and there is nothing that addresses this situation.  Thanks for any help and suggestions.

    The manual (and a pot of coffee) sometimes is better than an assumption.   It's not copying the entire hard drive.
    From page # 1:    Note: HP SimpleSave does NOT back up your operating system or applications.
    I would suggest you explore the md1500h hard drive, as it's likley it has created (with you help) backups based on several separate dates. You can read my previous reply (here). It details links to re-fresh the drive.
    I am a volunteer. I am not an HP employee.
    To say THANK YOU, press the "thumbs up symbol" to render a KUDO. Please click Accept as Solution, if your problem is solved. You can render both Solution and KUDO.
    The Law of Effect states that positive reinforcement increases the probability of a behavior being repeated. (B.F.Skinner). You toss me KUDO and/or Solution, and I perform better.
    (2) HP DV7t i7 3160QM 2.3Ghz 8GB
    HP m9200t E8400,Win7 Pro 32 bit. 4GB RAM, ASUS 550Ti 2GB, Rosewill 630W. 1T HD SATA 3Gb/s
    Custom Asus P8P67, I7-2600k, 16GB RAM, WIN7 Pro 64bit, EVGA GTX660 2GB, 750W OCZ, 1T HD SATA 6Gb/s
    Custom Asus P8Z77, I7-3770k, 16GB RAM, WIN7 Pro 64bit, EVGA GTX670 2GB, 750W OCZ, 1T HD SATA 6Gb/s
    Both Customs use Rosewill Blackhawk case.
    Printer -- HP OfficeJet Pro 8600 Plus

  • How to free up space on my mac

    hi all,
    i've a macbbok air with 128gb flash storage{2013}.i needed to free up space, so i made a backup on a seagate harddrive connected to my airport extreme. after the backup was successfully done, I moved a previously downloaded large file{45gb} to trash,and then emptied trash.

    See here for answer about “OTHER” taking up space and how to free up unwanted space being taken up:
    http://pondini.org/TM/30.html
    and here:
    http://pondini.org/OSX/DiskSpace.html  

  • How to free up space on Macbook air

    How can I free up space on my Macbook Air? I can't seem to find any large files that I can delete

    keep large media files OFF your Air unless you know you need them.
    NO computer is a data storage device, especially for static files (large one most certain) just sitting there on the computer "collecting dust"
    In the case of a Macbook Air or Macbook Pro Retina with ‘limited’ storage on the SSD, this distinction becomes more important in that in an ever rapidly increasing file-size world, you keep vital large media files, pics, video, PDF collections, music off your SSD and archived on external storage, for sake of the necessary room for your system to have free space to operate, store future applications and general workspace.  You should never be put in the position of considering “deleting things” on your macbook SSD in order to ‘make space’.
    Professionals who create and import very large amounts of data have almost no change in the available space on their computers internal HD because they are constantly archiving data to arrays of external or networked HD.
    Or in the case of the consumer this means you keep folders for large imported or created data and you ritually offload and archive this data for safekeeping, not only to safeguard the data in case your macbook has a HD crash, or gets stolen, but importantly in keeping the ‘breathing room’ open for your computer to operate, expand, create files, add applications, for your APPS to create temp files, and for general operation.

  • How do I see how much free disk space I have?

    I just upgraded my OS from Snow Lepeord to Mountain Lion. When I had the finder window open, it always told me at the bottom how many files and how much disk space was being used in that folder. Additionally, it told me how much free space I had on my hard drive. After the upgrade, it no longer does that. Did Apple get rid of this or is there an option I need to turn on? I looked around and couldn't find i

    Well, you should see something like this:
    If you don't then try this:
    Repair the Hard Drive and Permissions - Lion
    Boot to the Recovery HD:
    Restart the computer and after the chime press and hold down the COMMAND and R keys until the menu screen appears. Alternatively, restart the computer and after the chime press and hold down the OPTION key until the boot manager screen appears. Select the Recovery HD and click on the downward pointing arrow button.
    Repair
    When the recovery menu appears select Disk Utility. After DU loads select your hard drive entry (mfgr.'s ID and drive size) from the the left side list.  In the DU status area you will see an entry for the S.M.A.R.T. status of the hard drive.  If it does not say "Verified" then the hard drive is failing or failed. (SMART status is not reported on external Firewire or USB drives.) If the drive is "Verified" then select your OS X volume from the list on the left (sub-entry below the drive entry,) click on the First Aid tab, then click on the Repair Disk button. If DU reports any errors that have been fixed, then re-run Repair Disk until no errors are reported. If no errors are reported then click on the Repair Permissions button. When the process is completed, then quit DU and return to the main menu. Select Restart from the Apple menu.
    If this doesn't work then reinstall:
    Reinstalling Lion/Mountain Lion Without Erasing the Drive
    Boot to the Recovery HD: Restart the computer and after the chime press and hold down the COMMAND and R keys until the menu screen appears. Alternatively, restart the computer and after the chime press and hold down the OPTION key until the boot manager screen appears. Select the Recovery HD and click on the downward pointing arrow button.
    Repair the Hard Drive and Permissions: Upon startup select Disk Utility from the main menu. Repair the Hard Drive and Permissions as follows.
    When the recovery menu appears select Disk Utility. After DU loads select your hard drive entry (mfgr.'s ID and drive size) from the the left side list.  In the DU status area you will see an entry for the S.M.A.R.T. status of the hard drive.  If it does not say "Verified" then the hard drive is failing or failed. (SMART status is not reported on external Firewire or USB drives.) If the drive is "Verified" then select your OS X volume from the list on the left (sub-entry below the drive entry,) click on the First Aid tab, then click on the Repair Disk button. If DU reports any errors that have been fixed, then re-run Repair Disk until no errors are reported. If no errors are reported click on the Repair Permissions button. Wait until the operation completes, then quit DU and return to the main menu.
    Reinstall Lion/Mountain Lion: Select Reinstall Lion/Mountain Lion and click on the Continue button.
    Note: You will need an active Internet connection. I suggest using Ethernet if possible because it is three times faster than wireless.

  • How much free disk space after setup

    I am just about to purchase a macbook and I am trying to find out how much disk space I can expect to have free.
    I was thinking of getting the 80gb model but I also have a 40gb ipod which is two thirds full.
    How much free space can I expect or should I go for the 120gb HD model?

    To give you an indication, my System and Library folders add up to around 12GB and my Applications folder is around 10GB.
    While these aren't small they are rather typical as it includes the standard Mac OS X installation, full iLife 06, Adobe CS2, Microsoft Office v.X, Macromedia Studio MX plus a few other things. So you can realistically count on anything from 20 to 30GB for the OS and software. Yes you can obviously get less than that by optimising your installations. From there it's just how much data you have and what sort of data you use.
    For most average users 60GB is plenty. If you do anything with video, have a large music library (mine is 10GB) and play games then obviously these will afftect your drive choice.
    If price is not an issue then go for a 120GB drive, Apple or 3rd party. For cost effectiveness the best choice is an Apple upgrade to 80GB.

  • HT2106 I downloaded my itunes library to my iphone 4S and now I am almost up to capacity.  Any suggestions on how to free up space without deleting the itunes library?  I also just backed up my phone to iCloud

    How do I free up space on my iphone 4S?

    Drag it from the Music item of the Finder's sidebar to an external drive, launch iTunes with the Option key held down, and point it there.
    (59635)

Maybe you are looking for

  • Help me to do this "IMAQ"-1

    Dear friends Please go through this vi this vi it will display a image window when u click inside that window a square box will create, where ever u click it will create multiple box. i used imaq windraw function, u can see another image window in th

  • Printing from a Mac with OS X Mavericks to a printer on Windows Network

    I am having trouble printing to a espon WP4530 that is connected via USB to a windows PC running XP on a wireless network I see the printer - to add it over the wireless network (Add Printer - under the windows tab), but nothing prints when I select

  • Platform problem

    My class and I are having some problems with the java sdk1.4.1. I have it install on a win 98 SE, two of my class mates have it installed on win XP, and it works fine on both. we now have it installed on win 2000. Can someone please tell me why this

  • Permission problem while the install of printer's driver

    Guys, when i'm installing the driver (lpr and cupswrapper) of my brother, happening a thing. Report the error: [black@arch bin]$ sudo dpkg -i --force-all dcpj315wlpr-1.1.3-1.i386.debdpkg: warning: overriding problem because --force enabled: package a

  • Superseeded Dynamic Stamp

    Hi there, I'm having a problem with Acrobat 9 Pro and Win 7 Dynamic Stamps. I'm an IT technician and I'm trying to help a client wich uses Adobe 9 Pro and Stamps...Dynamic ones. Because we live and work in Portugal, I had to use the next string, in o