Home » Oracle Code

Tablespaces with autoextend parameter

23 November 2009 765 views No Comment

Some tablespaces can be autoextensible, in this case, when necessary, Oracle automatically allocate new space for the tablespace; so you have not to add space to tablespaces. Use this query to see list of tablespaces with used and free space and to see if each tablespace is autoextensible:

SELECT
  a.file_id,
  a.tablespace_name,
  trunc(decode(a.autoextensible,'YES',a.maxsize-a.bytes+b.free,'NO',b.free)/1024/1024) free_mb,
  trunc(a.bytes/1024/1024) size_mb,
  trunc(a.maxsize/1024/1024) maxsize_mb,
  a.autoextensible ae,
  trunc(decode(a.autoextensible,'YES',(a.maxsize-a.bytes+b.free)/a.maxsize*100,'NO',b.free/a.maxsize*100)) free_pct
FROM
  (SELECT
     file_id,
     tablespace_name,
     autoextensible,
     bytes,
     decode(autoextensible,'YES',maxbytes,bytes) maxsize
   FROM dba_data_files
   GROUP BY file_id, tablespace_name, autoextensible, bytes,
     decode(autoextensible,'YES',maxbytes,bytes)
  ) a
  RIGHT OUTER JOIN
  (SELECT
    file_id,
    tablespace_name,
    sum(bytes) free
   FROM dba_free_space
   GROUP BY file_id, tablespace_name
  ) b
  ON (a.file_id=b.file_id AND a.tablespace_name=b.tablespace_name)
ORDER BY a.tablespace_name ASC;
Google : Tablespaces with autoextend parameter
Google Search: Tablespaces with autoextend parameter
DB Error Code: Tablespaces with autoextend parameter

Leave your response!

Add your comment below, or trackback from your own site. You can also subscribe to these comments via RSS.

Be nice. Keep it clean. Stay on topic. No spam.

You can use these tags:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

This is a Gravatar-enabled weblog. To get your own globally-recognized-avatar, please register at Gravatar.