Oracle Database 12c Administrator (OCA)
1 Introduction to Oracle Database 12c
1-1 Overview of Oracle Database 12c
1-2 Oracle Database Architecture
1-3 Oracle Database Components
1-4 Oracle Database Installation
2 Oracle Database Administration
2-1 Database Creation and Configuration
2-2 Managing Tablespaces and Datafiles
2-3 Managing Users and Security
2-4 Managing Privileges and Roles
2-5 Managing Profiles
2-6 Managing Auditing
3 Oracle Database Storage Structures
3-1 Understanding Oracle Database Storage Structures
3-2 Managing Oracle Database Storage
3-3 Managing Oracle Database Segments
3-4 Managing Oracle Database Extents
3-5 Managing Oracle Database Blocks
4 Oracle Database Backup and Recovery
4-1 Introduction to Oracle Database Backup and Recovery
4-2 Oracle Database Backup Strategies
4-3 Oracle Database Recovery Strategies
4-4 Oracle Database Backup and Recovery Tools
4-5 Oracle Database Backup and Recovery Procedures
5 Oracle Database Performance Tuning
5-1 Introduction to Oracle Database Performance Tuning
5-2 Oracle Database Performance Tuning Tools
5-3 Oracle Database Performance Tuning Techniques
5-4 Oracle Database Performance Tuning Best Practices
6 Oracle Database High Availability
6-1 Introduction to Oracle Database High Availability
6-2 Oracle Database High Availability Features
6-3 Oracle Database High Availability Tools
6-4 Oracle Database High Availability Best Practices
7 Oracle Database Security
7-1 Introduction to Oracle Database Security
7-2 Oracle Database Security Features
7-3 Oracle Database Security Tools
7-4 Oracle Database Security Best Practices
8 Oracle Database Monitoring and Maintenance
8-1 Introduction to Oracle Database Monitoring and Maintenance
8-2 Oracle Database Monitoring Tools
8-3 Oracle Database Maintenance Tasks
8-4 Oracle Database Monitoring and Maintenance Best Practices
9 Oracle Database Cloud Services
9-1 Introduction to Oracle Database Cloud Services
9-2 Oracle Database Cloud Services Features
9-3 Oracle Database Cloud Services Tools
9-4 Oracle Database Cloud Services Best Practices
10 Oracle Database SQL and PLSQL
10-1 Introduction to Oracle Database SQL and PLSQL
10-2 Oracle Database SQL and PLSQL Syntax
10-3 Oracle Database SQL and PLSQL Functions
10-4 Oracle Database SQL and PLSQL Best Practices
11 Oracle Database Data Management
11-1 Introduction to Oracle Database Data Management
11-2 Oracle Database Data Management Tools
11-3 Oracle Database Data Management Techniques
11-4 Oracle Database Data Management Best Practices
12 Oracle Database Application Development
12-1 Introduction to Oracle Database Application Development
12-2 Oracle Database Application Development Tools
12-3 Oracle Database Application Development Techniques
12-4 Oracle Database Application Development Best Practices
Managing Tablespaces and Datafiles in Oracle Database 12c

Managing Tablespaces and Datafiles in Oracle Database 12c

Key Concepts

Tablespaces

A tablespace is a logical storage unit within an Oracle database that groups related logical structures together. Each tablespace consists of one or more datafiles, which are the physical files on disk where the actual data is stored. Tablespaces are crucial for organizing and managing data efficiently.

Think of a tablespace as a filing cabinet with multiple drawers. Each drawer (datafile) can hold different types of documents (data), and the entire cabinet (tablespace) is used to organize these documents.

Datafiles

Datafiles are the physical files on disk that store the actual data of the Oracle database. Each tablespace has one or more datafiles associated with it. These files are managed by the Oracle Database Management System (DBMS) and are essential for data persistence.

Imagine datafiles as individual bookshelves in a library. Each bookshelf (datafile) holds a collection of books (data), and together, they form the entire library (tablespace).

Creating Tablespaces

To create a tablespace, you need to specify its name, the size of the initial datafile, and the location where the datafile will be stored. The following SQL command is used to create a tablespace:

        CREATE TABLESPACE users
        DATAFILE '/u01/app/oracle/oradata/ORCL/users01.dbf'
        SIZE 100M
        AUTOEXTEND ON NEXT 10M MAXSIZE 200M;
    

In this example, a tablespace named "users" is created with an initial datafile of 100MB. The datafile will automatically extend by 10MB when needed, up to a maximum size of 200MB.

Managing Datafiles

Managing datafiles involves tasks such as adding new datafiles to a tablespace, resizing existing datafiles, and moving datafiles to different locations. These operations are crucial for maintaining the performance and scalability of the database.

For instance, to add a new datafile to an existing tablespace, you can use the following SQL command:

        ALTER TABLESPACE users
        ADD DATAFILE '/u01/app/oracle/oradata/ORCL/users02.dbf'
        SIZE 50M
        AUTOEXTEND ON NEXT 5M MAXSIZE 100M;
    

This command adds a new datafile of 50MB to the "users" tablespace, which will automatically extend by 5MB when needed, up to a maximum size of 100MB.

Automatic Storage Management (ASM)

Automatic Storage Management (ASM) is a feature in Oracle Database 12c that simplifies the management of storage by automatically distributing data across disks. ASM provides load balancing, mirroring, and striping of datafiles, ensuring optimal performance and reliability.

Consider ASM as an intelligent storage manager that automatically organizes your bookshelves (datafiles) in a library (database) to ensure easy access and protection of books (data).

By understanding and effectively managing tablespaces and datafiles, you can ensure the optimal performance, scalability, and reliability of your Oracle Database 12c environment.