oracle database architecture overview

58
Oracle Database Architecture overview There are two terms that are used with Oracle Database - A collection of physical operating system files Instance - A set of Oracle processes and a SGA (allocation of memory) These two are very closely related but a database can be mounted and opened by many instances. An instance may mount and open only a single database at any one point in time. The File Structure The are a number of different file types that make up a database Parameter File - These files tells Oracle were to find the control files. Also they detail how big the memory area will be, etc Data Files - These hold the tables, indexes and all other segments Temp Files - used for disk-based sorting and temporary storage Redo Log Files - Our transaction logs Undo log files - allows a user to rollback a transaction and provides read consistency. Archive Log Files - Redo log files which have been archived Control File - Details the location of data and log files and other relevant information about their state. Password File - Used to authenticate users logging in into the database.

Upload: sravankumarthadakamalla

Post on 19-Aug-2015

257 views

Category:

Documents


5 download

DESCRIPTION

or

TRANSCRIPT

Oracle Database Architecture overviewThere are two terms that are used with Oracle Database - A collection of physical operating system files Instance - A set of Oracle processes and a SGA (allocation of memory)These two are very closely related but a database can be mounted and opened by many instances. An instance may mount and open only a single database at any one point in time.The File StructureThe are a number of different file types that mae up a database Parameter File - These files tells Oracle were to find the control files. Also they detail how big the memory area will be! etc Data Files - These hold the tables! inde"es and all other segments Temp Files - used for dis-based sorting and temporary storage Redo Log Files - Our transaction logs Undo log files - allows a user to rollbac a transaction and provides read consistency. Archive Log Files - #edo log files which have been archived Control File - $etails the location of data and log files and other relevant information about their state. Password File - %sed to authenticate users logging in into the database. Log files - alert.log contains database changes and events including startup information. trace files - are debugging files.Parameter Files&n order for Oracle to start it needs some basically information! this information is supplied by using a parameter file. The parameter file can be either a pfile or a spfile' pfile - a very simple plain te"t file which can be manually edited via vi or notepad spfile - a binary which cannot be manually edited (Oracle (i or higher re)uired)The parameter file for Oracle is the commonly now file init.ora or init.ora! the file contains ey*value pairs of information that Oracle uses when starting the database. The file contains information such as database name! caches si+es! location of control files! etc.,y $efault the location of the parameter file is windows - -O#A./01 2O304database uni" - -O#A./01 2O30*dbsThe main difference between the spfile and pfile is that instance parameters can be changed dynamically using a spfile! where as you re)uire a instance reboot to load pfile parameters.To convert the file from one of the other you can perform the followingcreate pfile using a spfile create pfile='c:\oracle\pfile\initD10.ora' from spfile;startup db using pfile startup pfile='c:\oracle\pfile\initD10.ora';create spfile using a pfile create spfile from pfile;Display spfile location show parameter spfileData Files,y $efault Oracle will create at least two data files! the system data file which holds the data dictionary and sysaux data file which non-dictionary ob5ects are stored! however there will be many more which will hold various types of data! a data file will belong to one tablespace only (see tablespaces for further details).$ata files can be stored on a number of different filesystem types .ooed - these are normally filesystems that can be accessed using 6ls6 commands in uni" #aw - these are raw dis partitions which cannot be viewed! normally used to avoid filesystem buffering. AS3 - automatic storage management is Oracle new database filesystem (see asm for further details). .lustered 7S - this is a special filesystem used in Oracle #A. environments.$ata files contain the following Segments - are database ob5ects! a table! a inde"! rollbac segments. 0very ob5ect that consumes space is a segment. Segments themselves consist of one or more e"tents. !tents - are a contiguous allocation of space in a file. 0"tents! in turn! consist of data blocs "loc#s - are the smallest unit of space allocation in Oracle. ,locs normally are89,! :9,! ;9,! 89, in si+e but can be larger.The relationship between segments! e"tents and blocs loos lie thisThe parameter $,1,/O.91S&?0 determines the default bloc si+e of the database. $etermining the bloc si+e depends on what you are going to do with the database! if you are using small rows then use a small bloc si+e (oracle recommends ;9,)! if youare using /O,@s then the bloc si+e should be larger.2KB or 4KB OLTP - online transaction processing database would benefit from a small block sie!KB "default# $ost databases would be OK to use t%e default sie&'KB or (2KB D) - data ware%ouses* media database would benefit from a larger block sieNotes+ou can %a,e different block sies wit%in t%e database* eac% tablespace %a,ing a different block sie depending on w%at is stored in t%e tablespace- .or an e/ample0ystem tablespace could use t%e default !KB and t%e OLTP tablespace could use a block sie of 4KB-There are few parameters that cannot be changed after installing Oracle and the DB_BLOCK_SIZ is one of them! so ma"e s#re to select the correct choice when installing Oracle$A data bloc will be made up of the following! the two main area@s are the free space and the data area.%eadercontains information regarding t%e type of block "a table block* inde/ block* etc#* transaction information regarding acti,e and past transactions on t%e block and t%e address "location# of t%e block on t%e diskTable Director& contains information about t%e tables t%at store rows in t%is block'ow Director&contains information describing t%e rows t%at are to be found on t%e block- T%is is an array of pointers to w%ere t%e rows are to be found in t%e data portion of t%e block-Bloc" o(erhead T%e t%ree abo,e pieces are know as t%e Block O,er%ead and are used by Oracle to manage t%e block itself-)ree space a,ailable space wit%in t%e blockData data wit%in t%e blockTablespacesA tablespace is a container which holds segments. 0ach and every segment belongs to e"actly one tablespace. Segments never cross tablespace boundaries. A tablespace itself has one or more files associated with it. An e"tent will be contained entirely within one data file.So in summary the Oracle hierarchy is as follows' A database is made up of one or more tablespaces A tablespace is made up of one or more data files! a tablespace contains segments A segment (table! inde"! etc) is made up of one or more e"tents. A segment e"ists in a tablespace but may have data in many data files within a tablespace. An extent is a continuous set of blocs on a dis. An e"tent is in a single tablespace and is always in a single file within that tablespace. A block is the smallest unit of allocation in the database. A bloc is the smallestunit of i*o used by the database.The minimum tablespaces re)uired are the system and sysaux tablespace! the following reasons are why tablespaces are used. Tablespaces mae it easier to allocate space )uotas to users in the database Tablespaces enable you to perform partial bacups and recoveries based on the tablespace as a unit Tablespaces can be allocated to different diss and controllers to improve performance Aou can tae tablespaces offline without affecting the entire database Aou can import and e"port specific application data by using the import and e"port utilities at the tablespace.There are a number of types that a tablespace can be ,igfile tablespaces! will have only one file which can range from ;-lobal 9rea#T%is is memory t%at is pri,ate to a single process or t%read and is not accessible by any ot%er process or t%read7-. ";ser >lobal 9rea#T%is is memory t%at is assoicated wit% your session* it can be found in t%e P>9 or 0>9 depending on w%et%er you are connected to t%e database ,ia s%ared ser,er0%ared 0er,er - t%e ;>9 will be in t%e 0>9Dedicated 0er,er - t%e ;>9 will be in t%e P>9S+There are five memory structures that mae up the System Global Area (SGA). The SGA will store many internal data structures that all processes need access to! cache data from dis! cache redo data before writing to dis! hold parsed SG/ plans and so on.Shared *oolT%e s%ared pool consists of t%e following areas:Librar& cache includes t%e s%ared 0EL area* pri,ate 0EL areas* PLF0EL procedures and packages t%e control structuressuc% as locks and library cac%e %andles- Oracle code is first parsed* t%en e/ecuted * t%is parsed code is stored in t%e library cac%e* oracle first c%ecks t%e library cac%e to see if t%ere is an already parsed and ready to e/ecute form of t%e statement in t%ere* if t%ere is t%is will reduce 2P; time considerably* t%is is called a soft parse* 3f Oracle %as to parse it t%en t%is is called a hard parse$ 3f t%ere is not enoug% room in t%e cac%e oracle will remo,e older parsed code* ob,iously it is better to keep as muc% parsed code in t%e library cac%e as possible- Keep an eye on missed cac%e %its w%ic% is an indication t%at a lot of %ard parsing is going on- Dictionar& cache is a collection of database tables and ,iews containing information about t%e database* its structures* pri,ileges and users- )%en statements are issued oracle will c%eck permissions* access* etc and will obtain t%is information from its dictionary cac%e* if t%e information is not in t%e cac%e t%en it %as to be read in from t%e diskand placed in to t%e cac%e- T%e more information %eld in t%e cac%e t%e less oracle %as to access t%e slow disks-T%e parameter 0A91=D