<?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>Vinod S R's Blog &#187; Oracle</title>
	<atom:link href="http://www.vinodsr.com/myblog/mytags/oracle/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.vinodsr.com/myblog</link>
	<description>think tech talk tek</description>
	<lastBuildDate>Fri, 20 Aug 2010 11:37:27 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>How to export sequences  using sql</title>
		<link>http://www.vinodsr.com/myblog/2009/05/how-to-export-sequences-using-sql/</link>
		<comments>http://www.vinodsr.com/myblog/2009/05/how-to-export-sequences-using-sql/#comments</comments>
		<pubDate>Thu, 14 May 2009 15:04:59 +0000</pubDate>
		<dc:creator>vinod</dc:creator>
				<category><![CDATA[Oracle]]></category>

		<guid isPermaLink="false">http://www.vinodsr.com/myblog/?p=18</guid>
		<description><![CDATA[Normally sequences are not exported if we give partial export. For such cases we can use sql to generate quries for sequence droping and creating select &#8216;drop sequence &#8216;&#124;&#124;sequence_name&#124;&#124;&#8217;;&#8217; from user_sequences where sequence_name like&#8217;SEQ_DB%&#8217;; select &#8216;create sequence &#8216;&#124;&#124;sequence_name&#124;&#124; &#8216; minvalue &#8216;&#124;&#124; MIN_VALUE &#124;&#124; &#8216; maxvalue &#8216;&#124;&#124; MAX_VALUE &#124;&#124; &#8216; start with &#8216;&#124;&#124;last_number&#124;&#124; &#8216; increment by [...]]]></description>
			<content:encoded><![CDATA[<p>Normally sequences are not exported if we give partial export.</p>
<p>For such cases we can use sql to generate quries for sequence droping and creating</p>
<blockquote><p>select &#8216;drop sequence &#8216;||sequence_name||&#8217;;&#8217; from user_sequences where sequence_name like&#8217;SEQ_DB%&#8217;;</p>
<p>select &#8216;create sequence &#8216;||sequence_name||<br />
&#8216; minvalue &#8216;|| MIN_VALUE ||<br />
&#8216; maxvalue &#8216;|| MAX_VALUE ||<br />
&#8216; start with &#8216;||last_number||<br />
&#8216; increment by &#8216;|| INCREMENT_BY ||<br />
&#8216; cache &#8216;||CACHE_SIZE ||<br />
decode(ORDER_FLAG,&#8217;Y',&#8217; order &#8216;)||<br />
decode(CYCLE_FLAG,&#8217;Y',&#8217; cycle &#8216;)||<br />
&#8216;;&#8217;</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://www.vinodsr.com/myblog/2009/05/how-to-export-sequences-using-sql/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>How to track queries in oracle ..</title>
		<link>http://www.vinodsr.com/myblog/2009/05/how-to-track-queries-in-oracle/</link>
		<comments>http://www.vinodsr.com/myblog/2009/05/how-to-track-queries-in-oracle/#comments</comments>
		<pubDate>Thu, 14 May 2009 15:00:19 +0000</pubDate>
		<dc:creator>vinod</dc:creator>
				<category><![CDATA[Oracle]]></category>

		<guid isPermaLink="false">http://www.vinodsr.com/myblog/?p=11</guid>
		<description><![CDATA[In Oracle there is a easy way to track the current queries processed by the database. Suppose you want to track the Insert queries in your DB . then for that use this query select substr(sql_text,instr(sql_text,&#8217;INTO &#8220;&#8216;),30) table_name, rows_processed, round((sysdate-to_date(first_load_time,&#8217;yyyy-mm-dd hh24:mi:ss&#8217;))*24*60,1) minutes, trunc(rows_processed/((sysdate-to_date(first_load_time,&#8217;yyyy-mm-dd hh24:mi:ss&#8217;))*24*60)) rows_per_min from   sys.v_$sqlarea where  sql_text like &#8216;INSERT %INTO &#8220;%&#8216; and  command_type [...]]]></description>
			<content:encoded><![CDATA[<p>In Oracle there is a easy way to track the current queries processed by the database.</p>
<p>Suppose you want to track the Insert queries in your DB .</p>
<p>then for that use this query</p>
<blockquote>
<p style="text-align: left;">select substr(sql_text,instr(sql_text,&#8217;INTO &#8220;&#8216;),30) table_name,<br />
rows_processed,<br />
round((sysdate-to_date(first_load_time,&#8217;yyyy-mm-dd hh24:mi:ss&#8217;))*24*60,1) minutes,<br />
trunc(rows_processed/((sysdate-to_date(first_load_time,&#8217;yyyy-mm-dd hh24:mi:ss&#8217;))*24*60)) rows_per_min<br />
from   sys.v_$sqlarea<br />
where  sql_text like &#8216;<span style="color: #0000ff;"><strong>INSERT %INTO &#8220;%</strong></span>&#8216;<br />
and  command_type = 2<br />
and  open_versions &gt; 0;</p></blockquote>
<p style="text-align: left;">Replace the text in blue color (&#8216;<span style="color: #0000ff;"><strong>INSERT %INTO &#8220;%</strong></span>&#8216;) According to your purpose</p>
]]></content:encoded>
			<wfw:commentRss>http://www.vinodsr.com/myblog/2009/05/how-to-track-queries-in-oracle/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>How to Get the Locked Tables List In Oracle</title>
		<link>http://www.vinodsr.com/myblog/2009/05/how-to-get-the-locked-tables-list-in-oracle/</link>
		<comments>http://www.vinodsr.com/myblog/2009/05/how-to-get-the-locked-tables-list-in-oracle/#comments</comments>
		<pubDate>Thu, 14 May 2009 14:57:07 +0000</pubDate>
		<dc:creator>vinod</dc:creator>
				<category><![CDATA[Oracle]]></category>

		<guid isPermaLink="false">http://www.vinodsr.com/myblog/?p=9</guid>
		<description><![CDATA[Here is the query to get the locked tables in oracle SELECT l.inst_id,SUBSTR(L.ORACLE_USERNAME,1,8) ORA_USER, SUBSTR(L.SESSION_ID,1,3) SID, S.serial#, SUBSTR(O.OWNER&#124;&#124;&#8217;.'&#124;&#124;O.OBJECT_NAME,1,40) OBJECT, P.SPID OS_PID, DECODE(L.LOCKED_MODE, 0,&#8217;NONE&#8217;, 1,&#8217;NULL&#8217;, 2,&#8217;ROW SHARE&#8217;, 3,&#8217;ROW EXCLUSIVE&#8217;, 4,&#8217;SHARE&#8217;, 5,&#8217;SHARE ROW EXCLUSIVE&#8217;, 6,&#8217;EXCLUSIVE&#8217;, NULL) LOCK_MODE FROM sys.GV_$LOCKED_OBJECT L, DBA_OBJECTS O, sys.GV_$SESSION S, sys.GV_$PROCESS P WHERE L.OBJECT_ID = O.OBJECT_ID and l.inst_id = s.inst_id AND L.SESSION_ID = [...]]]></description>
			<content:encoded><![CDATA[<p>Here is the query to get the locked tables in oracle</p>
<blockquote><p>SELECT l.inst_id,SUBSTR(L.ORACLE_USERNAME,1,8) ORA_USER, SUBSTR(L.SESSION_ID,1,3) SID,<br />
S.serial#,<br />
SUBSTR(O.OWNER||&#8217;.'||O.OBJECT_NAME,1,40) OBJECT, P.SPID OS_PID,<br />
DECODE(L.LOCKED_MODE, 0,&#8217;NONE&#8217;,<br />
1,&#8217;NULL&#8217;,<br />
2,&#8217;ROW SHARE&#8217;,<br />
3,&#8217;ROW EXCLUSIVE&#8217;,<br />
4,&#8217;SHARE&#8217;,<br />
5,&#8217;SHARE ROW EXCLUSIVE&#8217;,<br />
6,&#8217;EXCLUSIVE&#8217;,<br />
NULL) LOCK_MODE<br />
FROM sys.GV_$LOCKED_OBJECT L, DBA_OBJECTS O, sys.GV_$SESSION S, sys.GV_$PROCESS P<br />
WHERE L.OBJECT_ID = O.OBJECT_ID<br />
and l.inst_id = s.inst_id<br />
AND L.SESSION_ID = S.SID<br />
and s.inst_id = p.inst_id<br />
AND S.PADDR = P.ADDR(+)<br />
order by l.inst_id  ;</p></blockquote>
<p><span style="text-decoration: underline;">And to get the details of a particular session given by the sid in the above query use this query </span></p>
<blockquote><p>select STATUS ,  PROCESS , PROGRAM , LOGON_TIME  from v$session where sid=&lt;SID&gt;</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://www.vinodsr.com/myblog/2009/05/how-to-get-the-locked-tables-list-in-oracle/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>How to get the TableSpace usage in Oracle</title>
		<link>http://www.vinodsr.com/myblog/2009/05/how-to-get-the-tablespace-usage-in-oracle/</link>
		<comments>http://www.vinodsr.com/myblog/2009/05/how-to-get-the-tablespace-usage-in-oracle/#comments</comments>
		<pubDate>Thu, 14 May 2009 14:54:08 +0000</pubDate>
		<dc:creator>vinod</dc:creator>
				<category><![CDATA[Oracle]]></category>

		<guid isPermaLink="false">http://www.vinodsr.com/myblog/?p=6</guid>
		<description><![CDATA[Table Space Usage in Oracle]]></description>
			<content:encoded><![CDATA[<p>To get the table space usage in oracle use this query</p>
<blockquote><p>select    a.TABLESPACE_NAME,<br />
ROUND(a.BYTES/1024000) &#8220;Used (MB)&#8221;,<br />
ROUND(b.BYTES/1024000) &#8220;Free (MB)&#8221;,<br />
round(((a.BYTES-b.BYTES)/a.BYTES)*100,2) &#8220;% USED&#8221;<br />
from<br />
(<br />
select  TABLESPACE_NAME,<br />
sum(BYTES) BYTES<br />
from    dba_data_files<br />
group   by TABLESPACE_NAME<br />
)<br />
a,<br />
(<br />
select  TABLESPACE_NAME,<br />
sum(BYTES) BYTES ,<br />
max(BYTES) largest<br />
from    dba_free_space<br />
group   by TABLESPACE_NAME<br />
)<br />
b<br />
where    a.TABLESPACE_NAME=b.TABLESPACE_NAME<br />
and a.TABLESPACE_NAME like &#8216;%&#8217;<br />
order      by ((a.BYTES-b.BYTES)/a.BYTES) desc ;</p></blockquote>
<p>If You want to list a particular table space  replace <em><strong> a.TABLESPACE_NAME like &#8216;%&#8217; </strong></em>with<strong> <em>a.TABLESPACE_NAME like &#8216;MY_TABLE_SPACE&#8217;</em></strong></p>
<p>To get the temporary tablespace usuage use this query</p>
<blockquote><p>SELECT tablespace_name, SUM(bytes_used), SUM(bytes_free)<br />
FROM V$temp_space_header<br />
GROUP BY tablespace_name;</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://www.vinodsr.com/myblog/2009/05/how-to-get-the-tablespace-usage-in-oracle/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
