0% found this document useful (0 votes)
4 views

Tablespace and Temporary Tablespace

Tablespace management in Oracle database
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views

Tablespace and Temporary Tablespace

Tablespace management in Oracle database
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 10

Tablespace

In Oracle database architecture, a tablespace is a logical storage


container that groups together one or more data files, which in turn store
the actual data of database objects such as tables, indexes, and
partitions. Here's how a tablespace works:

1. Logical Storage Organization: A tablespace provides a logical


organization for storing and managing database objects. Each
tablespace is associated with a specific database and contains one
or more data files, which are physical files stored on the underlying
file system of the database server.
2. Data File Allocation: Data files are allocated to a tablespace when
it is created or when additional space is needed to accommodate
new data. Each data file has a fixed size, which is specified when
the file is created, and can dynamically grow as needed, up to a
maximum size defined by the database administrator.
3. Storage Management: Tablespaces provide a mechanism for
managing the storage of database objects within the Oracle
database. Administrators can specify various storage parameters for
each tablespace, such as initial size, growth increment, and
autoextend options, to control how data files are allocated and
managed.
4. Segment Allocation: Within each tablespace, database objects are
stored in segments, which are logical units of storage for individual
tables, indexes, and partitions. When a new object is created (such
as a table or index), the Oracle database allocates space for the
object's segments within the appropriate tablespace.
5. Extent Management: Extents are contiguous blocks of space
allocated to database objects within a tablespace. When an object
requires additional space, the Oracle database allocates new
extents from the tablespace's free space pool. Extent management
can be either dictionary-managed or locally-managed, with locally-
managed extent management being the preferred method due to its
better performance and scalability.
6. Tablespace Types: Oracle supports different types of tablespaces,
each with its own characteristics and purposes. Common types
include:
 Permanent Tablespaces: Used to store permanent data
such as tables and indexes.
 Temporary Tablespaces: Used for sorting and temporary
storage of data during query processing and other database
operations.
 Undo Tablespaces: Used to store undo data, which is used
to roll back transactions and provide read consistency.
7. Backup and Recovery: Tablespaces play a critical role in database
backup and recovery operations. Administrators can back up and
restore individual tablespaces, allowing for efficient management of
data protection and disaster recovery.

Overall, tablespaces provide a flexible and scalable mechanism for


organizing and managing the storage of database objects within the
Oracle database, allowing administrators to allocate and manage storage
resources efficiently while ensuring data integrity and availability.

 Types of tablespace:
In Oracle Database, there are several types of tablespaces, each
designed for specific purposes. Here are the common types of
tablespaces:

1. Permanent Tablespace:
 Permanent tablespaces are the most common type and
are used to store permanent data, such as tables and
indexes, that persist across database sessions.
 They typically contain user-created objects that are
intended to be long-lasting and are not temporary in
nature.
 Permanent tablespaces are often used for storing
application data and system objects that are essential
for the functioning of the database.
2. Temporary Tablespace:
 Temporary tablespaces are used for temporary storage
of data during database operations such as sorting,
joining, and aggregating.
 They are used to store intermediate result sets
generated during SQL query processing.
 Temporary tablespaces are often used to support
operations that require large amounts of temporary
storage, such as sorting large result sets or performing
complex data manipulations.
3. Undo Tablespace:
 Undo tablespaces are used to store undo data, which is
used to roll back transactions and provide read
consistency.
 When a transaction modifies data in the database, the
original data values are stored in the undo tablespace
before the changes are committed.
 Undo tablespaces are essential for maintaining the
integrity of transactions and supporting features such
as rollback and read consistency.
4. System Tablespace:
 The system tablespace is a special type of tablespace
that contains the data dictionary, which stores
metadata about the database objects and their
relationships.
 It also contains the SYSTEM and SYSAUX tablespaces,
which contain system-related objects and auxiliary
objects used by the database.
 The system tablespace is critical for the functioning of
the database and should be managed carefully to
ensure database stability and performance.
5. Bigfile Tablespace:
 Bigfile tablespaces are a special type of tablespace
introduced in Oracle Database 11g that allows for the
creation of very large data files, up to 4 exabytes in
size.
 Unlike traditional tablespaces, which consist of multiple
smaller data files, a bigfile tablespace consists of a
single large data file.
 Bigfile tablespaces are often used for storing large
tables, indexes, or other objects that require large
amounts of storage space.
6. Temporary Undo Tablespace:
 Temporary undo tablespaces are a variation of undo
tablespaces that are used specifically for temporary
undo data storage.
 They are typically used in situations where temporary
undo storage is needed, such as during online table
redefinition operations or in certain types of partition
maintenance operations.

These are some common types of tablespaces in Oracle


Database, each serving different purposes and providing specific
functionalities to support the storage and management of data
within the database.

1) To see the names of the tablespaces;


2) To see files with their respective tablespaces;

3) To create a tablespace naming demo;


4) To add one more datafile to demo tablespace;

5) To resize datafile of tablespace demo;

6) To see row of tablespace demo in table dba_data_files;

7) To drop demo tablespace with the files;

8) To drop a tablespace without deleting files;

9) We can create an existing dropped tablespace by reusing its


files;

10) To change the default tablespace of meesam user to


demo from users;
11) To check the default tablespace of user meesam;

12) To see the quota given to the user;

13) To see the size of datafiles of tablespace;

14) To see the total size of total datafiles of all tablespaces;

Temporary Tablespace
1) To see the structure of the table dba_temp_files;

2) To see the file names of temp tablespaces;

3) To create a temporary tablespace;


4) To add more temp files to temp tablespace;

5) To resize the tempfile ;

6) To set temporary tablespace temp2 to user meesam;

7) To see the allocated temp tablespace to meesam;

8) To see the created temp2 tablspace;


9) To see the size of the tempfiles of temporary tablespaces(in mb, in gb);

 To on autoexnted datafile;

You might also like