0% found this document useful (0 votes)
6 views5 pages

Managing Instances, Datafiles & Tablespace

The document provides an overview of managing instances, datafiles, and tablespaces in Oracle Database, detailing the physical and logical structures of databases. It explains the purpose and types of tablespaces, how to create and manage them, and includes commands for viewing and altering tablespaces. Efficient management of these components is crucial for effective database administration.

Uploaded by

hicata2319
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views5 pages

Managing Instances, Datafiles & Tablespace

The document provides an overview of managing instances, datafiles, and tablespaces in Oracle Database, detailing the physical and logical structures of databases. It explains the purpose and types of tablespaces, how to create and manage them, and includes commands for viewing and altering tablespaces. Efficient management of these components is crucial for effective database administration.

Uploaded by

hicata2319
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

Managing Instances, Datafiles & Tablespace.

md 2024-02-16

Managing Instance, Datafiles & Tablespace


1. Table
Overview

A table is a fundamental database object that organizes data into structured rows and columns. Each row
represents a single record, while each column represents a specific attribute of that record.

2. Types of Database Structure


Physical Structure

Represents how data is stored on the storage devices.


Includes datafiles, tablespaces, segments, extents, database blocks, and OS blocks.

Logical Structure

Represents how data is organized and accessed logically.


Includes tables, indexes, views, and other database objects.

3. Tablespace
Overview

A tablespace is a logical storage container in Oracle Database that groups related datafiles together. It
provides a way to manage and allocate storage space for database objects.

4. Purpose of Tablespace
Why Introduced?

Efficient storage management: Allows for easier management and allocation of storage space.
Logical organization: Provides a logical grouping of database objects for easier management and
administration.
Performance optimization: Enables optimization of storage allocation and performance tuning at the
tablespace level.

5. Logical Structure (Tree Diagram)


You are correct. Let's include database blocks (DB blocks) and OS blocks within extents in the diagram:

Database
└── DB
├── Tablespaces
│ ├── Segments
│ │ ├── Tables
│ │ │ ├── Data Rows

1/5
Managing Instances, Datafiles & Tablespace.md 2024-02-16

│ │ │ └── Indexes
│ │ ├── Views
│ │ │ └── SQL Query Definitions
│ │ └── Indexes
│ │ └── Index Entries
│ └── ...
├── Extents
│ │ │ │ ├── Database Blocks
│ │ │ │ │ └── OS Blocks
│ │ │ │ └── ...
│ │ └── ...
│ └── ...
└── ...

Explanation

Database: Represents the entire Oracle Database.


DB: Denotes the logical database structure.
Tablespaces: Logical storage containers within the database.
Segments: Logical storage units that contain related database objects.
Tables: Database objects that store data in rows and columns.
Data Rows: Actual data stored within the tables.
Indexes: Structures used to improve the speed of data retrieval operations.
Index Entries: Entries within indexes that point to specific rows in tables.
Views: Virtual tables that display data from one or more tables.
SQL Query Definitions: Definitions of SQL queries that define the views.
Indexes: Structures used to improve the speed of data retrieval operations.
Extents: Contiguous allocation units within segments.
Database Blocks: Smallest unit of storage within Oracle Database.
OS Blocks: Smallest unit of storage in the operating system.
...: Represents other tablespaces and their respective components.

6. Physical Structure
Components of Physical Structure

Datafiles: Physical files on the operating system that store database objects.
Tablespaces: Logical containers that group related datafiles.
Control Files: Binary files that manage database metadata and structure.
Redo Log Files: Files that record changes made to the database for recovery purposes.
Archived Redo Log Files: Copies of redo log files that have been archived.

Managing Tablespaces in Oracle Database


1. Viewing Tablespaces
Use the DBA_Tablespaces view to see all tablespaces in the database.

2/5
Managing Instances, Datafiles & Tablespace.md 2024-02-16

SELECT * FROM DBA_Tablespaces;

2. Viewing Tablespaces with Specific Attributes


Retrieve specific attributes such as tablespace name, status, contents, extent management,
segment space management, and whether it's a bigfile tablespace.

SELECT tablespace_name, status, contents, extent_management,


segment_space_management, Bigfile FROM dba_tablespaces;

3. Types of Tablespaces

There are several types of tablespaces in Oracle:


SYSTEM: Contains Oracle's data dictionary and core functionality.
SYSAUX: Auxiliary tablespace containing additional system-related tables and indexes.
UNDOTBS: Stores undo data necessary for transactions and rollback operations.
TEMP: Used for temporary storage and sorting operations.
USERS: Typically used to store user-created objects and data.
Each tablespace has a specific role in managing database storage and performance.

4. Associating Tablespaces with Datafiles

You can find which datafiles are associated with each tablespace using the DBA_DATA_FILES
view.

5. Viewing Commands and Outputs

Here are some useful commands and their outputs:


Viewing oratab file: cat /etc/oratab
Viewing datafiles in the database: SELECT * FROM dba_data_files
Viewing datafile sizes: SELECT tablespace_name, files, bytes/(1024*1024) as
'Size in MB', maxbytes/(1024*1024*1024) as 'Size in GB', autoextensible
FROM DBA_data_files
Autoextensible indicates whether the datafile can automatically grow in size when needed.

6. Creating a New Tablespace

You can create a new tablespace using the CREATE TABLESPACE command.

CREATE TABLESPACE eproducts DATAFILE '/u02/oradata/ORCL/eproducts01.dbf' SIZE 1G;

7. Why Create a New Tablespace

New tablespaces are created to manage database storage more efficiently, isolate data, or meet
specific performance requirements.

8. Examples of Creating New Tablespaces


3/5
Managing Instances, Datafiles & Tablespace.md 2024-02-16

Creating with minimal parameters:

CREATE TABLESPACE eproducts DATAFILE '/u02/oradata/ORCL/eproducts01.dbf' SIZE 1G;

Creating with detailed parameters:

CREATE SMALLFILE TABLESPACE woodproducts DATAFILE


'/u02/oradata/orcl/woodproductd.dbf' SIZE 500M AUTOEXTEND ON NEXT 4M MAXSIZE 2G
EXTENT MANAGEMENT LOCAL SEGMENT SPACE MANAGEMENT AUTO;

Differences between bigfile and smallfile tablespaces:

-- Bigfile tablespace creation


CREATE BIGFILE TABLESPACE bigtbs DATAFILE '/u02/oradata/ORCL/bigtbs01.dbf' SIZE
10G;

Unlimited size in Oracle tablespaces: Oracle allows tablespaces to have unlimited size by specifying the
MAXSIZE parameter as UNLIMITED.

9. Extending Datafile Sizes

Datafile sizes can be extended by adding new datafiles to tablespaces or resizing existing ones.

10. Extent Management

Extent management controls how space within a tablespace is allocated for segments.
Local extent management (LMT) tracks extents within the tablespace itself, while dictionary
extent management (DMT) uses data dictionary tables to manage extents.

11. Space Management

Space management determines how extents are managed within a segment.


Auto space management automatically manages free space within extents, while manual space
management requires explicit allocation of extents.

12. Tablespace Status and Contents

ONLINE status indicates that the tablespace is accessible for operations.


CONTENTS indicate the type of data stored in the tablespace: Permanent, Temporary, or UNDO.

13. Altering Tablespaces

Renaming a tablespace:

ALTER TABLESPACE woodproducts RENAME TO wproducts;

4/5
Managing Instances, Datafiles & Tablespace.md 2024-02-16

- Online/Offline/Read Only/Read Write tablespace:

ALTER TABLESPACE wproducts OFFLINE;


ALTER TABLESPACE wproducts ONLINE;
ALTER TABLESPACE wproducts READ ONLY;

14. Extending Tablespace Size


Adding a new datafile:

ALTER TABLESPACE eproducts ADD DATAFILE '/u02/oradata/ORCL/eproducts02.dbf' SIZE


200M;

- Increasing the size of an existing datafile:

ALTER DATABASE DATAFILE '/u02/oradata/ORCL/eproducts02.dbf' RESIZE 500M;

15. Dropping a Tablespace


To drop a tablespace and its contents:

DROP TABLESPACE wproducts INCLUDING CONTENTS AND DATAFILES;

Conclusion
Understanding how to manage instances, datafiles, and tablespaces is essential for efficient database
administration.

5/5

You might also like