Archive for July 28, 2008

Creating Oracle Tablespaces

Posted in Database, Oracle, SQL, Software, Technology, pl/sql, programming with tags , , , , on July 28, 2008 by Joey

The following syntax demonstrates how to create an Oracle tablespace:

CREATE TABLESPACE myTablespace
DATAFILE ‘/oracle/ts_mytablespace.dbf’
SIZE 100m
AUTOEXTEND on
NEXT 10m
MAXSIZE 500m;

The size of this tablespace is defined as 100 megabytes. By having the AUTOEXTEND attribute set to “on,” the statement is specifying that if the tablespace size exceeds 100 megabytes, more space will be allocated for the tablespace. The amount of space by which to extend the tablespace is specified by the “NEXT” attribute, which in this example is 10 megabytes. The tablespace will continue to grow until it reaches the maximum allowable size, which is determined by the “MAXSIZE” attribute – 500 megabytes.

Note: In order to create an Oracle tablespace, you must have the CREATE TABLESPACE privilege.