Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.



Published on

oracle foreign key primary key constraints performance tuning MTS IOT 9i block size backup rman corrupted column drop rename recovery controlfile backup clone architecture database archives export dump dmp duplicate rows extents segments fragmentation hot cold blobs migration tablespace locally managed redo undo new features rollback ora-1555 shrink free space user password link TNS tnsnames.ora listener java shutdown sequence

  • Be the first to comment

  • Be the first to like this


  1. 1. Free Space in a Tablespace Administration TipsFinding the amount of used and free space in a TablespaceThe following bit of SQL will do the trick:SELECT TABLESPACE_NAME,ROUND(SUM(TOTAL_MB)-SUM(FREE_MB)) MB_USED,ROUND(SUM(TOTAL_MB)) MB_SIZE,ROUND((SUM(TOTAL_MB)-SUM(FREE_MB))/SUM(TOTAL_MB)*100) PCT_FULL,ROUND(SUM(MAX_MB) - (SUM(TOTAL_MB)-SUM(FREE_MB))) MB_FREE,ROUND(SUM(MAX_MB)) MB_MAXSIZE,ROUND((SUM(TOTAL_MB)-SUM(FREE_MB))/SUM(MAX_MB)*100) PCT_UTILFROM(SELECT TABLESPACE_NAME,SUM(BYTES)/1024/1024 FREE_MB,0 TOTAL_MB,0 MAX_MBFROM DBA_FREE_SPACE GROUP BY TABLESPACE_NAMEUNIONSELECT TABLESPACE_NAME,0 CURRENT_MB,SUM(BYTES)/1024/1024 TOTAL_MB,SUM(DECODE(MAXBYTES, 0, BYTES, MAXBYTES))/1024/1024 MAX_MBFROM DBA_DATA_FILES GROUP BY TABLESPACE_NAME)GROUP BY TABLESPACE_NAME;Youll get a report that looks a bit like this:TABLESPACE_NAME MB_USED MB_SIZE PCT_FULL MB_FREE MB_MAXSIZE PCT_UTIL--------------- ---------- ---------- ---------- ---------- ---------- ----------INDX 0 25 0 16384 16384 0SYSTEM 87 325 27 16297 16384 1UNDOTBS 1 200 1 16383 16384 0USERS 0 25 0 16384 16384 0The various columns can be explained thus:MB_USED: Total amount of space currently in use within a tablespaceMB_SIZE: Total size of the tablespace, adding up the physical sizes of all datafilesPCT_FULL: Used divided by Size, expressed as a percentageMB_FREE: Total amount of tablespace still sitting there emptyMB_MAXSIZE: This shows how big the tablespace can become. Often this will be the same as the MB_SIZE column -but not if youve switched on autoextend, in which case this column will show the maxsize parameterPCT_UTIL: Size divided by Maxsize expressed as a percentageIn other words, PCT_FULL shows you what percentage of what youve currently got is beingused, whereas PCT_UTIL shows what percentage of the maximum you could possibly *oneday* have is being used. Personally, I wouldnt touch autoextend with a barge pole, and Idbe looking to resize or add extra datafiles when the PCT_FULL column is reaching aroundthe 75 - 80% mark.Copyright © Howard Rogers 2001 10/17/2001 Page 1 of 1