Managing+Tablespaces
Managing+Tablespaces
By Ahmed Baraka
Logical Physical
Database
Segment
Extent
data
OS block
block
4K 16G
8K 32G
16K 64G
32K 128G
• Options:
- Automatic: uses bitmaps to manage free space in the segment (this is
called automatic segment space management or ASSM)
- Manual: uses linked lists called "freelists" to manage free space in the
segment
• Automatic is the default and more efficient
• Create tablespaces:
CREATE TABLESPACE hrtbs ;
CREATE TABLESPACE hrtbs SIZE 1G;
• For CDB, datafiles are created in the following directory path format:
<OMF>/<CDB DB name>/<pdb GUID>/datafile/<datafile name>.dbf
<OMF>/<$ORACLE_SID>/datafile/<datafile name>.dbf
Clause Description
DBA_TABLESPACES Describes all tablespaces in the database.
V$TABLESPACE Displays tablespace information from the control file.
DBA_DATA_FILES Describes all the data files.
V$DATAFILE Displays datafile information from the control file.
DBA_TEMP_FILES Describes all temporary files (tempfiles) in the database.
V$TEMPFILE Displays temp file information.
Clause Description
NORMAL The database takes a checkpoint for all data files of the tablespace (clean)
TEMPORARY The database takes offline the data files that are not already offline. The
tablespace may require recovery before you can bring it back online.
IMMEDIATE No checkpoint is taken on any data file. Media recovery for the tablespace is
required before the tablespace can be brought online