Oracle Dat Admin - $@@#2
Oracle Dat Admin - $@@#2
Processor cannot do any processing on the disk, it can do it only from the RAM. So
for CPU to work on any data, it has to 1st bring it from the DISK to RAM and then
work on that data.
SGA is a memory allcoation like Shrared pool, Buffer cache and other components).
and set of processes called as Background processes which are going to use the CPU
to do some activity.
These components togerther form the Oracle database. When ever user connects to the
database, he is actually connecting to Instance. which is combination of SGA and
processes, and these processes will interact with the database files to fetch data.
--------------------------------
Redo Log: is a log file, as and when you make changes to the data, it is logged and
kept in redo log.These files are used to hold the changes made in the database.
Redo log files can be utilized during the database recovery process to retrieve the
original information.
Parameter File: Used to create the instance, and components of the instance is
created based on this. THis is called PFILE, SP File is server parameter file.This
file contains the parameters which define the way the database is expected to start
up
Password file:This file holds the user passwords and thus maintains the security of
databases.
Compenents of Instance:
Shared Pool
Buffer Cache
Redo Log Buffer
Large Pool
Java Pool
etc.
The Shared Pool is a portion of the SGA that contains shared memory structures,
such as shared SQL and PL/SQL areas. It is used to store the parsed representation
of SQL statements, execution plans, and PL/SQL program units. This allows for the
efficient reuse of frequently executed statements, reducing the need for reparsing
and improving performance.
The Buffer Cache is a portion of the SGA that stores copies of data blocks read
from datafiles. It is used to cache frequently accessed data blocks, reducing the
number of disks I/Os required to access the data. This can improve performance by
reducing disk I/O time and increasing the speed of data retrieval.
Redo log Buffer: The most crucial structure for recovery operations is the redo
log, which consists of two or more preallocated files that store all changes made
to the database as they occur. Every instance of an Oracle Database has an
associated redo log to protect the database in case of an instance failure
Java pool: The Java Pool is an optional portion of the SGA that is used by Java
Virtual Machine (JVM) and related components. It is used to store Java-related data
structures, such as Java classes and objects. This pool is used when the Oracle
Database is configured to run Java applications or when using Oracle JVM.
Large Pool: The Large Pool is an optional portion of the SGA that can be used for
large memory allocation, such as backup and restore operations and I/O server
processes. It is typically used to improve the performance of these operations by
reducing the amount of disk I/O required.
System Monitor Process (SMON): These processes are responsible for performing
system-level recovery and maintenance activities.
Process Monitor Process (PMON): The task of these processes is to monitor other
background processes.
Database Writer Process (DBWR): This process performs the task of writing data
blocks from the Database Buffer Cache (present in SGA) to physical data
files(Present in the Database system).
Log Writer Process (LGWR): This process writes the Redo blocks from Redo Log Buffer
(present in SGA) to Redo Log Files(present in the Database system).
CheckPoint (CKPT): This process maintains data files and control files with the
most recent checkpoint information.
-------------------
From Ramkumar Swaminathan - Video 3
Coming to Instance
Primary component of SGA are, shared pool, buffer cache, redo log buffer,
optionally large pool, java pool and streams pool. Primary 5.
Shared pool is where all executables are available, all library of PLSQL and SQL
that we execute are kept here. Plus it also has a cache of the data dictionary. so
a shared pool is made up of Library Cache and Data dictionary cache. Thats what is
shared pool.
Buffer cache contains whatever data you query upon, SQL query pulls the data from
the data files and places it in buffer cache where the processing happens.
Redo Log buffer, when ever we change data , entries are made in redo log buffer.
Processes: SMON, PMON, DBWR, CKPT, LGRW. These 5 are very important processes.
Whenever we make change to data, it is in temporary memory, DBWR will write down
what is called as Dirty buffer. What is the dirty buffer? any block that is read
into buffer cache and changed is called as dirty buffer and it is the
responsibility of DBWR to write it to the Dirty buffer. LGWR - as and when we make
changes in buffer cache, redo log entries are made and LGWR responsibility is to
write it into the REDO LOG files in DB.
---------------------------
All executable code called by any session connected to the instance is kept in
library cache. it could be SQL or PLSQL. For SQL, a sql comes from user session and
undergoes a parse, a hash value is created and the optimizer generates a execution
plan.
Every sql has a SQL area which is available in Library cache, if same SQL is
executed again, it can reuse whatever is already parsed and kept and execute the
statement.
Similarly, for PLSQL, there can be two types like stored plsql like procedure,
functions, packages OR we could call anonymous block. If it is anonymous block, it
has to be compiled at run time and executed, whereas if it is stored plsql block,
it has to read it from dictionary i.e. system metadata oracle maintains in
dictionary cache, which is pulled from the system tablespace and executed. That is
what is there in library cache