Wednesday, October 5, 2011

Create tablespace in Oracle

Permanent tablespace

create tablespace ts_something
logging
datafile '/dbf1/ts_sth.dbf'
size 32m
autoextend on
next 32m maxsize 2048m
extent management local;


create tablespace data datafile ' /u01/app/oracle/oradata/my/data.dbf'
size   10M
autoextend on maxsize      200M
extent management local uniform size  64K;


Temporary tablespace

create temporary tablespace temp_mtr
  tempfile '/dbf1/mtr_temp01.dbf'
  size 32m
  autoextend on
  next 32m maxsize 2048m
  extent management local;


Undo tablespace

create undo tablespace ts_undo
datafile '/dbf/undo.dbf'
size 100M;



Also more than one datafile can be created with a single create tablespace command:

create tablespace mytbs
  datafile ' /u01/app/oracle/oradata/my/mytbs _01.dbf' size 4M autoextend off,
              ' /u01/app/oracle/oradata/my/mytbs _02.dbf' size 4M autoextend off,
             '  /u01/app/oracle/oradata/my/mytbs _03.dbf' size 4M autoextend off
  logging
  extent management local;




In addition you can check tablespace details through below view..
SELECT * FROM DBA_TABLESPACES


You can drop a tablespace through below statement...
DROP TABLESPACE tbs_01
INCLUDING CONTENTS 
CASCADE CONSTRAINTS; 


No comments:

Post a Comment