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

<channel>
	<title>Parthokonar&#039;s Blog</title>
	<atom:link href="http://parthokonar.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://parthokonar.wordpress.com</link>
	<description>Just another WordPress.com weblog</description>
	<lastBuildDate>Mon, 16 Nov 2009 11:48:40 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='parthokonar.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://1.gravatar.com/blavatar/f09bb2edf10f075e06356f28892dd9ec?s=96&#038;d=http%3A%2F%2Fs2.wp.com%2Fi%2Fbuttonw-com.png</url>
		<title>Parthokonar&#039;s Blog</title>
		<link>http://parthokonar.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://parthokonar.wordpress.com/osd.xml" title="Parthokonar&#039;s Blog" />
	<atom:link rel='hub' href='http://parthokonar.wordpress.com/?pushpress=hub'/>
		<item>
		<title>How to get Data Definition Language (DDL) statements ? Parameter: SQLFILE</title>
		<link>http://parthokonar.wordpress.com/2009/11/16/how-to-get-data-definition-language-ddl-statements-parameter-sqlfile/</link>
		<comments>http://parthokonar.wordpress.com/2009/11/16/how-to-get-data-definition-language-ddl-statements-parameter-sqlfile/#comments</comments>
		<pubDate>Mon, 16 Nov 2009 11:48:40 +0000</pubDate>
		<dc:creator>parthokonar</dc:creator>
				<category><![CDATA[Oracle]]></category>
		<category><![CDATA[How to get Data Definition Language (DDL) statements ? Parameter: SQLFILE]]></category>

		<guid isPermaLink="false">http://parthokonar.wordpress.com/?p=88</guid>
		<description><![CDATA[How to get Data Definition Language (DDL) statements ? Parameter: SQLFILE With the Import Data Pump parameter SQLFILE you can specify the name of a file into which all of the SQL DDL is written that Import would have executed, based on other parameters. The SQL is not actually executed, and the target system remains [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=parthokonar.wordpress.com&amp;blog=8245597&amp;post=88&amp;subd=parthokonar&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<h3>How to get Data Definition Language (DDL) statements ? Parameter: SQLFILE</h3>
<p>With the Import Data Pump parameter <strong>SQLFILE</strong> you can specify the name of a file into which all of the SQL DDL is written that Import would have executed, based on other parameters. The SQL is not actually executed, and the target system remains unchanged. The file is written to the directory object specified in the DIRECTORY parameter, unless another directory_object is explicitly specified here. Any existing file that has a name matching the one specified with this parameter is overwritten.<br />
Syntax: SQLFILE=[directory_object:]file_name<br />
Example:</p>
<div><code>-- create a SQL file with DDL statements:</p>
<p>% impdp scott/tiger DIRECTORY=my_dir DUMPFILE=expdp_s.dmp \<br />
NOLOGFILE=y SQLFILE=impdp_s.sql FULL=y </code></div>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/parthokonar.wordpress.com/88/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/parthokonar.wordpress.com/88/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/parthokonar.wordpress.com/88/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/parthokonar.wordpress.com/88/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/parthokonar.wordpress.com/88/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/parthokonar.wordpress.com/88/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/parthokonar.wordpress.com/88/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/parthokonar.wordpress.com/88/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/parthokonar.wordpress.com/88/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/parthokonar.wordpress.com/88/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/parthokonar.wordpress.com/88/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/parthokonar.wordpress.com/88/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/parthokonar.wordpress.com/88/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/parthokonar.wordpress.com/88/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=parthokonar.wordpress.com&amp;blog=8245597&amp;post=88&amp;subd=parthokonar&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://parthokonar.wordpress.com/2009/11/16/how-to-get-data-definition-language-ddl-statements-parameter-sqlfile/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/59d21fd4e6034dd828027d060fc33408?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">parthokonar</media:title>
		</media:content>
	</item>
		<item>
		<title>Check running process of expdp impdp in oracle</title>
		<link>http://parthokonar.wordpress.com/2009/11/16/check-running-process-of-expdp-impdp-in-oracle/</link>
		<comments>http://parthokonar.wordpress.com/2009/11/16/check-running-process-of-expdp-impdp-in-oracle/#comments</comments>
		<pubDate>Mon, 16 Nov 2009 11:42:26 +0000</pubDate>
		<dc:creator>parthokonar</dc:creator>
				<category><![CDATA[Oracle Scripts]]></category>
		<category><![CDATA[Check running process of expdp impdp in oracle]]></category>
		<category><![CDATA[process of expdp impdp]]></category>

		<guid isPermaLink="false">http://parthokonar.wordpress.com/?p=85</guid>
		<description><![CDATA[To know whether exp/impdp process is running or not 1. By using ps -ef  at unix prompt. % ps -ef &#124; grep expdp oracle    8874  8704  1 07:00 pts/2    00:00:03 expdp                DIRECTORY=my_dir .. 2. By this sql script. SQL&#62; conn /as sysdba Connected. SQL&#62; select to_char(sysdate,&#8217;YYYY-MM-DD HH24:MI:SS&#8217;) &#8220;DATE&#8221;, s.program, s.sid, 2         s.status, s.username, d.job_name, p.spid, s.serial#, p.pid 3    from v$session s, v$process p, dba_datapump_sessions d 4   where p.addr=s.paddr [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=parthokonar.wordpress.com&amp;blog=8245597&amp;post=85&amp;subd=parthokonar&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>To know whether exp/impdp process is running or not</p>
<p>1. By using ps -ef  at unix prompt.</p>
<p><code>% ps -ef | grep expdp </code><code>oracle    8874  8704  1 07:00 pts/2    00:00:03 expdp                DIRECTORY=my_dir ..</code></p>
<p>2. By this sql script.</p>
<p>SQL&gt; conn /as sysdba<br />
Connected.<br />
SQL&gt; select to_char(sysdate,&#8217;YYYY-MM-DD HH24:MI:SS&#8217;) &#8220;DATE&#8221;, s.program, s.sid,<br />
2         s.status, s.username, d.job_name, p.spid, s.serial#, p.pid<br />
3    from v$session s, v$process p, dba_datapump_sessions d<br />
4   where p.addr=s.paddr and s.saddr=d.saddr;</p>
<p>DATE                PROGRAM                                                                 SID STATUS   USERNAME<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;- &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;- &#8212;&#8212;&#8212;- &#8212;&#8212;&#8211; &#8212;&#8212;&#8212;&#8211;<br />
2009-11-16 16:38:23 impdp.exe                                                               127 ACTIVE   SYSTEM<br />
2009-11-16 16:38:23 ORACLE.EXE (DM00)                                                       130 ACTIVE   SYSTEM<br />
2009-11-16 16:38:23 ORACLE.EXE (DW01)                                                       135 ACTIVE   SYSTEM</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/parthokonar.wordpress.com/85/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/parthokonar.wordpress.com/85/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/parthokonar.wordpress.com/85/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/parthokonar.wordpress.com/85/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/parthokonar.wordpress.com/85/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/parthokonar.wordpress.com/85/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/parthokonar.wordpress.com/85/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/parthokonar.wordpress.com/85/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/parthokonar.wordpress.com/85/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/parthokonar.wordpress.com/85/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/parthokonar.wordpress.com/85/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/parthokonar.wordpress.com/85/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/parthokonar.wordpress.com/85/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/parthokonar.wordpress.com/85/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=parthokonar.wordpress.com&amp;blog=8245597&amp;post=85&amp;subd=parthokonar&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://parthokonar.wordpress.com/2009/11/16/check-running-process-of-expdp-impdp-in-oracle/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/59d21fd4e6034dd828027d060fc33408?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">parthokonar</media:title>
		</media:content>
	</item>
		<item>
		<title>The PUBLIC role/User in Oracle.</title>
		<link>http://parthokonar.wordpress.com/2009/11/16/the-public-roleuser-in-oracle/</link>
		<comments>http://parthokonar.wordpress.com/2009/11/16/the-public-roleuser-in-oracle/#comments</comments>
		<pubDate>Mon, 16 Nov 2009 10:20:11 +0000</pubDate>
		<dc:creator>parthokonar</dc:creator>
				<category><![CDATA[Oracle]]></category>
		<category><![CDATA[PUBLIC role in Oracle]]></category>
		<category><![CDATA[PUBLIC role/User]]></category>
		<category><![CDATA[The PUBLIC role/User in Oracle.]]></category>

		<guid isPermaLink="false">http://parthokonar.wordpress.com/?p=82</guid>
		<description><![CDATA[The PUBLIC role/User in Oracle. When the Oracle Database is been created, the sql.bsq script is run which creates a rle called PUBLIC. &#8220;create role public &#8220; But you cannot see from DBA_ROLES view that the role exists SQL&#62; select * from dba_roles where role=&#8217;PUBLIC&#8217;; no rows selected The DBA_ROLES view is created during the [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=parthokonar.wordpress.com&amp;blog=8245597&amp;post=82&amp;subd=parthokonar&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>The PUBLIC role/User in Oracle.</p>
<p>When the Oracle Database is been created, the sql.bsq script is run which creates a rle called PUBLIC. &#8220;create role public &#8220;</p>
<p>But you cannot see from DBA_ROLES view that the role exists</p>
<p>SQL&gt; select * from dba_roles where role=&#8217;PUBLIC&#8217;;<br />
no rows selected</p>
<p>The DBA_ROLES view is created during the execution of the catalog.sql script:</p>
<p>create or replace view DBA_ROLES (ROLE, PASSWORD_REQUIRED)<br />
as<br />
select name, decode(password, null, &#8216;NO&#8217;, &#8216;EXTERNAL&#8217;, &#8216;EXTERNAL&#8217;,<br />
&#8216;GLOBAL&#8217;, &#8216;GLOBAL&#8217;, &#8216;YES&#8217;)<br />
from  user$<br />
where type# = 0 and name not in (&#8216;PUBLIC&#8217;, &#8216;_NEXT_USER&#8217;);</p>
<p>You see how the PUBLIC role is hidden from DBA_ROLES view.</p>
<p>In SYS.USER$, there are 2 types of objects: role (0) or user (1).</p>
<p>SQL&gt; select user#, name from sys.user$ order by 1;</p>
<p>USER# NAME<br />
&#8212;&#8212;&#8212;- &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<br />
0 SYS<br />
1 PUBLIC<br />
2 CONNECT<br />
3 RESOURCE<br />
4 DBA<br />
5 SYSTEM<br />
6 SELECT_CATALOG_ROLE<br />
7 EXECUTE_CATALOG_ROLE<br />
8 DELETE_CATALOG_ROLE<br />
9 EXP_FULL_DATABASE<br />
10 IMP_FULL_DATABASE<br />
11 OUTLN<br />
12 RECOVERY_CATALOG_OWNER<br />
13 GATHER_SYSTEM_STATISTICS<br />
14 LOGSTDBY_ADMINISTRATOR<br />
15 AQ_ADMINISTRATOR_ROLE<br />
16 AQ_USER_ROLE</p>
<p>When we create a user if the create session role is granted to public. then the created user can connect without giving it the create session role.</p>
<p>E.g:-</p>
<p>1. We create a user.</p>
<p>SQL&gt; create user USER123 identified by USER123;</p>
<p>User created.</p>
<p>2. Try to connect that user.</p>
<p>SQL&gt; connect USER123/USER123;<br />
ERROR:<br />
ORA-01045: user USER123 lacks CREATE SESSION privilege; logon denied</p>
<p>Warning: You are no longer connected to ORACLE.</p>
<p>3. Grant create session to public;</p>
<p>SQL&gt; grant create session to public;<br />
SP2-0640: Not connected<br />
SQL&gt; conn /as sysdba<br />
Connected.<br />
SQL&gt; grant create session to public;</p>
<p>Grant succeeded.</p>
<p>4. Try to connect again. It is been connected,</p>
<p>SQL&gt; connect USER123/USER123;<br />
Connected.</p>
<p>In fact the user, though not granted the CREATE SESSION privilege directly<br />
got it from the PUBLIC role that had this privilege been granted previously.</p>
<p>SQL&gt; select * from user_sys_privs;</p>
<p>USERNAME                       PRIVILEGE                            ADM<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212; &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212; &#8212;<br />
PUBLIC                         CREATE SESSION                       NO</p>
<p>So when you grant some privileges or roles to PUBLIC, this means that any<br />
newly created user is automatically granted these without requiring any<br />
explicit GRANT statement.</p>
<p>That&#8217;s it.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/parthokonar.wordpress.com/82/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/parthokonar.wordpress.com/82/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/parthokonar.wordpress.com/82/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/parthokonar.wordpress.com/82/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/parthokonar.wordpress.com/82/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/parthokonar.wordpress.com/82/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/parthokonar.wordpress.com/82/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/parthokonar.wordpress.com/82/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/parthokonar.wordpress.com/82/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/parthokonar.wordpress.com/82/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/parthokonar.wordpress.com/82/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/parthokonar.wordpress.com/82/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/parthokonar.wordpress.com/82/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/parthokonar.wordpress.com/82/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=parthokonar.wordpress.com&amp;blog=8245597&amp;post=82&amp;subd=parthokonar&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://parthokonar.wordpress.com/2009/11/16/the-public-roleuser-in-oracle/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/59d21fd4e6034dd828027d060fc33408?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">parthokonar</media:title>
		</media:content>
	</item>
		<item>
		<title>Dropping user in oralce by killing active sessions</title>
		<link>http://parthokonar.wordpress.com/2009/10/29/dropping-user-in-oralce-by-killing-active-sessions/</link>
		<comments>http://parthokonar.wordpress.com/2009/10/29/dropping-user-in-oralce-by-killing-active-sessions/#comments</comments>
		<pubDate>Thu, 29 Oct 2009 04:14:53 +0000</pubDate>
		<dc:creator>parthokonar</dc:creator>
				<category><![CDATA[Oracle]]></category>
		<category><![CDATA[Dropping user in oralce]]></category>
		<category><![CDATA[Dropping user in oralce by killing active sessions]]></category>

		<guid isPermaLink="false">http://parthokonar.wordpress.com/?p=80</guid>
		<description><![CDATA[Today when i was looking through the metalink , i found this script, which seems to be a useful script for DBA&#8217;s. The following PL/SQL script is intended to be used for immediate removal of a user from the database.  It kills all active sessions and then drops the user from the database. I have [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=parthokonar.wordpress.com&amp;blog=8245597&amp;post=80&amp;subd=parthokonar&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Today when i was looking through the metalink , i found this script, which seems to be a useful script for DBA&#8217;s.<br />
The following PL/SQL script is intended to be used for immediate removal of a user from the database.  It kills all active sessions and then drops the user from the database. I have tested in 10.2, it works fine</p>
<p>CREATE OR REPLACE PROCEDURE kill_drop_user (in_username IN VARCHAR2,<br />
sleep_interval IN NUMBER DEFAULT 10)<br />
AS<br />
PRAGMA AUTONOMOUS_TRANSACTION;<br />
cannot_drop_user EXCEPTION;<br />
PRAGMA EXCEPTION_INIT(cannot_drop_user, -1940);<br />
user_count    NUMBER := -1;<br />
BEGIN<br />
SELECT count(*) INTO user_count FROM dba_users WHERE username = in_username;<br />
IF user_count = 0 THEN<br />
DBMS_OUTPUT.PUT_LINE(&#8216;User &#8216; || in_username || &#8216; does not exist.&#8217;);<br />
RETURN;<br />
END IF;<br />
FOR i IN (SELECT sid, serial# FROM v$session WHERE username = in_username) LOOP<br />
EXECUTE IMMEDIATE &#8216;alter system kill session &#8216; || &#8221;&#8221; || i.sid || &#8216;,&#8217; || i.serial# || &#8221;&#8217; immediate&#8217;;<br />
DBMS_OUTPUT.PUT_LINE(&#8216;Killing user &#8216; || i.sid || &#8216;, &#8216; || i.serial#);<br />
END LOOP;<br />
LOOP<br />
BEGIN<br />
DBMS_OUTPUT.PUT_LINE(&#8216;Attempting to drop user &#8216; || in_username || &#8216;&#8230;&#8217;);<br />
EXECUTE IMMEDIATE &#8216;DROP USER &#8216; || in_username || &#8216; CASCADE&#8217;;<br />
EXIT WHEN SQLCODE &lt;&gt; -1940;<br />
EXCEPTION<br />
WHEN cannot_drop_user THEN<br />
&#8211;DBMS_OUTPUT.PUT_LINE(SQLERRM);<br />
DBMS_OUTPUT.PUT_LINE(&#8216;Waiting &#8216; || sleep_interval || &#8216; seconds for resource clean-up&#8230;&#8217;);<br />
DBMS_LOCK.SLEEP(sleep_interval);<br />
WHEN OTHERS THEN<br />
DBMS_OUTPUT.PUT_LINE(&#8216;Inner: &#8216; || SQLERRM);<br />
END;<br />
END LOOP;<br />
DBMS_OUTPUT.PUT_LINE(&#8216;Exiting loop with SQLCODE: &#8216; || SQLCODE);<br />
DBMS_OUTPUT.PUT_LINE(&#8216;User &#8216; || in_username || &#8216; has been dropped.&#8217;);<br />
EXCEPTION<br />
WHEN OTHERS THEN<br />
DBMS_OUTPUT.PUT_LINE(&#8216;Outer: &#8216; || SQLERRM);<br />
END;<br />
/</p>
<p>Configuring the Sample Code</p>
<p>This script is intended to be run by the SYS user of the database.<br />
Running the Sample Code</p>
<p>1. Copy the sample code below into a file named kill_drop_user.sql.<br />
2. Open SQL*Plus and connect as user SYS to your database</p>
<p>SQL&gt; CONNECT sys/change_on_install@orcl AS SYSDBA</p>
<p>3. Create a user called TEST with password TEST</p>
<p>SQL&gt; GRANT connect, resource TO test IDENTIFIED BY test;</p>
<p>4. Create the procedure kill_drop_user</p>
<p>SQL&gt; @&#8221;C:\scripts\kill_drop_user.sql&#8221;</p>
<p>5. Open three (3) SQL*Plus sessions and connect as user TEST.<br />
6. Execute the PL/SQL script</p>
<p>SQL&gt; SET serveroutput ON size 1000000<br />
SQL&gt; SET timing ON<br />
SQL&gt; EXEC kill_drop_user(&#8216;TEST&#8217;);</p>
<p>The above script may be a good help for you.</p>
<p>Partho Konar</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/parthokonar.wordpress.com/80/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/parthokonar.wordpress.com/80/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/parthokonar.wordpress.com/80/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/parthokonar.wordpress.com/80/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/parthokonar.wordpress.com/80/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/parthokonar.wordpress.com/80/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/parthokonar.wordpress.com/80/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/parthokonar.wordpress.com/80/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/parthokonar.wordpress.com/80/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/parthokonar.wordpress.com/80/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/parthokonar.wordpress.com/80/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/parthokonar.wordpress.com/80/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/parthokonar.wordpress.com/80/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/parthokonar.wordpress.com/80/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=parthokonar.wordpress.com&amp;blog=8245597&amp;post=80&amp;subd=parthokonar&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://parthokonar.wordpress.com/2009/10/29/dropping-user-in-oralce-by-killing-active-sessions/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/59d21fd4e6034dd828027d060fc33408?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">parthokonar</media:title>
		</media:content>
	</item>
		<item>
		<title>Cloning An Oracle Database in Windows</title>
		<link>http://parthokonar.wordpress.com/2009/10/28/cloning-an-oracle-database-in-windows/</link>
		<comments>http://parthokonar.wordpress.com/2009/10/28/cloning-an-oracle-database-in-windows/#comments</comments>
		<pubDate>Wed, 28 Oct 2009 04:35:54 +0000</pubDate>
		<dc:creator>parthokonar</dc:creator>
				<category><![CDATA[Oracle]]></category>
		<category><![CDATA[Cloning An Oracle Database in Windows]]></category>
		<category><![CDATA[database cloning]]></category>
		<category><![CDATA[Steps for Cloning An Oracle Database in Windows]]></category>

		<guid isPermaLink="false">http://parthokonar.wordpress.com/?p=76</guid>
		<description><![CDATA[Yesterday I was asked by developers to create a developement database a clone of the production database in the same system , it is a windows machine. the oracle version is 10.2.0 So these are the steps i followed. 1.  Create A Backup Control File Script. First you need to obtain a script that will [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=parthokonar.wordpress.com&amp;blog=8245597&amp;post=76&amp;subd=parthokonar&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Yesterday I was asked by developers to create a developement database a clone of the production database in the same system , it is a windows machine. the oracle version is 10.2.0</p>
<p>So these are the steps i followed.</p>
<p>1.  Create A Backup Control File Script.</p>
<p>First you need to obtain a script that will create a copy of the existing control file.</p>
<p>connect with sysdba .. conn /as sysdba then issue the command</p>
<p>ALTER DATABASE BACKUP CONTROLFILE TO TRACE ;</p>
<p>This creates a file in the trace file directory. The file usually has the extension &#8216;.trc&#8217; and will be located either in the directory defined by the parameter &#8216;user_dump_dest&#8217;, or if this parameter is undefined it will be in $ORACLE_HOME/rdbms/log. Edit this file with your favourite editor and remove the crud. Then rename it as &#8220;ctrl&lt;NEW_SID&gt;.sql,&#8221; where &lt;NEW_SID&gt; will be the ORACLE_SID of the copied database.</p>
<p>2.Modify The Script Created In The Previous Step.</p>
<p>The CREATE CONTROLFILE command in the script ctrl&lt;NEW_SID&gt;.sql contains SQL, which might look something like this:</p>
<p>CREATE CONTROLFILE SET DATABASE &#8220;LDMPRD&#8221; RESETLOGS ARCHIVELOG<br />
MAXLOGFILES 32<br />
MAXLOGMEMBERS 2<br />
MAXDATAFILES 32<br />
MAXINSTANCES 16<br />
MAXLOGHISTORY 1815<br />
LOGFILE<br />
GROUP 1 &#8216;E:\ORACLE\ORADATA\LDMPRD\REDO03.LOG&#8217;  SIZE 500M,<br />
GROUP 2 &#8216;E:\ORACLE\ORADATA\LDMPRD\REDO02.LOG&#8217;  SIZE 500M,<br />
GROUP 3 &#8216;E:\ORACLE\ORADATA\LDMPRD\REDO01.LOG&#8217;  SIZE 500M<br />
DATAFILE<br />
&#8216;D:\ORACLE\ORADATA\LDMPRD\SYSTEM01.DBF&#8217;,<br />
&#8216;D:\ORACLE\ORADATA\LDMPRD\ELSERV1.DBF&#8217;,<br />
&#8216;D:\ORACLE\ORADATA\LDMPRD\TEMP01.DBF&#8217;,<br />
&#8216;D:\ORACLE\ORADATA\LDMPRD\TOOLS01.DBF&#8217;,<br />
&#8216;D:\ORACLE\ORADATA\LDMPRD\INDX01.DBF&#8217;,<br />
&#8216;D:\ORACLE\ORADATA\LDMPRD\DR01.DBF&#8217;,<br />
&#8216;D:\ORACLE\ORADATA\LDMPRD\ELESIVER01.DBF&#8217;,<br />
&#8216;D:\ORACLE\ORADATA\LDMPRD\TEMP02.DBF&#8217;<br />
CHARACTER SET WE8ISO8859P1<br />
;</p>
<p>Where the string LDMPRD is the Oracle SID of the original database. This should be changed to LDMDEV. As the new database i want to create is the clone of LDMPRD. Remember to ser the keyword &#8220;SET&#8221; not reuse. We have to take only the script something mentioned above. as there are other things mentioned in the trace file.</p>
<p>it should look like this :- and named something like ctrl_LDMDEV.sql.</p>
<p>CREATE CONTROLFILE SET DATABASE &#8220;LDMDEV&#8221; RESETLOGS ARCHIVELOG<br />
MAXLOGFILES 32<br />
MAXLOGMEMBERS 2<br />
MAXDATAFILES 32<br />
MAXINSTANCES 16<br />
MAXLOGHISTORY 1815<br />
LOGFILE<br />
GROUP 1 &#8216;E:\ORACLE\ORADATA\LDMDEV\REDO03.LOG&#8217;  SIZE 500M,<br />
GROUP 2 &#8216;E:\ORACLE\ORADATA\LDMDEV\REDO02.LOG&#8217;  SIZE 500M,<br />
GROUP 3 &#8216;E:\ORACLE\ORADATA\LDMDEV\REDO01.LOG&#8217;  SIZE 500M<br />
DATAFILE<br />
&#8216;D:\ORACLE\ORADATA\LDMDEV\SYSTEM01.DBF&#8217;,<br />
&#8216;D:\ORACLE\ORADATA\LDMDEV\ELSERV1.DBF&#8217;,<br />
&#8216;D:\ORACLE\ORADATA\LDMDEV\TEMP01.DBF&#8217;,<br />
&#8216;D:\ORACLE\ORADATA\LDMDEV\TOOLS01.DBF&#8217;,<br />
&#8216;D:\ORACLE\ORADATA\LDMDEV\INDX01.DBF&#8217;,<br />
&#8216;D:\ORACLE\ORADATA\LDMDEV\DR01.DBF&#8217;,<br />
&#8216;D:\ORACLE\ORADATA\LDMDEV\ELESIVER01.DBF&#8217;,<br />
&#8216;D:\ORACLE\ORADATA\LDMDEV\TEMP02.DBF&#8217;<br />
CHARACTER SET WE8ISO8859P1<br />
/</p>
<p>3. Copy The Existing Database To The New Location.</p>
<p>This will be a cold copy. So obviously you should make sure that the database is shutdown and all services are stopped before attempting to copy the database.</p>
<p>If the copy is on the same host, you can use the DOS copy command (once the instance is shutdown). Or you can just copy and paste via mouse also.</p>
<p>On the target host you need to copy all parameter files and all files mentioned above to their new location. Make sure you preserve ownership and permissions.</p>
<p>4.Set Up Parameter Files For The New Database</p>
<p>There may be several parameters that need to be edited in new_sid here it is LDMDEV In particular you will need to edit the control_files parameter so that it points to the name and location that you want to use for the new control files. You will also have to change the DB_NAME parameter in init&lt;NEW_SID&gt;.ora. Change it to the newname for your database. Usually this corresponds the LDMDEV. As well as i modified the db_unique_name also. Any &#8216;ifile&#8217; parameters will need to be edited to point to the new name of the include file in the new location. We have to crease other dump directoried so that it point to new oracle_sid.</p>
<p>5  Create The Control File For The New Database.</p>
<p>Now edit the file like ctrl_LDMDEV.sql and strip out everything up to and including the STARTUP NOMOUNT command. Remove the ALTER DATABASE OPEN command and everything after it. This leaves a command which just creates the controlfile.</p>
<p>6  Create The Services For NEW_SID i.e LDMDEV</p>
<p>Create the services &#8220;OracleService&lt;Sid&gt;&#8221; and the &#8220;OracleStart&lt;Sid&gt;&#8221; for &#8220;NEW_SID&#8221; with the following command:</p>
<p>oradim -new -sid LDMDEV -intpwd &lt;password&gt; -startmode auto -pfile &lt;path_name&gt;</p>
<p>7 Run &#8216;CREATE CONTROLFILE&#8217; For &lt;NEW_SID&gt; i.e LDMDEV</p>
<p>Make sure that your current directory is the one that contains ctrl&lt;NEW_SID&gt;.sql<br />
ctrl_LDMDEV.sql. or you can specify the full pathe also.</p>
<p>Set your ORACLE_SID to &lt;NEW_SID&gt;</p>
<p>Startup SVRMGRL and enter the following:</p>
<p>CONNECT INTERNAL<br />
STARTUP NOMOUNT PFILE=&lt;full path&gt;\init&lt;NEW_SID&gt;.ora<br />
@ctrl_LDMDEV.sql<br />
ALTER DATABASE OPEN RESETLOGS;<br />
create spfile from pfile;</p>
<p>(note. if we create the oracle service then it will say that the database is already running while doing the step :- STARTUP NOMOUNT PFILE=&lt;full path&gt;\init&lt;NEW_SID&gt;.ora.</p>
<p>8. Then we need to create appropriate listener.ora and tnsnames.ora file so the the client users can connect the the database.</p>
<p>May be it will help you to clone a database in windows environment.</p>
<p>Partho Konar.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/parthokonar.wordpress.com/76/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/parthokonar.wordpress.com/76/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/parthokonar.wordpress.com/76/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/parthokonar.wordpress.com/76/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/parthokonar.wordpress.com/76/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/parthokonar.wordpress.com/76/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/parthokonar.wordpress.com/76/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/parthokonar.wordpress.com/76/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/parthokonar.wordpress.com/76/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/parthokonar.wordpress.com/76/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/parthokonar.wordpress.com/76/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/parthokonar.wordpress.com/76/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/parthokonar.wordpress.com/76/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/parthokonar.wordpress.com/76/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=parthokonar.wordpress.com&amp;blog=8245597&amp;post=76&amp;subd=parthokonar&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://parthokonar.wordpress.com/2009/10/28/cloning-an-oracle-database-in-windows/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/59d21fd4e6034dd828027d060fc33408?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">parthokonar</media:title>
		</media:content>
	</item>
		<item>
		<title>Creating a flat file from a table</title>
		<link>http://parthokonar.wordpress.com/2009/09/18/creating-a-flat-file-from-a-table/</link>
		<comments>http://parthokonar.wordpress.com/2009/09/18/creating-a-flat-file-from-a-table/#comments</comments>
		<pubDate>Fri, 18 Sep 2009 19:31:14 +0000</pubDate>
		<dc:creator>parthokonar</dc:creator>
				<category><![CDATA[Oracle]]></category>
		<category><![CDATA[Creating a flat file from a table]]></category>
		<category><![CDATA[flat file.]]></category>

		<guid isPermaLink="false">http://parthokonar.wordpress.com/2009/09/18/creating-a-flat-file-from-a-table/</guid>
		<description><![CDATA[Creating a flat file from oracle database table is very easy. e.g We need to create a flat file for the emp table. SQL&#62; conn scott/tiger SQL&#62;set pagesize 100 SQL&#62;set linesize 100 SQL&#62;spool emp.lst SQL&#62;select * from emp; SQL&#62;spool off now in the unix prompt if we do ls -ltr we will get that file [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=parthokonar.wordpress.com&amp;blog=8245597&amp;post=74&amp;subd=parthokonar&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Creating a flat file from oracle database table is very easy.<br />
e.g<br />
We need to create a flat file for the emp table.<br />
SQL&gt; conn scott/tiger<br />
SQL&gt;set pagesize 100<br />
SQL&gt;set linesize 100<br />
SQL&gt;spool emp.lst<br />
SQL&gt;select * from emp;<br />
SQL&gt;spool off</p>
<p>now in the unix prompt if we do<br />
ls -ltr<br />
we will get that file (emp.lst) in the current working directory.</p>
<p>That&#8217;s it..</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/parthokonar.wordpress.com/74/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/parthokonar.wordpress.com/74/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/parthokonar.wordpress.com/74/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/parthokonar.wordpress.com/74/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/parthokonar.wordpress.com/74/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/parthokonar.wordpress.com/74/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/parthokonar.wordpress.com/74/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/parthokonar.wordpress.com/74/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/parthokonar.wordpress.com/74/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/parthokonar.wordpress.com/74/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/parthokonar.wordpress.com/74/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/parthokonar.wordpress.com/74/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/parthokonar.wordpress.com/74/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/parthokonar.wordpress.com/74/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=parthokonar.wordpress.com&amp;blog=8245597&amp;post=74&amp;subd=parthokonar&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://parthokonar.wordpress.com/2009/09/18/creating-a-flat-file-from-a-table/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/59d21fd4e6034dd828027d060fc33408?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">parthokonar</media:title>
		</media:content>
	</item>
		<item>
		<title>parameters affect database tuning</title>
		<link>http://parthokonar.wordpress.com/2009/09/09/parameters-affect-database-tuning/</link>
		<comments>http://parthokonar.wordpress.com/2009/09/09/parameters-affect-database-tuning/#comments</comments>
		<pubDate>Wed, 09 Sep 2009 20:30:26 +0000</pubDate>
		<dc:creator>parthokonar</dc:creator>
				<category><![CDATA[Oracle]]></category>
		<category><![CDATA[parameters affect database tuning]]></category>

		<guid isPermaLink="false">http://parthokonar.wordpress.com/2009/09/09/parameters-affect-database-tuning/</guid>
		<description><![CDATA[The parameters listed below are what we consider to be the top init.ora parameters which usually affect database tuning. ===================== DB_BLOCK_BUFFERS SHARED_POOL_SIZE SORT_AREA_SIZE DBWR_IO_SLAVES ROLLBACK_SEGMENTS SORT_AREA_RETAINED_SIZE DB_BLOCK_LRU_EXTENDED_STATISTICS SHARED_POOL_RESERVED_SIZE<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=parthokonar.wordpress.com&amp;blog=8245597&amp;post=72&amp;subd=parthokonar&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>The parameters listed below are what we consider to be the top init.ora<br />
parameters which usually affect database tuning.  </p>
<p>=====================<br />
DB_BLOCK_BUFFERS<br />
SHARED_POOL_SIZE<br />
SORT_AREA_SIZE<br />
DBWR_IO_SLAVES<br />
ROLLBACK_SEGMENTS<br />
SORT_AREA_RETAINED_SIZE<br />
DB_BLOCK_LRU_EXTENDED_STATISTICS<br />
SHARED_POOL_RESERVED_SIZE</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/parthokonar.wordpress.com/72/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/parthokonar.wordpress.com/72/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/parthokonar.wordpress.com/72/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/parthokonar.wordpress.com/72/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/parthokonar.wordpress.com/72/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/parthokonar.wordpress.com/72/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/parthokonar.wordpress.com/72/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/parthokonar.wordpress.com/72/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/parthokonar.wordpress.com/72/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/parthokonar.wordpress.com/72/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/parthokonar.wordpress.com/72/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/parthokonar.wordpress.com/72/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/parthokonar.wordpress.com/72/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/parthokonar.wordpress.com/72/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=parthokonar.wordpress.com&amp;blog=8245597&amp;post=72&amp;subd=parthokonar&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://parthokonar.wordpress.com/2009/09/09/parameters-affect-database-tuning/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/59d21fd4e6034dd828027d060fc33408?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">parthokonar</media:title>
		</media:content>
	</item>
		<item>
		<title>Latches and Enqueues</title>
		<link>http://parthokonar.wordpress.com/2009/09/01/latches-and-enqueues/</link>
		<comments>http://parthokonar.wordpress.com/2009/09/01/latches-and-enqueues/#comments</comments>
		<pubDate>Tue, 01 Sep 2009 19:18:17 +0000</pubDate>
		<dc:creator>parthokonar</dc:creator>
				<category><![CDATA[Oracle]]></category>
		<category><![CDATA[Enqueues]]></category>
		<category><![CDATA[Latches]]></category>
		<category><![CDATA[Latches and Enqueues]]></category>

		<guid isPermaLink="false">http://parthokonar.wordpress.com/2009/09/01/latches-and-enqueues/</guid>
		<description><![CDATA[Latches Latches are simple, low-level serialization mechanisms to protect shared data structures in the system global area (SGA). For example, latches protect the list of users currently accessing the database and protect the data structures describing the blocks in the buffer cache. A server or background process acquires a latch for a very short time [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=parthokonar.wordpress.com&amp;blog=8245597&amp;post=70&amp;subd=parthokonar&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Latches</p>
<p>Latches are simple, low-level serialization mechanisms to protect shared data structures in the system global area (SGA). For example, latches protect the list of users currently accessing the database and protect the data structures describing the blocks in the buffer cache. A server or background process acquires a latch for a very short time while manipulating or looking at one of these structures. The implementation of latches is operating system dependent, particularly in regard to whether and how long a process will wait for a latch.</p>
<p>A latch is a type  of a lock that can be very quickly acquired and freed.<br />
Latches are typically used to prevent more than one process from<br />
executing the same  piece of  code at  a given time. Associated with each<br />
latch is a cleanup procedure that will be called if a process  dies while<br />
holding  the latch.  Latches  have an  associated level  that  is used to<br />
prevent deadlocks.  Once a process acquires a latch at a certain level it<br />
cannot subsequently acquire a latch at a  level that is equal to  or less<br />
than that level (unless it acquires it nowait).</p>
<p>Latches vs Enqueues</p>
<p>    Enqueues are another type of locking mechanism used in Oracle.<br />
    An enqueue is a more sophisticated mechanism which permits several concurrent<br />
    processes to have varying degree of sharing of &#8220;known&#8221; resources. Any object<br />
    which can be concurrently used, can be protected with enqueues. A good example<br />
    is of locks on tables. We allow varying levels of sharing on tables e.g.<br />
    two processes can lock a table in share mode or in share update mode etc.<br />
    One difference is that the enqueue is obtained using an OS specific<br />
    locking mechanism. An enqueue allows the user to store a value in the lock,<br />
    i.e the mode in which we are requesting it. The OS lock manager keeps track<br />
    of the resources locked. If a process cannot be granted the lock because it<br />
    is incompatible with the mode requested and the lock is requested with wait,<br />
    the OS puts the requesting process on a wait queue which is serviced in FIFO.<br />
    Another difference between latches and enqueues is that<br />
    in latches there is no ordered queue of waiters like in enqueues. Latch<br />
    waiters may either use timers to wakeup and retry or spin (only in<br />
    multiprocessors). Since all waiters are concurrently retrying (depending on<br />
    the scheduler), anyone might get the latch and conceivably the first one to<br />
    try might be the last one to get.</p>
<p>How to identify contention for internal latches?</p>
<p>        Relevant data dictionary views to query<br />
        &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;</p>
<p>    V$LATCH<br />
    V$LATCHHOLDER<br />
    V$LATCHNAME</p>
<p>    Each row in the V$LATCH table contains statistics for a different type<br />
    of latch. The columns of the table reflect activity for different types<br />
    of latch requests. The distinction between these types of requests is<br />
    whether the requesting process continues to request a latch if it<br />
    is unavailable:</p>
<p>    willing-to-wait        If the latch requested with a willing-to-wait<br />
                                    request is not available, the requesting process<br />
                                    waits a short time and requests the latch again.<br />
                                    The process continues waiting and requesting until<br />
                                    the latch is available.</p>
<p>    no wait                    If the latch requested with an immediate request is<br />
                                    not available, the requesting process does not<br />
                                    wait, but continues processing.</p>
<p>    V$LATCHNAME key information:<br />
    &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;</p>
<p>    GETS                      Number of successful willing-to-wait requests for<br />
                                    a latch.</p>
<p>    MISSES                  Number of times an initial willing-to-wait request<br />
                                    was unsuccessful.</p>
<p>    SLEEPS                  Number of times a process waited a requested a latch<br />
                                    after an initial wiling-to-wait request.</p>
<p>    IMMEDIATE_GETS              Number of successful immediate requests for each latch.</p>
<p>    IMMEDIATE_MISSES          Number of unsuccessful immediate requests for each latch.</p>
<p>    Calculating latch hit ratio<br />
    &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-</p>
<p>    To get the Hit ratio for  latches apply the following formula:</p>
<p>    &#8220;willing-to-wait&#8221; Hit Ratio=(GETS-MISSES)/GETS<br />
    &#8220;no wait&#8221; Hit Ratio=(IMMEDIATE_GETS-IMMEDIATE_MISSES)/IMMEDIATE_GETS</p>
<p>    This number should be close to 1. If not, tune according to the latch name</p>
<p>Some Useful SQL scripts to get latch information</p>
<p>    /*<br />
    ** Display System-wide latch statistics.<br />
    */<br />
    column name format A32 truncate heading &#8220;LATCH NAME&#8221;<br />
    column pid heading &#8220;HOLDER PID&#8221;<br />
    select c.name,a.addr,a.gets,a.misses,a.sleeps,<br />
    a.immediate_gets,a.immediate_misses,b.pid<br />
    from v$latch a, v$latchholder b, v$latchname c<br />
    where a.addr = b.laddr(+)<br />
    and a.latch# = c.latch#<br />
    order by a.latch#;</p>
<p>    /*<br />
    ** Given a latch address, find out the latch name.<br />
    */<br />
    column name format a64 heading &#8216;Name&#8217;<br />
    select a.name from v$latchname a, v$latch b<br />
    where b.addr = &#8216;&amp;addr&#8217;<br />
    and b.latch#=a.latch#;</p>
<p>    /*<br />
    ** Display latch statistics by latch name.<br />
    */<br />
    column name format a32 heading &#8216;LATCH NAME&#8217;<br />
    column pid heading &#8216;HOLDER PID&#8217;<br />
    select c.name,a.addr,a.gets,a.misses,a.sleeps,<br />
    a.immediate_gets,a.immediate_misses,b.pid<br />
    from v$latch a, v$latchholder b, v$latchname c<br />
    where a.addr   = b.laddr(+) and a.latch# = c.latch#<br />
    and c.name like &#8216;&amp;latch_name%&#8217; order by a.latch#; </p>
<p>Some important latches are :- </p>
<p>Cache buffers chains latch</p>
<p>Cache buffers LRU chain latch</p>
<p>Redo allocation latch</p>
<p>Redo copy latch</p>
<p>Library cache latch</p>
<p>Library cache pin latch</p>
<p>Shared pool latch</p>
<p>Row cache objects latch</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/parthokonar.wordpress.com/70/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/parthokonar.wordpress.com/70/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/parthokonar.wordpress.com/70/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/parthokonar.wordpress.com/70/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/parthokonar.wordpress.com/70/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/parthokonar.wordpress.com/70/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/parthokonar.wordpress.com/70/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/parthokonar.wordpress.com/70/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/parthokonar.wordpress.com/70/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/parthokonar.wordpress.com/70/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/parthokonar.wordpress.com/70/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/parthokonar.wordpress.com/70/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/parthokonar.wordpress.com/70/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/parthokonar.wordpress.com/70/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=parthokonar.wordpress.com&amp;blog=8245597&amp;post=70&amp;subd=parthokonar&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://parthokonar.wordpress.com/2009/09/01/latches-and-enqueues/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/59d21fd4e6034dd828027d060fc33408?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">parthokonar</media:title>
		</media:content>
	</item>
		<item>
		<title>Blocking Transaction</title>
		<link>http://parthokonar.wordpress.com/2009/08/31/blocking-transaction/</link>
		<comments>http://parthokonar.wordpress.com/2009/08/31/blocking-transaction/#comments</comments>
		<pubDate>Mon, 31 Aug 2009 13:38:00 +0000</pubDate>
		<dc:creator>parthokonar</dc:creator>
				<category><![CDATA[Oracle]]></category>
		<category><![CDATA[Blocking Transaction]]></category>

		<guid isPermaLink="false">http://parthokonar.wordpress.com/2009/08/31/blocking-transaction/</guid>
		<description><![CDATA[Blocking Transaction A transaction that has made only a few changes but has been idle for a long time could cause a rollback segment to grow and finally cause an ORA-1650 &#8220;unable to extend rollback segment %s by %s in tablespace %s&#8221; OR ORA-1562 &#8220;failed to extend rollback segment number %s&#8221; This can cause for [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=parthokonar.wordpress.com&amp;blog=8245597&amp;post=68&amp;subd=parthokonar&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Blocking Transaction</p>
<p>A transaction that has made only a few changes but has been idle for<br />
a long time could cause a rollback segment to grow and finally cause an</p>
<p>ORA-1650 &#8220;unable to extend rollback segment %s by %s in tablespace %s&#8221;</p>
<p>OR</p>
<p>ORA-1562 &#8220;failed to extend rollback segment number %s&#8221;</p>
<p>This can cause for instance stuck backup jobs. In such cases it is<br />
necessary to find the session that holds the blocking transaction.</p>
<p>Query to find blocking transaction<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-</p>
<p>In order to find the blocking session perform the following query from sqlplus:<br />
(connect as SYS or AS SYSDBA):</p>
<p>SELECT s.sid, s.serial#, t.start_time, t.xidusn,s.username<br />
 FROM V$session s, V$transaction t, V$rollstat r<br />
 WHERE s.saddr=t.ses_addr<br />
 AND t.xidusn=r.usn<br />
 AND ((r.curext=t.start_uext-1) OR<br />
     ((r.curext=r.extents-1) AND t.start_uext=0));</p>
<p>Example output:</p>
<p>SID    SERIAL#       START_TIME            XIDUSN         USERNAME<br />
&#8212;    &#8212;&#8212;-       &#8212;&#8212;&#8212;&#8212;&#8212;       &#8212;&#8212;         &#8212;&#8212;&#8212;-<br />
  8         13       8/22/2000 14:15:10         2         SCOTT</p>
<p>Check if the transaction can be ended or whether the transaction needs<br />
to be killed and take the necessary action.   </p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/parthokonar.wordpress.com/68/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/parthokonar.wordpress.com/68/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/parthokonar.wordpress.com/68/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/parthokonar.wordpress.com/68/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/parthokonar.wordpress.com/68/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/parthokonar.wordpress.com/68/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/parthokonar.wordpress.com/68/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/parthokonar.wordpress.com/68/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/parthokonar.wordpress.com/68/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/parthokonar.wordpress.com/68/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/parthokonar.wordpress.com/68/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/parthokonar.wordpress.com/68/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/parthokonar.wordpress.com/68/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/parthokonar.wordpress.com/68/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=parthokonar.wordpress.com&amp;blog=8245597&amp;post=68&amp;subd=parthokonar&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://parthokonar.wordpress.com/2009/08/31/blocking-transaction/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/59d21fd4e6034dd828027d060fc33408?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">parthokonar</media:title>
		</media:content>
	</item>
		<item>
		<title>How to remove a parameter from spfile</title>
		<link>http://parthokonar.wordpress.com/2009/08/26/how-to-remove-a-parameter-from-spfile/</link>
		<comments>http://parthokonar.wordpress.com/2009/08/26/how-to-remove-a-parameter-from-spfile/#comments</comments>
		<pubDate>Wed, 26 Aug 2009 20:44:48 +0000</pubDate>
		<dc:creator>parthokonar</dc:creator>
				<category><![CDATA[Oracle]]></category>
		<category><![CDATA[How to remove a parameter from spfile]]></category>
		<category><![CDATA[remove a parameter from spfile]]></category>

		<guid isPermaLink="false">http://parthokonar.wordpress.com/2009/08/26/how-to-remove-a-parameter-from-spfile/</guid>
		<description><![CDATA[How to remove a parameter from spfile This feature is available in Oracle 9 and Oracle 10. To remove a parameter from spfile and reset it to default value run the following command: alter system reset &#8220;log_archive_start&#8221; scope=spfile sid=&#8217;*'; Take note that you must supply the SID= option to the ALTER SYSTEM command. And if [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=parthokonar.wordpress.com&amp;blog=8245597&amp;post=66&amp;subd=parthokonar&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>How to remove a parameter from spfile</p>
<p>This feature is available in Oracle 9 and Oracle 10. To remove a parameter from spfile and<br />
reset it to default value run the following command:</p>
<p>alter system reset &#8220;log_archive_start&#8221; scope=spfile sid=&#8217;*';</p>
<p>Take note that you must supply the SID= option to the ALTER SYSTEM command. </p>
<p>And if it is a pfile we just need to remove that line.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/parthokonar.wordpress.com/66/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/parthokonar.wordpress.com/66/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/parthokonar.wordpress.com/66/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/parthokonar.wordpress.com/66/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/parthokonar.wordpress.com/66/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/parthokonar.wordpress.com/66/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/parthokonar.wordpress.com/66/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/parthokonar.wordpress.com/66/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/parthokonar.wordpress.com/66/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/parthokonar.wordpress.com/66/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/parthokonar.wordpress.com/66/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/parthokonar.wordpress.com/66/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/parthokonar.wordpress.com/66/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/parthokonar.wordpress.com/66/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=parthokonar.wordpress.com&amp;blog=8245597&amp;post=66&amp;subd=parthokonar&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://parthokonar.wordpress.com/2009/08/26/how-to-remove-a-parameter-from-spfile/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/59d21fd4e6034dd828027d060fc33408?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">parthokonar</media:title>
		</media:content>
	</item>
	</channel>
</rss>
