Sunday 24 July 2016

TRAINING (ORA-1) - Oracle Technical Architecture


Instance: Memory Structures and Background Processes




Memory Structures:

1.) Shared Pool Shared Pool is further subdivided into a number of other structures.

i.) 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, and it is a slow process that Oracle does on demand. By caching parsed code in the shared pool so that it can be reused without reparsing, performance can be greatly improved.
ii.) Data Dictionary Cache
The data dictionary cache stores recently used object definitions: descriptions of tables, indexes, users, and other metadata definitions. Keeping such definitions in memory, rather than having to read them repeatedly from the data dictionary on disk, enhances performance.

2.) Database Buffer Cache
Database Buffer Cache is Oracle’s work area for executing SQL. Users don’t ever update data on disk. They copy data into the database buffer cache and update it there, in memory. Ideally, all the data that is frequently accessed will be in the database buffer cache, therefore minimizing the need for disk I/O.

3.) Log Buffer
Log Buffer is a very small memory structure used as a short-term staging area for all changes that are applied to data in the database buffer cache.

4.) Large Pool 
Large Pool is an optional area that, if created, will be used automatically by various processes that would otherwise take memory from the shared pool.

5.) Java Pool 
Java Pool is required only if your application is going to run Java stored procedures within the database: it is used for the heap space needed to instantiate the Java objects. However, a number of Oracle options are written in Java, so the Java pool is considered standard nowadays.
Streams Pool is used by Oracle streams, an advanced tool that is beyond the scope of this session.


Background Processes:

SMON
SMON’s major function is opening the database: enabling the connection between the instance and a database. During normal running, it carries out a number of monitoring and tidying-up operations.

PMON
PMON looks after user sessions, taking appropriate action if a session gets into trouble. For instance, if a user’s PC reboots while the user is logged on to the database, PMON will detect this and tidy up whatever work the user had in progress.

DBWn 
DBWn process or processes (by default, an instance will have one database writer per eight CPUs) is responsible for all writing to datafiles. Remember no sessions ever update data on disk; they update only data in the database buffer cache: all updates are then funneled through the DBWn to disk. In general, DBWn writes as little and as rarely as possible. The assumption is that disk I/O is bad for performance, so Oracle keeps it to a minimum.

LGWR 
LGWR propagates all changes applied to data in the database buffer cache to the online redo log files on disk. In contrast with DBWn, this disk write activity is done as near as possible in real time—and when you issue the COMMIT statement, it really is done in real time: it immediately flushes the changes from their small and temporary staging area, the log buffer in the SGA, to the online redo log files on disk. This is to ensure that all users’ work is saved so that, in the event of damage to the database’s datafiles, the changes can be applied to a restored backup. In this manner Oracle can guarantee that data will never be lost.

CKPT
CKPT process is responsible for ensuring that, from time to time, the instance is synchronized with the database. In principle, the database is always out of date: there will be changes that have been applied in memory that have not yet been written to the datafiles by DBWn (though the changes themselves will have been streamed out to the online redo log files by LGWR as they happen). There are occasions when it is necessary to force a write of all changed data from the database buffer cache to the datafiles, to bring the database right up-to-date. The CKPT process controls the frequency of this.

No comments:

Post a Comment