Tuning day 1 summary
oracle instance: all data that is related to the oracle program on memory.
dedicated connection: a one-to-one relationship between a user session and a server process,
ensuring that each user has exclusive access to a dedicated server process for database
interactions.
user process: refers to the software component running on a user's machine that facilitates
communication between the user's application and the Oracle database server.
sort space area: an area inside the server process in which data is sorted.
server process: a process on the database server that manages communication with client
applications, executes SQL statements, and performs database operations on behalf of those
clients.
shared connection: a connection model where multiple user sessions share a pool of server
processes on the database server.
Dispatcher: is a background process responsible for managing and distributing incoming client
connection requests among the available server processes and gives them ids.
Listener: connects users to the DB through the connection string (contains IP, protocol, DB
name).
Server Processor (Oracle Instance): the server processor, also known as the Oracle instance, is
responsible for managing the overall execution environment for the database. The server
processor coordinates the execution of SQL statements by allocating system resources (CPU,
memory, I/O) and enforcing concurrency control mechanisms to maintain data consistency.
The Program Global Area (PGA): is a memory region allocated for each user process connected
to the database. It holds session-specific data and control structures such as variables, cursor
states, and sort areas.
SQL Execution Flow: When a SQL statement is received by the server processor, it initiates the
execution process by allocating a PGA for the corresponding session. The server processor
coordinates the execution of the SQL statement, accessing data from disk or memory as
needed, while the PGA manages memory structures and buffers for query processing within the
session.
Select statement
1. Parsing
1. checks syntax
2. checks data dictionary to confirm table and column info
3. checks privilege (also through data dictionary)
4. determines retrieval strategy
soft parse: the process of parsing a SQL statement without recompiling its execution
plan. Instead, Oracle attempts to reuse an existing execution plan from the Shared Pool,
saving CPU and memory resources compared to a full parse.
hard parse: the process of fully parsing a SQL statement, which involves syntax and
semantic analysis, determining the optimal execution plan, and generating necessary
data structures.
The Shared Pool: is a memory area within the System Global Area (SGA) that stores
parsed SQL statements, execution plans, and other shared memory structures to
optimize query processing and reduce the overhead of statement parsing.
2. execution
SGA (System Global Area): a shared memory region that contains data and control
information for the Oracle database instance. The SGA is allocated when the Oracle
instance starts up and remains in memory until the instance is shut down.
Library Cache: The Library Cache is a part of the Shared Pool that stores parsed SQL
statements, execution plans, and PL/SQL cod.
Data Dictionary Cache: The Data Dictionary Cache, also known as the Row Cache, stores
metadata information about database objects (such as tables, indexes, and columns)
accessed by SQL statements.
reminder about how data is stored on disk and data blocks
Data block: is the unit which Oracle reads / writes from hard disk. oracle tables are made of
data blocks.
if the table is larger than your cache size in SGA, buffering will occur, meaning you'll retrieve
parts of the table from the hard disk, load them into memory process them, then go into the
next part.
Cache Buffer: is a memory area within the System Global Area (SGA) used to store frequently
accessed data blocks from disk, allowing for faster data retrieval and reducing the need for disk
I/O operations.
character set: a collection of characters and symbols that can be used to represent textual data
stored in the database.
3. Fetching
redo log (also known as redo logs or redo log groups): which is a sequence of records that log
changes made to the database by transactions. These changes include inserts, updates, and
deletes of data.
Log Writer (LGWR): is a background process responsible for writing redo log buffers to the redo
log files on disk. It ensures that changes made to the database (transactions) are securely
recorded in the redo logs.
Non-archiving mode: is a configuration where redo logs, which record changes made to the
database, are not archived. This means that once a redo log is filled, it is overwritten.
Archive mode: is a database configuration where redo logs, which record changes made to the
database, are archived before being overwritten.
log switch: is the process that transfers from log files to the archive directory.
In the archive directory, files are stored using log sequence not their normal names, to avoid
conflicts
Log Group: s a logical grouping of one or more redo log files. Log Groups provide redundancy
and fault tolerance by allowing multiple redo log files to be used interchangeably.
Log Member: is a physical file that belongs to a Log Group and stores redo log information
generated by database transactions.
Undo Tablespace: The Undo tablespace is a dedicated storage area in the database used to
store undo data.
Dirty block: refers to a data block that has been modified in memory (in the cache) but has not
yet been written back to the disk yet.
Database writer: is a critical background process responsible for writing modified data blocks
from the database buffer cache to the data files on disk