Question: I see a
mismatch between my "size" parameter and the actual extent size
in a tablespace:
CREATE SMALLFILE
TABLESPACE "TEST2"
NOLOGGING
DATAFILE '/u02/oradata/ORCLBD/TEST2.dbf'
SIZE
5M
EXTENT MANAGEMENT LOCAL
UNIFORM SIZE 3K
SEGMENT
SPACE MANAGEMENT MANUAL;
My extents will be
uniform and each one with 3K, but if 1 extent is a set of
contiguous blocks, so at least I should have 8k for my extent (1
data block in my database is 8k). But a query against
dba_extents shows this as 16k for my initial extents.
Why do I see 16k instead of 3k as specified?
Answer: The initial size of a tablespace
is also governed by the MINEXTENTS parameter. In this case, you did
not specify in your
create tablespace syntax, so the
default in
dba_tablespaces takes effect. The
minimum blocks for any table is 2 blocks, one block for the
segment
header, and one minimum data block.
To examine the size of existing tables, I recommend the Oracle datafile and tablespace scripts to see
details:
-
Oracle tablespace and data file internals scripts
In your case, you specify a value that is less than the
database blocksize (8k), but Oracle cannot allocate less than
one block (plus another block for the segment header), so
you see 16k (8k * 2) for your initial tablespace size.
Robert Freeman notes from his book "Easy Oracle Jumpstart":
An
extent is an uninterrupted (or contiguous) allocation of blocks
within a segment. Extents are assigned to a segment
automatically by Oracle, so you will rarely deal directly with
an extent, rather you will deal directly with its associated
segment (table or index).
An extent must be on contiguous blocks within a
single datafile, so an extent cannot span multiple Oracle
datafiles. Oracle will allocate the size of the extents based on
the type of tablespace.