Category: Every Day Tricks

How To free up Disk Space used by Oracle

The time comes when your Oracle database server has gobbled up a lot of space on the hard disk and you wonder why it still uses so much disk space after having deleted a lot of data from your tables. There is an easy way to shrink the size of Oracle’s tablespaces.

How much disk space can I save?

Simply execute the following statement to have a look at how much space your tablespaces currently occupy and how much space you could save. The statement provides you with the current size of each tablespace as well as the size you could shrink it to and the space you would save when shrinking it to that size:

select file_name,
ceil( (nvl(hwm,1)*8192)/1024/1024 ) SHRINK_TO,
ceil( blocks*8192/1024/1024) CURRENT_SIZE,
ceil( blocks*8192/1024/1024) -
ceil( (nvl(hwm,1)*8192)/1024/1024 ) SAVINGS
from dba_data_files a,
( select file_id, max(block_id+blocks-1) hwm
from dba_extents
group by file_id ) b
where a.file_id = b.file_id(+)

Save the space!

Then run the following statement to shrink a tablespace to a specified size.

alter database datafile '/path/to/data/file.dbf' resize 100m;


I found this very helpful hint at stackexchange:


Managing Multiple Eclipse-Workspaces with Shortcuts

Most of us are working on more than one project at once, each living in its own eclipse workspace. Eclipse supports this with the workspace feature and even provides a function to switch between workspaces. A not so commonly known function of eclipse is that it also supports command line arguments which make life a little easier if you have multiple workspaces. This way, you can create multiple shortcuts on your desktop, each starting the same eclipse installation with a different workspace. How to do this in an orderly fashion is described in the following.

Create ECLIPSE_HOME system property

First, create the system property ECLIPSE_HOME, pointing to the folder in which you have your eclipse version of choice installed. If you need more that one eclipse installation, simply create multiple system properties with different names. You can also skip this step completely but it makes the shortcuts we create later more robust.

Create JAVA_HOME system property

The JAVA_HOME system property should already be set on most systems. However, you should check that it points to a JDK and not to a JRE.

Create a shortcut for each workspace

Now, create a shortcut for each of your workspaces that you want to quick access for. In windows, create a .bat file in each workspace folder with the following content (in unix systems this can be created analogous):

"%ECLIPSE_HOME%\eclipse.exe" -vm "%JAVA_HOME%\bin" -data .

This shortcut will start the eclipse installed in ECLIPSE_HOME with the Java runtime lying in JAVA_HOME. Eclipse will start with the current folder (“.”) as workspace.


Having a quick access shortcut to each workspace like above saves some time switching between workspaces. You can play around with the eclipse command line parameters and add some more or change them. More command line parameters of eclipse can be found here.