<?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 Articles</title>
	<atom:link href="http://www.expertsharing.com/category/oracle-articles/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>Undo Tablespace Oracle</title>
		<link>http://www.expertsharing.com/2008/06/20/undo-tablespace-oracle/</link>
		<comments>http://www.expertsharing.com/2008/06/20/undo-tablespace-oracle/#comments</comments>
		<pubDate>Fri, 20 Jun 2008 22:14:56 +0000</pubDate>
		<dc:creator>Praveen</dc:creator>
		
		<category><![CDATA[Oracle Articles]]></category>

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

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

		<category><![CDATA[Undo Retention]]></category>

		<category><![CDATA[Undo retention duration]]></category>

		<category><![CDATA[UNDO TABLESPACE MANAGEMENT]]></category>

		<guid isPermaLink="false">http://www.expertsharing.com/?p=125</guid>
		<description><![CDATA[Every Oracle database requires a mechanism to undo transactional changes. All the changes made by the dml transactions can be done undone using rollback segments until oracle 8i.  Oracle has introduced an  advanced feature called Automatic undo tablespace management from oracle version 9.0.0.   In contrast to the Roll back segment management, Oracle automatically manages all the operations [...]]]></description>
			<content:encoded><![CDATA[<p>Every Oracle database requires a mechanism to undo transactional changes. All the changes made by the dml transactions can be done undone using rollback segments until oracle 8i.  Oracle has introduced an  advanced feature called <strong><span style="color: #008000;">Automatic undo tablespace management</span></strong> from oracle version 9.0.0.   In contrast to the Roll back segment management, Oracle automatically manages all the operations like adding the segments, shrinking the segments, naming the segments, managing them, making the best possible use of undo space.</p>
<p>All the operations specified below involves an <strong>undo tablespace</strong>.</p>
<p>1. Revert back changes done with a rollback command.<br />
2. Providing read consistency to Oracle sessions.<br />
3. analyzing or retrieving the data at an earlier point of time using a flash back query.<br />
4. Recover the database.</p>
<p><strong>Creation of Undo tablespace</strong> :</p>
<p>You can create an <strong>undo tablespace</strong> at the time of creation of the database with &#8216;CREATE DATABASE&#8217; command or later on you can add an UNDO tablespace with &#8216;CREATE UNDO TABLESPACE&#8217; COMMAND. If Automatic undo management is enabled, and if  no Single <strong>undo tablespace</strong> available, Oracle makes use of  SYSTEM tablespace for undo management which is not recommended. Oracle also creates a warning in alert.log file, if it uses the system tablespace for UNDO management.</p>
<p>For automatic undo tablespace management by oracle, there should be atleast one active <strong>UNDO tablespace</strong> per instance.</p>
<p><strong>Undo tablespace creation example</strong>  by using the create database command.</p>
<blockquote><p>CREATE database strinix<br />
 controlfile reuse<br />
 datafile &#8216;/u01/oradata/strinix/system_01.dbf&#8217; size 300M<br />
undo tablespace undo_tbs_`<br />
 datafile &#8216;/u02/oradata/strinix/undo_tbs_01.dbf&#8217; size 600M<br />
logfile<br />
   group 1<br />
    (&#8217;/u10/oradata/strinix/redo_g1m1.log&#8217;) size 25M,<br />
    . . . . . . . . . . . . . . . .<br />
   <br />
;</p></blockquote>
<p>When creating A new database, if Undo TS is specified but no ‘undo tablespace’ in ‘CREATE DATABASE’ command, the database creation fails with the following errors.</p>
<blockquote><p><span style="color: #808000;">ORA-01092: ORACLE instance terminated. Disconnection forced<br />
ORA-30045: No undo tablespace name specified</span></p></blockquote>
<p><strong>Undo tablespace creation example</strong> by using the create undo tablespace command.</p>
<blockquote><p>CREATE undo tablespace undo_tbs<br />
 datafile &#8216;/u02/oradata/strinix/undo_tbs_01.dbf&#8217; size 600M;</p></blockquote>
<p><strong>Drop UNDO TABLESPACE:</strong></p>
<p>You can drop an undo tablespace similar to other tablespaces.</p>
<p>Drop undo tablespace example :</p>
<blockquote><p>DROP TABLESPACE undotbs_01;</p></blockquote>
<p>The above statement would work only if your undo tablespace is not being used by the system currently. If an UNDO TABLESPACE consists of pending transactions, DROP TABLESPACE statement will fail.</p>
<p>You can force undo tablespace to be dropped by the following command :</p>
<p><span style="font-family: Courier New;">DROP TABLESPACE &#8230;..INCLUDING CONTENTS</span></p>
<p> <strong>Undo tablespace Characteristics</strong>:</p>
<ul>
<li>No Permanent objects can be created in UNDO TABLESPACE (ORACLE WILL THROW ORA-30022) error.</li>
<li>You can change the data file size , add data files to the undo tablespace similiar like other tablespaces.</li>
<li>Changes are permitted in data file properties.</li>
<li>You can alter the tablespace for online Backups.</li>
<li>You cannot offline an active undo tablespace.</li>
<li>You cannot change extent sizes of an undo tablespace.</li>
</ul>
<p><strong>Automatic Undo segments:</strong></p>
<p>The names of <strong>Automatic Undo segments</strong> are system generated. They are in the form of _SYSSMUn$  (n is the undo segment number,  usn). The number of Initial undo segments created depends upon the SESSIONS parameter.  More automatic undo segments can be  brought online, or created, as needed, provided undo space is available. One transaction per undo segment is desired reach.</p>
<p><span style="color: #000080;"><em>Dynamic Extents Transfer</em></span>:: Reusing expired (or unexpired) undo extents from other undo segments</p>
<p><em><span style="color: #000080;">Shrinking of Undo Segments</span></em>: Every 12 hours SMON shrinks idled undo segments.Foreground processes signal SMON to shrink undo segments when more undo space is needed</p>
<h2><span style="color: #808000;">UNDO RETENTION</span> :</h2>
<p> <strong>UNDO RETENTION</strong> specifies the duration of undo information to be held in the undo tablespace before overwriting. if a transaction is committed, there is no need to hold the undo information, but to provide the read consistency oracle tries to hold the undo information atleast for the specified duration. But holding of the undo information is not guranteed. If sufficient space is not available in undo tablespace, Oracle can overwrite the undo information.If any of this overwritten undo information is required for consistent read in a current long-running query, the query could fail with the <strong>ora-01555 : snapshot too old</strong> error message.</p>
<p><strong>UNDO RETENTION</strong> period is specified in seconds. The default value for <strong>undo retention period</strong> is 900 seconds. Maximum value for  Undo retention is <span style="font-size: medium;">4</span><span style="font-size: medium;">294</span><span style="font-size: medium;">967</span><span style="font-size: medium;">295 SECONDS</span>. For a fixed size undo tablespace the parameter &#8220;<strong>undo_retention</strong>&#8220;  is ignored. Obviously  it would not be a best practice to keep an undo tablespace in an unlimited size. The other way is to fix the maximum size of a tablespace and enable the autoextend option.</p>
<p>An example of autoextending a tablespace fixing the maximum size</p>
<blockquote><p>CREATE undo tablespace undo_tbs<br />
 datafile &#8216;/u02/oradata/strinix/undo_tbs_01.dbf&#8217; AUTOEXTEND ON NEXT 10M  maxsize 800M;</p></blockquote>
<p>You can also change <strong>UNDO_RETENTION PERIOD</strong> immediately by using the following command.</p>
<p>ALTER SYSTEM SET UNDO_RETENTION = 3600;</p>
<p> <br />
<strong><span style="text-decoration: underline;">Initilization parameters required for Automatic undo management:</span></strong></p>
<p><span style="color: #ff9900;">UNDO_MANAGEMENT = &lt;auto|manual&gt;.</span></p>
<p><span style="color: #000000;">If UNDO_MANAGEMENT is specified as auto in initilizatin file, Oracle automatic undo management is enabled. if Manual is specified  for this parameter , then the traditional Rollback segment are used for undo management.  If Manual is specified for UNDO_MANAGEMENT ,below undo parameters will be ignored.</span></p>
<p><span style="color: #ff9900;">UNDO_TABLESPACE = &lt;ts_name&gt;</span></p>
<p><span style="color: #000000;">UNDO_TABLESPACE specifies the tablespace name which should be used as undo tablespace.</span></p>
<p><span style="color: #ff9900;">UNDO_RETENTION = &lt;seconds|900&gt;</span></p>
<p><span style="color: #000000;">UNDO RETENTION period is specfied in seconds.</span></p>
<p><span style="color: #ff9900;">UNDO_SUPPRESS_ERRORS = &lt;false|true&gt;</span></p>
<p>The defualt value for UNDO_SUPPRESS_ERRORS  is false. It Reports an error if  any manual management operation is done related to automatic undo segments. TRUE: Reports success for all such operations without actually carrying them out.</p>
<p><strong><span style="color: #3366ff;"><span style="text-decoration: underline;">Switching of Undo tablespace:</span></span></strong></p>
<p>An undo tablespace can be changed dynamically by using the following command:</p>
<blockquote><p>alter system set undo_tablespace = &lt;New Undo TS Name&gt;;</p></blockquote>
<p> </p>
<p> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.expertsharing.com/2008/06/20/undo-tablespace-oracle/feed/</wfw:commentRss>
		</item>
		<item>
		<title>TIPS FOR ORACLE9i DBA EXAM 3 (#1Z0-032, Fundamentals II)</title>
		<link>http://www.expertsharing.com/2008/05/29/tips-to-help-students-pass-oracle9i-dba-exam-3-1z0-032-fundamentals-ii/</link>
		<comments>http://www.expertsharing.com/2008/05/29/tips-to-help-students-pass-oracle9i-dba-exam-3-1z0-032-fundamentals-ii/#comments</comments>
		<pubDate>Thu, 29 May 2008 15:28:26 +0000</pubDate>
		<dc:creator>Praveen</dc:creator>
		
		<category><![CDATA[Oracle Articles]]></category>

		<category><![CDATA[exam # 1z0-0032]]></category>

		<category><![CDATA[Oracle certification exam 1z0-0032 tips]]></category>

		<guid isPermaLink="false">http://www.expertsharing.com/?p=97</guid>
		<description><![CDATA[This exam focuses on three primary topics: basic Oracle Net configuration (in other words, configuring Oracle for network access), the skills that you use to protect and recover an Oracle database from the inevitable problems of data loss, and the Export/Import and SQL*Loader utilities. Expect to answer approximately 63 multiple choice questions in 90 minutes. [...]]]></description>
			<content:encoded><![CDATA[<p>This exam focuses on three primary topics: basic Oracle Net configuration (in other words, configuring Oracle for network access), the skills that you use to protect and recover an Oracle database from the inevitable problems of data loss, and the Export/Import and SQL*Loader utilities. Expect to answer approximately 63 multiple choice questions in 90 minutes. To pass the exam, you need to answer at least 41 questions correctly (65%). Specifically, the exam tests you about the following categories of information:</p>
<p> </p>
<ul>
<li>the general need for Oracle Net, Oracle Corp.&#8217;s products that support applications in a networked environment</li>
<li>the benefits of Oracle Net</li>
<li><strong>Oracle Net software architecture</strong></li>
<li>Oracle Net name resolution methods (host naming, local naming, etc.)</li>
<li>shared server configuration and tuning</li>
<li>Oracle Net connection models (<strong>shared server</strong>, <strong>dedicated server</strong>, bequeathed, etc.)</li>
<li><strong>Oracle Net disconnections</strong></li>
<li>Oracle Net configuration files (sqlnet.ora, tnsnames.ora, listener.ora, etc.)</li>
<li>the <strong>TNS_ADMIN</strong> environment variable</li>
<li>network design</li>
<li>the <strong>Oracle Net Manager</strong> and Oracle Net Configuration Assistant</li>
<li>the purpose and configuration of a listener process</li>
<li>automatic service registration with the listener</li>
<li>static service registration with the listener</li>
<li>the Listener Control utility</li>
<li>transparent connection load balancing and failover</li>
<li>troubleshooting network connectivity problems</li>
<li>the <strong>TNSPING</strong> utility</li>
<li>failures that can damage an Oracle database system such as SQL statement failure, foreground and background process failure, system and instance crashes, disk (media) failures, and user errors</li>
<li>the roll forward (redo) and roll back (undo) recovery stages of crash, instance, and media recovery</li>
<li>the function of the database&#8217;s online log members, archived log files, and undo (rollback) segments in database recovery</li>
<li>configuration of the database&#8217;s online log groups and members, log archiving, checkpoints, and the control file</li>
<li>user-managed physical database backup and recovery using SQL commands and operating system commands</li>
<li>database backup and recovery using the <strong>Recovery Manager (RMAN) utility</strong></li>
<li>logical database backup and recovery using the <strong>Import and Export utilities</strong></li>
<li>detection and repair of data block corruption</li>
<li>bulk data loads of external data using the SQL*Loader utility</li>
<li>bulk data loads of internal data using direct-load INSERT statements</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.expertsharing.com/2008/05/29/tips-to-help-students-pass-oracle9i-dba-exam-3-1z0-032-fundamentals-ii/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Tips for the Oracle DBA certificatin Exam 1Z0-007</title>
		<link>http://www.expertsharing.com/2008/05/28/tips-for-the-oracle-dba-certificatin-exam-1z0-007/</link>
		<comments>http://www.expertsharing.com/2008/05/28/tips-for-the-oracle-dba-certificatin-exam-1z0-007/#comments</comments>
		<pubDate>Wed, 28 May 2008 21:49:05 +0000</pubDate>
		<dc:creator>Praveen</dc:creator>
		
		<category><![CDATA[Oracle Articles]]></category>

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

		<category><![CDATA[HOW TO ESACPE CHARACTERS IN ORACLE]]></category>

		<category><![CDATA[NATURAL JOINS ORACLE]]></category>

		<category><![CDATA[NON-EQUIJOINS]]></category>

		<category><![CDATA[Round and trunc]]></category>

		<category><![CDATA[TRUNCATE DATE]]></category>

		<guid isPermaLink="false">http://www.expertsharing.com/?p=96</guid>
		<description><![CDATA[Be prepared to identify the correct usage the optional ESCAPE parameter when you want Oracle to interpret literally a wildcard character within the expression. In the expression, specify the escape character (for example, \) followed by the wildcard character that you want Oracle to interpret literally. Then specify the escape character in the ESCAPE parameter [...]]]></description>
			<content:encoded><![CDATA[<p>Be prepared to identify the correct usage the optional <strong>ESCAPE parameter</strong> when you want <strong>Oracle to interpret literally a wildcard character</strong> within the expression. In the expression, specify the escape character (for example, \) followed by the wildcard character that you want Oracle to interpret literally. Then specify the escape character in the ESCAPE parameter itself. For example, the following query returns the job IDs and job titles for jobs that have a job ID that begins with the characters &#8220;FI_&#8221;.</p>
<p><em>SELECT job_id, job_title<br />
FROM jobs<br />
WHERE job_id LIKE &#8216;FI\_%&#8217; ESCAPE &#8216;\&#8217;;</em></p>
<p>The following example explains how to use the <strong>ROUND and TRUNC</strong> functions to round or<strong> truncate DATE values to the nearest day</strong>. Notice that the ROUND and TRUNC functions accept a format model element (for example, DAY) as their second argument; if you omit this argument, these functions round and truncate dates to the nearest day, respectively. Note that you can use the SQL functions<strong> ROUND and TRUNC with DATE values only</strong>; you cannot use these functions with TIMESTAMP, TSTZ, or TSLTZ values.</p>
<p><em>SELECT<br />
ROUND(TO_DATE(&#8217;23-AUG-99:12:12&#8242;,&#8217;DD-MON-RR:HH24:MI&#8217;), &#8216;DAY&#8217;) AS result,<br />
TRUNC(TO_DATE(&#8217;23-AUG-99:12:12&#8242;,&#8217;DD-MON-RR:HH24:MI&#8217;), &#8216;DAY&#8217;) AS result<br />
FROM dual;</em></p>
<p>The only valid logical operators in an outer join <strong>condition are = and AND.</strong></p>
<p><span id="more-96"></span></p>
<p>The exam will most likely include two or more questions that test your knowledge of less frequently used <strong>non-equijoins</strong>. A <strong>non-equijoin</strong> is useful when no corresponding columns exist between related tables, but rather a relationship exists between two columns having compatible datatypes. A <strong>non-equijoin</strong> is a query that uses a join condition with something other than the equality operator, including the BETWEEN, &lt;, &lt;=, &gt;, or &gt;= operators. More specifically, the result set of a <strong>non-equijoin of two tables</strong> A and B includes rows in which the join attribute from A falls within a specified range of values that originate from B. Be familiar with using both older and <strong>newer non-equijoin syntax</strong>. The course Join Related Data includes an exercise with the following query that demonstrates how to build <strong>a non-equijoin using the older syntax</strong>.</p>
<p><em>SELECT e.last_name, e.hire_date<br />
FROM hr.employees e, hr.job_history h<br />
WHERE e.hire_date BETWEEN h.start_date AND h.end_date<br />
AND h.employee_id = 122</em>;</p>
<p>The following query uses the new join syntax</p>
<p><em>SELECT e.last_name, e.hire_date<br />
FROM hr.employees e JOIN hr.job_history h<br />
ON (e.hire_date BETWEEN h.start_date AND h.end_date)<br />
AND h.employee_id = 122;</em></p>
<p><em>SELECT e.last_name, e.hire_date<br />
FROM hr.employees e JOIN hr.job_history h<br />
ON (e.hire_date &gt;= h.start_date AND e.hire_date &lt;= h.end_date)<br />
AND h.employee_id = 122;</em><br />
A <strong>natural join of two tables</strong> that do not have matching columns is equivalent to a cross join of the tables – in other words, <strong>it produces a Cartesian product</strong>.</p>
<p>Beware that questions on the OCP exams do not classify a join that uses the<strong> USING clause</strong> as a<strong> natural join</strong> – they only consider a natural join as a query that uses the<strong> NATURAL keyword</strong>.</p>
<p>The exam will likely include many scenario-based questions that ask you to identify joins that meet specific criteria. Be prepared to identify equivalent joins that use both older or newer syntax.<br />
 For example, the following four queries produce equivalent result sets.</p>
<p><em>SELECT i.order_id,<br />
i.line_item_id AS item_id,<br />
p.product_name AS product,<br />
i.quantity AS quantity<br />
FROM order_items i, product_information p<br />
WHERE p.product_id = i.product_id;</em></p>
<p><em>SELECT order_id,<br />
line_item_id AS item_id,<br />
product_name AS product,<br />
quantity<br />
FROM order_items i<br />
INNER JOIN product_information p<br />
ON p.product_id = i.product_id;</em></p>
<p><em>SELECT order_id,<br />
line_item_id AS item_id,<br />
product_name AS product,<br />
quantity<br />
FROM order_items<br />
INNER JOIN product_information<br />
USING (product_id);<br />
SELECT order_id,<br />
line_item_id AS item_id,<br />
product_name AS product,<br />
quantity<br />
FROM order_items<br />
NATURAL JOIN product_information;</em></p>
<p>Some of the joins that are test question answers are long and complicated queries that can consume a lot of valuable time to analyze line-by-line. To save time, you can often rule out certain answers quickly by looking for joins with invalid syntax. For example, look for joins that use a condition in the <strong>USING clause</strong> [for example, USING (p.product_id = l.product_id)], a column list in the ON clause [for example, ON (product_id)], qualified column names in the USING clause [for example, USING(p.product_id)], invalid combinations of the ON and USING clauses, invalid combinations of the <strong>NATURAL keyword</strong> and an <strong>ON or USING clause, etc.</strong></p>
<p>Be careful when analyzing <strong>natural joins</strong> of two tables that have two or more matching columns. As our course Join Related Data discusses, if you want to join such tables on a subset of matching columns, you must use the USING clause rather than the<strong> NATURAL</strong> keyword.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.expertsharing.com/2008/05/28/tips-for-the-oracle-dba-certificatin-exam-1z0-007/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Tips for Oracle 9i DBA exam #1Z0-31</title>
		<link>http://www.expertsharing.com/2008/05/24/tips-for-oracle-9i-dba-exam-1z0-31/</link>
		<comments>http://www.expertsharing.com/2008/05/24/tips-for-oracle-9i-dba-exam-1z0-31/#comments</comments>
		<pubDate>Sat, 24 May 2008 06:54:27 +0000</pubDate>
		<dc:creator>Praveen</dc:creator>
		
		<category><![CDATA[Oracle Articles]]></category>

		<category><![CDATA[Oracle 9i dba certification tips]]></category>

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

		<guid isPermaLink="false">http://www.expertsharing.com/?p=94</guid>
		<description><![CDATA[In the architecture section of the exam, expect questions that test your knowledge of very specific details about the Oracle software architecture. Specifically, you should be intimately familiar with what functions each Oracle background process performs; make sure that you know details such as what SMON does, what events cause DBWn to write dirty buffers [...]]]></description>
			<content:encoded><![CDATA[<p>In the architecture section of the exam, expect questions that test your knowledge of very specific details about the <strong>Oracle software architecture</strong>. Specifically, you should be intimately familiar with what functions each<strong> Oracle background process</strong> performs; make sure that you know details such as what SMON does, what events cause <strong>DBWn</strong> to write dirty buffers to data files, what events cause<strong> LGWR to write the log buffer</strong> to the current online log group, which background processes perform I/O, and so on.</p>
<p>Understand that when a user establishes a<strong> dedicated server connection</strong>, Oracle allocates all portions of the corresponding PGA outside the shared pool. However, when a user establishes a <strong>multithreaded server (MTS) connection,Oracle</strong> allocates memory for the session&#8217;s cursor state and sort area, collectively known as the User Global Area (UGA) from the shared pool. Therefore, when you configure an Oracle instance with MTS, it is important to consider how much memory MTS sessions can allocate from the shared pool.</p>
<p><span id="more-94"></span></p>
<p>The architecture section of the exam will also ask you questions about the operations performed during SQL statement processing, including the commit of a transaction. For example, you should understand that a server process reads <strong>Oracle blocks</strong> from a data file into the<strong> buffer cache</strong>, that the server process updates buffers in the buffer cache, and that <strong>LGWR</strong> writes redo entries to the log buffer and then to the current online log group to protect all changes made to the database.</p>
<p> You should understand the guidelines set forth by the Optimal Flexible Architecture (OFA). For example, know the directory structure that OFA guidelines recommend for software files and database files, how to name database files so that they are distinguishable, and so on.</p>
<p> </p>
<p>In particular, know how to use the orapwd utility to create a password file and understand the effects of setting the <strong>REMOTE_LOGIN_PASSWORD</strong> FILE parameter to <strong>EXCLUSIVE, NONE (the default), and SHARED</strong>.</p>
<p>Consider the following scenario for an existing database:<br />
1. The instance&#8217;s REMOTE_LOGIN_PASSWORDFILE parameter is set to EXCLUSIVE.<br />
2. The current password for SYS is SYSPWD.<br />
3. You execute the following command to create or re-create the database&#8217;s password file</p>
<p>orapwd file=&#8230; password</p>
<p> </p>
<p>4. You start SQL*Plus and then execute then following commands:</p>
<p><strong>CONNECT</strong> sys/oracle AS sysdba;<br />
<strong>CREATE USER test IDENTIFIED BY password</strong>;<br />
<strong>GRANT SYSDBA</strong> TO test;</p>
<p>First, when you create or re-create a password file for a database, Oracle registers the SYS user in the new password file with the <strong>SYSDBA and SYSOPER</strong> privileges, and the SYS user&#8217;s entry in the password file uses the password that you specify in the PASSWORD parameter of the orapwd command, NOT the current password for the SYS account in the database. The CONNECT command above demonstrates this fact.</p>
<p>Now, which one of the following CONNECT commands do you think will execute successfully?<br />
CONNECT test/oracle AS SYSDBA;<br />
CONNECT test/password AS SYSDBA;</p>
<p>The correct answer is the second command, NOT the first command, as several practice test and actual exam questions that we have seen incorrectly state! With <strong>REMOTE_LOGIN_PASSWORDFILE = EXCLUSIVE</strong>, when you grant the SYSDBA or SYSOPER privilege to a user or execute an <strong>ALTER USER &#8230; IDENTIFIED BY &#8230;</strong> statement for a user, Oracle updates the entry in the password file for the user with that user&#8217;s current database password.</p>
<p>Continuing with the scenario, suppose you now issue the following command:</p>
<p><strong>ALTER USER sys IDENTIFIED BY syspwd;</strong></p>
<p><strong> </p>
<p>Which one of the following CONNECT commands do you think will execute successfully now?</strong><br />
<strong>CONNECT sys/oracle AS SYSDBA;<br />
CONNECT sys/syspwd AS SYSDBA;</strong><br />
The correct answer is the second command, NOT the first command.</p>
<p>A final note on this subject. When testing the functionality described above in your practice environment, make sure to use a remote connection to your database or a host operating system account that does not have the operating system privileges to establish <strong>SYSDBA/SYSOPER</strong> database connections; otherwise, you might get confused at the results because you can enter whatever you want for a password when trying to establish <strong>SYSDBA/SYSOPER</strong> database connections - if it is not the correct password, <strong>Oracle authenticates</strong> your privileged connection request using operating system authentication instead.<br />
 </p>
<p>When you do not specify a<strong> PFILE parameter</strong> with a <strong>STARTUP </strong>command when using either SQL*Plus or iSQL*Plus,</p>
<p>1) Oracle reads the default persistent <strong>parameter file (SPFILE) on the</strong> host, if available;</p>
<p> 2) if the default SPFILE is not available on the host, Oracle reads the SPFILE named spfile.ora in the default location on the host, if available;</p>
<p> 3) if neither <strong>SPFILE</strong> is available, Oracle reads the default <strong>PFILE</strong> on the host, if available;</p>
<p>4) otherwise, Oracle returns an error.</p>
<p>Be careful with questions about<strong> ALTER TABLE &#8230; DEALLOCATE UNUSED and ALTER INDEX &#8230; DEALLOCATE</strong> UNUSED. These statements deallocate unused space above the segment&#8217;s high water mark, NOT all unused space.</p>
<p>Carefully review the default settings for resource limit profile parameters and the units for each parameter.</p>
<p>For<br />
example, for the<strong> CREATE PROFILE and ALTER PROFILE</strong> commands, the unit for the <strong>CPU_PER_SESSION</strong> and CPU_PER_CALL parameters is hundredths of a second, the unit for the IDLE_TIME parameter is minutes, the unit for the PASSWORD_LIFE_TIME, PASSWORD_REUSE_TIME, PASSWORD_LOCK_TIME, and PASSWORD_GRACE_TIME parameters is days, etc.</p>
<p>You should know the rules set forth by the default password complexity checking function, SYS.VERIFY_FUNCTION, when using password checking with resource limit profiles. Specifically, a user&#8217;s password cannot match the username; the password must be at least four characters in length; the password cannot be the simple words welcome, database, account, user, password, oracle, computer, or abcd; the password must contain at least one letter, one digit and one punctuation mark; a new password must differ from the old password by at least three characters.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.expertsharing.com/2008/05/24/tips-for-oracle-9i-dba-exam-1z0-31/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Locks in oracle</title>
		<link>http://www.expertsharing.com/2008/05/21/90/</link>
		<comments>http://www.expertsharing.com/2008/05/21/90/#comments</comments>
		<pubDate>Wed, 21 May 2008 15:54:36 +0000</pubDate>
		<dc:creator>Praveen</dc:creator>
		
		<category><![CDATA[Oracle Articles]]></category>

		<category><![CDATA[how locks are released]]></category>

		<category><![CDATA[Lock modes]]></category>

		<category><![CDATA[lock types]]></category>

		<category><![CDATA[Locks duration]]></category>

		<category><![CDATA[row level locks]]></category>

		<category><![CDATA[table level locks]]></category>

		<guid isPermaLink="false">http://www.expertsharing.com/?p=90</guid>
		<description><![CDATA[Locks are mechanisms that prevent transactions from accessing the same resource concurrently with an intent of modification to the data.
Objects Affected By Locks

Tables and rows (data in tables).
data dictionary rows , shared memory structures which are not designated as physical objects.

When do Locks occur:
Any transaction resulting in modifying the data in a table acquires a [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Locks</strong> are mechanisms that prevent transactions from accessing the same resource concurrently with an intent of modification to the data.</p>
<h4>Objects Affected By Locks</h4>
<ul>
<li>Tables and rows (data in tables).</li>
<li>data dictionary rows , shared memory structures which are not designated as physical objects.</li>
</ul>
<p><strong>When do Locks occur:</strong></p>
<p>Any transaction resulting in modifying the data in a table acquires a lock. These are termed as DML locks. Other types of locks also occur when a ddl statement is used.<strong> </strong></p>
<p><strong>Oracle Lock duration</strong></p>
<p>All the locks acquired by Statements with in a transaction are held until completion of transaction.</p>
<p><strong>How Oracle Locks are released</strong></p>
<p>When a transaction explicitly commits with a commit statement or the transaction is rolledback with a rollback statement, all the locks held by the transaction are released.</p>
<p>Oracle also releases locks acquired after a savepoint when rolling back to the savepoint.</p>
<p><strong>Oracle Lock Modes</strong></p>
<h5>Exclusive Lock</h5>
<p>The lock is obtained to modify the data in a table.Any transaction acquiring an exclusive lock would be given permission to modify the data. The first transaction that acquires an exlusive lock is the only eligible transaction to modify the resource until the exclusive lock is released.</p>
<p><span id="more-90"></span></p>
<h5>Shared Lock</h5>
<p>As the name itself indicates that the data can be shared among transactions depending upon the operations involved. Mutiple transactions can read the data by shared locks  preventing a concurrent access by an exclusive lock. More than one shared lock can exist on the same resource.</p>
<h4>Oracle Lock types</h4>
<ul>
<li>DML locks</li>
<li>DDL locks (dictionary locks)</li>
<li>Oracle Internal Locks/Latches</li>
<li>Oracle Distributed Locks</li>
</ul>
<p>DML LOCKS : DML LOCKS are used to prevent damage to the data in the tables from being modified by transactions acting concurrently.  DML operations can acquire locks at row level or table level.DML locks acquiring locks at row level are called row level locks. Locks acquired at the table level are called table level locks.</p>
<p><strong>Oracle Row Level Locks</strong> :</p>
<p>1. For DML statements like insert, update, delete and Select For Update  Oracle automatically quired row Level Locks.</p>
<p>2. Row level locking Provides the best concurreny becausing of  its locking mechanism at row level.  A transaction updating only two rows in table of 10,000 rows only holds the lock for those two rows. Other 9998 rows are available for other transactions.</p>
<p>3. You can have any number of Row level locks held by a transaction. Practically there is no limit on the no of row level locks held by a transaction.</p>
<p>4. A modified row is always locked exclusively so that other users cannot modify the row until the transaction holding the lock is committed or rolled back.</p>
<p>5. If any transaction acquires a row lock, then the  transaction inherently acquires a table lock for the corresponding table. This behaviour is provided by the Oracle database to restrict other conflicting DDL operations like alter table, drop table, truncate table when a transaction has acquired a row lock.</p>
<p><em><strong>See an Lock example for the above</strong></em></p>
<p>Session 1:</p>
<blockquote><p>create table test ( x number(10));</p>
<p>Table created.</p>
<p>Insert into test values(20);</p>
<p>1 row inserted.</p></blockquote>
<p>But do not enter a commit statement in Session 1 and do not close the session 1. Start a new session</p>
<p>Session 2:</p>
<blockquote><p>drop table test;</p>
<p>ORA-00054 resource busy and acquire with NO WAIT specified.</p></blockquote>
<p><strong>Oracle Table Level Locks</strong> :</p>
<p>1. Oracle Table level Locks can be acquired by DML statements like INSERT, UPDATE, DELETE , SELECT FOR UPDATE, LOCK TABLE statements.</p>
<p>2. DML operations acquire table level locks in order to Prevent DDL operations on behalf of the transaction.</p>
<p>3. Exclusive DDL locks are prevented if a Oracle table level locks exists on a table.</p>
<p>4. If there is any uncommited data in a table , that table cannot be altered or droped or truncated until all the Oracle table level locks are released on that table.</p>
<p><strong>Oracle Table Level Lock Modes :</strong></p>
<ul>
<li>row share (RS),</li>
<li>row exclusive (RX),</li>
<li>share (S),</li>
<li>share row exclusive (SRX),</li>
<li>exclusive (X).</li>
</ul>
<p>Below is a table depicting locking mode and other Lock operations permitted when a lock is present.</p>
<div class="O">
<div style="mso-line-spacing: '90 50 0'; mso-margin-left-alt: 216; mso-char-wrap: 1; mso-kinsoku-overflow: 1"><a href="http://www.expertsharing.com/wp-content/uploads/2008/07/lock_modes1.png"><img class="alignnone size-full wp-image-133" title="lock_modes1" src="http://www.expertsharing.com/wp-content/uploads/2008/07/lock_modes1.png" alt="" width="500" height="273" /></a></div>
<div class="O">
<div style="mso-line-spacing: '90 20 0'; mso-margin-left-alt: 216; mso-char-wrap: 1; mso-kinsoku-overflow: 1"><span style="font-family: 'Courier New';">* Waits if another transaction has a lock </span></div>
</div>
</div>
<p>Details about row share(RS), row Exclusive locks(RX) , share (S), share row exclusive(SRX), exclusive (X) continued here.</p>
<p><strong></strong></p>
<p><strong></strong></p>
]]></content:encoded>
			<wfw:commentRss>http://www.expertsharing.com/2008/05/21/90/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Oracle database Certification</title>
		<link>http://www.expertsharing.com/2008/05/17/oracle-database-certification/</link>
		<comments>http://www.expertsharing.com/2008/05/17/oracle-database-certification/#comments</comments>
		<pubDate>Sat, 17 May 2008 18:09:14 +0000</pubDate>
		<dc:creator>Praveen</dc:creator>
		
		<category><![CDATA[Oracle Articles]]></category>

		<category><![CDATA[Oracle 9i certified Associate]]></category>

		<category><![CDATA[Oracle 9i Certified Professional]]></category>

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

		<category><![CDATA[Oracle certification tracks]]></category>

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

		<guid isPermaLink="false">http://www.expertsharing.com/2008/05/17/oracle-database-certification/</guid>
		<description><![CDATA[Oracle database Certification is a recognition to you, to work as qualified professional recognized around the world to work on Oracle database at various levels.With Oracle certification you will get more Opportunities and higher Pay packages.
 Being an Oracle certified Professional you would be having the right skills, efficient hands-on work experience to work on Oracle [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Oracle database Certification</strong> is a recognition to you, to work as qualified professional recognized around the world to work on Oracle database at various levels.With <strong>Oracle certification</strong> you will get more Opportunities and higher Pay packages.</p>
<p> Being an <strong>Oracle certified Professional</strong> you would be having the right skills, efficient hands-on work experience to work on Oracle datbase.</p>
<p>Oracle provides three certification tracks.  You can choose any track that best suits  your individual job profile and your interests.</p>
<p><strong>Oracle certification tracks</strong> :</p>
<ul>
<li>Oracle database Administrator</li>
<li>Web Application developer</li>
<li>Oracle Application server administrator.</li>
</ul>
<p><span id="more-88"></span></p>
<p><strong>Oracle database Administrator (DBA):</strong></p>
<p>The tasks of a typical database administrator are</p>
<p>1. Installing</p>
<p>2. database Modelling and design</p>
<p>3. Database configuration</p>
<p>4. creating users</p>
<p>5. Back up and recovery</p>
<p>6. Performance tuning</p>
<p>7. Data recovery</p>
<p>8. Problem solving</p>
<p>9. Upgrades</p>
<p>10. Migration</p>
<p><strong>Oracle database Administration</strong> track is further divided in to two tracks.</p>
<ul>
<li><strong>Oracle 10g Certified Associate, Professional and Master</strong></li>
<li><strong>Oracle 9i Certified Associate, Professional and Master</strong>.</li>
</ul>
<p>Oracle 8i Certification track is the actual Oracle database administration track available until oracle 9i database version is releseaed.</p>
<p>People who have completed Oracle 8i certified Professional track can migrate to Oracle 9i certified professional track by clearing an exam.</p>
<p><strong>Oracle9i Certified Associate</strong></p>
<p>The certification tracks begins with Associate level. OracleCertified Associates have skill sets to work as a Oracle developer or can act as an Associate helping the senior database administrators. In order to become a Oracle 9i certified DBA associate , you need to clear two exams.</p>
<p><strong>1.  Exam #1Z0-007 Introduction to Oracle9i: SQL<br />
</strong>This is an online exam. It is also available at Oracle University or Authorized Prometric TestCenters.</p>
<p>Exam Price: $95.00 USD<br />
Duration: 120 minutes<br />
Number of Questions: 52<br />
Passing Score: 71%<br />
 </p>
<p>OR</p>
<p><strong>Exam #1Z0-001 Introduction to Oracle: SQL and PL/SQL</strong></p>
<p>If the exam #1Z0-001 is already cleared then there is no need to take the exam #1Z0-007.</p>
<p>Exam Price: $125.00 USD<br />
Duration: 120 minutes<br />
Number of Questions: 57<br />
Passing Score: 68%<br />
 </p>
<p><strong>2.Exam #1Z0-031 Oracle 9i Database: Fundamentals I</strong></p>
<p>Exam Price: $125.00 USD<br />
Duration: 120 minutes<br />
Number of Questions: 60<br />
Passing Score: 73%</p>
<p><strong>Oracle 9i Certified Database Professional</strong> :-</p>
<p>You need to be <strong>Oracle 9i dba associate(OCA)</strong> inorder to qualify for Oracle 9i Certified Professional certification track.If you want to add the qualification of Oracle 9i database administrator certified Professional ( OCP), you must pass the following 2 exams .</p>
<p><strong>1. Exam #1Z0-032 Oracle9i Database: Fundamentals II</strong></p>
<p>Exam Price: $125.00 USD<br />
Duration: 120 minutes<br />
Number of Questions: 63<br />
Passing Score: 73%<br />
 </p>
<p><strong>2. Exam #1Z0-033 Oracle9i Database: Performance Tuning</strong></p>
<p>Exam Price: $125.00 USD<br />
Duration: 120 minutes<br />
Number of Questions: 65<br />
Passing Score: 72%<br />
 </p>
<p>To Obtain Oracle 9i OCP certification , you need one Oracle university hands-on experience in addition to the above two exams.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.expertsharing.com/2008/05/17/oracle-database-certification/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Bitmap Indexes</title>
		<link>http://www.expertsharing.com/2008/02/16/bitmap-indexes/</link>
		<comments>http://www.expertsharing.com/2008/02/16/bitmap-indexes/#comments</comments>
		<pubDate>Sat, 16 Feb 2008 12:02:39 +0000</pubDate>
		<dc:creator>Praveen</dc:creator>
		
		<category><![CDATA[Oracle Articles]]></category>

		<category><![CDATA[B-tree Oracle Search]]></category>

		<category><![CDATA[difference between b-tree &amp; Bitmap index]]></category>

		<category><![CDATA[how bitmap index works]]></category>

		<category><![CDATA[Oracle 10g Bitmap index]]></category>

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

		<category><![CDATA[oracle index bit]]></category>

		<guid isPermaLink="false">http://www.expertsharing.com/2008/02/16/bitmap-indexes/</guid>
		<description><![CDATA[Generally we deal with two types of indexes . One is B-Tree Indexes and the other is Bitmap indexes.B-tree indexes have been traditional favorites for Oltp databases.if we classify the tables based on the underlying data, there are two types 1. read write tables (Huge Inserts ,Update and Deletes) 2. Read only tables - Table which [...]]]></description>
			<content:encoded><![CDATA[<p>Generally we deal with two types of indexes . One is <strong>B-Tree Indexes</strong> and the other is <strong>Bitmap indexes</strong>.B-tree indexes have been traditional favorites for <strong>Oltp databases</strong>.if we classify the tables based on the underlying data, there are two types 1. read write tables (Huge Inserts ,Update and Deletes) 2. Read only tables - Table which are almost having static data. Aggregated tables, Dimensional tables, Fact tables, Pre Aggregation temp tables are some of the examples of Read only tables.</p>
<p>Bitmap indexes are <strong>highly compressed</strong> and usually take very less space when compared to B-tree indexes and are extensively used in data warehouses.</p>
<h4><em>When a bitmap index can be created on a table?</em></h4>
<p>Bitmap indexes are the most suitable for columns having very few unique values (very low cardinality). Ideally to choose the bitmap indexes as the right choice for a column the cardinality should be less than or equal to<strong> 0.05%.</strong></p>
<p>Table should have no insert, update , delete or very few dml statements can act as good choice for bitmap indexes.<br />
<code><br />
create bitmap index Person_state on person (state);<br />
</code></p>
<p><strong><em>The internal storage format of a bitmap index</em></strong><br />
<code><br />
Row Region North East West South<br />
1 Ohio 1 0 0 0<br />
2 Texas 0 1 0 0<br />
3 New mexico 0 0 1 0<br />
4 Pennsylvan 0 0 1 0<br />
5 Atlanta 0 0 0 1<br />
6 South caro 1 0 0 0<br />
</code></p>
<h4><strong>Advantage of Bitmap Indexes</strong></h4>
<p>Due to the nature of highly compressed structure of an bitmap index, Data can be accessed much faster than traditional B-tree indexes.</p>
<p>Bitmap index represent a good trade-off between disk usage and Cpu cost. A bitmap index requires more cpu cycles to decompress but requires less amount of work from disk I/O.</p>
<h4><strong>Disadvantages of Bitmap Indexes</strong></h4>
<p>Bitmap Indexes are traditionally meant to be developed for data warehouses. A modification to a bitmap index requires more work than a modification to b-tree indexes.</p>
<h4>Deadlock&#8217;s On bitmap indexes</h4>
<p>Bitmap indexes are not suitable for large concurrent single row Dml operations. Though bitmap indexes can be used in this form</p>
<h6><em>insert into &lt;bitmap_index_table&gt; select * from &lt;table&gt;</em> .</h6>
<p>If there are 3 or more sessions simultaneously working to insert into a table which is bitmap indexed a dead lock situation can occur with an error message shown below</p>
<p><strong><em>ERROR at line 1:<br />
ORA-00060: deadlock detected while waiting for resource</em></strong></p>
<p>And an other error you can face with bitmap index is</p>
<p><em><strong>ORA-28611: bitmap index is corrupted - see trace file for diagnostics</strong></em></p>
<p>Cause: Bitmap index might have corrupted due to validation</p>
<p>Action: Rebuild the Bitmap index. Like B-tree index you cannot build a bitmap index online. Try alter index &lt;bitmap_index_demo&gt; rebuild;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.expertsharing.com/2008/02/16/bitmap-indexes/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Oracle Partitioning - Partition Types</title>
		<link>http://www.expertsharing.com/2008/02/14/oracle-partitioning-partition-types/</link>
		<comments>http://www.expertsharing.com/2008/02/14/oracle-partitioning-partition-types/#comments</comments>
		<pubDate>Thu, 14 Feb 2008 13:38:04 +0000</pubDate>
		<dc:creator>Praveen</dc:creator>
		
		<category><![CDATA[Oracle Articles]]></category>

		<category><![CDATA[Composite Partitioning]]></category>

		<category><![CDATA[Hash Partition]]></category>

		<category><![CDATA[List Partitioning]]></category>

		<category><![CDATA[Oracle Date Partitioning]]></category>

		<category><![CDATA[Range Partitioning]]></category>

		<guid isPermaLink="false">http://www.expertsharing.com/2008/02/14/oracle-partitioning-partition-types/</guid>
		<description><![CDATA[Oracle Partitioning is the splitting of data groups belonging to the same table  into separate physical areas using separate partition tablespaces. Partitions can actually coexist in the same physical data file, but the same effect of partitioning might not be achieved. Separate partitions can be accessed in Parallel or individually or in groups.
How can partitioning [...]]]></description>
			<content:encoded><![CDATA[<p>Oracle Partitioning is the splitting of data groups belonging to the same table  into separate physical areas using separate partition tablespaces. Partitions can actually coexist in the same physical data file, but the same effect of partitioning might not be achieved. Separate partitions can be accessed in Parallel or individually or in groups.</p>
<p><em><strong>How can partitioning improve the performance of Sql queries ?<br />
</strong></em>Partitioning can be used to break large tables into smaller subsets.Processing of small subsets individually or in parallel ways is much faster than executing serial procession on large data sets. Partitioning is the most useful in very large database applications.</p>
<p><strong><em><u>Benefits of Oracle Partitioning</u></em></strong></p>
<ul>
<li>Parallel processing is a way of splitting data into separately located physical files. Separating table and index datafiles onto separate disks in a nonpartitioned database is a form of simple partitioning. It is often highly beneficial to read index and data spaces from separate locations because table and index physical spaces are often read almost in parallel.Partitioning can enhance the benefits of splitting datafiles.</li>
<li>Different partitions within the same table can have different physical storage structures. Different partitions within a table can even be<br />
both read-write and read only, perhaps allowing separation of archived and current data.</li>
<li>Backup, recovery, and utility usage (SQL*Loader, Export, andImport) can utilize parallel processing and activities on individual partitions.</li>
</ul>
<p><span id="more-45"></span></p>
<p>The Optimizer can access individual partitions when processing SQL code. This process is termed <strong><em>partition pruning</em></strong> because partitions can potentially be removed from the database read required by a query. Additionally, the Optimizer can execute against multiple partitions using parallel processing, generally on high-end multiple CPU server platforms, with datafiles spread across multiple disks</p>
<p><strong><em>What is manual Partition Pruning ?</em></strong></p>
<p>Exclusively instructing the optimizer to use a specified partition only to retrived the data based on partition name.</p>
<p>Partitions can be created on single or multiple columns of a table. A tablecan be divided into separate partitions based on three methods: (1) ranges of values, (2) values in lists, and (3) hashing algorithms in columns. Additionally,partitions can be one of two composites of the already mentioned three partitioning methods.</p>
<p>A partition is divided based on what is called a partition key. This key is internal to Oracle Database. The partition key is the data definition splitting table rows into separate partitions. For example, a range partition on a table could have rows separated into different partitions based on a date for each row, perhaps dividing financial data into quarters. The partition key is that date column, as defined by the range partition.<br />
What are the specifics of the different partitioning methods?</p>
<p><strong>Range Partition</strong> : The most used form of Partitioning- This splits rows in a table based on ranges of values (e.g., splitting a table of transactions into periods, such as the four quarters in a year, where the four quarters would be derived from a transaction date).</p>
<p><strong>List partition</strong>: This splits rows based on lists of values, dividing rows into separate partitions based on matches between list entries and row column values. For example, a table containing state codes such as NY (New York) and CA (California) could be split up into separate partitions for each state.</p>
<p><strong>Hash partition</strong>: A hashing algorithm separates rows based on a column specification into a specified number of separate partitions. The hash value is calculated internally from the partition key. This partitioning method splits the number of rows in a table evenly across all partitions.</p>
<p><strong>Composite partition</strong>: Partitions can contain subpartitions of two types: (1) a range partition can contain multiple hash subpartitions, and (2) a range partition can contain multiple list subpartitions</p>
<p>Next article on Oracle Partitions will be continued &#8230;&#8230;. Pls look after</p>
]]></content:encoded>
			<wfw:commentRss>http://www.expertsharing.com/2008/02/14/oracle-partitioning-partition-types/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Tracing an Oracle session : oracle trace 10046</title>
		<link>http://www.expertsharing.com/2008/02/10/tracing-an-oracle-session-oracle-trace-10046/</link>
		<comments>http://www.expertsharing.com/2008/02/10/tracing-an-oracle-session-oracle-trace-10046/#comments</comments>
		<pubDate>Sun, 10 Feb 2008 09:14:12 +0000</pubDate>
		<dc:creator>Praveen</dc:creator>
		
		<category><![CDATA[Oracle Articles]]></category>

		<category><![CDATA[alter session set sql_trace true]]></category>

		<category><![CDATA[alter session trace]]></category>

		<category><![CDATA[oracle trace 10046]]></category>

		<category><![CDATA[oracle trace enable]]></category>

		<category><![CDATA[oracle trace tkprof]]></category>

		<category><![CDATA[oracle trace tool]]></category>

		<category><![CDATA[oracle tracel sql]]></category>

		<guid isPermaLink="false">http://www.expertsharing.com/2008/02/10/tracing-an-oracle-session-oracle-trace-10046/</guid>
		<description><![CDATA[Have you ever got stucked up in a long running job ? Do you want to know the behaviour of each sql you are writing ? how the execution path of a sql is determined ? Do you want to know the most time consuming sql statement in your long running procedure or job ? [...]]]></description>
			<content:encoded><![CDATA[<p>Have you ever got stucked up in a long running job ? Do you want to know the behaviour of each sql you are writing ? how the execution path of a sql is determined ? Do you want to know the most time consuming sql statement in your long running procedure or job ? Do you want to know how much time is being spent for cpu cyles, disk acces ? where is the root problem of an query ? on What wait event oracle is waiting ?</p>
<p>For all your question on simple answer is Oracle 10046 Trace. Oracle trace Sql event traces the sql that a user session executes giving diagnostics information, which is useful for general troubleshooting and performance tuning. Oracle 10046 trace is a powerful platform to identify the most problematic sql and how it is behaving with in the oracle environment. With Oracle 10046 trace oracle is capable of providing detailed information that can be used to locate an error or to identify and resolve Performance problems. Oracle 10046 Trace itself consumes memory as well effects the performance of jobs you want to test it. Never run a oracle trace in a production system.To avoid this Oracle has introduced different trace levels based on the information needed.   The other trace levels available with oracle 10046 trace are level 1, level 4, level 8, level 12.A 10046 deep trace (level 12) shows exactly how the database is processing a query, the events the system is waiting on and how much time it spends waiting for a specific event.You can enable the tracing or disable it at different phases of a complex job and it is clearly possible to identify a performance issue.</p>
<p><span id="more-22"></span></p>
<p>When implementing a 10046 trace, the best approach is to capture the trace stats only for the Query most needed.  To do this you can open a new session,turn the trace on, run the query , deactivate the trace in that session and close that session. However it is also possible to capture the oracle 10046 trace stats for already a long running session.</p>
<p>Oracle 10046 trace event works in all Oracle Versions 10g, oracle 9i, oracle 8i. Oracle 10g has introduced a new package called dbms_monitor to get the diagnostics information similar to 10046 trace event which is helpfule in shared server.</p>
<p>Trace levels</p>
<p><strong>Level 1</strong> - Standard sql trace, nO wait events, no bind variables tracking.All the activities are traced until the end of the session.</p>
<p><strong>Level 4</strong> - In addition to the level 1 tracing , level 4 tracks all the values of the bind variables used in the pl/sql Programs.The code displays these bind variables as: b1, etc. When level4 is activated, the substituted value for the bind variable is displayed in the trace file.</p>
<p><strong>alter session set events ‘10046 trace name context forever, level 4’;</strong></p>
<p><strong>Level 8</strong> - In addition to the level 1 tracing, level 8 displays all the system wait events for this session.<br />
<strong>alter session set events ‘10046 trace name context forever, level 8’;</strong></p>
<p><strong>Level 12</strong> -  In addtion to the level1, level 4 and level 8 is tracked in level 12. (i.e)  tracing in addition to both bind variable substitution and database wait events.  A level 12 trace is used for performance issues.</p>
<p><strong>alter session set events ‘10046 trace name context forever, level 12’;</strong></p>
<p><strong><em>Steps for tracing a session</em></strong></p>
<p>1. Start a new session by starting sql* plus<br />
<code><br />
</code></p>
<p><a href="http://www.expertsharing.com/wp-content/uploads/2008/07/sql-trace.png"><img class="alignnone size-full wp-image-134" title="sql-trace" src="http://www.expertsharing.com/wp-content/uploads/2008/07/sql-trace.png" alt="" width="578" height="273" /></a></p>
<p><code><br />
SQL&gt; alter session set timeD_statistics=TRUE;<br />
Session altered.</code></p>
<p>4. Set the max_dump_file_size to unlimited So that your trace is not incomplete and have necessary information. max_dump_file_size is the maximum trace file size that oracle can accomodate.</p>
<p><code><br />
SQL&gt; ALTER SESSION SET MAX_DUMP_FILE_SIZE=&lt;you can use UNLIMITED keyword or specify the size in bytes &gt;;<br />
Session altered.</code></p>
<p>5. All ther trace files would be directed to the same directory. So it would be difficult to identify your current session&#8217;s trace file. Give an identification suffix to your trace file.<br />
<code><br />
SQl&gt; alter session set TRACEFILE_IDENTIFIER = 'PRAVEEN';<br />
Session altered.</code></p>
<p>6. Turn the oracle 10046 trace event on for your current session for the respective level you want to trace (level 4, level 8, level 12).</p>
<p><code><br />
SQL&gt; alter session set events '10046 trace name context forever, level 12';<br />
ERROR:<br />
ORA-01031: insufficient privileges<br />
</code></p>
<p>So what happened in the above scenario , am i not having neccessary previliges to alter a session. Then if so how can the above statements like alter session set timed_statistics=true are working perfectly. So i have traced around the net for the necessary information, but not able to find it out. finally i came to know that first when alter session command was introduced, there is no alter session privilege. So oracle has realized the importance and security of trace events and introduced a privilege called <strong>&#8220;alter session&#8221; </strong>which is required to trace not only 10046 trace events and also other events.<br />
So what i did is</p>
<p>logged in as sys..</p>
<p><code><br />
SQL&gt; Grant alter session to praveen;</code></p>
<p>logged in as praveen..<br />
<code><br />
SQL&gt; alter session set events '10046 trace name context forever, level 12';<br />
Session altered.</code><br />
7. For simple understanding i am just entering a simple query<br />
<code><br />
SQL&gt; SELECT * FROM COMP_SCRIP_MAP;</code><code>-----data--------------------</code><br />
8. Turn of the oracle trace with the following statement<br />
<code><br />
SQL&gt; alter session set events '10046 trace name context off';<br />
Session altered.<br />
</code></p>
<p>9. Query Execution is over, trace file is generated, then where to look for your trace file. Usually user trace files are generated in the directory specified by the user_dump_dest parameter in init.ora or spfile.<br />
<code><br />
SQL&gt; select value from v$parameter where name='user_dump_dest';</code></p>
<p>10. select the value from the above query and change to that directory in your operating system.<br />
<code>xx_ora_2844_praveen.trc</code></p>
<p>11. Find the correct trace file by giving the following command in unix prompt.</p>
<p><code>find . -name "*PRAVEEN*" -print</code><br />
12. The trace file consists of very detailed information which is quite difficult to understand for us. To pack the trace file and analyze things in it and present it in a user understandable format a tool called tkprof is used.<br />
at the unix prompt type</p>
<p><code><br />
tkprof xx_ora_2844_praveen.trc<br />
</code></p>
<p>output-file can be any name and can be pointed to your home directory.</p>
<p>here is part of the formatted trace file by tkprof for the above query.</p>
<pre>SELECT *
FROM
 COMP_SCRIP_MAP   

call     count       cpu    elapsed       disk      query    current        rows
------- ------  -------- ---------- ---------- ---------- ----------  ----------
Parse        1      0.09       0.15          6        218          0           0
Execute      1      0.00       0.00          0          0          0           0
Fetch       36      0.00       0.07          6         42          0         526
------- ------  -------- ---------- ---------- ---------- ----------  ----------
total       38      0.09       0.23         12        260          0         526   

Misses in library cache during parse: 1
Optimizer mode: ALL_ROWS
Parsing user id: 36     

Rows     Row Source Operation
-------  ---------------------------------------------------
    526  TABLE ACCESS FULL COMP_SCRIP_MAP (cr=42 pr=6 pw=0 time=51951 us)   

Elapsed times include waiting on following events:
  Event waited on                             Times   Max. Wait  Total Waited
  ----------------------------------------   Waited  ----------  ------------
  SQL*Net message to client                      36        0.00          0.00
  db file sequential read                         1        0.03          0.03
  db file scattered read                          1        0.00          0.00
  SQL*Net message from client                    36        0.32          9.33
********************************************************************************</pre>
<p>How to study the trace file will be explained in coming posts</p>
]]></content:encoded>
			<wfw:commentRss>http://www.expertsharing.com/2008/02/10/tracing-an-oracle-session-oracle-trace-10046/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
