<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Techno Oracle</title>
	<atom:link href="http://www.technooracle.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.technooracle.com</link>
	<description>Oracle information centre</description>
	<lastBuildDate>Tue, 17 Apr 2012 12:07:51 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>C++ Interview Questions : Inheritance</title>
		<link>http://www.technooracle.com/oracle-tutorials/c-interview-inheritance/</link>
		<comments>http://www.technooracle.com/oracle-tutorials/c-interview-inheritance/#comments</comments>
		<pubDate>Tue, 17 Apr 2012 12:07:51 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[C++ Interview Questions]]></category>

		<guid isPermaLink="false">http://www.technooracle.com/?p=421</guid>
		<description><![CDATA[Q: What is inheritance? A: Inheritance allows one class to reuse the state and behavior of another class. The derived class inherits the properties and method implementations of the base class and extends it by overriding methods and adding additional properties and methods. Q: When should you use multiple inheritance? A:There are three acceptable answers:- [...]]]></description>
			<content:encoded><![CDATA[<p>Q: What is inheritance?</p>
<p>A: Inheritance allows one class to reuse the state and behavior of another class. The derived class inherits the properties and method implementations of the base class and extends it by overriding methods and adding additional properties and methods.</p>
<p>Q: When should you use multiple inheritance?</p>
<p>A:There are three acceptable answers:- &#8220;Never,&#8221;"Rarely,&#8221; and &#8220;When the problem domain cannot be accurately modeled any other way.&#8221; Consider an Asset class, Building class, Vehicle class, and CompanyCar class. All company cars are vehicles. Some company cars are assets because the organizations own them. Others might be leased. Not all assets are vehicles. Money accounts are assets. Real estate holdings are assets. Some real estate holdings are buildings. Not<br />
all buildings are assets. Ad infinitum. When you diagram these relationships, it becomes apparent that multiple inheritance is a likely and intuitive way to model this common problem domain. The applicant should understand, however, that multiple inheritance, like a chainsaw, is a useful tool that has its perils, needs respect, and is best avoided except when nothing else will do.</p>
<p>Q: Explain the IS A and HAS A class relationships. How would you implement each in a class design?</p>
<p><span>IS-A Relationship:-</span>In object oriented programming,the concept of IS-A is a totally based on Inheritance.for eg: Car is a vehicle. Mango is a Fruit etc</p>
<p>HAS-A Relationship: In object-oriented programming has-a relationship is also known as composition.For eg A car is a composition of machine parts such as Engine,Carburetor etc.</p>
<p>Q: When is a template a better solution than a base class?</p>
<p>A: When you are designing a generic class to contain or otherwise manage objects of other types, when the format and behavior of those other types are unimportant to their containment or management, and particularly when those other types are unknown (thus, the generality) to the designer of the container or manager class.</p>
<p>Q: What is multiple inheritance(virtual inheritance)? What are its advantages and disadvantages?</p>
<p>A: Multiple Inheritance is the process whereby a child can be derived from more than one parent class. The advantage of multiple inheritance is that it allows a class to inherit the functionality of more than one base class thus allowing for modeling of complex relationships. The disadvantage of multiple inheritance is that it can lead to a lot of confusion(ambiguity) when two base classes implement a method with the same name.</p>
<p>Q: What a derived class inherits or doesn&#8217;t inherit?</p>
<p>A: Inherits:<br />
Every data member defined in the parent class (although such members may not always be accessible in the derived class!)<br />
Every ordinary member function of the parent class (although such members may not always be accessible in the derived class!)<br />
The same initial data layout as the base class.</p>
<p>Doesn&#8217;t Inherit :<br />
The base class&#8217;s constructors and destructor.<br />
The base class&#8217;s assignment operator.<br />
The base class&#8217;s friends</p>
<p>&nbsp;</p>
<p>Courtesy</p>
<p>C++ Interview Questions<br />
Compiled by Dr. Fatih Kocan, Wael Kdouh, and Kathryn Patterson<br />
for the Data Structures in C++ course(CSE 3358) Spring 2008</p>
]]></content:encoded>
			<wfw:commentRss>http://www.technooracle.com/oracle-tutorials/c-interview-inheritance/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>C++ Interview Questions : C vs C++</title>
		<link>http://www.technooracle.com/oracle-tutorials/c-vs-cplusplus/</link>
		<comments>http://www.technooracle.com/oracle-tutorials/c-vs-cplusplus/#comments</comments>
		<pubDate>Mon, 16 Apr 2012 10:10:35 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[C++ Interview Questions]]></category>

		<guid isPermaLink="false">http://www.technooracle.com/?p=418</guid>
		<description><![CDATA[Q: How do you link a C++ program to C functions? A: By using the extern &#8220;C&#8221; linkage specification around the C function declarations. Programmers should know about mangled function names and type-safe linkages. Then they should explain how the extern &#8220;C&#8221; linkage specification statement turns that feature off during compilation so that the linker [...]]]></description>
			<content:encoded><![CDATA[<p>Q: How do you link a C++ program to C functions?</p>
<p>A: By using the extern &#8220;C&#8221; linkage specification around the C function declarations.<br />
Programmers should know about mangled function names and type-safe linkages. Then they should explain how the extern &#8220;C&#8221; linkage specification statement turns that feature off during compilation so that the linker properly links function calls to C functions.</p>
<p>Q: Is there anything you can do in C++ that you cannot do in C?</p>
<p>A: No. There is nothing you can do in C++ that you cannot do in C. After all you can write a C++ compiler in C.<br />
Q: What are the differences between a struct in C and in C++?</p>
<p>A: In C++ a struct is similar to a class except for the default access specifier( refere to other question in the document). In C we have to include the struct keyword when declaring struct. In c++ we don’t have to.</p>
<p>Q: What does extern &#8220;C&#8221; int func(int *, Foo) accomplish?</p>
<p>A: It will turn o_ &#8220;name mangling&#8221; for func so that one can link to code compiled by a C compiler.</p>
<p>Q: What are the access privileges in C++? What is the default access level?</p>
<p>A: The access privileges in C++ are private, public and protected. The default access level assigned to members of a class is private. Private members of a class are accessible only within the class and by friends of the class. Protected members are accessible by the class itself and it&#8217;s sub-classes. Public members of a class can be accessed by anyone.</p>
<p>Q:How does C++ help with the tradeoff of safety vs. usability?</p>
<p>A: In C, encapsulation was accomplished by making things static in a compilation unit or module. This prevented another module from accessing the static stuff. (By the way, static data at file-scope is now deprecated in C++: don&#8217;t do that.)<br />
Unfortunately this approach doesn&#8217;t support multiple instances of the data, since there is no direct support for making multiple instances of a module&#8217;s static data. If multiple instances were needed in C, programmers typically used a struct. But unfortunately C structs don&#8217;t support encapsulation. This exacerbates the tradeoff between safety (information hiding) and usability (multiple instances).In C++, you can have both multiple instances and encapsulation via a class. The public part of a class contains the class&#8217;s interface, which normally consists of the class&#8217;s public member functions and its friend functions. The private and/or protected parts of a class contain the class&#8217;s implementation, which is typically where the data lives. The end result is like an &#8220;encapsulated struct.&#8221; This reduces the tradeoff between safety (information hiding) and usability (multiple instances).</p>
<p>&nbsp;</p>
<p>Courtesy</p>
<p>C++ Interview Questions<br />
Compiled by Dr. Fatih Kocan, Wael Kdouh, and Kathryn Patterson<br />
for the Data Structures in C++ course(CSE 3358)<br />
Spring 2008</p>
]]></content:encoded>
			<wfw:commentRss>http://www.technooracle.com/oracle-tutorials/c-vs-cplusplus/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to Calculate Oracle CPU usage</title>
		<link>http://www.technooracle.com/oracle-tutorials/how-to-calculate-oracle-cpu-usage/</link>
		<comments>http://www.technooracle.com/oracle-tutorials/how-to-calculate-oracle-cpu-usage/#comments</comments>
		<pubDate>Fri, 13 Apr 2012 07:14:01 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Oracle Tips and Tricks]]></category>

		<guid isPermaLink="false">http://www.technooracle.com/?p=406</guid>
		<description><![CDATA[If You wants to identify the impact of particular user on the Database,or if you want to determine how much resources are consumed, cpu, IO used by this ID,you can use the following script to display CPU utilization  for any Oracle user. select aa.username, bb.SID, VALUE/100 cpu_usage_seconds from v$session a, v$sesstat b, v$statname c where [...]]]></description>
			<content:encoded><![CDATA[<p>If You wants to identify the impact of particular user on the Database,or if you want to determine how much resources are consumed, cpu, IO used by this ID,you can use the following script to <span><span>display CPU utilization  for any Oracle user.</span></span></p>
<p><span>select<br />
 aa.username,<br />
 bb.SID,<br />
 VALUE/100 cpu_usage_seconds<br />
 from<br />
 v$session a,<br />
 v$sesstat b,<br />
 v$statname c<br />
where<br />
 b.STATISTIC# = c.STATISTIC#<br />
 and<br />
 NAME like &#8216;%CPU used by this session%&#8217;<br />
and<br />
 b.SID = a.SID<br />
and<br />
 a.status=&#8217;ACTIVE&#8217;<br />
and<br />
 a.username is not null<br />
 order by VALUE desc;</p>
<p></span></p>
]]></content:encoded>
			<wfw:commentRss>http://www.technooracle.com/oracle-tutorials/how-to-calculate-oracle-cpu-usage/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Partitioning in oracle</title>
		<link>http://www.technooracle.com/oracle-tutorials/partition-by-oracle/</link>
		<comments>http://www.technooracle.com/oracle-tutorials/partition-by-oracle/#comments</comments>
		<pubDate>Sat, 26 Mar 2011 09:53:22 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Home]]></category>
		<category><![CDATA[oracle partition]]></category>
		<category><![CDATA[oracle partitioned tables]]></category>
		<category><![CDATA[oracle table partition]]></category>
		<category><![CDATA[partition by oracle]]></category>

		<guid isPermaLink="false">http://www.technooracle.com/?p=415</guid>
		<description><![CDATA[Partitioning the Tables in Oracle database is an important aspect when it comes to Performance Management.As the number of rows in table increases,The performance impacts wil increase Backup and recovery process may take longer time than usal and sql queries that affecting entire table will take loger time. we can reduce the performance issue causing [...]]]></description>
			<content:encoded><![CDATA[<p>Partitioning the Tables in Oracle database is an important aspect when it comes to Performance Management.As the number of rows in table increases,The performance impacts wil increase<br />
Backup and recovery process may take longer time than usal and sql queries that affecting entire table will take loger time.<br />
we can reduce the performance issue causing by large tables through separating the rows of a single table into<br />
multiple parts. Dividing a table’s data in this manner is called partitioning the table.the table that is partitioned is called a partitioned table, and the parts are called partitions.<br />
By splitting a large table’s rows across multiple smaller partitions,</p>
<ul>
<li>The performance of queries against the tables may improve because Oracle may have to search only one partition (one part of the table) instead of the entire table to resolve a query.</li>
<li>The table may be easier to manage. Because the partitioned table’s data is stored in multiple parts, it may be easier to load and delete data in the partitions than in the large table.</li>
<li>Backup and recovery operations may perform better. Because the partitions are smaller than the partitioned table, you may have more options for backing up and recovering the partitions than you would have for a single large table.</li>
</ul>
<p>In Oracle we can partition a table by the following methods</p>
<h2>Range Partitioning</h2>
<p>Tables are partitioned by ranges of values.useful when dealing with data that has logical ranges  		into which it can be distributed.</p>
<p>eg:</p>
<p><strong>create table Library</strong><br />
<strong>(      Title VARCHAR2(100) primary key,</strong><br />
<strong> Publisher VARCHAR2(20),</strong><br />
<strong> CategoryName VARCHAR2(20),</strong><br />
<strong> Rating VARCHAR2(2),</strong><br />
<strong> references CATEGORY(CategoryName)</strong><br />
<strong>)</strong><br />
<strong>partition by range (CategoryName)</strong></p>
<p>table will be partitioned based on the values in the CategoryName</p>
<h2>Hash Partitioning</h2>
<p>A hash partition determines the physical placement of data by performing a hash function on the values of the partition key.In hash partitioning, consecutive values of the partition key are not generally stored in the same<br />
partition. Hash partitioning distributes a set of records over a greater set of partitions than range partitioning does, potentially decreasing the likelihood for I/O contention.</p>
<p>To create a hash partition, use the partition by hash clause in place of partition by range</p>
<p>eg:</p>
<p><strong>create table </strong><strong> Library</strong><br />
<strong>(      Title VARCHAR2(100) primary key,</strong><br />
<strong> Publisher VARCHAR2(20),</strong><br />
<strong> CategoryName VARCHAR2(20),</strong><br />
<strong> Rating VARCHAR2(2),</strong><br />
<strong> references CATEGORY(CategoryName)</strong><br />
<strong>)</strong><br />
<strong>partition by hash (CategoryName)</strong><br />
<strong>partitions 16</strong>;</p>
<p>Use hash  		partitioning if your data does not easily lend itself to range partitioning, but you would like to partition for performance and manageability reasons.</p>
<h2>List Partitioning</h2>
<p>In list partitioning, you tell Oracle all the possible values and designate the partitions into which the corresponding rows should be inserted.</p>
<p><strong>create table </strong><strong> Library</strong><br />
<strong>(      Title VARCHAR2(100) primary key,</strong><br />
<strong> Publisher VARCHAR2(20),</strong><br />
<strong> CategoryName VARCHAR2(20),</strong><br />
<strong> Rating VARCHAR2(2),</strong><br />
<strong> references CATEGORY(CategoryName)</strong><br />
<strong>)</strong><br />
<strong>partition by list (CategoryName)</strong></p>
<h2>Creating Subpartitions</h2>
<p>You can create subpartitions—that is, partitions of partitions. You can use subpartitions to combine all types of partitions: range partitions, list partitions, and hash partitions. For example, you can use hash partitions in combination with range partitions, creating hash partitions of the range<br />
partitions. For very large tables, this composite partitioning may be an effective way of separating the data into manageable and tunable divisions.</p>
<h2>Indexing Partitions</h2>
<p>When you create a partitioned table, you should create an index on the table. The index may be partitioned according to the same range values used to partition the table. In the following listing,</p>
<p>create index index_library<br />
on  library(CategoryName)<br />
local<br />
(partition PART1<br />
tablespace PART1_NDX_TS,<br />
partition PART2<br />
tablespace PART2_NDX_TS);</p>
]]></content:encoded>
			<wfw:commentRss>http://www.technooracle.com/oracle-tutorials/partition-by-oracle/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using SQL statements in C</title>
		<link>http://www.technooracle.com/oracle-tutorials/use-sql-in-c-cplusplus/</link>
		<comments>http://www.technooracle.com/oracle-tutorials/use-sql-in-c-cplusplus/#comments</comments>
		<pubDate>Tue, 15 Feb 2011 14:18:48 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Pro *C]]></category>
		<category><![CDATA[C SQL]]></category>
		<category><![CDATA[c sql connection]]></category>
		<category><![CDATA[c sql tutorial]]></category>
		<category><![CDATA[embedded sql c]]></category>

		<guid isPermaLink="false">http://www.technooracle.com/?p=413</guid>
		<description><![CDATA[The Standards for C,C++ and  SQL were designed to enable  Application portability.To achieve this portability it is necessary that both platforms must confirm to the international standards.The SQL/2 standard supports embedding sql statements in other languages.Oracle&#8217;s embedded SQL environment is called Pro*C.This Tutorial shows how to embed sql statements in C or C++. A C [...]]]></description>
			<content:encoded><![CDATA[<p>The Standards for C,C++ and  SQL were designed to enable  Application portability.To achieve this portability it is necessary that both platforms must confirm to the international standards.The SQL/2 standard supports embedding sql statements in other languages.Oracle&#8217;s embedded SQL environment is called <strong>Pro*C</strong>.This Tutorial shows how to embed sql statements in C or C++.</p>
<p>A C or C++  program that uses sql statements compiled in 3 steps</p>
<p>1.<strong>Pro*C</strong> precompiler recognizes the SQL statements in the program.</p>
<p>2.<strong>Pro*C</strong> precompiler replace the SQL statements with appropriate function call in SQL runtime library.</p>
<p>3.The compiler compiles the code as normal C or C++ code and produce the Executable.<br />
<span id="more-413"></span></p>
<h2><span style="color: #000080;">Use of C in SQL :Syntax</span></h2>
<p><strong>EXEC SQL <em>sql_statement</em>;</strong></p>
<p>All sql statements in the program should start with <strong>EXEC SQL </strong>and should ends with a ;(semi colon).</p>
<p>There is a restriction that You should declare the variables before executable statements.</p>
<h3><span style="color: #000080;"><strong>Declaring Host Variables</strong></span></h3>
<p>The C datatypes that can be used with Oracle include:</p>
<ol> char<br />
char[n]<br />
int<br />
short<br />
long<br />
float<br />
double<br />
VARCHAR[n]</ol>
<p>A host variable reference must be prefixed with a colon &#8220;:&#8221; in SQL statements, but should not be prefixed with a colon in C statements.</p>
<p>Example</p>
<p>//use of Host variables in C program<br />
int main()<br />
{<br />
int emp_no;<br />
char *emp_name;</p>
<p>EXEC SQL INSERT INTO emp(empno, ename)<br />
VALUES(:emp_no,:emp_name);<br />
}</p>
<h3><span style="color: #000080;"><strong>Declaring Pointers</strong></span></h3>
<p>int main()<br />
{<br />
int *emp_no;<br />
char *emp_name;</p>
<p>//result will be written into *emp_no<br />
EXEC SQL SELCT field_name INTO :emp_no WHERE &#8212;-</p>
<p>}</p>
<h3><span style="color: #000080;"><strong>Declaring Arrays</strong></span></h3>
<p>int emp_number[50];<br />
char name[50][11];<br />
/* &#8230; */<br />
EXEC SQL INSERT INTO emp(emp_number, name)<br />
VALUES (:emp_number, :emp_name);</p>
<h2><span style="color: #000080;">Embed C in SQL:SAMPLE PROGRAM</span></h2>
<p>/* Begin program */</p>
<p>EXEC SQL INCLUDE SQLCA;</p>
<p>EXEC SQL BEGIN DECLARE SECTION<br />
emp_name VARCHAR2(20)<br />
emp_number integer<br />
EXEC SQL END DECLARE SECTION</p>
<p>EXEC SQL WHENEVER SQLERROR STOP</p>
<p>EXEC SQL CONNECT frans</p>
<p>/* Formulate query */</p>
<p>EXEC SQL SELECT employee_name,employee_number<br />
INTO emp_name,emp_number<br />
FROM employees<br />
WHERE emp_number = 185678</p>
<p>/* Print emp_name and emp_number */</p>
<p>EXEC SQL DISCONNECT</p>
<p>/* End program */</p>
<p><strong>Program Explanation</strong></p>
<table border="1" width="100%">
<tbody>
<tr>
<td>EXEC SQL INCLUDE SQLCA</td>
<td>Incorporates SQL&#8217;s error handling mechanism (SQL Communications Area).</td>
</tr>
<tr>
<td>DECLARE SECTION</td>
<td>Host variables must be declared to SQL prior to their use in any embedded SQL statements</td>
</tr>
<tr>
<td>EXEC SQL WHENEVER SQLERROR STOP</td>
<td>An error handling mechanism must precede all executable embedded SQL statements in a program.</td>
</tr>
<tr>
<td>EXEC SQL CONNECT personnel</td>
<td>Initiates access to the data base. A CONNECT statement must precede any references to a database.</td>
</tr>
<tr>
<td>EXEC SQL SELECT</td>
<td>SQL select statement</td>
</tr>
<tr>
<td>EXEC SQL DISCONNECT</td>
<td>close connection between the program and the database.</td>
</tr>
</tbody>
</table>
<h3><span style="color: #000080;">List of Embedded SQL Statements in C</span></h3>
<table border="1" width="100%">
<tbody>
<tr>
<td colspan="2" align="CENTER"><strong>Declarative Statements</strong></td>
</tr>
<tr>
<td><tt>EXEC SQL ARRAYLEN</tt></td>
<td>To use host arrays with PL/SQL</td>
</tr>
<tr>
<td><tt>EXEC SQL BEGIN DECLARE SECTION</tt></p>
<p><tt>EXEC SQL END DECLARE SECTION</tt></td>
<td>To declare host variables</td>
</tr>
<tr>
<td><tt>EXEC SQL DECLARE</tt></td>
<td>To name Oracle objects</td>
</tr>
<tr>
<td><tt>EXEC SQL INCLUDE</tt></td>
<td>To copy in files</td>
</tr>
<tr>
<td><tt>EXEC SQL TYPE</tt></td>
<td>To equivalence datatypes</td>
</tr>
<tr>
<td><tt>EXEC SQL VAR</tt></td>
<td>To equivalence variables</td>
</tr>
<tr>
<td><tt>EXEC SQL WHENEVER</tt></td>
<td>To handle runtime errors</td>
</tr>
<tr>
<td colspan="2" align="CENTER"><strong>Executable Statements</strong></td>
</tr>
<tr>
<td><tt>EXEC SQL ALLOCATE</tt></td>
<td rowspan="14">To define and control Oracle data</td>
</tr>
<tr>
<td><tt>EXEC SQL ALTER</tt></td>
</tr>
<tr>
<td><tt>EXEC SQL ANALYZE</tt></td>
</tr>
<tr>
<td><tt>EXEC SQL AUDIT</tt></td>
</tr>
<tr>
<td><tt>EXEC SQL COMMENT</tt></td>
</tr>
<tr>
<td><tt>EXEC SQL CONNECT</tt></td>
</tr>
<tr>
<td><tt>EXEC SQL CREATE</tt></td>
</tr>
<tr>
<td><tt>EXEC SQL DROP</tt></td>
</tr>
<tr>
<td><tt>EXEC SQL GRANT</tt></td>
</tr>
<tr>
<td><tt>EXEC SQL NOAUDIT</tt></td>
</tr>
<tr>
<td><tt>EXEC SQL RENAME</tt></td>
</tr>
<tr>
<td><tt>EXEC SQL REVOKE</tt></td>
</tr>
<tr>
<td><tt>EXEC SQL TRUNCATE</tt></td>
</tr>
<tr>
<td><tt>EXEC SQL CLOSE</tt></td>
</tr>
<tr>
<td><tt>EXEC SQL DELETE</tt></td>
<td rowspan="8">To query and manipulate Oracle data</td>
</tr>
<tr>
<td><tt>EXEC SQL EXPLAIN PLAN</tt></td>
</tr>
<tr>
<td><tt>EXEC SQL FETCH</tt></td>
</tr>
<tr>
<td><tt>EXEC SQL INSERT</tt></td>
</tr>
<tr>
<td><tt>EXEC SQL LOCK TABLE</tt></td>
</tr>
<tr>
<td><tt>EXEC SQL OPEN</tt></td>
</tr>
<tr>
<td><tt>EXEC SQL SELECT</tt></td>
</tr>
<tr>
<td><tt>EXEC SQL UPDATE</tt></td>
</tr>
<tr>
<td><tt>EXEC SQL COMMIT</tt></td>
<td rowspan="4">To process transactions</td>
</tr>
<tr>
<td><tt>EXEC SQL ROLLBACK</tt></td>
</tr>
<tr>
<td><tt>EXEC SQL SAVEPOINT</tt></td>
</tr>
<tr>
<td><tt>EXEC SQL SET TRANSACTION</tt></td>
</tr>
<tr>
<td><tt>EXEC SQL DESCRIBE</tt></td>
<td rowspan="3">To use dynamic SQL</td>
</tr>
<tr>
<td><tt>EXEC SQL EXECUTE</tt></td>
</tr>
<tr>
<td><tt>EXEC SQL PREPARE</tt></td>
</tr>
<tr>
<td><tt>EXEC SQL ALTER SESSION</tt></td>
<td rowspan="2">To control sessions</td>
</tr>
<tr>
<td><tt>EXEC SQL SET ROLE</tt></td>
</tr>
<tr>
<td><tt>EXEC SQL EXECUTE</tt></p>
<p><tt>END-EXEC</tt></td>
<td>To embed PL/SQL blocks</td>
</tr>
</tbody>
</table>
<p><strong>The following rules apply to embedded SQL statements in C:</strong></p>
<p>*  Do not split the<strong> EXEC SQL</strong> keyword pair between lines.</p>
<p>* You must use the SQL statement terminator. If you do not use it,This may cause indeterminate errors.</p>
<p>* <strong>C/C++</strong> comments can be placed before the statement initializer or after the statement terminator.<br />
* Multiple<strong> SQL</strong> statements and<strong> C/C++</strong> statements may be placed on the same line.<br />
* The <strong>SQL</strong> precompiler leaves carriage returns, line feeds, and TABs in a quoted string as is.<br />
* <strong>SQL</strong> comments are allowed on any line that is part of an embedded<strong> SQL </strong>statement. These comments are not allowed in dynamically executed statements.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.technooracle.com/oracle-tutorials/use-sql-in-c-cplusplus/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>UTL_FILE_DIR in Oracle</title>
		<link>http://www.technooracle.com/oracle-tutorials/utl_file_dir-in-oracle/</link>
		<comments>http://www.technooracle.com/oracle-tutorials/utl_file_dir-in-oracle/#comments</comments>
		<pubDate>Fri, 28 Jan 2011 18:10:09 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Oracle Initialization Parameters]]></category>

		<guid isPermaLink="false">http://www.technooracle.com/?p=411</guid>
		<description><![CDATA[UTL_FILE_DIR parameter allow you to specify one or more directories where you can do input/output operations in PL SQL.These file can be written and can be read using UTL_FILE Package. syntax for setting UTL_FILE_DIR is alter system set UTL_FILE_DIR = '/tmp' scope=spfile; Specifying multiple directories in the spfile alter system set utl_file_dir='/tmp/dir1','/tmp/dir2','/tmp' scope=spfile In the [...]]]></description>
			<content:encoded><![CDATA[<p><strong>UTL_FILE_DIR </strong>parameter allow you to specify one or more directories where you can do input/output operations in <strong>PL SQL.</strong>These file can be written and can be read using <strong>UTL_FILE</strong> Package.</p>
<h3>syntax for setting UTL_FILE_DIR is</h3>
<pre>alter system set UTL_FILE_DIR = '/tmp' scope=spfile;
<h3>Specifying multiple directories in the <a href="http://www.adp-gmbh.ch/ora/admin/spfile.html"></a>spfile</h3>

alter system set utl_file_dir='/tmp/dir1','/tmp/dir2','/tmp' scope=spfile
</pre>
<p>In the past(upto Oracle 8i), accessible directories for the <code>UTL_FILE</code> functions were specified in the initialization file using the <code>UTL_FILE_DIR</code> parameter. The disadvantage of the init param is that if it is used, it is valid for all <strong>USERS</strong> in the database. There is no way (other than totally disable utl_file for someone) to selectively restrict directories to someone.</p>
<p>From Oracle 9i, <code>UTL_FILE_DIR</code> access is not recommended. It is recommended that you use the <strong><code>CREATE DIRECTORY</code></strong> feature, which replaces <strong><code>UTL_FILE_DIR</code></strong>. Directory objects offer more flexibility and control to the <code><strong>UTL_FILE</strong></code><strong></strong> access.Moreover directories can be maintained dynamically (that is, without shutting down the database), and are consistent with other Oracle tools. <code>CREATE DIRECTORY</code> privilege is granted only to <code>SYS</code> and <code>SYSTEM</code> by default.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.technooracle.com/oracle-tutorials/utl_file_dir-in-oracle/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Use DECODE for IF/ELSE Selection</title>
		<link>http://www.technooracle.com/oracle-tutorials/use-decode-for-ifelse-selection/</link>
		<comments>http://www.technooracle.com/oracle-tutorials/use-decode-for-ifelse-selection/#comments</comments>
		<pubDate>Thu, 27 Jan 2011 14:04:21 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Oracle Tuning]]></category>

		<guid isPermaLink="false">http://www.technooracle.com/?p=378</guid>
		<description><![CDATA[Programmers often need a way to count and/or add up variable conditions for a group of rows. The DECODE statement provides a very efficient way of doing this. Because DECODE is rather complex, few programmers take the time to learn to use this statement to full advantage. The following statement uses DECODE to count the [...]]]></description>
			<content:encoded><![CDATA[<p>Programmers often need a way to count and/or add up variable conditions for a group of rows. The DECODE statement provides a very efficient way of doing this. Because DECODE is rather complex, few programmers take the time to learn to use this statement to full advantage. The following statement uses DECODE to count the number of first, second, and third placings a racehorse has run:</p>
<p>SELECT</p>
<p>horse_name, to_char(sum(decode(position,1,1,0))),<br />
to_char(sum(decode(position,2,1,0))), to_char(sum(decode(position,3,1,0)))<br />
FROM winners<br />
GROUP BY horse_name</p>
<p>In the sum(decode(position,2,1,0)) construct, we are saying that if the horse&#8217;s finishing position is 2 (second), add one to the count of seconds. The results of this statement appear as follows:<br />
Horse<br />
Firsts<br />
Seconds<br />
Thirds<br />
Wild Charm<br />
1<br />
2<br />
2<br />
The alternative statement without the decode involves scanning the table three times, rather than once, as in the previous statement.</p>
<p>SELECT horse_name<br />
, count(w1.position)<br />
, count(w2.position)<br />
, count(w3.position)<br />
FROM winners w1, winners w2, winners w3<br />
WHERE w1.horse_name = w2.horse_name<br />
AND w2.horse_name = w3.horse_name<br />
AND w1.position = 1<br />
AND w2.position = 2<br />
AND w3.position = 3<br />
GROUP BY horse_name;</p>
<p><strong> YHAWUFX3V4PW</strong></p>
]]></content:encoded>
			<wfw:commentRss>http://www.technooracle.com/oracle-tutorials/use-decode-for-ifelse-selection/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>DBMS_ALERT Package</title>
		<link>http://www.technooracle.com/oracle-tutorials/dbms_alert-package/</link>
		<comments>http://www.technooracle.com/oracle-tutorials/dbms_alert-package/#comments</comments>
		<pubDate>Wed, 19 Jan 2011 11:27:14 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Oracle Packages]]></category>
		<category><![CDATA[DBMS_ALERT]]></category>
		<category><![CDATA[DBMS_ALERT package]]></category>

		<guid isPermaLink="false">http://www.technooracle.com/?p=407</guid>
		<description><![CDATA[you can use alerts to notify you about an event for informational purposes. The DBMS_ALERT package is typically a one-way asynchronous communication that is triggered when a transaction commits. Unless a transaction commits, no information is sent to the alert. This means that a waiting procedure or application remains idle until the desired transaction commits. [...]]]></description>
			<content:encoded><![CDATA[<p>you can use alerts to notify you about an event for informational<br />
purposes. The DBMS_ALERT package is typically a one-way asynchronous communication that is triggered when a transaction commits. Unless a transaction commits, no information is sent to the alert. This means that a waiting procedure or application remains idle until the desired transaction commits. Because alerts provide one-way communication, they have limited usage.</p>
<h2>Setting up ALERT using DBMS_ALERT</h2>
<p>Use the following Order to setting  up an alert</p>
<p><strong>REGISTER-</strong>to record your interest in a particular alert.</p>
<p><strong>WAITTONE</strong>-wait for a specific alert.</p>
<p><strong>WAITANY-</strong>wait for any of  your registred alerts<br />
<strong> </strong></p>
<p><strong>SIGNAL-</strong>use this when the condition for the alert is met and the transaction has been committed.</p>
<h2>Using SIGNAL to Issue an Alert</h2>
<p>The Syntax for the SIGNAL Procedure</p>
<pre><strong>PROCEDURE SIGNAL(alert_name IN VARCHAR2,message_sent IN VARCHAR2);</strong></pre>
<p>alert_name can be a maximum of 30 characters, and it is not case sensitive. &#8220;message_sent&#8221; can be up to 1,800 characters, which allows for a generous concatenation of text, variable names, and so on. This message is sent to the waiting session.It is common for multiple sessions to concurrently issue signals on the same alert. In this case, as each session issues the alert, it blocks all other concurrent sessions until it commits.The net effect of this behavior is that alerts can cause transactions to become serialized.</p>
<h2>Registering for an Alert</h2>
<p>Before you can even search for an alert, you must register the alert you want to monitor,which adds you to the master registration list. You take this first step by using the  REGISTER procedure.</p>
<p>Syntax for using REGISTER procedure</p>
<p><strong>PROCEDURE REGISTER(alert_name IN VARCHAR2);</strong></p>
<p>alert_name is the name of the alert to monitor.</p>
<h2>Waiting for a Specific Alert</h2>
<p>If you want to monitor one alert, use the <strong>WAITONE</strong> Procedure<br />
The Syntax for the WAITONE Procedure</p>
<p><strong>PROCEDURE WAITONE(alert_name IN VARCHAR2,alert_message OUT VARCHAR2,alert_status OUT INTEGER,timeout IN NUMBER DEFAULT maxwait);</strong></p>
<h2>Waiting for Any Registered Alert</h2>
<p>WAITANY procedure allows you to constantly monitor for any alert for which you have registered in the current session.</p>
<p>The Syntax for the WAITANY Procedure</p>
<p><strong>PROCEDURE WAITANY(alert_name OUT VARCHAR2, alert_message OUT VARCHAR2, alert_status OUT INTEGER,timeout IN NUMBER DEFAULT maxwait);</strong></p>
<h2>Removing One Alert</h2>
<p>To remove only one specific alert from the registration list, use the REMOVE procedure.</p>
<p>The Syntax for the REMOVE Procedure</p>
<p><strong>PROCEDURE REMOVE(alert_name IN VARCHAR2);</strong></p>
<h2>Removing All Alerts</h2>
<p>You can remove all registered alerts from the current session by placing a call to the procedure REMOVEALL procedure is as follows: <strong></strong></p>
<p><strong>PROCEDURE REMOVEALL;</strong></p>
<p>After the procedure is executed, all registered alerts are deleted. An implicit COMMIT is executed with this call.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.technooracle.com/oracle-tutorials/dbms_alert-package/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Oracle 11g:Automatic Storage Management</title>
		<link>http://www.technooracle.com/oracle-tutorials/using-oracle-asm/</link>
		<comments>http://www.technooracle.com/oracle-tutorials/using-oracle-asm/#comments</comments>
		<pubDate>Sat, 01 Jan 2011 13:43:50 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Oracle ASM]]></category>
		<category><![CDATA[oracle 10g asm]]></category>
		<category><![CDATA[oracle 11 g asm]]></category>
		<category><![CDATA[oracle asm]]></category>
		<category><![CDATA[oracle asm commands]]></category>
		<category><![CDATA[oracle asm documentation]]></category>
		<category><![CDATA[oracle asm tutorial]]></category>
		<category><![CDATA[oracle rac asm]]></category>
		<category><![CDATA[setup oracle asm]]></category>

		<guid isPermaLink="false">http://www.technooracle.com/?p=404</guid>
		<description><![CDATA[Automatic Storage Management (ASM) provides a centralized way to manage Oracle Database disk storage.In this,we will discuss what ASM is, how to configure an ASM instance, how to manage an ASM instance, and finally, how to use ASM from within an Oracle database. What is ASM? ASM is designed to simplify Oracle database storage administration. Database [...]]]></description>
			<content:encoded><![CDATA[<div id="_mcePaste">Automatic Storage Management (ASM) provides a centralized way to manage Oracle Database disk storage.In this,we will discuss what ASM is, how to configure an ASM instance, how to manage an ASM instance, and finally, how to use ASM from within an Oracle database.</div>
<h2><strong>What is ASM?</strong></h2>
<div id="_mcePaste">
<ul>
<li>ASM is designed to simplify Oracle database storage administration. Database environments have become  more complex, with large numbers of (and larger) data files,storage area networks (SANs), and high-availability requirements.</li>
<li>ASM is somewhat like a logical volume manager, allowing you to reduce the management of Oracle files into ASM disk groups. It also provides redundancy configurations, re-balancing operations, and, when installed on top of cluster ware, the ability to share database-related files.</li>
<li>ASM stores files in disk groups, which are logical entities made up of one or more physical disk drives. ASM is good for more than just storing database datafiles.</li>
<li>In an ASM instance, you can store database datafiles, online redo logs, archived redo logs, backup files, and data-pump dump files as well as change-tracking files and control files of one or several Oracle databases, though these databases and the ASM instance must have affinity to a given machine or cluster.</li>
<li>ASM also provides the ability to locate the flash recovery area on an ASM disk group, so your backups to disk can be made to ASM.</li>
</ul>
</div>
<p><span id="more-404"></span></p>
<h2>Features of ASM</h2>
<ul>
<li>Automatic software d NN ata striping (RAID-0)</li>
<li>Load balancing across physical disks</li>
<li>Software RAID-1 data redundancy with double or triple mirrors</li>
<li>Elimination of fragmentation</li>
<li> Simplification of file management via support for Oracle Managed Files (OMF)</li>
<li> Ease of maintenance</li>
</ul>
<h3>Creating the ASM Instance</h3>
<p>To create the ASM instance with the DBCA, do the following:</p>
<ul>
<li> Start the Oracle DBCA.</li>
<li> The DBCA presents a list of options for you to choose from. Select Configure Automatic Storage Management and click Next.</li>
<li> The DBCA then prompts you for the SYS password for the new ASM instance to be created. Enter the password for the SYS account.</li>
<li> Oracle then creates the ASM instance. A new window appears giving you the option to create new disk groups. You can choose to create disk groups or you can click Finish to complete the ASM instillation.</li>
<li> The name of the resulting instance will be +ASM. You can log into the ASM instance</li>
</ul>
<p>from SQL*Plus, as shown in this example:</p>
<p>C:\Documents and Settings\technooracle&gt;Set ORACLE_SID=+ASM</p>
<p>C:\Documents and Settings\technooracle&gt;Sqlplus sys/Robert as sysasm</p>
<p>SQL*Plus: Release 11.1.0.6.0 &#8211; Production on Mon Jul 14 19:55:33 2008</p>
<p>Copyright (c) 1982, 2007, Oracle. All rights reserved.</p>
<p>Connected to:</p>
<p>Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 – Production</p>
<p>With the Partitioning, OLAP and Data Mining options</p>
<p>SQL&gt; select instance_name from v$instance;</p>
<p>INSTANCE_NAME</p>
<p>&#8212;&#8212;&#8212;&#8212;&#8212;-</p>
<p>+asm</p>
<h3>Starting and Stopping the ASM Instance</h3>
<p>Starting an ASM Instance</p>
<p>Starting an ASM instance is quite easy, as shown in this exercise.</p>
<p>1. The name of the resulting instance will be +ASM. You can log into the ASM instance</p>
<p>2. Now, start the ASM instance with the startup command:</p>
<p>SQL&gt; startup</p>
<p>ASM instance started</p>
<p>Total System Global Area 83886080 bytes</p>
<p>Fixed Size 1247420 bytes</p>
<p>Variable Size 57472836 bytes</p>
<p>ASM Cache 25165824 bytes</p>
<p>Shutting down the ASM instance is just as easy. A shutdown immediate, shutdown abort, or just a plain shutdown will do fine. If you execute a normal or immediate shutdown command on an ASM instance, that shutdown will fail if there is any database using that ASM instance. An error will be returned and the ASM instance will stay up. As a result, before you shut down the ASM instance, you will need to shut down all databases using that ASM instance.<br />
You can perform a shutdown abort on the ASM instance. This will cause the ASM instance to shut down immediately and all of the associated databases will be shut down in an inconsistent state. This will require instance recovery when the databases are restarted, which can increase the time it takes to reopen the database. Oracle recommends that you not use the shutdown abort command when stopping an ASM instance.</p>
<p><span style="font-family: arial, serif; line-height: normal;">The options for the <code>STARTUP</code> command are:</span></p>
<ul>
<li><code>FORCE</code> &#8211; Performs a <code>SHUTDOWN ABORT</code> before restarting the ASM instance.</li>
<li><code>MOUNT</code> &#8211; Starts the ASM instance and mounts the disk groups specified by the <code>ASM_DISKGROUPS</code> parameter.</li>
<li><code>NOMOUNT</code> &#8211; Starts the ASM instance without mounting any disk groups.</li>
<li><code>OPEN</code> &#8211; This is not a valid option for an ASM instance.</li>
</ul>
<p>The options for the <code>SHUTDOWN</code> command are:</p>
<ul>
<li><code>NORMAL</code> &#8211; The ASM instance waits for all connected ASM instances and SQL sessions to exit then shuts down.</li>
<li><code>IMMEDIATE</code> &#8211; The ASM instance waits for any SQL transactions to complete then shuts down. It doesn&#8217;t wait for sessions to exit.</li>
<li><code>TRANSACTIONAL</code> &#8211; Same as <code>IMMEDIATE</code>.</li>
<li><code>ABORT</code> &#8211; The ASM instance shuts down instantly.</li>
</ul>
<h3>What is supported in ASM</h3>
<p>Only Oracle files are supported:</p>
<p>* Database files<br />
* Control files<br />
* Online redo log files<br />
* Archived redo log files<br />
* Flash recovery area files<br />
* RMAN files (image copy and backup)</p>
<p>These files are NOT supported:</p>
<p>* Installation files (in ORACLE_HOME, CRS_HOME)<br />
* ORACLE_BASE files( including alert log, trace files, etc)<br />
* CRS voting disk and OCR files<br />
* Output data from UTL_FILE<br />
* Any user or application specific files(e.g. XML or Java files)<br />
* Oracle 9i external table files</p>
]]></content:encoded>
			<wfw:commentRss>http://www.technooracle.com/oracle-tutorials/using-oracle-asm/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using SQL Trace in oracle</title>
		<link>http://www.technooracle.com/oracle-tutorials/using-sql-trace-in-oracle/</link>
		<comments>http://www.technooracle.com/oracle-tutorials/using-sql-trace-in-oracle/#comments</comments>
		<pubDate>Wed, 29 Dec 2010 17:32:17 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Oracle Tuning]]></category>
		<category><![CDATA[oracle trace]]></category>
		<category><![CDATA[oracle trace sql]]></category>
		<category><![CDATA[SQL Trace]]></category>
		<category><![CDATA[sql trace oracle]]></category>

		<guid isPermaLink="false">http://www.technooracle.com/?p=401</guid>
		<description><![CDATA[SQL Trace causes trace files to be produced by Oracle Database. Various items of interest are generated into trace files. This information comprises details of CPU and I/O needs plus parsing and execution information, processed rows, commits, and rollbacks. The output in trace files is more or less impossible to interpret by hand. Setting up [...]]]></description>
			<content:encoded><![CDATA[<p>SQL Trace causes trace files to be produced by Oracle Database. Various items of interest are generated into trace files. This information comprises details of CPU and I/O needs plus parsing and execution information, processed rows, commits, and rollbacks. The output in trace files is more or less impossible to interpret by hand.</p>
<h2><span style="color: #0000ff;">Setting up SQL Trace</span></h2>
<p>SQL Trace can be configured for instance-level use or for a  session, for a session either within a current open session or from one session  to another. Setting instance-wide tracing can cause serious performance  problems. It is better for performance to enable tracing only from a current  session or for a specific session. Not using instance-wide tracing can miss a  lot of useful information. I am using instance-level tracing since I am not  working on a production server database. Start by setting the TIMED_STATISTICS,  TIMED_OS_STATISTICS, and MAX_DUMP_FILE_SIZE parameters.</p>
<pre>TIMED_STATISTICS = TRUE
TIMED_OS_STATISTICS = 5
MAX_DUMP_FILE_SIZE = 1M</pre>
<p><!-- more Continue Reading --></p>
<p>The effect on performance of setting the TIMED_STATISTICS  parameter is negligible. The parameters previously shown enable collection of  statistics including CPU and I/O statistics. TIMED_STATISTICS writes information  to both trace files plus the V$SYSSTATS and V$SESSSTATS performance views.  TIMED_OS_STATISTICS is a timing mechanism for statistics collection, triggering  system statistics collection periodically.</p>
<p>The MAX_DUMP_FILE_SIZE parameter will truncate each trace file in  the USER_DUMP_DEST directory, the default target directory for trace files,  usually the $ORACLE_BASE/admin/$ORACLE_SID/ udump directory.</p>
<p>Next set the SQL_TRACE parameter to switch on SQL Trace. The  TRACE_ENABLED parameter could also be set to TRUE but we will avoid that.  Setting TRACE_ENABLED tends to produce copious amounts of detail, more relevant  to Oracle support personnel than anything else.</p>
<pre>SQL_TRACE = TRUE</pre>
<p>Trace files contain generated statistics. In past versions of  Oracle trace levels could be set. Oracle9<em>i</em> Database has a  new parameter called STATISTICS_LEVEL which can be set to BASIC, TYPICAL, or  ALL. The default is TYPICAL. Setting ALL would incur significant overhead and a  noticeable effect on performance. In my database I will set the STATISTICS_LEVEL  parameter to ALL to gather as much information as possible. Note that setting  this parameter to ALL automatically sets the TIMED_OS_STATISTICS parameter to  5.</p>
<pre>STATISTICS_LEVEL = ALL</pre>
<h3><span style="color: #0000ff;">Session-Level Tracing</span></h3>
<p>Specific sessions can be traced. Tracing at the session level can help to remove tracing overhead from the database in general and focus on a specific session. Personally I have never seen the value in using the session level of tracing. There is far too much information produced. There are easier ways of tracking down problems than using session-level tracing. This command traces the current session. Tracing a specific session may be most applicable to tracking down some really nasty SQL code such as in a pre-release application, or one which should not have been released, or perhaps in an ad hoc SQL environment.</p>
<p>ALTER SESSION SET SQL_TRACE = TRUE;</p>
<p>This command will trace a session other than the current session, someone else&#8217;s session.</p>
<p>DBMS_SYSTEM_SET_SQL_TRACE_IN SESSION(SID, SERIAL#, TRUE);</p>
<div>
<h3><span style="color: #0000ff;">Finding  Trace Files</span></h3>
<p>One of the biggest problems with trace files is finding  them. Many files can be generated. You could find the files applicable to  specific processes by including tags in your SQL code such as SELECT &#8216;my trace file&#8217; FROM DUAL; or by  checking datestamps in the operating system. Typically a trace file is named in  the following format:</p>
<pre>$ORACLE_SID_ora_<span style="font-family: symbol;">&lt;</span>pid<span style="font-family: symbol;">&gt;</span>.trc</pre>
<p>&#8220;pid&#8221; represents the process ID of the process which generated the  trace file. The process ID can be found with the following query, which finds  the process identifier using the process and session addresses and the session  auditing identifier as the session identifier.</p>
<pre>SELECT spid FROM v$process
WHERE addr = (SELECT paddr FROM v$session
      WHERE audsid = USERENV('sessionid'));<a name="656"></a></pre>
</div>
<h2><span style="color: #0000ff;">Using SQL Trace</span></h2>
<p>So the next logical step is to make use of SQL Trace. I have now set up my Oracle Database configuration parameter file (init.ora) with various parameter changes.</p>
<p>TIMED_STATISTICS = TRUE<br />
TIMED_OS_STATISTICS=5<br />
MAX_DUMP_FILE_SIZE = 1M<br />
SQL_TRACE = TRUE<br />
STATISTICS_LEVEL = ALL<br />
Now I bounce my database to instantiate these configuration parameter changes.</p>
<p>Tip  Some of these parameters can be updated online using the ALTER SYSTEM command.</p>
<p>The next step is starting up my highly active concurrent database scripting (see Appendix B). These scripts use the DBMS_JOBS package to repetitively execute a slew of database changes to my Accounts schema, from multiple concurrently executed database jobs using the DBMS_JOBS package. Since I am running sessions using the DBMS_JOBS package I have to be able to find trace files for each session. So let&#8217;s change the process identifier query to access multiple sessions, and find a trace file that way. So how do I find the appropriate sessions? Log into a database administrator user such as SYSTEM and execute a query something like this.</p>
<p>SELECT audsid, username, saddr, paddr, sid, serial#<br />
FROM v$session WHERE username = &#8216;ACCOUNTS&#8217; AND audsid != 0;<br />
Then I change my process identifier finding query and find a filename.</p>
<p>SELECT &#8216;c:\oracle\admin\test\udump\test_ora_&#8217;||spid||&#8217;.trc&#8217;<br />
&#8220;Trace File&#8221;<br />
FROM v$process<br />
WHERE addr = (<br />
SELECT paddr FROM V$SESSION<br />
WHERE username = &#8216;ACCOUNTS&#8217; AND audsid != 0);<br />
Trace File<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<br />
c:\oracle\admin\test\udump\test_ora_972.trc</p>
<p>Trace files can look like the gibberish shown below. Not really very easy to interpret is it? Yes that is sarcastic; certainly the very lowest form of wit but apt in this case. This is where TKPROF comes into play.</p>
<p>======================<br />
PARSING IN CURSOR #3 len=56 dep=1 uid=0 oct=3 lid=0<br />
tim=13822711723 hv=4049165760 ad=&#8217;67f67898&#8242;<br />
select order#,columns,types from access$ where d_obj#=:1<br />
END OF STMT<br />
PARSE #3:c=0,e=145,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,<br />
tim=13822711703<br />
EXEC #3:c=0,e=136,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,<br />
tim=13822714183<br />
FETCH #3:c=0,e=114,p=0,cr=3,cu=0,mis=0,r=1,dep=1,og=4,<br />
tim=13822714826<br />
FETCH #3:c=0,e=78,p=0,cr=2,cu=0,mis=0,r=1,dep=1,og=4,<br />
tim=13822715459<br />
FETCH #3:c=0,e=67,p=0,cr=2,cu=0,mis=0,r=1,dep=1,og=4,<br />
tim=13822716065<br />
FETCH #3:c=0,e=64,p=0,cr=2,cu=0,mis=0,r=1,dep=1,og=4,<br />
tim=13822716662<br />
FETCH #3:c=0,e=65,p=0,cr=2,cu=0,mis=0,r=1,dep=1,og=4,<br />
tim=13822717260<br />
FETCH #3:c=0,e=42,p=0,cr=1,cu=0,mis=0,r=0,dep=1,og=4,<br />
tim=13822717850<br />
STAT #3 id=1 cnt=5 pid=0 pos=1 obj=97 op=&#8217;TABLE ACCESS BY<br />
INDEX ROWID ACCESS$ &#8216;<br />
STAT #3 id=2 cnt=5 pid=1 pos=1 obj=129 op=&#8217;INDEX RANGE<br />
SCAN I_ACCESS1 &#8216;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.technooracle.com/oracle-tutorials/using-sql-trace-in-oracle/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

