<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Mehrajhussain's Weblog</title>
	<atom:link href="http://mehrajhussain.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://mehrajhussain.wordpress.com</link>
	<description>Just another WordPress.com weblog</description>
	<lastBuildDate>Wed, 17 Sep 2008 09:59:33 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='mehrajhussain.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>Mehrajhussain's Weblog</title>
		<link>http://mehrajhussain.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://mehrajhussain.wordpress.com/osd.xml" title="Mehrajhussain&#039;s Weblog" />
	<atom:link rel='hub' href='http://mehrajhussain.wordpress.com/?pushpress=hub'/>
		<item>
		<title>Oracle Database Q&amp;A</title>
		<link>http://mehrajhussain.wordpress.com/2008/09/17/oracle-database-q-a/</link>
		<comments>http://mehrajhussain.wordpress.com/2008/09/17/oracle-database-q-a/#comments</comments>
		<pubDate>Wed, 17 Sep 2008 09:33:10 +0000</pubDate>
		<dc:creator>mehrajhussain</dc:creator>
				<category><![CDATA[Interview Questions]]></category>

		<guid isPermaLink="false">http://mehrajhussain.wordpress.com/?p=9</guid>
		<description><![CDATA[Intention of this post is to get as much interview question for Oracle DBA as possible to help you get the idea about the type of questions you can expect in interviews and exams. This will help you in increasing the knowledge about oracle database 9i as some of the questions may be new to [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mehrajhussain.wordpress.com&amp;blog=4882595&amp;post=9&amp;subd=mehrajhussain&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Intention of this post is to get as much interview question for Oracle DBA as possible to help you get the idea about the type of questions you can expect in interviews and exams. This will help you in increasing the knowledge about oracle database 9i as some of the questions may be new to you. <strong>This post has questions related to oracle 9i DBA only.</strong><br />
<strong>1) Explain the difference between a hot backup and a cold backup and the benefits associated with each.</strong></p>
<p>A hot backup is basically taking a backup of the database while it is still up and running and it must be in archive log mode. A cold backup is taking a backup of the database while it is shut down and does not require being in archive log mode. The benefit of taking a hot backup is that the database is still available for use while the backup is occurring and you can recover the database to any point in time. The benefit of taking a cold backup is that it is typically easier to administer the backup and recovery process. In addition, since you are taking cold backups the database does not require being in archive log mode and thus there will be a slight performance gain as the database is not cutting archive logs to disk.</p>
<p><strong>2) You have just had to restore from backup and do not have any control files. How would you go about bringing up this database?</strong></p>
<p>I would create a text based backup control file, stipulating where on disk all the data files where and then issue the recover command with the using backup control file clause.</p>
<p><strong>3) How do you switch from an init.ora file to a spfile?</strong></p>
<p>Issue the create spfile from pfile command.</p>
<p><strong>4) Explain the difference between a data block, an extent and a segment.</strong></p>
<p>A data block is the smallest unit of logical storage for a database object. As objects grow they take chunks of additional storage that are composed of contiguous data blocks. These groupings of contiguous data blocks are called extents. All the extents that an object takes when grouped together are considered the segment of the database object. Extent may not be continuous.</p>
<p><strong>5) Give two examples of how you might determine the structure of the table DEPT.</strong></p>
<p>Use the describe command or use the dbms_metadata.get_ddl package.</p>
<p><strong>6) Where would you look for errors from the database engine?</strong></p>
<p>In the alert log.</p>
<p><strong>7) Compare and contrast TRUNCATE and DELETE for a table.</strong></p>
<p>Both the truncate and delete command have the desired outcome of getting rid of all the rows in a table. The difference between the two is that the truncate command is a DDL operation and just moves the high water mark and produces a now rollback. The delete command, on the other hand, is a DML operation, which will produce a rollback and thus take longer to complete.</p>
<p><strong> <img class="wp-smiley" src="http://s.wordpress.com/wp-includes/images/smilies/icon_cool.gif" alt="8)" /> Give the reasoning behind using an index.</strong></p>
<p>Faster access to data blocks in a table.</p>
<p><strong>9) Give the two types of tables involved in producing a star schema and the type of data they hold.</strong></p>
<p>Fact tables and dimension tables. A fact table contains measurements while dimension tables will contain data that will help describe the fact tables.</p>
<p><strong>10)  What type of index should you use on a fact table?</strong></p>
<p>A Bitmap index.</p>
<p><strong>11)  Give two examples of referential integrity constraints.</strong></p>
<p>A primary key and a foreign key.</p>
<p><strong>12) A table is classified as a parent table and you want to drop and re-create it. How would you do this without affecting the children tables?</strong></p>
<p>Disable the foreign key constraint to the parent, drop the table, re-create the table, enable the foreign key constraint.</p>
<p><strong>13) Explain the difference between ARCHIVELOG mode and NOARCHIVELOG mode and the benefits and disadvantages to each.</strong></p>
<p>ARCHIVELOG mode is a mode that you can put the database in for creating a backup of all transactions that have occurred in the database so that you can recover to any point in time. NOARCHIVELOG mode is basically the absence of ARCHIVELOG mode and has the disadvantage of not being able to recover to any point in time. NOARCHIVELOG mode does have the advantage of not having to write transactions to an archive log and thus increases the performance of the database slightly.</p>
<p><strong>14) What command would you use to create a backup control file?</strong></p>
<p>Alter database backup control file to trace.</p>
<p><strong>15) Give the stages of instance startup to a usable state where normal users may access it.</strong></p>
<p>STARTUP NOMOUNT &#8211; Instance startup. Control File is read here.</p>
<p>STARTUP MOUNT &#8211; The database is mounted. Datafiles are read for the status and checked with control file.</p>
<p>STARTUP OPEN &#8211; The database is opened. Normal users can access.</p>
<p><strong>16) What column differentiates the V$ views to the GV$ views and how?</strong></p>
<p>The INST_ID column which indicates the instance in a RAC environment the information came from.</p>
<p><strong>17) How would you go about generating an EXPLAIN plan?</strong></p>
<p>Create a plan table with utlxplan.sql.</p>
<p>Use the explain plan set statement_id = ‘tst1′ into plan_table for a SQL statement</p>
<p>Look at the explain plan with utlxplp.sql or utlxpls.sql</p>
<p><strong>18) How would you go about increasing the buffer cache hit ratio?</strong></p>
<p>Use the buffer cache advisory over a given workload and then query the v$db_cache_advice table. If a change was necessary then I would use the alter system set db_cache_size command.</p>
<p><strong>19) Explain an ORA-01555</strong></p>
<p>You get this error when you get a snapshot too old within rollback. It can usually be solved by increasing the undo retention or increasing the size of rollbacks. You should also look at the logic involved in the application getting the error message.</p>
<p><strong>20) Explain the difference between $ORACLE_HOME and $ORACLE_BASE.</strong></p>
<p>ORACLE_BASE is the root directory for oracle. ORACLE_HOME located beneath ORACLE_BASE is where the oracle products reside.</p>
<p><strong>21) How would you determine the time zone under which a database was operating?</strong></p>
<p>select DBTIMEZONE from dual;</p>
<p><strong>22) Explain the use of setting GLOBAL_NAMES equal to TRUE.</strong></p>
<p>Setting GLOBAL_NAMES dictates how you might connect to a database. This variable is either TRUE or FALSE and if it is set to TRUE it enforces database links to have the same name as the remote database to which they are linking.</p>
<p><strong>23) Explain the difference between a FUNCTION, PROCEDURE and PACKAGE.</strong></p>
<p>A function and procedure are the same in that they are intended to be a collection of PL/SQL code that carries a single task. While a procedure does not have to return any values to the calling application, a function will return a single value. A package on the other hand is a collection of functions and procedures that are grouped together based on their commonality to a business function or application.</p>
<p><strong>24) Explain the use of table functions.</strong></p>
<p>Table functions are designed to return a set of rows through PL/SQL logic but are intended to be used as a normal table or view in a SQL statement. They are also used to pipeline information in an ETL process.</p>
<p><strong>25) Name three advisory statistics you can collect.</strong></p>
<p>Buffer Cache Advice, Segment Level Statistics, &amp; Timed Statistics</p>
<p><strong>26) Where in the Oracle directory tree structure are audit traces placed?</strong></p>
<p>In unix $ORACLE_HOME/rdbms/audit, in Windows the event viewer</p>
<p><strong>27) Explain materialized views and how they are used.</strong></p>
<p>Materialized views are objects that are reduced sets of information that have been summarized, grouped, or aggregated from base tables. They are typically used in data warehouse or decision support systems.</p>
<p><strong>28) When a user process fails, what background process cleans up after it?</strong></p>
<p>PMON</p>
<p><strong>29)  What background process refreshes materialized views?</strong></p>
<p>The Job Queue Processes.</p>
<p><strong>30) What is the Difference between OLTP and OLAP</strong></p>
<p>OLTP is nothing but OnLine Transaction Processing ,which contains a normalised tables and online data,which have frequent insert/updates/delete.</p>
<p>But OLAP(Online Analtical Programming) contains the history of OLTP data, which is, non-volatile ,acts as a Decisions Support System and is used for creating forecasting reports.</p>
<p><strong>31)  How would you determine what sessions are connected and what resources they are waiting for?</strong></p>
<p>Use of V$SESSION and V$SESSION_WAIT</p>
<p><strong>32)  Describe what redo logs are.</strong></p>
<p>Redo logs are logical and physical structures that are designed to hold all the changes made to a database and are intended to aid in the recovery of a database.</p>
<p><strong>33)  How would you force a log switch?</strong></p>
<p>ALTER SYSTEM SWITCH LOGFILE;</p>
<p><strong>34)  Give two methods you could use to determine what DDL changes have been made.</strong></p>
<p>You could use Logminer or Streams</p>
<p><strong>35)  What does coalescing a tablespace do?</strong></p>
<p>Coalescing is only valid for dictionary-managed tablespaces and de-fragments space by combining neighboring free extents into large single extents.</p>
<p><strong>36)  What is the difference between a TEMPORARY tablespace and a PERMANENT tablespace?</strong></p>
<p>A temporary tablespace is used for temporary objects such as sort structures while permanent tablespaces are used to store those objects meant to be used as the true objects of the database.</p>
<p><strong>37)  Name a tablespace automatically created when you create a database.</strong></p>
<p>The SYSTEM tablespace.</p>
<p><strong>38)  When creating a user, what permissions must you grant to allow them to connect to the database?</strong></p>
<p>Grant the CONNECT to the user.</p>
<p><strong>39)  How do you add a data file to a tablespace?</strong></p>
<p>ALTER TABLESPACE  ADD DATAFILE  SIZE</p>
<p><strong>40)  How do you resize a data file?</strong></p>
<p>ALTER DATABASE DATAFILE  RESIZE ;</p>
<p><strong>41)  What view would you use to look at the size of a data file?</strong></p>
<p>DBA_DATA_FILES</p>
<p><strong>42)  What view would you use to determine free space in a tablespace?</strong></p>
<p>DBA_FREE_SPACE</p>
<p><strong>43)  How would you determine who has added a row to a table?</strong></p>
<p>Turn on fine grain auditing for the table.</p>
<p><strong>44)  How can you rebuild an index?</strong></p>
<p>ALTER INDEX  REBUILD;</p>
<p><strong>45)  Explain what partitioning is and what its benefit is.</strong></p>
<p>Partitioning is a method of taking large tables and indexes and splitting them into smaller, more manageable pieces.</p>
<p><strong>46)  You have just compiled a PL/SQL package but got errors, how would you view the errors?</strong></p>
<p>SHOW ERRORS</p>
<p><strong>47)  How can you gather statistics on a table?</strong></p>
<p>The ANALYZE command.</p>
<p><strong>48)  How can you enable a trace for a session?</strong></p>
<p>Use the DBMS_SESSION.SET_SQL_TRACE or</p>
<p>Use ALTER SESSION SET SQL_TRACE = TRUE;</p>
<p><strong>49)  What is the difference between the SQL*Loader and IMPORT utilities?</strong></p>
<p>These two Oracle utilities are used for loading data into the database. The difference is that the import utility relies on the data being produced by another Oracle utility EXPORT while the SQL*Loader utility allows data to be loaded that has been produced by other utilities from different data sources just so long as it conforms to ASCII formatted or delimited files.</p>
<p><strong>50)  Name two files used for network connection to a database.</strong></p>
<p>TNSNAMES.ORA and SQLNET.ORA</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/mehrajhussain.wordpress.com/9/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/mehrajhussain.wordpress.com/9/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/mehrajhussain.wordpress.com/9/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mehrajhussain.wordpress.com/9/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/mehrajhussain.wordpress.com/9/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/mehrajhussain.wordpress.com/9/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/mehrajhussain.wordpress.com/9/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/mehrajhussain.wordpress.com/9/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/mehrajhussain.wordpress.com/9/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/mehrajhussain.wordpress.com/9/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/mehrajhussain.wordpress.com/9/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/mehrajhussain.wordpress.com/9/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/mehrajhussain.wordpress.com/9/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/mehrajhussain.wordpress.com/9/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/mehrajhussain.wordpress.com/9/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/mehrajhussain.wordpress.com/9/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mehrajhussain.wordpress.com&amp;blog=4882595&amp;post=9&amp;subd=mehrajhussain&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://mehrajhussain.wordpress.com/2008/09/17/oracle-database-q-a/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/2771625dec06b9c9e30f6c4528a06172?s=96&#38;d=identicon" medium="image">
			<media:title type="html">mehrajhussain</media:title>
		</media:content>

		<media:content url="http://s.wordpress.com/wp-includes/images/smilies/icon_cool.gif" medium="image">
			<media:title type="html">8)</media:title>
		</media:content>
	</item>
		<item>
		<title>Oracle 9i Undo Management</title>
		<link>http://mehrajhussain.wordpress.com/2008/09/17/oracle-9i-undo-management/</link>
		<comments>http://mehrajhussain.wordpress.com/2008/09/17/oracle-9i-undo-management/#comments</comments>
		<pubDate>Wed, 17 Sep 2008 09:32:03 +0000</pubDate>
		<dc:creator>mehrajhussain</dc:creator>
				<category><![CDATA[Oracle Database]]></category>

		<guid isPermaLink="false">http://mehrajhussain.wordpress.com/?p=6</guid>
		<description><![CDATA[Introduction So much to tell about undo management that even this post is not sufficient to explain the concept. Well a small effort to explain the undo concept in Oracle Database 9i. Lets start with the main funda and then we will see how automatic undo management and manual undo management differs. We will also [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mehrajhussain.wordpress.com&amp;blog=4882595&amp;post=6&amp;subd=mehrajhussain&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<h3 class="post-title entry-title"><a href="http://mehrajhussain.blogspot.com/2008/08/oracle-9i-undo-management.html"><br />
</a></h3>
<div class="post-body entry-content">
<div id="post-283" class="post hentry category-oracle-database-9i tag-oracle-9i-undo-management tag-undo-management-in-oracle-9i tag-undo-retention tag-undo-segments tag-undo-tablespace"><span style="text-decoration:underline;"><strong>Introduction</strong></span></p>
<div class="storycontent">
<div class="snap_preview">
<p>So much to tell about undo management that even this post is not sufficient to explain the concept. Well a small effort to explain the undo concept in Oracle Database 9i. Lets start with the main funda and then we will see how automatic undo management and manual undo management differs. We will also see undo segments and difference between private and public undo segments.</p>
<p><span style="text-decoration:underline;"><strong>Undo fundamentals</strong></span></p>
<p>Undo is the rather the most important functionality present in database, without which a database cannot work. undo serves following purpose in database</p>
<ul>
<li>Provide transaction level read consistency of data to all users in database</li>
<li>Permits user to rollback or discard the changes that have been made in transaction</li>
<li>Provide transaction recovery in case of instance failure while the user is in the middle of transaction</li>
</ul>
<p>When a user fires a DML (Either update, delete or insert), oracle will fetch the data from disk into database buffer cache for user to change the data also at the same time a copy of the original data is placed in undo segments. This happens for every DML transaction that is executed in database. When a user makes changes to the data, he can verify the change before doing COMMIT. If he thinks that the data change was not correct, he can ROLLBACK the changes back to original. This functionality is provided by undo. The copy of data which was placed in Undo segment will be copied back and any data change will be discarded. This is a very basic principle. The actual transaction is bit complicated.</p>
<p>When a data is fetched into database buffer cache a copy of the same has to be placed in undo segment. Now imagine that there are many users that are working in the database simultaneously and each firing a DML statement needs to place the original copy in undo segment. How the undo segment will be managed amongst so many transactions? To answer this question we need to understand Automatic undo management and manual undo management. Lets see first Auto undo management.</p>
<p><span style="text-decoration:underline;"><strong>Automatic Undo Management</strong></span></p>
<p>In case of automatic undo management, we delegate all the burden of undo segment management to oracle. Oracle will take care of creating the required number of segments as and when required. In return, what oracle want is a tablespace from where he can create segments. So we have to provide a undo tablespace which oracle can use to create undo segments and store the original copy of data for user to view. For enabling automatic undo management, we need to set following parameters</p>
<p>1) UNDO_MANAGEMENT (either AUTO or MANUAL).</p>
<p>For automatic undo management this parameter should be set to AUTO.</p>
<p>2) UNDO-TABLESPACE</p>
<p>Here we provide the name of undo tablespace that we want oracle to use. Undo tablespace is a permanent tablespace that we create (just like other permanent tablespace) and gives it to oracle.</p>
<p>3) UNDO_RETENTION</p>
<p>To understand undo retention consider this scenario. User A fetches the data to update, a copy of data is also placed in undo segment in undo tablespace. User B queries for same data and he is given the old copy of data from undo segment (because user A has not yet committed the changes). After few mins, user A commits the changes.</p>
<p>When the data was copied to undo tablespace in one of the undo segment a lock was also placed on that data, which prevents other undo data to overwrite this data. As soon as user commits the data, this lock will be taken off and data can be overwritten.</p>
<p>Imagine that this data gets overwritten quickly and when user B re-queries the data in the same transaction he gets the error <strong><em>ORA-15555 Snapshot too old</em></strong>.</p>
<p>This happened because the undo segment from which user B was querying the data has been overwritten by some other undo segment data. When a user fires a DML oracle will look for free undo segments to put the copy of data and as soon as he finds the free undo segment he overwrites the previous data. However It would be good if oracle retains the data in these segments for some more time even after the user has committed the data and lock is remove. But for how much time should oracle keep this data after commit? This time is decided by this init.ora parameter UNDO_RETENTION. The time is specified in sec. Usually a value of 900 (sec) is seen to be fine.</p>
<p>In the header of undo segment there is a undo segment table. This table contains the records about which transaction is In-active and which transaction is using the undo segment currently. Also the size of undo segment is decided automatically by oracle and is sufficient to support current number of transactions. When a segments get full by data from various transactions, additional space is allocated to the undo segments by allocating extents to the segments. Extents are similar to segment but are allocated automatically if the segment get full. If the extent also gets full, next extent will get allocated. This continues till oracle accommodates current active transactions.</p>
<p><span style="text-decoration:underline;"><strong>Manual Undo Management</strong></span></p>
<p>In case of manual undo management a DBA is supposed to create undo segments manually. For understanding this lets first understand <span style="text-decoration:underline;">system and non-system undo segments </span>and <span style="text-decoration:underline;">public and private undo segment</span>.</p>
<p><span style="text-decoration:underline;">System and non-system undo segments</span></p>
<p>System undo segment is the one which resides in system tablespace and is created by oracle when you create a database. This undo segment will be used by oracle while updating the data dictionary. A normal user or a DBA is not supposed to use this segment.</p>
<p>non-system undo segment is the one which is created out side system tablespace and which will be used for normal transactions. A non-system undo segment can be pubic or private</p>
<p><span style="text-decoration:underline;">Public undo segment and private undo segment</span></p>
<p>A private undo segment is the one which can be created by initializing the init.ora parameter &#8211; ROLLBACK_SEGMENTS. You can specify the name(s) of undo segment which you want to create in this parameter as comma separated names and oracle will create those undo segment when it starts the database. These are called private undo segments because these are acquired by instance explicitly after starting the instance.</p>
<p>Public undo segments are the one that are available in the database pool from undo tablespace that you create.</p>
<p>When configuring the undo management manually, you need to define 2 parameters in init.ora</p>
<ol>
<li>TRANSACTIONS</li>
<li>TRANSACTIONS_PER_ROLLBACK_SEGMENT</li>
</ol>
<p>Based on the values of these parameter, oracle will decide the number of rollback segments required for the proper working of oracle database.</p>
<p>Example if number of transactions during normal operation is defined as 146 in init.ora file and TRANSACTIONS_PER_ROLLBACK_SEGMENT is defined as 18, then oracle needs 8 rollback segment for proper functioning. Oracle then checks if ROLLBACK_SEGMENTS parameter contains 8 rollback segments defined. If not then the difference of the rollback segments are taken from the pool of public undo segments.</p>
<p>So at any given time there are many undo segments and many extents are allocated to each undo segments. The extents are sequential. Example for the first transaction extent 1 will be allocated, for transaction 2 extent 2 will be allocated and so on.</p>
<p>Consider the below figure. In case currently 5 extents has been allocated.</p>
<p><a href="http://advait.files.wordpress.com/2008/04/11.jpg"><img class="alignleft size-full wp-image-284" src="http://advait.files.wordpress.com/2008/04/11.jpg?w=495" alt="" /></a></p>
<p>Now if a new transaction comes, oracle will check if any of the extent is free (In-active). Even a single extent can hold more then one transaction. Extents are made of oracle block. But a single oracle block can hold data from only one transaction. Now imaging that Extent 5 is having some space and all other extents are full. In this case new transaction will be allocated to extent 5. As transaction proceeds, the space in the extent will start getting occupied. A stage will come when extent 5 will get full. Not ideally one of the other extent should get freed (In-active) because of completion of some other transaction. But if all the transactions are long running then none of the extent will be freed. In this case oracle will pull a new extent into this “cycle” &#8211; an extent 6 as given below.</p>
<p><a href="http://advait.files.wordpress.com/2008/04/12.jpg"><img class="alignleft size-full wp-image-285" src="http://advait.files.wordpress.com/2008/04/12.jpg?w=495" alt="" /></a></p>
<p>With that taken place, now we have 6 extents in a cycle. After some time some of the transactions commits and there extents gets freed and can be allocated to other active transactions if required. Again if extents are insufficient a new extent will be pulled. This continuous until the tablespace is full.</p>
<p>For manual undo management, you need to set <strong>UNDO_MANAGEMENT=manual</strong></p>
<p><span style="text-decoration:underline;"><strong>“Optimal” Clause</strong></span></p>
<p>From the above scenario you can imaging that if the transactions are big enough then the cycle of extents will grow big and can be come unmanageable. To over come this problem there is a clause defined while creating undo segments. This clause is “OPTIMAL” clause. We can define optimal to some value, either in KB or on MB. If we take above example, consider each extent to be of size 1M and we have defined OPTIMAL=5M while creating undo segment. Now untill 5 extents are present in the cycle, no action will be taken. But when there is no space in any of the extent a 6th extent will be pulled. As soon as any extent gets freed it will be removed from the cycle and only 5 extent (equal to size specified by optimal) will be maintained. If some of the extents amongst 5 are free, none of them will be removed, because optimal is specified as 5M. Oracle will always try to maintain the size of segment as 5M. Following is the example for creating rollback segment with optimal parameter</p>
<p>CREATE ROLLBACK SEGMENT rollseg01 TABLESPACE UNDO_TBS1 STORAGE ( INITIAL 12k NEXT 12k MINEXTENTS 25 MAXEXTENTS 400 OPTIMAL 300k);</p>
<p><span style="text-decoration:underline;"><strong>Data Dictionary</strong></span></p>
<p>You can see the name of rollback segments, tablespace they reside into and status using following data dictionary view.</p>
<p>SQL&gt; select SEGMENT_NAME, TABLESPACE_NAME, SEGMENT_ID, STATUS<br />
2  from dba_rollback_segs<br />
3  order by segment_id;</p>
<p>SEGMENT_NAME                   TABLESPACE SEGMENT_ID STATUS<br />
—————————— ———- ———- —————-<br />
SYSTEM                         SYSTEM              0 ONLINE<br />
_SYSSMU1_1207284872$           UNDO_TBS            1 ONLINE<br />
_SYSSMU2_1207309696$           UNDO_TBS            2 ONLINE<br />
_SYSSMU3_1207980887$           UNDO_TBS            3 ONLINE<br />
_SYSSMU4_1207980890$           UNDO_TBS            4 ONLINE<br />
_SYSSMU5_1207980890$           UNDO_TBS            5 ONLINE<br />
_SYSSMU6_1207984687$           UNDO_TBS            6 ONLINE<br />
_SYSSMU7_1207984689$           UNDO_TBS            7 ONLINE<br />
_SYSSMU8_1207984689$           UNDO_TBS            8 ONLINE<br />
_SYSSMU9_1207984689$           UNDO_TBS            9 ONLINE<br />
_SYSSMU10_1207984689$          UNDO_TBS           10 OFFLINE</p>
<p>SEGMENT_NAME                   TABLESPACE SEGMENT_ID STATUS<br />
—————————— ———- ———- —————-<br />
_SYSSMU11_1207984689$          UNDO_TBS           11 OFFLINE<br />
_SYSSMU92_1204797035$          UNDO_TBS           92 ONLINE<br />
_SYSSMU93_1204797035$          UNDO_TBS           93 ONLINE<br />
_SYSSMU94_1204797035$          UNDO_TBS           94 ONLINE<br />
_SYSSMU95_1204797035$          UNDO_TBS           95 ONLINE<br />
_SYSSMU96_1204797035$          UNDO_TBS           96 ONLINE</p>
<p>If you can see carefully here, segment SYSTEM belongs to SYSTEM tablespace and having ID as 0. This is a system undo segment.</p>
<p>Hope this helps !!</p></div>
</div>
</div>
</div>
<div class="post-footer">
<div class="post-footer-line post-footer-line-1"><span class="post-author vcard"> Posted by <span class="fn">Mehraj Hussain</span> </span> <span class="post-timestamp"> at <a class="timestamp-link" title="permanent link" rel="bookmark" href="http://mehrajhussain.blogspot.com/2008/08/oracle-9i-undo-management.html"><abbr class="published" title="00">9:57 PM</abbr></a> </span> <span class="reaction-buttons"> </span> <span class="star-ratings"> </span> <span class="post-comment-link"> <a class="comment-link" href="http://www.blogger.com/comment.g?blogID=74069703116668216&amp;postID=5197218173614637106">0 comments</a> </span> <span class="post-backlinks post-comment-link"> </span> <span class="post-icons"> <span class="item-control blog-admin pid-220583025"> <a title="Edit Post" href="http://www.blogger.com/post-edit.g?blogID=74069703116668216&amp;postID=5197218173614637106"> <img class="icon-action" src="http://www.blogger.com/img/icon18_edit_allbkg.gif" alt="" /> </a> </span> </span></div>
<div class="post-footer-line post-footer-line-2"><span class="post-labels"> </span></div>
</div>
<p><a name="6541166390230980042"></a></p>
<h3 class="post-title entry-title"><a href="http://mehrajhussain.blogspot.com/2008/08/redo-generations-in-hot-backup.html">Redo Generations in Hot Backup</a></h3>
<p><a rel="bookmark" href="http://advait.wordpress.com/2008/05/27/excess-redo-log-generation-during-hot-backup-oracle-9i/">Excess redo log generation during Hot Backup &#8211; Oracle 9i</a></p>
<div id="post-392" class="post hentry category-oracle-database-9i tag-excessive-redo-logs-during-hot-backup tag-fractured-blocks tag-hot-backup tag-recovery">
<div class="meta">Filed under:  <a title="View all posts in Oracle Database 9i" rel="category tag" href="http://wordpress.com/tag/oracle-database-9i/">Oracle Database 9i</a> — advait @ 6:29 pm<br />
Tags: <a rel="tag" href="http://wordpress.com/tag/excessive-redo-logs-during-hot-backup/">excessive redo logs during hot backup</a>, <a rel="tag" href="http://wordpress.com/tag/fractured-blocks/">fractured blocks</a>, <a rel="tag" href="http://wordpress.com/tag/hot-backup/">hot backup</a>, <a rel="tag" href="http://wordpress.com/tag/recovery/">recovery</a></div>
<div class="storycontent">
<div class="snap_preview">
<p>Many of you must have heard or experienced that while taking hot backup of database LGWR process writes aggressively. Meaning that more redo data has been written to redo log file and consecutively more archive logs gets generated.</p>
<p>Here is the common misconception we have in our mind. If some one ask, why excessive redo logs and archive logs are getting generated when we start a hot backup of database ?? Quickly we answer .. Its simple, when we put tablespace in hot backup mode, Oracle will take a check point of tablespace and data files belonging to this tablespace will be freezed. Any user activity happening on objects belonging to this tablespace wont write data to these datafiles, instead it will write data to redo log files. So obviously there will be more redo log file generation.</p>
<p>Well, to some extent this is COMPLETELY WRONG !!!</p>
<p>I will straight way come to the point and explain you what happens when we put the tablespace in hot backup mode.</p>
<p>Your first assumption that datafiles belonging to the tablespace in hot backup mode is freezed is wrong. Datafiles are not freezed, only the datafile headers will be freezed !! So simply imagine that when you put the tablespace in backup mode, Oracle will take a checkpoint and update the datafile headers with checkpoint SCN and there after it is freezed until we take tablespace out of backup mode.</p>
<p>Other datafile (other then header part) remains as normal and data changes happens continuously to this datafile.</p>
<p>Now you may want to ask me “do I mean to say that datafiles gets updated continuously even when we are coping the same to backup location ?”. The answer is YES. Never think that the datafile you are coping is “Consistent”. No, datafiles gets changed continuously !!!</p>
<p>You might want to ask couple of more questions then.</p>
<p>1) If we say that backup file is not consistent and changes continuously, then how come Oracle is able to recover the database when we restore that datafile?</p>
<p>2) If the data changes are anyway happening continuously on data files, then why there is excess redo log generation ?</p>
<p>Thats it !! don’t ask me more then this. Let me explain answers to these questions.</p>
<p>Consider a typical case, where an Oracle database is installed on Linux platform. The standard Oracle block size if 8K and lets say that OS level data block size is 512K. Now when we put the tablespace in “Begin Backup” mode checkpoint has happened and datafile header is freezed. You found which are the files related to this tablespace and started copying using OS command. Now when you copy a datafile using OS command it is going to copy as per OS block size. Lets say when you start copying it gave 8 blocks to you to copy &#8211; that means you are copying 4K (512K X 4) to backup location. That means you are copying half of Oracle block to backup location. Now this process of copy can be preempted by Server CPU depending on load. Lets say when you started copying after copy of those 8 block (4K, half of Oracle block), your process get preempted by CPU and it has allocated CPU time to some other important process. Mean while DBWR process changes that block that you have copied halfway (since datafile is not freezed and only header is freezed, continuous updates can happen to datafile).</p>
<p>After a while CPU returns back and gives you next 8 blocks to copy (rest of the halk Oracle block). Now here is the problem !!! we copied half of the oracle block taken at time T0 and another half taken at time T1 and in-between the data block got changed. Does this sounds consistent ? Not to me !! Such type of block is called <strong>“Fractured Block”</strong>.</p>
<p>Well, since Oracle copies files like this it should do some thing, so that during recovery it wont face any problem.</p>
<p>Usually in case of a normal tablespace (which is not in begin backup mode), when a transaction happens oracle generates redo information and puts in redo log file. This is the bare minimum information that oracle generates in order to redo the information. It does not copy the complete block. Where as in case of begin backup mode, if a transaction happens and changes any block FOR THE FIST TIME, oracle copies the complete block to redo log file. This happens only during first time. If subsequent transaction updates the same block again, oracle will not copy the complete block to redo, instead it will generate minimum information to redo the changes. Now because oracle has to copy the complete block when it changes for the first time in begin backup mode, we say that excess redo gets generated when we put tablespace in begin backup mode.</p>
<p>Question arises, why Oracle has to copy the complete block to redo log files. As you have seen above that during copy of datafile, there can be many fractured blocks, and during restore and recovery its going to put those block back and try to recover. Now assume that block is fractured and oracle has minimum information that it generates in the redo. Under such condition it wont be possible for Oracle to recover such blocks. So instead Oracle just copies the entire block back from redo log files to datafiles during recovery process. This will make the datafile consistent. So recovery process is very important which takes care of all fractured blocks and makes it possible to recover a database.</p>
<p>I hope this explains above 2 questions.</p>
<p>Now you can easily explain why hot backup is not possible if database is in NOARCHIVELOG mode.</p>
<p>When you take a backup using RMAN, it does not generate excessive redo logs. The reason is simple. RMAN is intelligent. It does not use OS block for copying, instead it uses oracle blocks for copying datafiles so the files are consistent.</p>
<p>Hope this helps !!</p></div>
</div>
</div>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/mehrajhussain.wordpress.com/6/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/mehrajhussain.wordpress.com/6/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/mehrajhussain.wordpress.com/6/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mehrajhussain.wordpress.com/6/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/mehrajhussain.wordpress.com/6/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/mehrajhussain.wordpress.com/6/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/mehrajhussain.wordpress.com/6/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/mehrajhussain.wordpress.com/6/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/mehrajhussain.wordpress.com/6/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/mehrajhussain.wordpress.com/6/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/mehrajhussain.wordpress.com/6/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/mehrajhussain.wordpress.com/6/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/mehrajhussain.wordpress.com/6/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/mehrajhussain.wordpress.com/6/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/mehrajhussain.wordpress.com/6/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/mehrajhussain.wordpress.com/6/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mehrajhussain.wordpress.com&amp;blog=4882595&amp;post=6&amp;subd=mehrajhussain&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://mehrajhussain.wordpress.com/2008/09/17/oracle-9i-undo-management/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/2771625dec06b9c9e30f6c4528a06172?s=96&#38;d=identicon" medium="image">
			<media:title type="html">mehrajhussain</media:title>
		</media:content>

		<media:content url="http://advait.files.wordpress.com/2008/04/11.jpg" medium="image" />

		<media:content url="http://advait.files.wordpress.com/2008/04/12.jpg" medium="image" />

		<media:content url="http://www.blogger.com/img/icon18_edit_allbkg.gif" medium="image" />
	</item>
		<item>
		<title>Basic Oracle Architecture</title>
		<link>http://mehrajhussain.wordpress.com/2008/09/17/basic-oracle-architecture/</link>
		<comments>http://mehrajhussain.wordpress.com/2008/09/17/basic-oracle-architecture/#comments</comments>
		<pubDate>Wed, 17 Sep 2008 09:30:08 +0000</pubDate>
		<dc:creator>mehrajhussain</dc:creator>
				<category><![CDATA[Oracle Database]]></category>

		<guid isPermaLink="false">http://mehrajhussain.wordpress.com/?p=3</guid>
		<description><![CDATA[Introduction This post is regarding the basic database architecture for 9i. Its been very late to upload this basic stuff, but I realized that it would be an incomplete blog without having even a brief architecture. So here it is. Below is the figure which gives a overview of “Inside Oracle”. An Oracle database is [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mehrajhussain.wordpress.com&amp;blog=4882595&amp;post=3&amp;subd=mehrajhussain&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><span style="text-decoration:underline;"><strong>Introduction</strong></span></p>
<p>This post is regarding the basic database architecture for 9i. Its been very late to upload this basic stuff, but I realized that it would be an incomplete blog without having even a brief architecture. So here it is.</p>
<p>Below is the figure which gives a overview of “Inside Oracle”.</p>
<p><a href="http://advait.files.wordpress.com/2008/04/oracle_processes1.gif"><img class="aligncenter size-medium wp-image-280" src="http://advait.files.wordpress.com/2008/04/oracle_processes1.gif?w=400&#038;h=260&#038;h=260" alt="" width="400" height="260" /></a></p>
<p>An Oracle database is a combination of oracle Instance and data files on the file system.</p>
<p>Oracle Database = Oracle Instance + Datafiles</p>
<p>Again Oracle Instance is nothing but Memory architecture and Background processes. Lets start the discussion with Memory architecture first.</p>
<p><span style="text-decoration:underline;"><strong>Memory Architecture</strong></span></p>
<p>Oracle database uses memory for its operation. The total memory allocated to the Oracle database can be broadly categorized into SGA (System Global Area) and PGA (Program Global Area).</p>
<p><span style="text-decoration:underline;">SGA Contains following data structure</span></p>
<ul class="LB1">
<li class="LB1">Database buffer cache</li>
<li class="LB1"><a name="8502"></a>Redo log buffer</li>
<li class="LB1"><a name="8503"></a>Shared pool</li>
<li class="LB1"><a name="20169"></a>Java pool</li>
<li class="LB1"><a name="11666"></a>Large pool (optional)</li>
<li class="LB1"><a name="8504"></a>Data dictionary cache</li>
<li class="LB1"><a name="8505"></a>Other miscellaneous information</li>
</ul>
<p>We can also categorized SGA into <strong>fixed SGA</strong> and variable SGA. When asked about Fixed SGA, <a href="http://asktom.oracle.com/pls/asktom/f?p=100:11:814037743059490::::P11_QUESTION_ID:365088445659" target="_self">AskTom</a> says that <em>“fixed SGA is a component of the SGA that varies in size from platform to platform and release to release. It is “compiled” into the database. The fixed SGA contains a set of variables that point to the other components of the SGA and variables that contain the values of various parameters. The size of the fixed SGA is something over which we have no control and it is generally very small. Think of this area as a “bootstrap” section of the SGA, something Oracle uses internally to find the other bits and pieces of the<br />
SGA.”</em></p>
<p><strong>Variable SGA </strong>contains 4 main components as listed above, those are “Database Buffer Cache”, “Redo Log Buffer”, “Shared Pool” and “Large Pool”. We call it variable SGA because we can alter the size of each of these components manually using ALTER SYSTEM command. The size of each of the components of variable SGA is determined by INIT.ORA parameters. Following are the INIT.ORA parameter for each of the component.</p>
<ul>
<li>Database Buffer Cache &#8211; <strong>db_block_buffers</strong></li>
<li>Redo Log Buffer &#8211; <strong>log_buffer</strong></li>
<li>Shared Pool &#8211; <strong>shared_pool_size</strong></li>
<li>Large Pool &#8211; <strong>Large_pool_size</strong></li>
</ul>
<p>We cannot however alter the size of Fixed SGA.</p>
<p><strong>Database Buffer Cache</strong> &#8211; This is used to hold the data into the memory. When ever a user access the data, it gets fetched into database buffer cache and it will be managed according to LRU (Least recently used) algorithm. Advantages &#8211; If a user is requesting data, which gets fetched into the buffer cache, then next time if he ask for same data with in a short period of time, the data will be read from buffer cache and Oracle process does not have to fetch data again from disk. Reading data from buffer cache is a faster operation. Another advantage is that if a user is modifying the data, it can be modified in the buffer cache which is a faster operation then modifying the data directly on the disk.</p>
<p><strong>Redo Log Buffer </strong>- This memory block hold the data which is going to be written to redo log file. Why do we need this data? To rollback the changes if the need be. But instead of writing the data directly to the redo log files, it is first written to log buffer which improves performance and then with the occurrence of certain event it will be written to redo log file.</p>
<p><strong>Shared Pool </strong>- This contains 2 memory section, 1) Library Cache 2) Dictionary Cache. Library cache hold the parsed SQL statement and execution plans and parsed PLSQL codes. Dictionary cache hold the information about user privileges, tables and column definitions, passwords etc. These 2 memory components are included in the size of shared pool.</p>
<p><strong>Large Pool </strong>- If defined then used for heavy operations such as bulk copy during backup or during restore operation.</p>
<p>The total size of SGA is determined by a parameter SGA_MAX_SIZE. Below is the simple calculation of memory sizes.</p>
<p>SQL&gt; show sga</p>
<p>Total System Global Area  577574308 bytes<br />
Fixed Size                   452004 bytes<br />
Variable Size             402653184 bytes<br />
Database Buffers          163840000 bytes<br />
Redo Buffers               10629120 bytes</p>
<p>This will show fixed and variable size SGA. Fixed size SGA, as I said is not in our control. However we can verify the size of variable SGA and other memory values shown above.</p>
<p>Database Buffers          163840000 bytes</p>
<p>SQL&gt; show parameters db_block_buffer</p>
<p>NAME                                 TYPE        VALUE<br />
———————————— ———– ——————————<br />
db_block_buffers                     integer     20000</p>
<p>This value is in terms of blocks. we can find the size of a block using DB_BLOCK_SIZE parameter</p>
<p>SQL&gt; show parameters db_block_size</p>
<p>NAME                                 TYPE        VALUE<br />
———————————— ———– ——————————<br />
db_block_size                        integer     8192</p>
<p>So Database Buffers = db_block_buffers X db_block_size = 20000 X 8192 = 163840000 bytes</p>
<p>Also Variable size = “Shared Pool Size” + “Large Pool Size” + “Java Pool size” (some times defined)</p>
<p>SQL&gt; SELECT pool, sum(bytes) from v$sgastat group by pool;</p>
<p>POOL        SUM(BYTES)<br />
———– ———-<br />
java pool     50331648<br />
shared pool  352321536<br />
11069860<br />
Variable size = 352321536 + 50331648 = 402653184 bytes</p>
<p><span style="text-decoration:underline;">Program Global Area</span></p>
<p>PGA contains information about bind variables, sort areas, and other aspect of cursor handling. This is not a shared area and every user has its own PGA. But why PGA is required for every user? The reason being that even though the parse information for SQL or PLSQL may be available in library cache of shared pool, the value upon which the user want to execute the select or update statement cannot be shared. These values are stored in PGA. This is also called Private Global Area.</p>
<p><span style="text-decoration:underline;"><strong>Going still deeper into the memory structure…</strong></span></p>
<p>Database buffer cache is again divided into 3 different types of cache.</p>
<ol>
<li>Default Cache</li>
<li>Keep Cache</li>
<li>Recycle Cache</li>
</ol>
<p>If we define the cache size using DB_CACHE_SIZE (or DB_BLOCK_BUFFER and specify the block size) then this will be <strong>default cache. </strong>The cache has a limited size, so not all the data on disk can fit in the cache. When the cache is full, subsequent cache misses cause Oracle to write dirty data already in the cache to disk to make room for the new data.</p>
<p>You can configure the database buffer cache with separate buffer pools that either keep data in the buffer cache or make the buffers available for new data immediately after using the data blocks.</p>
<ul class="LB1">
<li class="LB1">The <code>KEEP</code> buffer pool retains the schema object’s data blocks in memory. This is defined using the INIT.ORA parameter <code>DB_KEEP_CACHE_SIZE</code></li>
<li class="LB1"><a name="21438"></a>The <code>RECYCLE</code> buffer pool eliminates data blocks from memory as soon as they are no longer needed. This is defined using the INIT.ORA parameter <code>DB_RECYCLE_CACHE_SIZE</code></li>
</ul>
<p>You can also define multiple DB block sizes using following parameters. Example if you have defined standard default block size of 4K, then following parameters can be used to define a size of 2K, 8K, 16K and 32K.</p>
<p>DB_2K_CACHE_SIZE<br />
DB_8K_CACHE_SIZE<br />
DB_16K_CACHE_SIZE<br />
DB_32K_CACHE_SIZE</p>
<p>Note that you can define the Keep and Recycle cache only on standard block size and buffer cache size is the sum of sizes of each of these pools.</p>
<p><span style="text-decoration:underline;">Shared Pool Reserved Size</span></p>
<p>Shared Pool, as we have seen previously contains the parsed SQL statements and execution plans. With continuous use of database, after a period of time the shared pool will get fragmented. New parsed SQL and execution plans comes and old one gets aged out and hence overwritten. This will also lead to larger packages being aged out with new entries going into shared pool. Hence access to such larger packages will take time to parse and create execution plan. This might cause performance issues.</p>
<p>To avoid such situation, you can define a parameter SHARED_POOL_RESERVED_SIZE. This will reserve some additional space other then shared_pool_size. If an object (either parsed SQL statement or execution plan) is stored in reserved shared pool area then it will not age out.</p>
<p class="BP">For large allocations, the order in which Oracle attempts to allocate space in the shared pool is the following:</p>
<ol class="LN1" type="1">
<li class="LN1"><a name="37706"></a>From the unreserved part of the shared pool.</li>
<li class="LN1"><a name="37707"></a>If there is not enough space in the unreserved part of the shared pool, and if the allocation is large, then Oracle checks whether the reserved pool has enough space.</li>
<li class="LN1"><a name="43803"></a>If there is not enough space in the unreserved and reserved parts of the shared pool, then Oracle attempts to free enough memory for the allocation. It then retries the unreserved and reserved parts of the shared pool.</li>
</ol>
<p><span style="text-decoration:underline;"><strong>Process Architecture</strong></span></p>
<p>Oracle has several process running in the background for proper functioning of database. Following are the main categories of process.</p>
<ol>
<li>Server Process</li>
<li>Background Process</li>
</ol>
<p class="BP"><strong>Server Process &#8211; </strong>to handle the requests of user processes connected to the instance. Server processes (or the server portion of combined user/server processes) created on behalf of each user’s application can perform one or more of the following:</p>
<ul class="LB1">
<li class="LB1"><a name="20065"></a>Parse and execute SQL statements issued through the application</li>
<li class="LB1"><a name="2995"></a>Read necessary data blocks from datafiles on disk into the shared database buffers of the SGA, if the blocks are not already present in the SGA</li>
<li class="LB1"><a name="2997"></a>Return results in such a way that the application can process the information</li>
</ul>
<p class="BP"><strong>Background Process -</strong> An Oracle instance can have many background processes; not all are always present. The background processes in an Oracle instance include the following:</p>
<ul class="LB1">
<li class="LB1"><a name="3016"></a>Database Writer (DBW0 or DBW<em>n</em>)</li>
<li class="LB1"><a name="3018"></a>Log Writer (LGWR)</li>
<li class="LB1"><a name="3020"></a>Checkpoint (CKPT)</li>
<li class="LB1"><a name="3022"></a>System Monitor (SMON)</li>
<li class="LB1"><a name="3024"></a>Process Monitor (PMON)</li>
<li class="LB1"><a name="21256"></a>Archiver (ARC<em>n</em>)</li>
<li class="LB1"><a name="22072"></a>Recoverer (RECO)</li>
<li class="LB1"><a name="22079"></a>Lock Manager Server (LMS) &#8211; Real Application Clusters only</li>
<li class="LB1"><a name="22080"></a>Queue Monitor (QMN<em>n</em>)</li>
<li class="LB1"><a name="3034"></a>Dispatcher (D<em>nnn</em>)</li>
<li class="LB1"><a name="3036"></a>Server (S<em>nnn</em>)</li>
</ul>
<p>On many operating systems, background processes are created automatically when an instance is started.</p>
<p><span style="text-decoration:underline;">Database writer (DBWn) </span>- The <strong>database writer process (DBWn)</strong><em> </em>writes the contents of buffers to datafiles. The DBW<em>n</em> processes are responsible for writing modified (dirty) buffers in the database buffer cache to disk. Although one database writer process (DBW0) is adequate for most systems, you can configure additional processes (DBW1 through DBW9) to improve write performance if your system modifies data heavily. These additional DBW<em>n</em> processes are not useful on uniprocessor systems.</p>
<p><span style="text-decoration:underline;">Log Writer (LGWR)</span> &#8211;  The <strong>log writer process (LGWR)</strong> is responsible for redo log buffer management–writing the redo log buffer to a redo log file on disk. LGWR writes all redo entries that have been copied into the buffer since the last time it wrote.</p>
<p><span style="text-decoration:underline;">Checkpoint (CKPT) </span>- When a checkpoint occurs, Oracle must update the headers of all datafiles to record the details of the checkpoint. This is done by the CKPT process. The CKPT process does not write blocks to disk; DBW<em>n</em> always performs that work.</p>
<p><span style="text-decoration:underline;">System Monitor (SMON)</span> &#8211; <strong></strong>The <strong>system monitor process (SMON)</strong> performs crash recovery, if necessary, at instance startup. <strong></strong>SMON is also responsible for cleaning up temporary segments that are no longer in use and for coalescing contiguous free extents within dictionary-managed tablespaces. If any dead transactions were skipped during crash and instance recovery because of file-read or offline errors, SMON recovers them when the tablespace or file is brought back online. SMON wakes up regularly to check whether it is needed.</p>
<p><span style="text-decoration:underline;">Process Monitor (PMON) </span>-</p>
<p class="BP">The <strong>process monitor (PMON)</strong> performs process recovery when a user process fails. PMON is responsible for cleaning up the database buffer cache and freeing resources that the user process was using. For example, it resets the status of the active transaction table, releases locks, and removes the process ID from the list of active processes.</p>
<p><a name="17126"></a></p>
<p class="BP">PMON periodically checks the status of dispatcher and server processes, and restarts any that have died (but not any that Oracle has terminated intentionally). PMON also registers information about the instance and dispatcher processes with the network listener.</p>
<p class="BP"><span style="text-decoration:underline;">Archiver Process (ARCn)</span> -</p>
<p class="BP">The <strong>archiver process (ARCn)</strong> copies online redo log files to a designated storage device after a log switch<strong></strong> has occurred. ARC<em>n</em> processes are present only when the database is in ARCHIVELOG mode, and automatic archiving is enabled.</p>
<p><a name="21739"></a></p>
<p class="BP">An Oracle instance can have up to 10 ARC<em>n</em> processes (ARC0 to ARC9). The LGWR process starts a new ARC<em>n</em> process whenever the current number of ARC<em>n</em> processes is insufficient to handle the workload. The ALERT file keeps a record of when LGWR starts a new ARC<em>n</em> process.</p>
<p class="BP"><span style="text-decoration:underline;">Recoverer (RECO)</span> &#8211; The <strong>recoverer process (RECO)</strong> is a background process used with the distributed database configuration that automatically resolves failures involving distributed transactions. The RECO process of a node automatically connects to other databases involved in an in-doubt distributed transaction. When the RECO process reestablishes a connection between involved database servers, it automatically resolves all in-doubt transactions, removing from each database’s pending transaction table any rows that correspond to the resolved in-doubt transactions.</p>
<p class="BP">The RECO process is present only if the instance permits distributed transactions and if the<code> DISTRIBUTED_TRANSACTIONS </code>parameter is greater than zero. If this initialization parameter is zero, RECO is not created during instance startup.</p>
<p class="BP"><span style="text-decoration:underline;">Lock Manager Server (LMS) </span>-  In Oracle9<em>i</em> Real Application Clusters, a Lock Manager Server process (LMS) provides inter-instance resource management.</p>
<p class="BP"><span style="text-decoration:underline;">Queue Monitor (QMN<em>n</em>)</span> &#8211; The <strong>queue monitor process</strong> is an optional background process for Oracle Advanced Queuing, which monitors the message queues. You can configure up to 10 queue monitor processes. These processes, like the Jnnn processes, are different from other Oracle background processes in that process failure does not cause the instance to fail.</p>
<p class="BP">The above once explained are the mail background processes. Please refer to the Oracle documentation for detailed Oracle 9i Architecture.</p>
<p class="BP">Hope this helps !!</p>
<p class="BP"><span style="text-decoration:underline;"><strong>References:</strong></span></p>
<p>Oracle9i Database Online Documentation (Release 9.0.1)</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/mehrajhussain.wordpress.com/3/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/mehrajhussain.wordpress.com/3/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/mehrajhussain.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mehrajhussain.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/mehrajhussain.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/mehrajhussain.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/mehrajhussain.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/mehrajhussain.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/mehrajhussain.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/mehrajhussain.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/mehrajhussain.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/mehrajhussain.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/mehrajhussain.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/mehrajhussain.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/mehrajhussain.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/mehrajhussain.wordpress.com/3/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mehrajhussain.wordpress.com&amp;blog=4882595&amp;post=3&amp;subd=mehrajhussain&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://mehrajhussain.wordpress.com/2008/09/17/basic-oracle-architecture/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/2771625dec06b9c9e30f6c4528a06172?s=96&#38;d=identicon" medium="image">
			<media:title type="html">mehrajhussain</media:title>
		</media:content>

		<media:content url="http://advait.files.wordpress.com/2008/04/oracle_processes1.gif?w=400&#38;h=260" medium="image" />
	</item>
	</channel>
</rss>
