<?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"
	>

<channel>
	<title>Oracle Tips &#187; Oracle Tips</title>
	<atom:link href="http://www.expertsharing.com/category/oracle-tips/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.expertsharing.com</link>
	<description></description>
	<pubDate>Thu, 25 Sep 2008 17:29:46 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6.1</generator>
	<language>en</language>
			<item>
		<title>ORA-12154 TNS:could not resolve service name</title>
		<link>http://www.expertsharing.com/2008/06/21/ora-12154-tnscould-not-resolve-service-name/</link>
		<comments>http://www.expertsharing.com/2008/06/21/ora-12154-tnscould-not-resolve-service-name/#comments</comments>
		<pubDate>Sat, 21 Jun 2008 19:31:04 +0000</pubDate>
		<dc:creator>Praveen</dc:creator>
		
		<category><![CDATA[Oracle Tips]]></category>

		<category><![CDATA[ORA-12154]]></category>

		<category><![CDATA[ora-12154 error]]></category>

		<category><![CDATA[Ora-12154 Oracle]]></category>

		<category><![CDATA[Oracle names server]]></category>

		<category><![CDATA[tns entry]]></category>

		<category><![CDATA[tns problem]]></category>

		<category><![CDATA[tnsnames could not resolve service name]]></category>

		<category><![CDATA[tnsnames.ora]]></category>

		<guid isPermaLink="false">http://www.expertsharing.com/?p=127</guid>
		<description><![CDATA[ORA-12154 TNS:could not resolve service name
You might have come accross this error when connecting to an Oracle server from an Oracle client. Oracle client will throw this error if it is unable to connect to the server by using the service name specified. This error actually means that Sql * Net is  unable to recognize the [...]]]></description>
			<content:encoded><![CDATA[<h1><span style="color: #808000;"><span style="text-decoration: underline;">ORA-12154 TNS:could not resolve service name</span></span></h1>
<p>You might have come accross this error when connecting to an Oracle server from an Oracle client. Oracle client will throw this error if it is unable to connect to the server by using the service name specified. This error actually means that Sql * Net is  unable to recognize the host/service name specified in the connection Parameters.</p>
<p><span style="text-decoration: underline;">Explanation about how <strong>sql * net client</strong> connects to the server:</span></p>
<p>The parameters that are required to connect to an Oracle server.</p>
<p>1. Username<br />
2. Password<br />
3. Service name/connection String</p>
<p><img class="alignnone size-full wp-image-129" title="sqlplus_login11" src="http://www.expertsharing.com/wp-content/uploads/2008/06/sqlplus_login11.gif" alt="sqlplus- tnsnames-ora" width="354" height="227" /></p>
<p>What is a service name ?</p>
<p>Service name specifies an entry in the tnsname.ora file. Each service name consists of  hostname/ip address of the Oracle database server you want to connect, Port at which Oracle listener is working, the database instance you want to connect to, and the protocol you are using for the connection.</p>
<p> <span id="more-127"></span></p>
<p>Oracle client can connect to multiple instances of Oracle server by using the entries in tnsnames.ora file, by a directory server or by <strong>Oracle names server</strong>.</p>
<p> </p>
<p><strong>Tnsnames.ora</strong> file located in the /network/admin path of your Oracle home directory.</p>
<p>Reasons why you might face this <strong>ORA-12154 TNS:could not resolve service name error</strong> :</p>
<ul>
<li>Wrong entry in the <strong>tnsnames.ora</strong> file.</li>
<li>Incorrect host information, port number Or Database instance specified in the tnsnames.ora file.</li>
<li>Mistyped or Misspelled Or Incorrect correct entry in the tnsnames.ora file.</li>
</ul>
<p> </p>
<p><img class="alignnone size-full wp-image-130" title="tns-names" src="http://www.expertsharing.com/wp-content/uploads/2008/06/tns-names.png" alt="" width="632" height="454" /></p>
<p> </p>
<p><span style="text-decoration: underline;">Solutions to the </span><strong><span style="text-decoration: underline;">Ora-12154</span> </strong>:<br />
1. Check whether you system is have multiple instances of Oracle homes and multiple tnsnames.ora files and you are making the right entry to the right tnsnames.ora file.</p>
<p> <br />
2. Instead of manually placing an entry in the tnsnames.ora file , use the SQL Net Easy Configuration wizard.</p>
<p> <br />
3. Check the tns names.ora file to validate that the instance name has been typed correctly. If you are in Unix, validate that there are no control characters at the end of the name</p>
<p> <br />
4. If everything is fine and you are still facing the problem, go through the steps specified below, it will definitely work out.</p>
<p> </p>
<p><span style="text-decoration: underline;">Step 1</span> : Download a tool called Oracmd (oracle command line tool) from this<a rel="external nofollow" href="http://www.brothersoft.com/oracmd-57915.html" target="_blank"> link</a>. This software is a shareware , so you can use it for 30 days with out a problem.</p>
<p><span style="text-decoration: underline;">Step 2</span> : Install the tool Oracmd.The speciality of this tool it does not have any dependency on Oracle client installed on your system. it can even work if there is no Oracle client installed on your system. It does not require a tnsname.ora file.<br />
       </p>
<p><span style="text-decoration: underline;">Step 3</span> : Run the Oracmd tool . At the prompt type  connect <a href="mailto:username/password@host:port:SID">username/password@host:port:SID</a></p>
<p><strong>Host</strong> : host stands for Sever name or ip address where the oracle server is residing.<br />
<strong>port</strong> : port stands for port on which oracle listener is working.<br />
<strong>Sid</strong> :  System identifier is instance of oracle database you want to connect.</p>
<p>You can copy the host,port,sid values from tnsnames.ora file.</p>
<p>if you are able to perfectly connect to you Oracle database server , then you have right hostname, port and sid information. if you are unable to connect, then there should be a problem with the network connections to the Oracle server or firewall Problems or wrong hostname,port and sid information. Proceed to step 4 only if you are able to connect to Oracle with Oracmd.</p>
<p><span style="text-decoration: underline;">Step 4</span> : Back up the tnsname.ora as tnsnames.ora.old file</p>
<p><span style="text-decoration: underline;">Step 5</span> : Run  Start&gt;Programs&gt;Oracle &gt;<strong>SQL Net Easy Configuration.</strong></p>
<p>  Select the option to Add a new entry for network service name.<br />
  Enter the parameters are required in the forms.<br />
  Confirm the entry.</p>
<p><span style="text-decoration: underline;">Step 6</span> : Check out the new changes in the<strong> tnsnames.ora</strong> file</p>
<p><span style="text-decoration: underline;">Step 7</span> : Try to Connect now to Oracle databse server.</p>
<p><span style="text-decoration: underline;">Step 8</span> : if you are Still unable to connect to the Oracle Server by the above process , Remove all the entries in the tnsname.ora file, add them one by one by using <strong>Sql Net Easy Configuration</strong>.</p>
<p> </p>
<p> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.expertsharing.com/2008/06/21/ora-12154-tnscould-not-resolve-service-name/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Differences between automatic undo management and Manual undo management</title>
		<link>http://www.expertsharing.com/2008/06/19/differences-between-automatic-undo-management-and-manual-undo-management/</link>
		<comments>http://www.expertsharing.com/2008/06/19/differences-between-automatic-undo-management-and-manual-undo-management/#comments</comments>
		<pubDate>Thu, 19 Jun 2008 23:16:38 +0000</pubDate>
		<dc:creator>Praveen</dc:creator>
		
		<category><![CDATA[Oracle Tips]]></category>

		<category><![CDATA[AUM VS MUM]]></category>

		<category><![CDATA[automatic undo management]]></category>

		<category><![CDATA[ROLLBACK UNDO]]></category>

		<guid isPermaLink="false">http://www.expertsharing.com/?p=123</guid>
		<description><![CDATA[Differences between automatic undo management and Manual undo management
Traditionally until Oracle 8i you have been using Manaul undo management which deals with roll back segments. Typically undo information is stored in rollback segments until a rollback or commit statement is issued.But now with Oracle 9i all your troubles are gone with Manual undo management. Oracle [...]]]></description>
			<content:encoded><![CDATA[<h3><span style="color: #99cc00;"><span style="text-decoration: underline;">Differences between automatic undo management and Manual undo management</span></span></h3>
<p>Traditionally until Oracle 8i you have been using Manaul undo management which deals with roll back segments. Typically undo information is stored in rollback segments until a rollback or commit statement is issued.But now with Oracle 9i all your troubles are gone with Manual undo management. Oracle has introduced auto undo management.</p>
<p><strong><span style="color: #000080;">Terminology differences :</span></strong></p>
<p>In automatic undo management we call undo segment rather than rollback segment.</p>
<p>Automatic undo Management can be abbrevated as AUM oR sYSTEM MANAGED UNDO (SMU).</p>
<p>Manual undo management is usually abbrevated as MUM OR ROLLBACK UNOD (RBU).<br />
<strong></strong></p>
<p><strong></strong></p>
<p><strong><span style="color: #000080;">COMPATIBILITY differences :</span></strong></p>
<p>Automatic undo management is possible and compatible in Oracle versions 9.0.0 and higher.</p>
<p>Automatic Undo Management is enable by default if the database is created using database configuration assistant.</p>
<p>Manual undo management is not obseleted. it is even supported in the latest versions of Oracle. If you are flexible with Manual undo management ,you can even use it in Oracle version 9.x or 8.x.</p>
<p>You can even upgrade from Manaul undo management to Automatic undo Management.</p>
<p><span id="more-123"></span></p>
<p><span style="color: #000080;"><strong>Differences in Management of Segments :</strong></span></p>
<p><strong><span style="color: #003300;">Automatic Undo Management Mode:</span></strong></p>
<p>Oracle will automatically name, create and manage the Undo Segments.</p>
<p>Oracle can control the sizing and the number of undo segments</p>
<p>You require an Undo tablespace for automatic undo management.</p>
<p><span style="color: #003300;"><strong>Manual Undo Management Mode:</strong></span></p>
<p>Same as using Rollback Segments in Oracle8i and below</p>
<p>DBA has to create and manage the roll back segments.</p>
<p> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.expertsharing.com/2008/06/19/differences-between-automatic-undo-management-and-manual-undo-management/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Ora-01555 : Snapshot too old error</title>
		<link>http://www.expertsharing.com/2008/06/17/ora-0155-snapshot-too-old-error/</link>
		<comments>http://www.expertsharing.com/2008/06/17/ora-0155-snapshot-too-old-error/#comments</comments>
		<pubDate>Tue, 17 Jun 2008 20:49:22 +0000</pubDate>
		<dc:creator>Praveen</dc:creator>
		
		<category><![CDATA[Oracle Tips]]></category>

		<category><![CDATA[ora-01555]]></category>

		<category><![CDATA[ora-01555 error]]></category>

		<category><![CDATA[Ora-1555]]></category>

		<category><![CDATA[Oracle snapshot error]]></category>

		<category><![CDATA[snapshot too old error]]></category>

		<guid isPermaLink="false">http://www.expertsharing.com/?p=113</guid>
		<description><![CDATA[Ora-01555 : Snapshot too old error
By this time you might have come accross this ora-01555 error lot of times. Before learning about the causes of the Ora-01555 error, you need to understand about Read Consistency and dirty reads in Oracle.
Read Consistency : Let us take an example of Reading a 1 million records from a [...]]]></description>
			<content:encoded><![CDATA[<h1 style="text-align: center;"><span style="color: #ff6600;">Ora-01555 : Snapshot too old error</span></h1>
<p>By this time you might have come accross this <strong>ora-01555</strong> error lot of times. Before learning about the causes of the <strong>Ora-01555 error</strong>, you need to understand about Read Consistency and dirty reads in Oracle.</p>
<p>Read Consistency : Let us take an example of Reading a 1 million records from a table emp through a cursor.<br />
While fetching the data from the cursor in session A, if another session B updates the data simultaneously in the table emp by which 10000 records has been affected in the set of 1 million records. if these 10000 rows are not yet read by the cursor in session A, then</p>
<p> Whether the Oracle would read the updated records to Session A ? <span style="color: #ff0000;">NO</span>.</p>
<p> <span id="more-113"></span><br />
Session A has started before the session B has started. Read consistency is the feature of Oracle that gurantees you the Snapshot of data available to you at the start of the transaction. Oracle would return those old 10000 rows to session A which were available before the start of session B.</p>
<p> <br />
Oracle does this by the use of Roll Back segments. Oracle constructs the Original data by using the data available in Roll back segments.</p>
<p><span style="text-decoration: underline;"><strong>Lets us see the Process of Oracle updating the data:-</strong></span></p>
<p><strong></strong><br />
A data block Consists of a data block header and its data storage. similarly a rollback segment consists of a rollback segment header and a roll back segment data storage. A data block header stores the reference of the rollback segment which caused its state to change. After commiting the change to the data, the data block header is not updated but the corresponding entry in the rollback segment header is updated. Now when the changed data block is revisited by another transaction, the data block header is updated. This process is called delayed cleanout.</p>
<p>Stage 1: A normal view of data block and a rollback segment header. Data block header shows no reference to any transaction.<br />
<img class="alignnone size-full wp-image-117" title="ora-01555" src="http://www.expertsharing.com/wp-content/uploads/2008/06/ora-01553.png" alt="ora-01555 snapshot" width="671" height="488" /><br />
Stage 2: with an update statement , existing row 2 data will be copied to rollback sement. Row 2 data will be updated by the New values coming from the transaction 2. Data block header records a reference to transaction 2 and holds the status of the data block as uncommitted. In the Rollback segment the transaction 2 status would be changed to UNCOMMITTED.</p>
<p><img class="alignnone size-full wp-image-118" title="oracle-error-01555" src="http://www.expertsharing.com/wp-content/uploads/2008/06/oracle-error-01555.png" alt="oracle-error-01555" width="700" height="472" /></p>
<p>Stage 3 : if commit is applied for transaction 2, corresponding changes are made to data Roll back segment header, but not to the data block.</p>
<p><img class="alignnone size-full wp-image-120" title="snapshot-too-old" src="http://www.expertsharing.com/wp-content/uploads/2008/06/snapshot-too-old.png" alt="snapshot-too-old" width="700" height="549" /></p>
<p>Stage 4 : if another query requests for the rows in the data block, Oracle updates the data block header status with no reference to any transaction and its status. This is called as delayed block clean out.</p>
<p><img class="alignnone size-full wp-image-121" title="Oracle error" src="http://www.expertsharing.com/wp-content/uploads/2008/06/ora-15551.png" alt="Oracle error" width="694" height="456" /></p>
<p><strong></strong></p>
<p><strong>Solutions for the ora-01555 error :</strong><br />
1. Increase the Size of Roll back segment by adding more space to Roll back segment.</p>
<p> <br />
2. Add multiple roll back segments .<br />
An example of adding a rollback segment</p>
<blockquote><p>CREATE PUBLIC ROLLBACK SEGMENT rbs_02<br />
TABLESPACE rbspace<br />
STORAGE (<br />
INITIAL 120K<br />
NEXT 120K<br />
OPTIMAL 4M<br />
MINEXTENTS 20<br />
MAXEXTENTS 100 );</p></blockquote>
<p>When a rollback segment is created it is not used by Oracle , unless the newly created rollback segment is made online. You can make a roll back segment online or offline by using ALTER ROLLBACK SEGMENT</p>
<blockquote><p>ALTER ROLLBACK SEGMENT rbs_02 ONLINE;</p></blockquote>
<p>3. Reducing the frequency of commits in Pl/sql subprogram. Executing the commit command after each INSERT/UPDATE/DELETE would generate lot of Undo SPACE.<br />
Try to execute the commit command for a bunch of 5000 records or so</p>
<blockquote><p>if loop_count = 500 then<br />
commit;<br />
end if;</p></blockquote>
<p>3. Run the processing against a range of data.</p>
<p>4.Fetching accross commits should be avoided at any cost.Don&#8217;t fetch on a cursor that was opened prior to the last commit, particularly if the data queried by the cursor is being changed in the current session.</p>
<p> <br />
5.Ensure that the outer select does not revisit the same block at different times during the processing.</p>
<p>6. shfit to Oracle 9i automatic undo management to minimize the <span style="color: #ff6600;"><strong>Ora-01555 : Snapshot too old errors</strong> </span><span style="color: #000000;">to a greater extent.</span></p>
]]></content:encoded>
			<wfw:commentRss>http://www.expertsharing.com/2008/06/17/ora-0155-snapshot-too-old-error/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Oracle and Xml : query the data into xml format</title>
		<link>http://www.expertsharing.com/2008/06/09/oracle-and-xml-query-the-data-into-xml-format/</link>
		<comments>http://www.expertsharing.com/2008/06/09/oracle-and-xml-query-the-data-into-xml-format/#comments</comments>
		<pubDate>Mon, 09 Jun 2008 23:57:13 +0000</pubDate>
		<dc:creator>Praveen</dc:creator>
		
		<category><![CDATA[Oracle Tips]]></category>

		<category><![CDATA[DBMS_XMLQUERY PACKAGE]]></category>

		<category><![CDATA[Oracle xml]]></category>

		<category><![CDATA[xml from Oracle query]]></category>

		<guid isPermaLink="false">http://www.expertsharing.com/?p=110</guid>
		<description><![CDATA[Oracle Application Server provides a powerful utility to help you generate XML straight from data in your Oracle database &#8212; the XSQL processor. XML style sheets allows you to manipulate XML into various usable forms.
 What is xml ?
xml stands for eXtensible Markup language.
&#8220;eXtensible&#8221; - Information in a neutral way,stored in a neutral form, independent of [...]]]></description>
			<content:encoded><![CDATA[<p>Oracle Application Server provides a powerful utility to help you <strong>generate XML</strong> straight from data in your <strong>Oracle database &#8212; the XSQL processor</strong>. <strong>XML style sheets</strong> allows you to manipulate XML into various usable forms.</p>
<p> <span style="color: #ff0000;"><strong>What is xml ?</strong></span></p>
<p>xml stands for eXtensible Markup language.</p>
<p>&#8220;<span style="color: #ff9900;">eXtensible</span>&#8221; - Information in a neutral way,stored in a neutral form, independent of systems, devices and applications</p>
<p>&#8220;<span style="color: #ff6600;">Markup</span>&#8221; - Adding information to a document relating to its structure and/or format</p>
<p>&#8220;<span style="color: #ff6600;">Language</span>&#8221; - A standard methodology with formal syntax.</p>
<p><strong>Reasons behind xml Popularity</strong></p>
<p><em>Platform independent</em></p>
<p><em>Ease of data exchange</em></p>
<p><em>License-Free and well supported</em></p>
<p><em>Big players (Oracle and Microsoft) are backing the W3C XML standard</em></p>
<p> <span id="more-110"></span></p>
<p>An<strong> XML Example depicting Purchase Order</strong></p>
<blockquote><p><img class="alignnone size-full wp-image-112" title="xml-example" src="http://www.expertsharing.com/wp-content/uploads/2008/06/xml-example.png" alt="" width="561" height="476" /></p></blockquote>
<p> </p>
<p><span style="color: #000080;"><strong>Oracle xml components</strong></span></p>
<p>The XML Developer&#8217;s Kits (XDK&#8217;s) include components that can be used to read, modify, and transform XML documents (via XSL-T).</p>
<p><strong>Java<br />
</strong>        <strong>XML Parser</strong> and integrated XSL-T (XSL Transformation) Processor<br />
        XML documents to be transformed (converted) to formats such as HTML, WML, Voice, etc.<br />
        <strong>XML Class Generator<br />
</strong>         Generates Java classes based on XML document formats</p>
<p><strong><span style="color: #000080;">Oracle Xml Parser</span></strong></p>
<p>The <strong><span style="color: #000080;">Oracle XML parser</span></strong> is used to parse and translate XML documents.Using this parser, an XML document and its internal structure and data can be quickly translated to any other XML structure. In addition, this parser in conjunction with XSL-T can quickly transform an XML document to any applicable presentation format (I.e. WML, HTML, voice, etc.). The current version of the Oracle XML parser can be used both as a validating or non-validating parser. Validation is based on the use of XML document DTD&#8217;s.</p>
<p>The <strong><span style="color: #000080;">Oracle XML parser</span></strong> supports two common XML processing API&#8217;s:</p>
<p><strong>DOM (document object model) interface</strong>:<br />
The DOM interface is a W3C standard, and provides an industry-standard interface to read and parse an XML documents contents.</p>
<p><strong>SAX (simple API for XML) interface:<br />
</strong>This provides an API for working with XML documents.</p>
<p> </p>
<p>Two packages are provided with the database to support the use of XML and xml stylesheets with PL/SQL .</p>
<p><strong><span style="color: #003300;">DBMS_XMLQUERY : </span></strong>This package provides a group of procedures and functions that allow data to be extracted or read from database tables in XML format.<br />
<strong><span style="color: #003300;">DBMS_XMLSAVE : </span></strong>This package provides a group of procedures and functions that allow the user to read the contents of an XML document and insert, update, or delete data in database tables based on content within that XML document.</p>
<p><strong>An Pl/sql example of generating xml with a query by using the DMBS_XMLQUERY:</strong></p>
<p><strong></strong><br />
<code>create or replace procedure test_xmlquery<br />
is<br />
ctxsql dbms_xmlquery.ctxtype;<br />
clobvar1 clob;<br />
begin<br />
-- define the cursor<br />
ctxsql := dbms_xmlquery.newcontext('SELECT * FROM SCOTT.EMP');<br />
-- bring back the data<br />
clobvar1 := dbms_xmlquery.getxml(ctxsql);<br />
-- print the result<br />
clobfieldprinting(clobvar1);<br />
-- close the cursor<br />
dbms_xmlquery.closecontext(ctxsql);<br />
END;<br />
/</code></p>
<p>The &#8220;clobfieldprinting&#8221; procedure (this example can be found in the Oracle documentation) is listed below:</p>
<p> create procedure clobfieldprinting (output IN OUT NOCOPY CLOB)<br />
is<br />
xmlvar varchar2(32767);<br />
line varchar2(2000);<br />
begin<br />
&#8211; dbms_lob package is being used<br />
xmlvar := dbms_lob.substr(output,32767);<br />
loop<br />
exit when xmlvar is null;<br />
line := substr(xmlvar,1,instr(xmlvar,chr(10)));<br />
&#8211;printing of the line<br />
htp.prn(line);<br />
xmlstr := substr(xmlvar,instr(xmlvar,chr(10))+1);<br />
end loop;<br />
end;<br />
/</p>
<p>The output of the above code:</p>
<p> </p>
<p> </p>
<p><img class="alignnone size-full wp-image-111" title="xml-output" src="http://www.expertsharing.com/wp-content/uploads/2008/06/xml-output.png" alt="" width="594" height="398" /></p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.expertsharing.com/2008/06/09/oracle-and-xml-query-the-data-into-xml-format/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Index HINT IN Oracle</title>
		<link>http://www.expertsharing.com/2008/06/05/index-hint-in-oracle/</link>
		<comments>http://www.expertsharing.com/2008/06/05/index-hint-in-oracle/#comments</comments>
		<pubDate>Thu, 05 Jun 2008 16:36:24 +0000</pubDate>
		<dc:creator>Praveen</dc:creator>
		
		<category><![CDATA[Oracle Tips]]></category>

		<category><![CDATA[index_ASC HINT]]></category>

		<category><![CDATA[index_combine hint]]></category>

		<category><![CDATA[index_desc hint]]></category>

		<category><![CDATA[index_ffs hint]]></category>

		<guid isPermaLink="false">http://www.expertsharing.com/?p=108</guid>
		<description><![CDATA[An index hint instructs the optimizer to consider the use of an indexed table scan for a specified table. You can optionally specify one or more indexes in the hint. If no indexes names are specified in the hint, Oracle optimizer evaluates the cost of all indexes for a table and uses the most efficient.
 
Instructing [...]]]></description>
			<content:encoded><![CDATA[<p>An <strong><span style="color: #000080;">index hint</span></strong> instructs the optimizer to consider the use of an <strong>indexed table scan</strong> for a specified table. You can optionally specify one or more indexes in the hint. If no indexes names are specified in the hint, Oracle optimizer evaluates the cost of all indexes for a table and uses the most efficient.</p>
<p> <br />
Instructing the optmizer to use an  index is just a hint, it&#8217;s Oracle optimizer decision to make use of an index or not. If the Oracle optimizer recognizes that the cost of full table scan is cheaper than using an index, your <strong>index hint</strong> will be ignored. And there are more factors that optimizer  may favor the use of full table scan rather than using an index.one among them is <strong>db_file_multiblock_read_count</strong>  initiliazation parameter.</p>
<p><strong>db_file_multiblock_read_count</strong> is a parameter which specifies the number of blocks than can be read by Oracle simultaneously.</p>
<p>If you increase the value in the <strong>db_file_multiblock_read_count</strong> rather than the default value, then Oracle favours more of full table scan&#8217;s rather than index usage. If you decrease the value in the <strong>db_file_multiblock_read_count</strong>  , then Oracle favours more of index usage rather than full table scans.</p>
<p><span id="more-108"></span></p>
<p>Another parameter that can play an important role in choosing an index is optimizer_index_cost_adj.</p>
<p>Example of using an <strong>index hint</strong></p>
<p><span style="color: #008080;"><strong>SELECT /*+ INDEX(EMP EMP_IDX1) */ emp_name<br />
FROM EMP WHERE EMP_ID=34344</strong></span><br />
<strong><span style="color: #008080;">SELECT /*+ INDEX(EMP) */&#8230;.</span></strong></p>
<p><strong></strong><br />
IN the <strong>index hint</strong> first parameter specifies the table name or alias for the table . And the next list specifies the list of indexes for consideration.</p>
<p><span style="color: #000080;"><strong>INDEX_ASC(table [index]) :</strong></span><br />
Instructs the Optimizer to scan an index in Ascending order. But i dont see any difference between the index hint and index_asc hint, Since Oracle always scans an index in ascending Order.Index and index_asc are just like synonyms with out any difference in performance in any case.</p>
<p>An example of <strong>INDEX_ASC hint</strong></p>
<p><strong></strong><br />
<strong><span style="color: #008080;">CREATE INDEX idx_customers_id<br />
ON customers(cust_id);</span></strong></p>
<p><strong><span style="color: #008080;">set autotrace traceonly explain</span></strong></p>
<p><strong><span style="color: #008080;">SELECT *<br />
FROM customers<br />
WHERE cust_id = 99999;</span></strong></p>
<p><strong><span style="color: #008080;">SELECT /*+ INDEX_ASC(customers idx_customers_id) */ *<br />
FROM customers<br />
WHERE cust_id=99999; </span></strong></p>
<p><strong></strong></p>
<p><strong><span style="color: #000080;">INDEX_DESC(table [index]) :  </span></strong>Instructs the Optimizer to scan an index in descending Order. This hint is most useful in distributed environments. Say if you want to get the  data from a table that is inserted to a table recently based on some date, this hint can  be of immense help for you.<br />
An example of <strong>INDEX_DESC hint</strong></p>
<p><strong><span style="color: #008080;">set autotrace traceonly explain</span></strong></p>
<p><strong><span style="color: #008080;">SELECT *<br />
FROM customers<br />
WHERE cust_id = 99999;</span></strong></p>
<p><strong><span style="color: #008080;">SELECT /*+ INDEX_desc(customers idx_customers_id) */ *<br />
FROM customers<br />
WHERE cust_id=99999;</span></strong></p>
<p> </p>
<p><strong><span style="color: #000080;">INDEX_FFS(table [index]) : </span></strong>Instructs the optimizer to do a full scan of an index rather than a full scan of a table. The index scan can sometimes run faster, but if and only if every column in the WHERE clause for the specified table exists in the index.</p>
<p>Does not read every block in the index structure, contrary to what its name suggests An index full scan processes all of the leaf blocks of an index, but only enough of the branch blocks to find the first leaf block<br />
Provides ordered output, can be used to avoid sorts for ORDER BY clauses that specify index column order.</p>
<p>An example of <strong>Index_FFS hint</strong></p>
<p><span style="color: #008080;"><strong>set autotrace traceonly explain</strong></span></p>
<p><span style="color: #008080;"><strong>SELECT first_name<br />
FROM employees e;</strong></span></p>
<p><span style="color: #008080;"><strong>SELECT /*+ INDEX_FFS(e emp_name_ix) */ first_name<br />
FROM employees e; </strong></span></p>
<p> </p>
<p style="text-align: center;">
<blockquote><p><img class="alignnone size-full wp-image-109" title="index_Full_scan" src="http://www.expertsharing.com/wp-content/uploads/2008/06/1.png" alt="" width="320" height="143" /></p></blockquote>
<p style="text-align: center;"> </p>
<p><strong></strong></p>
<p><strong></strong><br />
<strong><span style="color: #000080;">Index_combine( table [index1 index2 ....]) : </span></strong>If you have ever worked in an datawarehouse environment, i am sure  you must have used this hint. Index_combine instructs the Optimizer to use one or more bitmapped indexes combined in an boolean relatinship to get the indexed row of a table.</p>
<p>Mainly this hint is used  while accessing the data from a fact table in a datawarehouse environment. If one or more bitmap indexes are created on the dimension keys of a fact table , Oracle combines all the indexes with a boolean &#8220;AND&#8221; , &#8220;OR&#8221; of bits in the bitmap index to give you result.<br />
An example of <strong>Index_combine hint</strong></p>
<p><strong></strong><br />
<span style="color: #008080;"><strong>SELECT /*+ INDEX_COMBINE(e geo_dmnsn_idx proft_dmnsn_idx) */ *<br />
FROM fact_trans_amt<br />
WHERE (geo_id = 108 OR proft_ctr_id = 110);</strong></span></p>
<p> </p>
<p> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.expertsharing.com/2008/06/05/index-hint-in-oracle/feed/</wfw:commentRss>
		</item>
		<item>
		<title>All_Rows Hint Oracle</title>
		<link>http://www.expertsharing.com/2008/06/04/all_rows-hint-oracle/</link>
		<comments>http://www.expertsharing.com/2008/06/04/all_rows-hint-oracle/#comments</comments>
		<pubDate>Wed, 04 Jun 2008 03:53:07 +0000</pubDate>
		<dc:creator>Praveen</dc:creator>
		
		<category><![CDATA[Oracle Tips]]></category>

		<guid isPermaLink="false">http://www.expertsharing.com/?p=106</guid>
		<description><![CDATA[
All_rows hint is used in an opposite view to first_rows hint. This hint is mainly used in datawarehouse environments. if You want to instruct the optimizer to choose the best plan in getting all the rows of the query by the minimum resources of the machine.
This hint is designed mainly  to consume less machine resources like CPU, [...]]]></description>
			<content:encoded><![CDATA[<h2 style="text-align: center;"></h2>
<p><strong>All_rows</strong> hint is used in an opposite view to <strong>first_rows</strong> hint. This hint is mainly used in datawarehouse environments. if You want to instruct the optimizer to choose the best plan in getting all the rows of the query by the minimum resources of the machine.</p>
<p><strong>This</strong> hint is designed mainly  to consume less machine resources like CPU, MEMORY as well as DISK I/O.</p>
<p>All_rows mainly targets on througput of the query rather than response time. So this hint is mainly used in dataware house environments rather then transactional environments.</p>
<p>The result of using an<strong> All_rows </strong>hint on optimizer Plans:</p>
<p><span style="color: #800000;"><strong>All_rows hint</strong> favours more of full table scans rather than index usage.</span></p>
<p><span style="color: #800000;"><strong>All_rows hint</strong> favour more of Sort_merge or Hash Joins rather than nested loops.</span></p>
<p><strong><span style="color: #000080;">Synatx of ALL_ROWS HINT:</span></strong></p>
<blockquote><p>SELECT /*+ ALL_ROWS */ &#8230;.. FROM &#8230;&#8230;</p></blockquote>
<p> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.expertsharing.com/2008/06/04/all_rows-hint-oracle/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Incorrect Usage Of Oracle Hints result in hint being ignored</title>
		<link>http://www.expertsharing.com/2008/06/04/incorrect-usage-of-oracle-hints-result-in-hint-being-ignored/</link>
		<comments>http://www.expertsharing.com/2008/06/04/incorrect-usage-of-oracle-hints-result-in-hint-being-ignored/#comments</comments>
		<pubDate>Wed, 04 Jun 2008 03:08:10 +0000</pubDate>
		<dc:creator>Praveen</dc:creator>
		
		<category><![CDATA[Oracle Tips]]></category>

		<category><![CDATA[Hints Correct usage]]></category>

		<category><![CDATA[Incorrect usage of Hints]]></category>

		<category><![CDATA[Oracle hints Ignored]]></category>

		<guid isPermaLink="false">http://www.expertsharing.com/?p=104</guid>
		<description><![CDATA[Why your hint is Ignored ? Know the correct Usage of Hints
Usually a hint is specified as  a comment to the sql statement. But the job of Oracle optimizer is to differentiate between a hint and a comment. If the Oracle hint is not specified correctly in  an sql statement, there is 100% chance of your hint [...]]]></description>
			<content:encoded><![CDATA[<h2><span style="color: #ff0000;">Why your hint is Ignored ? Know the correct Usage of Hints</span></h2>
<p>Usually a hint is specified as  a comment to the sql statement. But the job of <strong>Oracle optimizer</strong> is to differentiate between a hint and a comment. If the <strong>Oracle hint</strong> is not specified correctly in  an sql statement, there is 100% chance of your <strong>hint being ignored</strong> by the <strong>Oracle optimizer</strong>. If an <strong>incorrect hint is specified or a hint is mispelled</strong>, Optimizer ignores the hint instead of specifying an error. As the name specifies it is a &#8220;hint&#8221; to OPtimizer to choose the best path, not to report an error because of <strong>wrong hint</strong>.</p>
<p>I will list some of the cases where people go wrong in specifying a hint</p>
<p><strong><span style="color: #000080;">Table aliases :</span></strong></p>
<p>Let us have a look at the below query</p>
<blockquote>
<p align="left">SELECT /*+ INDEX(emp emp_PK) */ emp_name<br />
FROM emp a<br />
WHERE a.emp_no = 32322</p>
</blockquote>
<p align="left">In the above query you are instructing the oracle optimizer to use index hint. But<strong> Oracle</strong> definitely ignores your specification, it may or may not use the index based on the statistics available on the table EMP.This means that if the table is referenced via an alias within the SQL statement, the hint must also reference it via the alias .</p>
<p align="left"><strong><span style="color: #000080;">Correct Placement of Hints:</span></strong></p>
<p align="left">Always Place an hint immediately after the first sql verb. if you place the oracle hint anywhere else your hint will be ignored.</p>
<p align="left">Let us see the following query</p>
<blockquote>
<p align="left">SELECT emp_name<br />
FROM /*+ INDEX(a emp_pk) */ emp a</p>
</blockquote>
<p align="left">Oracle does not report an error, but will definitely ignore your specification of hint.</p>
<p align="left">The<strong> <span style="color: #339966;">correct way of using a hint</span></strong> is</p>
<blockquote>
<p align="left">SELECT /*+ INDEX(a emp_pk) */ emp_name<br />
FROM EMP a</p>
<p align="left">INSERT /*+ APPEND */</p>
</blockquote>
<p align="left"><em><span style="text-decoration: underline;">First three consecutive letters of  your hint should be &#8220;/&#8221; ,&#8221;*&#8221;,&#8221;+&#8221; and the last two letters should be &#8220;*&#8221;, &#8220;/&#8221;.</span></em></p>
]]></content:encoded>
			<wfw:commentRss>http://www.expertsharing.com/2008/06/04/incorrect-usage-of-oracle-hints-result-in-hint-being-ignored/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Oracle Performance Tuning Exam General tips</title>
		<link>http://www.expertsharing.com/2008/06/03/oracle-performance-tuning-exam-general-tips/</link>
		<comments>http://www.expertsharing.com/2008/06/03/oracle-performance-tuning-exam-general-tips/#comments</comments>
		<pubDate>Tue, 03 Jun 2008 05:34:22 +0000</pubDate>
		<dc:creator>Praveen</dc:creator>
		
		<category><![CDATA[Oracle Tips]]></category>

		<category><![CDATA[Oracle performance tuning]]></category>

		<category><![CDATA[Oracle tuning tips]]></category>

		<category><![CDATA[tuning exam tips]]></category>

		<category><![CDATA[Tuning Oracle]]></category>

		<guid isPermaLink="false">http://www.expertsharing.com/?p=101</guid>
		<description><![CDATA[Oracle Performance Tuning Exam
 
This exam focuses on the skills that you use to tune all components of an Oracle database application system. Expect to answer ~65 multiple-choice questions in 90 minutes or less. To pass the exam, you need to answer at least 46 questions correctly (70%). In general, the exam tests you about the [...]]]></description>
			<content:encoded><![CDATA[<h2 style="text-align: center;"><span style="color: #ff0000;">Oracle Performance Tuning Exam</span></h2>
<p style="text-align: center;"> </p>
<p style="text-align: left;">This exam focuses on the skills that you use to tune all components of an Oracle database application system. Expect to answer ~65 multiple-choice questions in 90 minutes or less. To pass the exam, you need to answer at least 46 questions correctly (70%). In general, the exam tests you about the following categories of information:</p>
<p style="text-align: left;"> the fundamental goals and strategies for Oracle database system and application tuning<br />
 the components that you can tune to affect overall performance<br />
 the roles that application designers, developers, database administrators, system administrators, and application end users play in the tuning process<br />
 the steps in SQL statement processing (e.g., open a cursor, parse)<br />
 registering application information in the data dictionary with the DBMS_APPLICATION_INFO package<br />
 techniques for using shared SQL and maximizing application performance<br />
 gathering optimizer statistics to ensure optimal execution plans<br />
 revealing SQL statement execution plans with the SQL command <strong>EXPLAIN PLAN</strong> and the <strong>SQL*Plus    AUTOTRACE</strong> feature<br />
 controlling optimizer behavior with initialization parameters, hints, and stored outlines<br />
 monitoring SQL statement performance statistics in the dynamic performance views<br />
 monitoring SQL statements using <strong>SQL tracing and TKPROF<br />
</strong> designing transactions<br />
 controlling and monitoring data locks (e.g., table locks, row locks)<br />
 avoiding deadlocks<br />
 setting isolation levels and extending read consistency<br />
 <strong>minimizing disk I/O</strong> with indexes (normal, bitmap, and function-based), index-organized tables, and clusters (indexed and hash)<br />
 tuning host operating system memory and disk I/O<br />
 tuning a database instance&#8217;s buffer cache<br />
 configuring multiple buffer pools (default, keep, and recycle pools) in the buffer cache<br />
 measuring dictionary cache and library cache hit ratios<br />
<strong> Oracle tuning</strong> a database instance&#8217;s shared pool for general use<br />
 <strong>Oracle</strong> <strong>tuning </strong>a database instance&#8217;s shared pool for shared server sessions<br />
 preventing fragmentation of shared pool memory<br />
 monitoring database I/O using dynamic performance views<br />
 using tablespaces and data files to reduce contention for database data<br />
 <strong>tuning the database</strong> writer background process(es)<br />
 <strong>tuning</strong> database checkpoints<br />
 <strong>tuning</strong> temporary (sort) space allocations<br />
 <strong>tuning</strong> redo log I/O with online log members and the redo log buffer<br />
 using the UTLBSTAT and UTLESTAT utilities to gather tuning statistics<br />
 using Oracle Expert to tune an Oracle database system</p>
]]></content:encoded>
			<wfw:commentRss>http://www.expertsharing.com/2008/06/03/oracle-performance-tuning-exam-general-tips/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Oracle exam # 1Z0-032 TIPS- BACKUP, RECOVERY,NET CONFIGURATION</title>
		<link>http://www.expertsharing.com/2008/06/02/oracle-exam-1z0-032-tips-backup-recoverynet-configuration/</link>
		<comments>http://www.expertsharing.com/2008/06/02/oracle-exam-1z0-032-tips-backup-recoverynet-configuration/#comments</comments>
		<pubDate>Mon, 02 Jun 2008 04:06:31 +0000</pubDate>
		<dc:creator>Praveen</dc:creator>
		
		<category><![CDATA[Oracle Tips]]></category>

		<category><![CDATA[backup exam tips]]></category>

		<category><![CDATA[Noarchivelog]]></category>

		<category><![CDATA[Oracle exam tips]]></category>

		<category><![CDATA[Oracle names]]></category>

		<category><![CDATA[recovery exam tips]]></category>

		<guid isPermaLink="false">http://www.expertsharing.com/?p=99</guid>
		<description><![CDATA[Specific tips for the exam 1Z0-0032:-
 
Although you are not expected to understand how to configure and make use of advanced Oracle Net features, you should be able to explain their function in an Oracle Net design. Such topics include the Oracle Internet Directory (OID, Oracle&#8217;s LDAP-compliant directory service), Oracle Names, Oracle Connection Manager, Oracle Advanced [...]]]></description>
			<content:encoded><![CDATA[<h3><span style="text-decoration: underline;">Specific tips for the exam 1Z0-0032:-</span></h3>
<p> </p>
<p>Although you are not expected to understand how to configure and make use of advanced Oracle Net features, you should be able to explain their function in an Oracle Net design. Such topics include the <strong>Oracle Internet Directory</strong> (OID, <strong>Oracle&#8217;s LDAP</strong>-compliant directory service), Oracle Names, Oracle Connection Manager, Oracle Advanced Security, the Oracle Net Application Proxy Kit, and Oracle Heterogeneous Services.</p>
<p> <br />
Do you understand the OSI model and how various Oracle Net software layers with different types of connections fit into this model? Expect several questions about this subject.</p>
<p>You must understand how to configure the two basic naming methods (name resolution methods) for <strong>Oracle Net: host naming and local naming.</strong></p>
<p><span id="more-99"></span></p>
<p>You must know how to configure and tune an Oracle database instance to support shared server connections in addition to dedicated server connections. Make sure that you have a complete understanding of the benefits of an <strong>Oracle Shared Server</strong> (formerly called the multithreaded server or MTS with previous releases of Oracle), the process architecture used to support shared server connections (dispatcher, a pool of shared servers, virtual circuits, request and response queues, etc.), the specific path and steps that shared server connections, requests, and responses take in an <strong>Oracle Shared Server</strong>, etc.</p>
<p> </p>
<p>Expect many questions that focus on offline redo log configuration. For example, you should understand how to configure both local and remote log archive destinations using the LOG_ARCHIVE_DEST_n,  LOG_ARCHIVE_DEST_STATE_n, LOG_ARCHIVE_DEST, LOG_ARCHIVE_DUPLEX_DEST, and LOG_ARCHIVE_FORMAT initialization parameters, the interaction of LOG_ARCHIVE_MIN_SUCCEED_DEST and the various log archive destination initialization parameters, and how to set the LOG_ARCHIVE_MAX_PROCESSES initialization parameter to start multiple Archiver (ARCn) background processes.</p>
<p> <br />
Spend an adequate amount of time practicing listener configuration, including the configuration of such listener features as dynamic service registration, static service registration, multiple listeners and connection load balancing, and manually editing listener.ora parameters. You should be intimately familiar  with the use of the Listener Control utility (lsnrctl).</p>
<p> </p>
<p>Starting with Oracle9i, connection load balancing also supports dedicated server connections in addition to shared server connections. Additionally, Oracle Net no longer supports the IPX/SPX protocol.</p>
<p>Understand the importance of basic database backup and recovery principles, including such terms as mean time between failures (MTBF) and mean time to recover (MTTR), the types of problems that can necessitate a database recovery (for example, system crash, disk failure, user error), the redo (roll forward) and undo (roll backward) stages of database recovery, and the structures necessary for various types of database recovery (the database control file, online redo log groups, undo segments, database backups, offline redo log files).</p>
<p>You must understand how to back up and recover an Oracle database with and without the Recovery Manager (RMAN) utility; the latter option is known as user-managed backup and recovery.<br />
Although most Oracle databases worth protecting operate with media recovery enabled (in <strong>ARCHIVELOG mode</strong>), an inordinate number of OCP exam questions focus on how to back up and recover databases that operate with media recovery disabled (in <strong>NOARCHIVELOG</strong> mode). Therefore, do not forget to spend some time learning about the procedures for dealing with databases that use <strong>NOARCHIVELOG</strong> mode. You should understand that to back up a<strong> NOARCHIVELOG</strong> mode database, you must take the database offline cleanly and back up all database files (data files and the control file); optionally, you can back up the database&#8217;s online redo log members. To recover a <strong>NOARCHIVELOG</strong> mode database, you can restore all database files (data files, the control file, and online redo log members), and then restart the database; alternatively, if you do not restore online log members because you did not back them up, you must startup a new instance, mount the database, use a <strong>RECOVER DATABASE UNTIL CANCEL</strong> command, and then use an <strong>ALTER DATABASE OPEN RESETLOGS</strong> command to clear the current online log members and start a new database incarnation. In either case, you lose all committed work that was performed since the backup used for the recovery.<br />
(Note: This process is actually a database restore, not a database recovery.)</p>
<p> </p>
<p>Make sure that you know how to perform a user-managed backup of an open database. For example, you should understand the significance of placing an online tablespace into backup mode (<strong>ALTER TABLESPACE &#8230; BEGIN BACKUP</strong>) before copying the tablespace&#8217;s data files, and what type of useful information that you can display when you query the<strong> V$BACKUP</strong> and <strong>V$DATAFILE_HEADER</strong> data dictionary views.</p>
<p>Make sure that you carefully understand other important issues that you will likely have to face in real-world situations. For example, when a disk drive is lost for an extended period of time, you should know how to restore lost database files to another disk and rename the files in the database control file using a command<br />
such as <strong>ALTER DATABASE &#8230; RENAME FILE</strong> before recovering the database.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.expertsharing.com/2008/06/02/oracle-exam-1z0-032-tips-backup-recoverynet-configuration/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Shared Pool and Shared Pool Tuning in Oracle</title>
		<link>http://www.expertsharing.com/2008/05/16/shared-pool-and-shared-pool-tuning-in-oracle/</link>
		<comments>http://www.expertsharing.com/2008/05/16/shared-pool-and-shared-pool-tuning-in-oracle/#comments</comments>
		<pubDate>Fri, 16 May 2008 17:20:47 +0000</pubDate>
		<dc:creator>Praveen</dc:creator>
		
		<category><![CDATA[Oracle Tips]]></category>

		<category><![CDATA[Oracle SGA and shared Pool]]></category>

		<category><![CDATA[Oracle Sga Stat]]></category>

		<category><![CDATA[shared_pool_size]]></category>

		<category><![CDATA[Shared_pool_size init.ora]]></category>

		<guid isPermaLink="false">http://www.expertsharing.com/2008/05/16/shared-pool-and-shared-pool-tuning-in-oracle/</guid>
		<description><![CDATA[Shared Pool tuning is the most important aspect of Oracle shared global area optimization. And by far it is the most neglected area.
Shared Pool is a memory area in Oracle which is in turn a part of Oracle SGA(System Global Area). Shared Pool comprises of  different meory Strctures. If shared pool size is not configured [...]]]></description>
			<content:encoded><![CDATA[<p>Shared Pool tuning is the most important aspect of Oracle shared global area optimization. And by far it is the most neglected area.</p>
<p>Shared Pool is a memory area in Oracle which is in turn a part of <strong>Oracle SGA</strong>(System Global Area). Shared Pool comprises of  different meory Strctures. If shared pool size is not configured Properly , the performance of the database suffers drastically.</p>
<p>Shared Pool consists of</p>
<p>1.<strong> Library Cache</strong></p>
<p>2. <strong>Dictionary Cache</strong></p>
<p>3. <strong>Control Structures.</strong></p>
<p>Library cache inturn comprises of Shared Sql Area, Pl/sql Procedures, Functions, Packages (loaded) and control Structures (Latches and locks).</p>
<p><span id="more-86"></span></p>
<p><strong>Shared Sql Area</strong> : contains <strong>Parsed SQL and execution Plans</strong> for statements already run against the database.</p>
<p><strong>Pl/sql Area</strong> : contains the recently executed Procedures, Functions and Packages.</p>
<p><strong>Control Structures</strong> : A memory are for maintaing Latches and Locks.</p>
<p>Dictionary cache  stores all the info of  tables and views in the database, Names and datatypes of the columns in the database, Object and system privileges of all the Users.</p>
<p>All the Shared Pool Structures are maintained by a<strong> LRU</strong> (least recently Used) algorithm, by which Oracle removes the objects from the shared Pool , Until there is <strong>enough free space in the shared Pool</strong> to accomodate new Object.</p>
<p>Oracle maintains the stats of all the objects in the shared pool, if any of the memory objects are not used from the last 3 seconds, these memory objects will be aged out and will be removed from the cache.</p>
<p>Library cache is described as the variable component of Shared Pool where as the dictionary cache is termed as fixed component of shared Pool.</p>
<p>The memory structures inside the<strong> Library cache</strong> are variable in size whereas the dictionary cache and control structures are relatively fixed in size.</p>
<p>The memory allocated for shared Pool is determined by an initialization Parameter called <strong>SHARED_POOL_SIZE</strong>.</p>
<p>Let us go ahead with shared pool tuning.</p>
<p>As i said shared_pool is a part of <strong>Oracle SGA</strong> (SYSTEM GLOBAL AREA),  the statistics of shared Pool usage are stored in a dynamic performance view called <strong><em>v$sgastat.</em></strong></p>
<p>The following query determines the available memory for <strong>SHARED_POOL_SIZE in Oracle sga</strong></p>
<p><strong><u>select sum (bytes)/1024/1024 from v$sgastat where pool=&#8217;shared pool&#8217;</u></strong></p>
<p>The above query Provides the shared pool size in mega bytes.</p>
<p>The following query determines the total used memory by shared_Pool in Oracle SGA.</p>
<p><strong><u>select sum (bytes)/1024/1024 from v$sgastat where pool=&#8217;shared pool&#8217; and name not in (&#8217;free memory&#8217;)</u></strong></p>
<p>Total Allocated memory for <strong>shared_pool in the init.Ora</strong> or spfile can be detemined by</p>
<p><strong><u>select  value from v$parameter where name=&#8217;shared_pool_size&#8217;</u></strong></p>
<p>combining the above three queries to consolidated result of allocated shared_pool, Shared_pool_used, Available free space with the shared Pool, Total available percentage, you can write the query as</p>
<p> select<br />
sum(a.bytes)/(1024*1024))shared_pool_used,<br />
max(b.value)/(1024*1024) shared_pool_size,<br />
sum(a.bytes)/(1024*1024))-<br />
(sum(a.bytes)/(1024*1024)) shared_pool_avail,<br />
((sum(a.bytes)/(1024*1024))/(max(b.value)/(1024*1024)))*100<br />
pct_shared_pool_avl<br />
from v$sgastat a, v$parameter b<br />
where (a.pool=&#8217;shared pool&#8217;<br />
and a.name not in (&#8217;free memory&#8217;))<br />
and<br />
b.name=&#8217;shared_pool_size&#8217;</p>
<p>You need to continously monitor the <strong>shared Pool</strong> with the above query at differnet times. During Peak times and Non peak times to have glance of shared pool usage in the Oracle database.</p>
<p>if the available pct_shared_pool_avl crosses 95% then i think you should re-consider the Process of increasing the <strong>shared_pool_size</strong>.</p>
<p><img src="http://www.expertsharing.com/wp-content/uploads/2008/05/shared_pool_size.JPG" alt="shared_pool_size.JPG" /></p>
]]></content:encoded>
			<wfw:commentRss>http://www.expertsharing.com/2008/05/16/shared-pool-and-shared-pool-tuning-in-oracle/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
