0% found this document useful (0 votes)
61 views

Oracle DBA On Unix and Linux: Michael Wessler

The document discusses the architecture of an Oracle database. It explains that a running Oracle database consists of database files, memory structures, and background processes on a Unix server. It outlines the different types of Oracle files, including software installation files, configuration/parameter files, and actual database files like data files, control files, redo log files, and rollback segments. It also describes the memory structures like the system global area and process structures, as well as the background processes that are part of an Oracle instance.

Uploaded by

jorhiavi
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
61 views

Oracle DBA On Unix and Linux: Michael Wessler

The document discusses the architecture of an Oracle database. It explains that a running Oracle database consists of database files, memory structures, and background processes on a Unix server. It outlines the different types of Oracle files, including software installation files, configuration/parameter files, and actual database files like data files, control files, redo log files, and rollback segments. It also describes the memory structures like the system global area and process structures, as well as the background processes that are part of an Oracle instance.

Uploaded by

jorhiavi
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 42

Oracle DBA on Unix and Linux

Michael Wessler

Oracle DBA on Unix and Linux


Chapter 2
Architecture of the
Oracle Server

Oracle DBA on Unix and Linux


ESSENTIALS
• A solid understanding of the architecture of an Oracle
database is essential to the success of the DBA.
• A RUNNING Oracle database consists of database files,
memory structures, and background processes.
• There are three types of Oracle files: software
installation files, configuration/parameter files, and actual
database files.
• An Oracle instance consists of memory structures and
background processes.
• Most of the components of an Oracle database are
tunable by the DBA; therefore, the DBA must understand
them.
Oracle DBA on Unix and Linux
Chapter Outline

• Oracle Products Relating to Database


Servers
• Database Versus Instance
• Oracle File Types
• Memory Structure
• Oracle Processes
• Transaction Control
• Miscellaneous Database Files
Oracle DBA on Unix and Linux
Oracle Products Relating to
Database Servers
Oracle Server Overview

Net 8 Unix Server


DBA Connection via
Server Manager Net 8
Oracle
Database
Programmer Connecting Instance
Net 8
via SQL Plus

End User Connecting


via Oracle Forms

Oracle DBA on Unix and Linux


Oracle Server Overview

The database resides on a Unix server. Users log into their


workstations. They then start up an Oracle application
such as SQL*Plus. This tool connects across a TCP/IP
network using the Oracle Net8 protocol to establish
connectivity with the Unix server running the database.
The user is then authenticated and receives a connection
with the database. From here the user issues SQL
statements that are sent across the network to the
database for processing, and results are sent back to the
user.

Oracle DBA on Unix and Linux


SQL*Plus

Oracle DBA on Unix and Linux


Server Manager

• Server Manager is geared specifically toward DBAs. It


replaced a product called SQL*DBA which was a previous
DBA utility. All DBA commands can be issued from Server
Manager, assuming the user has the correct level of
permissions.
• In versions of Oracle 8i, Server Manager was the only
command-line tool available to issue DBA commands
directly. If the DBAs WANTED TO START OR STOP A
DATABASE, THEY HAD TO LOG IN USING Server
Manager. This functionality was not available in SQL*Plus.

Oracle DBA on Unix and Linux


Net 8
• Net8 is the network software used to conect to Oracle
databases. Originally called SQL*Net, starting in Oracle 8
it was renamed Net8 can be used over such networking
protocols as IPX/SPX, DECnet, and IBM LU6.2, but in the
Unix/Linux world it is TCP/IP that is used.
• In a simple architecture, a specific Net8 configuration file
called tnsnames. ora was configured on the PC. This file
contained the IP address of the Unix server and the
names of the database on that server. The Unix server
had a serverside Net8 file called listener.ora containing
the names of the server’s database and basic connect
information.

Oracle DBA on Unix and Linux


Database Versus Instance
An Oracle Database Instance
Unix Server
Oracle Database Instance = Memory Structures + Background Processes
Memory Structure Physical Database Files
Control
System GloblalArea(SGA) Control1a.ct Control2b.ct
Control3c.ctl
Database Buffer l l
Cache
Data
Redo Log Buffer System01.dbf Temp01.dbf Rollback_01.rbs

Shared Pool Users01.dbf Data01.dbf Index01.rbs


Data Dictionary Cache
Library Cache

Large Pool Redo


Redo1a.rdo Redo1b.rdo Redo2a.rdo Redo2b.rdo
Java Pool
Redo03a.rdo Redo03b.rdo Redo4a.rdo Redo4a.rdo

PGA PGA PGA

Background Processes
PMON SMON DBWR LGWR CKPT ARCH RECO SNPnn QMNnn

Oracle DBA on Unix and Linux


Oracle File Types

• A running Oracle database is composed of three


main components:

- physical files on disk;


- memory structures;
- background processes.

Oracle DBA on Unix and Linux


Oracle File Types

• Oracle files can be broken into three categories:

- shared software installation files that are


loaded via the installation CD;
- database parameter and logging files;
- the actual files composing the database.

Oracle DBA on Unix and Linux


Oracle File Types (ext.)

Unix Server
Oracle File Types= Physical Database Files + Software Files + Database Parameter/ Log Files

Software Files Physical Database File


Tnsnames.ora Control
listener.ora
Control1a.ct Control2b.ct
oratab Control3c.ctl
l l

Data

System1.dbf Temp01.dbf Rollback_01.rbs

Database Parameter and Log Files Users01.dbf Data01.dbf Index01.rbs

init.ora Redo
config.ora Redo1a.rdo Redo1b.rdo Redo2a.rdo Redo2b.rdo
alert.log
Redok03a.r
Redo3b.rdo Redo4a.rdo Redo4a.rdo
do

Oracle DBA on Unix and Linux


Oracle File Types (ext.)
Control Files
• The control file stores information about the file structure
of the database.
• An Oracle database requires only one control file, but
typically three or more identical control files are used. The
reason for the redundancy is that control files are
absolutely essential for the database to run. If any control
file is damaged or lost, the database will need to be shut
down and repaired.
• The DBA should create the database with no fewer than
three control files, located on separate disks with separate
controllers. Control files are named with ctl suffix.

Oracle DBA on Unix and Linux


Oracle File Types (ext.)

Data Files
• Data files store the information accessed by the
database. There are five categories of data files, each
distinguished by the type of information it stores.
• Data files are physical objects, but they are organized
logically within the database as tablespaces. One or
more of the same type of data file compose a logical
tablespace.

Oracle DBA on Unix and Linux


Data File Types (ext.)

System
• System data file is stored in the data dictionary, which is
a read-only collection of tables and views owned by the
user SYS. And it contains relational tables containing
internal database information of both a physical and
logical nature.
• If the system data file becomes damaged or lost, the
database will crash immediately and require recovery. If
the system data file is lost, the database is rendered
useless.
• The system data file typically ends with a dbf suffix.

Oracle DBA on Unix and Linux


Data File Types (ext.)
Data
• Any user can write to a data file if he has a space quota
for that tablespace. Each user is assigned one default
tablespace containing one or more data files in which the
user can create tables.
• There usually are many data files in a database.
Tablespaces are often composed of several data files.
• Data files are not actually required for a database, but if
you lose a data file while the database is running, you
will lose access to any data contained in that file.
• A data file typically has a dbf suffix.

Oracle DBA on Unix and Linux


Data File Types (ext.)

Index
• Tables are created in data files and hold actual data.
And that data can be indexed to provide faster access.
• If you lose an index file, the database will still continue to
operate, but the associated loss of performance and
some index-dependent operations may render the
database useless from a business perspective.
• Each index file may contain indexes from multiple tables.
It typically ends with a idx suffix.

Oracle DBA on Unix and Linux


Data File Types (ext.)
Rollback
• Transaction Rollback
When a user updates a row in a table, the old value is stored in the
rollback segment in the event the user decides to roll back (or undo)
the statement.
• Transaction Recovery
If the database instance crashes before the statement can be
committed, the statement will be rolled back (undone) during
instance recovery.
• Read Consistency
Once the users start modifying data, they will be the only person
seeing those changes until they are made permanent with a commit.
Other users on the system will not see the uncommitted changes.

Oracle DBA on Unix and Linux


Oracle File Types (ext.)

Online Redo Logs


• Oracle requires two redo log groups. A redo log group
consists of one or more files called members.when
Oracle performs a log switch, it stops writing to mone
group and begins writing to the next group.
• Multiplexing involves creating multiple members for each
group. Each member is the same size but is located on a
different disk and controller to minimize the chance of
losing both members.

Oracle DBA on Unix and Linux


Memory Structures
• There are three memory structures the DBA focuses on:

- Shared Global Area (SGA);


- Program Global Area (PGA);
- User Global Area (UGA).

Oracle DBA on Unix and Linux


Memory Structures (ext.)

• Shared Global Area (SGA) =

database buffer cache


+ Redo Buffers (redo log buffer)
+ Variable Size (shared pool+large pool+Java
pool)
+ Fixed Size

Oracle DBA on Unix and Linux


Database Buffer Cache
A block in the buffer cache can be in one of three states:
current, dirty, or pinned.
• a block is current if it is the same in the buffer as it is on
disk.
• Dirty blocks are those blocks that have been modified
by a process and must be written to disk before they can
be reused.
• A pinned block buffer is one that is currently being used.

Oracle DBA on Unix and Linux


Database Buffer Cache
System Global Area (SGA

Database Buffer Cache Redo Log Buffer


LRU Least Recently Used List MRU End

Blocks Cycle Through List Based on State and Usage Shared Pool

Large Pool
Mid-Point Insertion
For 8i and above
) Dirty List
Server
Insert blocks at end DWBR Process Insert blocks at head of LRU list
For Full Table Scans

Server Dirty Blocks are moved to Dirty


Process List and later written back to
Data
disk by DBWR
Index
LRU and Dirty Block
Rollback
Lists in the Buffer Cache

Oracle DBA on Unix and Linux


Shared Pool
• The shared pool provides caching in memory to improve
performance for the same reasons as does the database buffer
cache.
• It is composed of two caches:
- Data Dictionary Cache: holds information about database objects
such as table definitions and privileges in memory. Data dictionary
information stored in the system tablespace.
- Library Cache: stores the text of SQL and PL/SQL blocks, the
corresponding parsed SQL and PL/SQL statements, and their
execution plans.
• Neither the data dictionary cache nor the library cache can be sized
directly. Both are sized together with the database parameter
SHARED_POOL_SIZE.

Oracle DBA on Unix and Linux


Redo Log Buffer

• The redo log buffer contains a record of any change to


the database. These include any type of insert, update,
or delete activity in Data Manipulation Language (DML),
as well as any changes to the database such as creating
or dropping objects in DML.
• When a user process makes a change to a row or data
object, Oracle writes that to this buffer. While that
change may later be rolled back, it is still recorded.
• The redo log buffer is sized by the database start-up
parameter LOG_BUFFER.

Oracle DBA on Unix and Linux


Large Pool
• The large pool is used to aid:
1. User Global Area (UGA) session memory when using a Multi Threaded
Server (MTS) configuration.
2. Extended Architecture (XA)
3. I/O slaves
4. Recovery manager (RMAN) backup and restore activities

• The parameter LARGE_POOL_SIZE configures the size of the memory


area in bytes.

Oracle DBA on Unix and Linux


Java Pool
• It is used to store shared Java objects, especially during
loading of classes.
• The parameter JAVA_POOL_SIZE sizes the Java pool
in bytes.

Oracle DBA on Unix and Linux


PGA and VGA
• The Program Global Area (PGA) is also referred to as the
Process Global Area. One PGA is allocated for each dedicated
server process spawned. The PGA contains user session data,
stack space, and cursor state information for its process.
• The User Global Area (UGA) is a subset of the PGA. It contains
the user session data and cursor information. Sorts for each
user occur first in this area. If the sort exceeds the value set in
SORT_AREA_SIZE, it will be moved to disk in the temporary
tablespace.
• PGA and UGA are both stored outside the SGA.

Oracle DBA on Unix and Linux


PGA and VGA (ext.)
System Global Area (SGA)

Shared Pool PGA/UGA Under MTS cofiguration


Redo Log Buffer Stores UGA if no Large
Pool
Large Pool
UGA UGA
Database Buffer Cache •User Session Data •User Session Data
•Memory Sorts •Memory Sorts
•Cursor Info •Cursor Info

Dispatcher
PGA/UGA Under Dedicated Server Configuration

PGA PGA
Stack Space Stack Space PGA PGA
UGA UGA •Stack Space •Stack Space
•User Session Data •User Session Data
•Memory Sorts •Memory Sorts
•Cursor Info •Cursor Info

User User
User User

Oracle DBA on Unix and Linux


Oracle Processes
Server processes
• When a user process has a request for work, that work is
done by a server process. Reading data from disk and
placing it in memory also is done by the server process.
• Dedicated Server
• Multi Threaded Server (MTS)

Oracle DBA on Unix and Linux


Oracle Processes (ext.)
Background Processes
• Background processes perform much of the legwork between the
memory structures and disks. Anytime data is written from memory
to disk, it is done by a background process.
• Background structures exist only when the database instance is
running.
• Unix command for seeing the background processes:
ps –ef | grep –I database_sid

Oracle DBA on Unix and Linux


Oracle Processes (ext.)
System Monitor Process (SMON)
SMON automatically performs the following activities:
• Instance recovery after a crash. This is the “roll forward” and “roll back”
stage in which transactions are resolved to the last completed checkpoint.
• Coalesces free space on disk within dictionary managed tablespaces if the
PCTFREE parameter is greater than 0. this applies to tables and indexes.
• Recovery of space used by temporary segments.

Oracle DBA on Unix and Linux


Oracle Processes (ext.)
Process Monitor Process (PMON)
• PMON cleans up abnormally terminated user processes. This includes
rolling back aprocess’s transaction and releasing its resources such as
transaction locks and memory.
• PMON also detects and resolves deadlocks by rolling back the
deadlocking transaction.
• If the database is set to use MTS, PMON will restart dispatcher and
server processes that have died unnaturally.

Oracle DBA on Unix and Linux


Oracle Processes (ext.)
Database Writer Process (DBWn)
• DBWn writes modified (dirty) blocks from the database buffer to disk. (includes committed
and uncommitted data.)
• DBWR writes blocks at:
- Every three seconds.
- When Oracle cannot find a free block in the LRU list as dictated by the Least Recently Used algorithm.
- When the number of dirty blocks in the buffer exceeds the value defined by the DBA in the start-up
parameter file (init.ora).
- At any system checkpoint (CKPT).
- When an object is dropped from the database.
- When a tablespace is offlined.
- At the beginning of a hot tablespace backup.

Oracle DBA on Unix and Linux


Oracle Processes (ext.)
Log Writer Process (LGWR)
• LGWR writes all the entries from the redo log buffer to the active online redo log
group. If there are two or more files int eh online redo log group, LGWR will write
to all the members in that group simultaneously.
• LGWR writes to the active log group under:
- Every three seconds.
- After a commit is issued.
- When the redo log buffer reaches one third full.
- When DBWR writes.
- During a checkpoint.

Oracle DBA on Unix and Linux


Oracle Processes (ext.)
Checkpoint Process (CKPT)
• CKPT is when Oracle takes a moment to flush its buffers and synchronize all
its files. During a checkpoint, all the database file headers and control files are
updated with the checkpoint sequence number.
• Memory buffers are also cleared during a checkpoint. All the modified (dirty)
blocks in the database buffer cache are written to disk by the DBWR process.
Also, the entire redo log buffer is written to disk by LGWR.

Oracle DBA on Unix and Linux


Oracle Processes (ext.)
Checkpoint Process (CKPT)
• CKPT occurs at:
- Every time a redo low switch occurs.
- When manually initiated by the DBA with SLTER SYSTEM CHECKPOINT.
- Just before any database shutdown except for a shutdown abort.
- When a tablespace is taken offline.
- At the beginning of a hot tablespace backup.
- After the specified time since the last checkpoint as defined by the parameter
LOG_CHECKPOINT_TIMEOUT.
- After the specified number of OS blocks have been written to the online redo log files since the last
checkpoint.

Oracle DBA on Unix and Linux


Oracle Processes (ext.)
Archiver Process (ARCn)
Recover Process (RECO)
Job Queue Processes (SNPnn)
Queue Monitor Processes (QMNnn)
Dispatcher Processes (Dnnn)
Shared Server Processes (Snnn)

Oracle DBA on Unix and Linux


Transaction Control
System Global Area (SGA)
Database Buffer Cache
Redo Log Buffer 12 8 Shared Pool 17 19
15 9
Libarary Cache 67
LRU List 10
11
16
Data Dictionary Cache
Server 7
Process Server
Process

LGWR DBWR DBWR DBWR

Server Process
PGA 5
Redo1.rdo Rollback Index Data
UGA 6
19 17
3
2 Listener
15 10 15 16 10 16 9 16 4

1
User Process User at PC

Oracle DBA on Unix and Linux


Miscellaneous Database Files
• Database Parameter/ Log files
- init.ora
- config.ora
- alert.log

• Oracle software installation files


- oratab
- tnsnames.ora
- listener.ora
- sqlnet.ora

Oracle DBA on Unix and Linux


END

Oracle DBA on Unix and Linux

You might also like