René Nyffenegger's collection of things on the web
René Nyffenegger on Oracle - Most wanted - Feedback
 

Create tablespace in Oracle

The create tablespace statement is used to create a tablespace.

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 '/home/oracle/databases/ora10/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;
Note, a temporary tablespace has tempfiles, not datafiles.

Undo tablespace

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

Misc

More than one datafile can be created with a single create tablespace command:
create tablespace ts_sth 
  datafile 'c:\xx\sth_01.dbf' size 4M autoextend off,
           'c:\xx\sth_02.dbf' size 4M autoextend off,
           'c:\xx\sth_03.dbf' size 4M autoextend off
  logging
  extent management local;
Adding a tablespace to a database is a structural change that requires a backup.