Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
127 views

Oracle Database 11g: Administration I

This document provides an overview of Oracle Database 11g architecture and administration. It discusses the three main structures that make up an Oracle instance: memory structures, process structures, and storage structures. It also describes relational and object-relational databases, focusing on how Oracle is both relational and object-oriented. Key memory areas like the system global area and program global area are explained.

Uploaded by

Abhinav
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
127 views

Oracle Database 11g: Administration I

This document provides an overview of Oracle Database 11g architecture and administration. It discusses the three main structures that make up an Oracle instance: memory structures, process structures, and storage structures. It also describes relational and object-relational databases, focusing on how Oracle is both relational and object-oriented. Key memory areas like the system global area and program global area are explained.

Uploaded by

Abhinav
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 7

Oracle Database 11g : Administration I

Trainers Name : Tim Warner

A Great Reference : Oracle Database Administration for Microsoft SQL Server DBA’s by Michelle
Melcher

Also visit : Oracle Database 11g Document Library(Google it)

Exploring the Oracle Database Architecture

The three chief structures that make up an Oracle Instance are

1. Memory Structures
2. Process Structures
3. Storage Structures

Database Basics

Database can be defined as a system to organize, store and retrieve data. Organization deals with
database design and normalization, storage deals with referential integrity, table relationships,
constraints and columns and retrieval deals with SQL statements like select, reporting etc.

Relational Database

Traditionally we have termed database as either a Flatfile Database or Relational database. A flatfile
database generally is just a single table like a excel sheet which has columns and rows to store data with
each rows being a discreet entity in that flaatfile database. The problem in FF db is that there is no
relationship b/w what we call in excel spreadsheets as tabs so over time human errors such as
duplication of data and data integrity issues occur due to the lack of referential integrity.

There are people who prefer FF db over Relational dtabase (for more details about this search for
NoSQL) but because we are studying about Oracle database which in itself is an example of relational db
we will have to get a good grasp of RDB.

Relational database is a database that consists of two or more linked tables and a linked table is
essentially a shared column meant to achieve integrity b/w those related tables which is chiefly
intended to eliminate data redundancy.

Object-Relational Database

Oracle is also called object relational database as it takes all the relational database principles and
applies it to the Object oriented Programming or OOP model (OOP is the standard way to develop
software and OO languages such as Oracle’s own JAVA has the same goals as the RDB’s such as Object
Reuse, Object Consistency and removal of Duplicate work and duplicate data). We have objects which
are discreet instantiations of classes which in OO terminology are blueprints of different objects. We put
our rules in our class and each time we instantiate an object of that class its initially created just like a
cookie cutter exactly like the template which is called inheritance.

As far as Programming languages are considered Oracle gives us some choices Java being Oracle’s own
product is a natural choice for DBA’s its imperative that we learn the Structured Query Language which
is our standard data access language and then we have PL/SQL which is Oracle’s own procedural SQL it
allows us to apply programming logic to SQL as SQL, on its own is just concerned with data retrieval,
data creation data update, PL/SQL allows you to take your code and put it on another level as far as the
intelligence is concerned.

Memory Structures

In Oracle’s own literature an Oracle Instance refers to several memory structures and background
processes that support only one database we could consider the oracle server to be an instance
connected to a database in a 1 to 1 relationship so it is important here to remember that unlike MySQL
or SQL server environment where you can pop up new database as often as you want its not like that in
Oracle, every database needs an instance to plug into and the instance provides the memory(physical
RAM+virtual RAM(hard disk space used as SWAP space)) and we have series of background processes
each has a role to play in database operations.

Real Application Clusters(RAC) environments where we have multiple instance or multiple installation of
Oracle 11g all focused on the same single database. Clustering is important if we need 24/7 uptime
because then we can schedule maintenance on any single node and as long as we have at least one
active RAC nodes servicing the databaes and servicing user connections the database is still online .

Difference b/w the System Global Area and Programme Global Area in Memory Structures

Note to self: Remember that any data residing in memory is volatile and will go away when the system is
shut down or restarted.

SGA is a partitioned collection of memory it’s a memory structure so when we bring up an instance and
attach it to a database Oracle a bunch of RAM into compartments or substructures some of them are
required like the databse buffer cache the log buffer the shared pool and some if them are optional like
the Large Pool the Java Pool or the Streams Pool.

Database Buffer is an area of memory that’s used as a scratch space for SQL its role is crucial coz it
temporarily stores recent user queries as well as the changes that are made to the underlying data files.
Here we have to remember that we have to do as much work as possible on the Memory as opposed to
the Hard Disk because the difference in I/O is huge. When we get to Process Structures we are going to
learn that a background process called the Database Writer performs what is called ‘Lazy Writes’ in the
background by taking modified data blocks lets say a user were to coonect to your database and make
some changes into it, initially those changed blocks will be queued in the database buffer and memory
when a commit (explained later) occurs the database writer takes that changed information and
incorporates it into the data files where they are permanently stored in the database. Another Memory
area called the Log Buffer is a staging area for a REDO log which is basically a core transcriptionist or a
repository that stores all the SQL statements that modify data in a database. The idea with the redo log
is that if something happens to the database then we can bring up all the SQL statements stored in the
redo log to bring the database up to speed so to decrease the contention with the hard disk we have Log
Buffer that stores and queues up those SQL statements and then another background process called the
log writer that periodically flushes the log and record those SQL statements onto the online redo log
files.

Shared Pool the shared pool stores parsed SQL/ PL/SQL code, parameters, data dictionary information,
so the shared almost is always in use as long as the database is up. When Oracle solves or satisfies a user
query it stores the execution plan into the shared pool so that if another user comes up with the same
SQL statement the execution plan being already stored in memory the user gets a much better
response.

Program Global Area – When we install Oracle database its in Dedicated Server Mode and we have one
Server Process spawned for every user sessions. So if we have five simultaneous users then all of them
have their own server process that runs not on the client but on the Oracle Server and each user has its
memory space also called the PGA. Within PGA each user has a scratch space for sorting, for queries/
SQL etc.
The above pic taken from Oracle documentation shows us pictorially what happens inside Oracle
Database

We have in the instance on the Server the SGA and within the SGA are the essential and optional
components. Op com Such as the JAVA pool for Java operations for running Oracle in conjuction with
the Java application server. Outside of the SGA in each user box they spawn a connection but its
important to understand that most of the heavy processing is being done on the Oracle Server and not
on the User’s machine. SO the PGA and the server processes act like proxies for the connected user. So
when a user accesses the Oracle Server through web applications/desktop application than that session
has its own memory space on the server and because sucha process will consume a lot of RAM, Oracle
lets us configure the Server in a Shared Mode where we have a connection pool instead of separate
PGA’s.

Sizing the Memory Structures

In contrast to the previous version of Oracle Database where we had to manually size the Memory
Structures the Oracle Database 11g has Automated Memory Management(AMM) so we can either
configure the memory size ourself or employ the AMM to control both the SGA and the PGA, we can set
a single Initialization Parameter its called Memory_Target and that for Oracle is the System wide usable
memory and so Oracle sizes its SGA and PGA’s according the Target memory allocated to it via the above
Parameter. We can selectively employ AMM for SGA or PGA or we can go for Manual Shared Memory
Management(MSMM). Specifically how do we size the memory is by logging into SQL*Plus and run an
Alter System Set command to change the memory target value (Note Any changes made to the sizing or
configuration of Memory Structures modifies the Server Parameter file(spfile)). When we create a
database using the Database Configuration Assistants one of the screens allows you to size memory
either by AMM or MSMM. Finally if we are going for Graphical Setup then we have Oracle Enterprise
Manager Console that doesn’t require the user to have any knowledge of Oracle.

We can examine the memory structures of an Oracle Database either through the SQL Plus client or
through the Enterprise Manager. Once logged in to the Enterprise manager or Database Control we can
navigate from Home to the Server page where we have Database Configurations specifically Memory
Advisor where we can enable or disable AMM, we have Total Memory Size and Maximum Memory Size
ie the memory allocated to the Database, we have graphs for Allocation History, SGA and PGA. Then at
the very bottom we have a metadata pooled from the data dictionary that shows us the SGA/PGA
components like the Shared Pool, Buffer Cache, Large Pool, Java Pool etc and their current allocation
size and then applying the changes made to the SPfile and the running instances.

On this page if we click showSQL it will Display something along the lines of this

ALTTER SYSTEM SET memory_target = 838860800 SCOPE=BOTH

Now to change the above value we will open the command terminal, log into the SQL Plus with our login
credentials, like :

SQL> show parameter memory

Now we will see both memory target and memory max target, So,

SQL> alter system set memory_target = 750M //as an example

Then SQL plus gives us another line no. where we will terminate our statement with a semicolon like :

2 ; //2 is the line no. automatically generated by the command terminal

System altered.

Now

SQL> show parameter memory_target

Gives us the new value of the memory_target (which in our case is 750M). Since our parameter scope is
set to both it will apply to the currently running instance as well as it will be recorded into the Server
Parameter file so that if we were to restart the database we will still retain that change. To look at
current sizing of our SGA through the command terminal, we can query our v$ dynamic performance
views

SQL> select * from v$sga // gives us our buffer sizes

SQL>select * from v$sgainfo //to get some more information such as the size of our buffers and
caches and wether they are dynamically resizable or not (Note: we can always change these settings in
the spfile).

SQL> host //takes us to our OS environment and exit command takes us to


the SQL Plus environment.

SQL>disconnect // disconnects us from SQL Plus but keeps the session active

SQL>exit // terminates the session.

SQL> select owner, view name

2 from dba views

3 where view_name like ‘V%’; //names starting from V, gives a lot of info

SQL> spool on //turns on spooling

SQL> spool C:\spool.txt

SQL> list //shows us the last command or query in our buffer as SQL Plus only
remembers last single statement that we have created.

1 select owner, view name

2 from dba views

3* where view_name like ‘V%’;

SQL> / //list all the dba starting with letter V and save it to the spool.txt file

SQL> spool off // turns off spooling

Oracle Background Process

Oracle Background Processes are the second part of the Oracle instance, first being the memory
structures.

Process is an instance of Computer Program that is being executed.


Characteristic of Background Processes are that they tend to start with the instance and generally they
stop when instance shuts down for example Windows Services. Oracle running on windows keeps all its
processes under a master process called ORACLE.EXE. This is one of the relatively few big differences
between Oracle running on UNIX and Windows. Under Linux the background processes are individually
id’d so we see them individually when we run the -ps command where as in Windows the background
processes run as threads under one master process. We can interact with those background processes
directly from SQL Plus by running the query ‘select program from V$process order by program’, here
v$process is the data dictionary view or V$ view or Dynamic Performance view (aliases for these built in
processes are affixed with V$) as they provide us with dynamically changing information depending on
the current state of the database.

Major Background Processes

1. SMON is the system monitor it’s our main house keeper of the oracle instance responsible for
mounting, opening and closing the database, performs system re

You might also like