0% found this document useful (0 votes)
3 views4 pages

Oracle Database Training Session Day-3

Uploaded by

suresh
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
Download as pdf or txt
0% found this document useful (0 votes)
3 views4 pages

Oracle Database Training Session Day-3

Uploaded by

suresh
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
Download as pdf or txt
Download as pdf or txt
You are on page 1/ 4

Oracle Database training session series- Day 3

Oracle Instance and Database

• Understanding SGA and PGA

• Instance vs. Database

• Initialization Parameters

This session delves into the key concepts of Oracle Instance and Database, focusing on memory
structures like SGA and PGA, their roles, and understanding the relationship between an instance
and a database. We also explore initialization parameters, which control the behaviour of the
database.

Understanding SGA and PGA

System Global Area (SGA)

Definition: SGA is a shared memory region allocated by an Oracle instance that contains data
and control information for the database.

Purpose: It is used for efficient communication between processes and ensures high
performance by reducing disk I/O through caching.

Components:

1. Database Buffer Cache:

▪ Caches data blocks read from datafiles.

▪ Improves performance by reusing frequently accessed data.

2. Shared Pool:

▪ Stores parsed SQL and PL/SQL code, and data dictionary information.

▪ Reduces parsing overhead for repeated SQL queries.

3. Redo Log Buffer:

▪ Temporarily stores redo entries before writing them to the redo log files.

▪ Ensures data recovery during a system failure.

4. Large Pool (optional):

▪ Used for large memory allocations, such as for RMAN backups and shared
server processes.

5. Java Pool (optional):

▪ Stores session-specific Java code and data.

6. Streams Pool (optional):

▪ Allocated for Oracle Streams.

1
Program Global Area (PGA)

Definition: PGA is a private memory region allocated to each server process or background
process.

Purpose: Contains data and control information specific to a session.

Components:

1. Session Information:

▪ Stores session-specific data (e.g., user logins).

2. Sort Area:

▪ Used for sorting operations like ORDER BY and GROUP BY.

3. Work Areas:

▪ Allocated for operations like hash joins and bitmap index scans.

o PGA Size Management: Controlled by the initialization parameter:

▪ Automatic: pga_aggregate_target

▪ Manual: workarea_size_policy

Instance vs. Database

Aspect Oracle Instance Oracle Database

A combination of memory structures (SGA) and The physical storage of data,


Definition background processes that interact with the including datafiles, redo log files, and
database. control files.

Enables users to connect and access the


Role Stores persistent data and metadata.
database.

SGA, PGA, and background processes like Datafiles, control files, redo logs, and
Components
DBWn, LGWR, etc. archive logs.

Lifecycle Exists only while the database is active. Persistent and stored on disk.

Example:

• Instance: Think of it as the engine that runs the database.

• Database: The fuel that the engine uses to perform operations.

Initialization Parameters

Initialization parameters control the configuration and behaviour of the Oracle instance. These are
stored in the Parameter File and can be modified to fine-tune performance.

Types of Parameter Files

1. SPFILE (Server Parameter File):

2
o Binary file stored on disk.

o Supports dynamic changes (without restarting the instance).

o Recommended for production environments.

2. PFILE (Parameter File):

o Text file (editable manually).

o Requires instance restart for changes to take effect.

Common Initialization Parameters

1. Memory Parameters:

o memory_target: Enables automatic memory management.

o sga_target and pga_aggregate_target: Controls SGA and PGA memory.

2. Process Parameters:

o processes: Maximum number of operating system processes that can connect.

o sessions: Maximum number of sessions.

3. Database Parameters:

o db_name: Specifies the name of the database.

o db_block_size: Defines the size of database blocks (default: 8 KB).

4. Control and Redo Parameters:

o control_files: Specifies the path to control files.

o log_archive_dest: Path for archived redo logs.

5. Diagnostic Parameters:

o background_dump_dest: Location for background process log files.

o user_dump_dest: Location for user process log files.

6. Security Parameters:

o remote_login_passwordfile: Specifies how passwords are stored for remote users.

Viewing and Modifying Parameters

1. View Current Parameters:

o Query dynamic performance views:

SHOW PARAMETER <parameter_name>;

SELECT name, value FROM v$parameter;

2. Modify Parameters (SPFILE):

o Dynamically:

3
ALTER SYSTEM SET memory_target=2G SCOPE=BOTH;

o Permanently:

ALTER SYSTEM SET processes=300 SCOPE=SPFILE;

o Restart the database to apply changes:

SHUTDOWN IMMEDIATE;

STARTUP;

Workflow: Instance and Database Interaction

1. Startup:

o Oracle Instance is started with STARTUP command.

o Reads initialization parameters from SPFILE/PFILE.

o Allocates memory (SGA and PGA) and starts background processes.

2. Mounting:

o Control files are read to identify the database structure.

3. Open Database:

o Datafiles and redo logs are opened for user access.

Summary

• SGA and PGA are critical memory structures for Oracle operations.

• The instance is the active component managing the database stored on disk.

• Initialization parameters provide fine-grained control over database behavior, ensuring


optimal performance and resource management.

This knowledge lays the groundwork for managing Oracle databases effectively in real-world
environments.

You might also like