Tablespaces Concepts
Published by : Obay Salah , November 19, 2024
The database is physically divided into storage files that can be viewed by the operating system, which are the Data files. The database is also divided into logical storage units, which are called Tablespaces. We mentioned that the Tablespace is a logical unit that contains one or more Datafiles, and each Datafile actually belongs to one Tablespace.Tablespace consists of a group of smaller logical units called Segments, which are logical units that make up the Tablespace, so that the Segment belongs to only one Tablespace.
It consists of a group of smaller logical units called Extents, which are also logical units, each Extent belongs to one Segment, and the Extents also consist of another smaller group, which is the smallest logical unit and is called Blocks Database.
The figure shows the options available for Tablespaces, which are:
1- Space Management in Tablespaces :
It is how to manage space in Tablespaces and there are two types:
- Locally Managed Tablespaces:
Here the Extents in the Tablespace are managed through the Tablespace by Bitmaps, the moment the Extents are allocated or edited, the Oracle Server changes the value of the Bitmap to the new state. This type of management is the default when creating the Tablespace in Oracle 10g and this type has become available starting from Oracle 8i.
Because no modification occurs in the Data Dictionary, Generate Undo Information is not generated.
To convert the Tablespace management from Dictionary Data to Locally, we use
DBMS_SPACE_ADMIN.TABLESPACE_MIGRATE_TO_LOCAL.
In this type of Tablespace management, there are two types of Extents management:
1- Automatic: Here we do not specify the size of the Extent, but it is specified by the system, and this type cannot be applied in (Temporary Tablespace).
2- Uniform: Here we can specify the size of the Extent in the Tablespace, and the original size of the Extent is 1MB, this type cannot be applied in Undo Tablespace.
Also in this type of Tablespace management there are two types of Segement management:
1-Automatic
2-Manual
- Dictionary- Managed Tablespaces :
Here the Extents in the Tablespace are managed through the Dictionary Data. The moment the Extents are customized or edited, the Oracle Server changes the Data Dictionary Tables.
2-Logging :
1- Yes: The moment the objects in the Tablespaces are changed, the changes are written to the Redo Log Files.
2- NO: Not all changes are written to the Redo Files Log.
3-Mode:
1 - Only Read: This means that we cannot write, modify or delete the data in the Tablespace. Of course, we cannot put both the System & Sysaux Tablespace in Read Only mode.
2 - Write and Read This means that we can write, modify or delete the data in the Tablespace.
4- Views :
These are queries to find out information about Tablespaces and Data Files:
DBA_TABLESPACES
V$TABLESPACE
DBA_DATA_FILES
V$DATAFILE
DBA_TEMP_FILES
V$TEMPFILE
5- Contains :
1-Permanent: It is used to store persistent objects in the database.
2- Temporary: It is used to store temporary objects in the database, and the database needs it, for example, for data arrangement operations.
3-Undo: The Database Server uses it to store Undo Information, which is necessary in the database and is created during the creation of the database. Another Undo Tablespace can be added when we need it; but at the same time, only one Undo works, which is specified by the variable file Undo_Tablespace=Value.
6-Status:
1- Online: The tablespace is available to all users.
2- Offline: The tablespace is not available to users and there are several options for this mode (Normal & Temporary & Immediate & For Recover), it is not possible to put
.Offline in the mode (System & Undo Tablespace)
7- SQL:
1 - Create: To make changes to the Tablespace.
2 - Alter: To make changes to the Tablespace.
3 - Drop: To delete the Tablespace.
8 -Type:
1 - Small Tablespace: It is a Tablespace that contains one or more Data Files, and this type is the default when creating a Tablespace.
2 - Big Tablespace: It is a new type of Tablespace that became available starting from Oracle 10, so that its size reaches 821 Terabytes (TB)
and contains only one data file.
Types of Tablespaces:
1-System Tablespace :
It is the most important Tablespace in the database at all, as the database does not work without it, and we cannot change its status to Offline & only Read.
This Tablespace is used by Oracle Server to manage the database, as it contains the Data Dictionary and tables that contain administrative information about the database,
It also contains (Sys Schema).
2- Sysaux Tablespace:
It is an auxiliary Tablespace for the System Tablespace that contains some components and products that are used in managing the database.
This Tablespace has become necessary in the database starting from the Oracle 10g release.
3- Temp Tablespace :
It is a Tablespace used to store temporary data and objects, for example when sorting. There may be more than one Temporary Tablespace in one database
But only one is active at the same time.
4- Undo Tablespace :
This Tablespace is used by the Oracle Server to store Undo Information. Have you ever thought about how to undo a modification to a specific field?
The old information is saved in this Tablespace.
* - It is worth noting here that whoever wants to create a Tablespace needs the permissions (DBA or CREATE TABLESPACE).
Comments
no comment yet!