Top Banner
DBA Database Administration
39
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: 2 chapter exploring the database architecture

DBADatabase Administration

Page 2: 2 chapter exploring the database architecture

Oracle Products

• Server Technologies– Oracle Database– Oracle Application Server– Oracle Enterprise Manager

• Development Tools– Languages– Oracle Developer Suite

• Applications– Oracle E-Business Suite– Oracle Collaboration Suite

Page 3: 2 chapter exploring the database architecture

Server Technologies

• Database Server– Repository of data without effective limit of data

• Application Server– a platform for developing, deploying, and

managing web applications. (Three tier applications)

Page 4: 2 chapter exploring the database architecture

Server Technologies

• Enterprise Manager– Database Control: A graphical tool for managing one

database.• It facilitates real-time management and monitoring for

scheduled jobs like backup operations

– Application Server Control• Graphical tool for managing one application server

instance or group of instances

– Grid Control• A management repository to manage all the databases

and application servers wherever they may be.

Page 5: 2 chapter exploring the database architecture

Role of an Oracle DBA

• Each database requires at least one database administrator (DBA) to administer it. – Installing and upgrading the Oracle server and application

tools– Allocating system storage and planning future storage

requirements for the database system– Creating primary database storage structures (tablespaces)

after application developers have designed an application– Creating primary objects (tables, views, indexes) once

application developers have designed an application– Modifying the database structure, as necessary, from

information given by application developers

Page 6: 2 chapter exploring the database architecture

Role of an Oracle DBA

– Enrolling users and maintaining system security– Ensuring compliance with your Oracle license agreement– Controlling and monitoring user access to the database– Monitoring and optimizing the performance of the

database– Planning for backup and recovery of database information– Maintaining archived data on tape– Backing up and restoring the database– Contacting Oracle Corporation for technical support

Page 7: 2 chapter exploring the database architecture

Oracle Architecture

Oracle architecture consists on two entities• Database– collection of data and supporting files on storage

disks on host computer• Instance– collection computer processes of one database in

memory – area of memory shared by these processes

Page 8: 2 chapter exploring the database architecture

Oracle Instance vs Other DBs Instance

• Oracle instance is different from other DBs like MS SQL Server, MySQL or IBM DB2– Collection of databases in one instance that shares

common memory– One-to-Many relationship between instance and

database• Relationship between instance and DB in oracle is

either – One-to-one OR– Many-to-one

Page 9: 2 chapter exploring the database architecture

Oracle Instance Relationship

• One-to-one– One instance per database

• Many-to-one– Real Application Clusters (RAC)– Database lives on shared disks– Instance on multiple computers attach to the db.

Page 10: 2 chapter exploring the database architecture

Instance

• The instance consists of memory and processes.

• Instance exists in RAM• The life time of instance as long as it exists in

the memory

Page 11: 2 chapter exploring the database architecture

Instance

• Memory– System Global Area (SGA): Shared memory

segments provided by operating systems– Program Global Area (PGA): Non-shared memory

area associated with server processes.• Processes– Background: The processes that make up the

instance called background processes– Foreground: The server processes

Page 12: 2 chapter exploring the database architecture

User & Oracle Interaction

Page 13: 2 chapter exploring the database architecture

• A user interacts with a user process.• A user process interacts with a server process.• A server process interacts with an instance.• An instance interacts with a database.

User & Oracle Interaction

Page 14: 2 chapter exploring the database architecture

System Global Area (SGA)

• The memory structures, which are implemented in shared memory segments provided by the operating system,

• Allocated at instance startup and released at instance shutdown.

• It is divided in• Buffer cache• Shared pool• Log buffer

Page 15: 2 chapter exploring the database architecture

Buffer Cache

• Largest portion of SGA• Working area of oracle to execute SQL.• User’s session don’t directly update data on disk

– Required data in blocks is first brought to buffer cache– Changes are applied on the data in buffer cache– Retrieving the data also goes via buffer cache

• Data is first accessed from buffer cache if not found than it has to be searched into the disk

• A buffer storing a block whose image is different from the block at disk will be called dirty buffer

• Clean buffer where block at buffer and block at disk have identical image

Page 16: 2 chapter exploring the database architecture

Log Buffer

• A small, short-term memory area for change vectors before they are written to redo log files on disk.

• A change vector is an update/modification applied to data.

• Redo log is the database guarantee that data will never be lost.

Page 17: 2 chapter exploring the database architecture

Log Buffer

• Redo is written directly to the redo log files by session server process

• If written to the disk directly sessions would wait for disk I/O.

• Redo log is written to redo log buffer in memory area first which is faster than disk writing

• Log buffer may containing the change vectors of many transactions will eventually write the redo log file

Page 18: 2 chapter exploring the database architecture

Log Buffer

• Size of log buffer is not very big, a big size log buffer will have a bad effect on performance

• Log buffer size can be increased, but cannot be decreased less than the default value.

• Default value ranges from 5 to 32 MB depending upon the SGA size, CPU and operating system

• Log buffer is allocated at the startup of instance and it cannot be changed without restarting instance

Page 19: 2 chapter exploring the database architecture

Shared pool

• Most complex structure of SAG• Shard pool components– The Library Cache– The data dictionary cache– The PL/SQL area– SQL Query and PL/SQL Function result cache

• The shared pool size is dynamic and can be automatically managed.

Page 20: 2 chapter exploring the database architecture

The Library Cache

• The library cache is a memory area for storing recently executed code, in its parsed form.

• Parsing is the conversion of code written by programmers into something executable.

• Parsing SQL code takes time– SELECT * FROM employees where first_name =

‘Shahbaz’• Before this statement can be executed, the Oracle

server has to work out what it means, and how to execute it.

Page 21: 2 chapter exploring the database architecture

The Library Cache

• To begin with, – what is employees? Is it a table, or a view? – Does it even exist? – Then the “*”—what are the columns that make up the

employees table– Does the user have permission to see the table– After statement understanding the server has to decide out

how best to execute it• The purpose of the Library Cache of the shared pool is

to store statements in their parsed.• Ready for execution

Page 22: 2 chapter exploring the database architecture

The Dictionary Cache

• Also called row cache• Stores recently used object definition in the

cache• Object definitions are available for all users

from cache to enhance the performance• It speeds up the parsing process

Page 23: 2 chapter exploring the database architecture

The PL/SQL Area

• These are functions, procedures and triggers stored with source code in Data Dictionary

• When a user call for any of these objects, it must be read from Data Dictionary

• To avoid repeated reading the objects are placed in PL/SQL area

Page 24: 2 chapter exploring the database architecture

The SQL Query and PL/SQL Function Result Cache

• It is a new feature in 11g• If same query is executed by one session or

many.• The results of such query is stored in the

Result cache• Result cache is intelligent enough to track the

changes in the tables as well• It always give updated results

Page 25: 2 chapter exploring the database architecture

Foreground Process

• Started when a used connects to the database– Foreground Process checks user’s permission • to access data• generating query• Retrieving data blocks into buffer cache and modifying

them

– Before modifying creates copy of data for undo– Creates entries for undo/redo log– It terminates when a user session is terminated

Page 26: 2 chapter exploring the database architecture

Background Process

• It lives from database startup to shut down– The Database Writer (DBWR) process is

responsible transferring modified data blocks to data files.

– Multiple DBWR can be created to share the load– DBWr writes data on four condition• No free buffers• Too many dirty buffers• A three second timeout• A checkpoint occurs

Page 27: 2 chapter exploring the database architecture

– The Log Writer (LGWR) transfers all the undo/redo entries in the log buffer to the redo log files

– When a session issues a COMMIT, the LGWR writes in real time: the session hangs while LGWR writes

– LGWR is an ultimate bottleneck in the Oracle performance.– There three conditions that will cause LGWR to execute

• Write on commit• If Log buffer one-third full• If DBWr is about to write dirty buffers

– The Archiver (ARCH) makes copies of redo log files when they fill up

Background Process

Page 28: 2 chapter exploring the database architecture

Background Process

• Check point process – Change block are not immediately transferred to

the data files– Changes are copied in batches– After a frequent intervals data is synchronized with

data files to store any modified data remaining any modified data into disk

– System Change Number (SCN) is maintained to record the change or update

– This is called check point

Page 29: 2 chapter exploring the database architecture

• The Process Monitor (PMON) – Watches the progress of database connection– In case of disconnection it initiates necessary roll

back• The System Monitor (SMON)– Mounts and open oracle DB– Perform any clean up activities in case of database

abnormal shut down– It uses redo log to perform clean activities

Background Process

Page 30: 2 chapter exploring the database architecture

Oracle Database

• Software– Server Side– Client Side

• Configuration Files– pfile (text file)– spfile (binary file)

• Data Files• Temporary Files• Redo Log Files

Page 31: 2 chapter exploring the database architecture

Data Files• Every Oracle database has one or more physical datafiles, which

contain all the database data like table & indexes.• The biggest component of Oracle Files

– Data files are grouped in logical space called tablesapce • Tablespaces should be only for the purpose indicated by its name• Some of tablespaces are

– System– SYSAUX– Data– Index– UNDO– Temp

Page 32: 2 chapter exploring the database architecture

Control File

• Used while starting of the DB• Contains following information about DB– Name & location of data files– Name & location of archived redo log files– Time stamp of database creation

• It is also a very critical file• Oracle keeps multiple copies of this file in

perfect synchronization• A control file is also used in database recovery.

Page 33: 2 chapter exploring the database architecture

Configuration/Parameter Files

• Settings for database startup– pfile (text) referred as init.ora– Spfile (binary)

• Listener.ora– Controls the operation of the listener– A process when user starts a DB connection

• Tnsnames.ora contains location of DB.

Page 34: 2 chapter exploring the database architecture

Temporary Files

• Oracle process uses a private work area called Program Global Area (PGA)

• PGA to hold intermediate results (i.e.) data sorting

• Temporary files are used to store intermediate results

Page 35: 2 chapter exploring the database architecture

Redo Log Files

• For transaction durability oracle stores– UNDO and REDO information

• Log Writer (LGWR) process writes the UNDO and REDO information to the log file.

• Size of REDO log file is decided by the DBA• REDO Log files are very important and must be

backed up.• A mirror of REDO log files is referred as REDO

Log Group

Page 36: 2 chapter exploring the database architecture

Archived Redo Log Files

• Redo File fills up, Archiver makes one or more copies of it locations specified by the DBA

• Copies enables Oracle to redo/undo data from the past history or even if the current redo file is damaged

Page 37: 2 chapter exploring the database architecture

Event Logs

• Oracle keeps log of important events– Start up– Shut down– DDL operations– User session creation– Errors

• Some log files used by oracle– Alert log stores DDL operation, start up, shutdown– Listener log stores user session– Trace file to log erros

Page 38: 2 chapter exploring the database architecture

Database Backup

• Backup files contain the backup of original data

• Backup copies are called flashback recovery area

Page 39: 2 chapter exploring the database architecture

Oracle Database

• Archived Redo Log Files• Control File• Event Logs• Database Backups