Tom
Tom

Reputation: 45104

Tablespace after Create Table. What does it mean?

Im reading some Oracle scripts, and I found one with this

Create Table XXY(...)

Tablespace SOME_TABLESPACE
....
NOCOMPRESS
NOPARALLEL
..

What does this mean? What is if for? There are many CreateTable statemsnts, but the Tablespace statement after is exactly the same.

As I understand SOME_TABLESPACE must exist when this script is excecuted, but thats all I could get. Is the purpose of the statement to store all the tables in the same place?

EDIT I read this

http://www.adp-gmbh.ch/ora/concepts/tablespaces.html

Upvotes: 0

Views: 4455

Answers (3)

Thorsten
Thorsten

Reputation: 13181

"Same place" doesn't quite describe it ...

A tablespace is a grouping of common data files. With your "Create" statements you can define in which tablespace an object gets stored. Usually different types of oracle objects are stored in different tablespaces that can have different capabilities.

Some examples:

  • "Data" (your tables and the rows stored in these tables) are stored in a different tablespace than "system information" (such as transaction logs or "caches"). This allows you to store system information on a local drive (quick, but somewhat limited in space) and data in a Storage Area network (basically unlimited space, but not quite as fast).
  • Table Data and Indexes can be stored in different tablespaces which may be on different disks. Therefore, table lookup and index lookup can use different disks and be faster than if both were on the same disk.

Tablespaces and their different characteristics are oen of the many ways of tuning an Oracle DB. Lots of capabilities, lots of complexity. If all you're doing is a little development machine, there is little need to worry about it.

Upvotes: 4

David Aldridge
David Aldridge

Reputation: 52346

It creates the table in that tablespace. In the case of partitioned tables it defines that tablespace as the default for new partitions and subpartitions also.

Upvotes: 2

Related Questions