Database Creation and Configuration in Oracle Database 12c
Key Concepts
- Database Creation
- Database Configuration
- Container and Pluggable Databases
- Initialization Parameters
- Datafiles and Tablespaces
Database Creation
Database creation in Oracle Database 12c involves several steps, including setting up the environment, defining initialization parameters, and creating the necessary files. The primary tool for creating a database is the DBCA
(Database Configuration Assistant) or manual scripts using CREATE DATABASE
SQL command.
Example: Using DBCA
, you can create a new CDB (Container Database) by specifying the database name, character set, and storage locations. The tool will then generate the necessary control files, datafiles, and redo logs.
Database Configuration
Database configuration involves setting up various parameters that control the behavior and performance of the database. This includes configuring memory structures, setting up network services, and defining security settings. Configuration can be done using the SQL*Plus
command-line tool or through the Oracle Enterprise Manager.
Example: To configure the SGA (System Global Area) size, you can modify the sga_target
parameter in the initialization file. This determines how much memory is allocated for the database's shared memory structures.
Container and Pluggable Databases
In Oracle Database 12c, the multitenant architecture allows for the creation of a Container Database (CDB) that can host multiple Pluggable Databases (PDBs). Each PDB is a self-contained database that can be plugged into or unplugged from the CDB. This architecture provides flexibility and resource sharing.
Example: After creating a CDB, you can use the CREATE PLUGGABLE DATABASE
command to create a new PDB. This PDB can then be managed independently while sharing common resources from the CDB.
Initialization Parameters
Initialization parameters are settings that define how the database operates. These parameters are stored in the initialization file (usually init.ora
or spfile
). They control aspects such as memory allocation, process limits, and logging behavior.
Example: The db_block_size
parameter defines the size of the database blocks, which affects how data is stored and accessed. Setting this parameter correctly is crucial for optimal performance.
Datafiles and Tablespaces
Datafiles are the physical files where the actual data is stored, and tablespaces are logical storage structures that group related datafiles together. Each tablespace can contain one or more datafiles, and tables, indexes, and other database objects are stored within tablespaces.
Example: You can create a new tablespace named "USERS" with a datafile of 100MB using the CREATE TABLESPACE
command. This tablespace can then be used to store user data.