<?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>TechnoBlogy &#187; Oracle</title>
	<atom:link href="http://technoblogy.net/category/db/oracle/feed/" rel="self" type="application/rss+xml" />
	<link>http://technoblogy.net</link>
	<description>Technology with a Big difference</description>
	<lastBuildDate>Mon, 05 Dec 2011 17:29:42 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Oracle database growth size</title>
		<link>http://technoblogy.net/oracle-database-growth-size/</link>
		<comments>http://technoblogy.net/oracle-database-growth-size/#comments</comments>
		<pubDate>Sun, 28 Nov 2010 14:32:15 +0000</pubDate>
		<dc:creator>Nauman</dc:creator>
				<category><![CDATA[Databases]]></category>
		<category><![CDATA[Oracle]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[growth]]></category>
		<category><![CDATA[monthly]]></category>
		<category><![CDATA[script]]></category>
		<category><![CDATA[size]]></category>

		<guid isPermaLink="false">http://technoblogy.net/oracle-database-growth-size/</guid>
		<description><![CDATA[How can we check the size of database growth? I needed to know this while generating a report for management regarding DB size.

Now here a little scri]]></description>
			<content:encoded><![CDATA[<p>How can we check the size of database growth? I needed to know this while generating a report for management regarding DB size.</p>
<p>Now here a little script that will retrieve the size of database monthly. For execution of this script you will need to have select privilege on <strong>sys.v_$datafile</strong> view. Following query will retrieve results based on months, however you can easily tweak this query for creation_time column to get any type of extracts.</p>
<p><strong>Script</strong></p>
<blockquote>
<pre>select to_char(creation_time, 'YYYY Month') "Month",
    sum(bytes)/1024/1024 "Growth in MB"
    from sys.v_$datafile
    where creation_time &gt; SYSDATE-365
    group by to_char(creation_time, 'YYYY Month');</pre>
</blockquote>
<p><strong>Result</strong></p>
<blockquote>
<pre>Month          Growth in MB
-------------- ------------
2010 December             2
2010 November            100</pre>
</blockquote>
]]></content:encoded>
			<wfw:commentRss>http://technoblogy.net/oracle-database-growth-size/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>ORA-00054: resource busy and acquire with NOWAIT specified</title>
		<link>http://technoblogy.net/ora-00054-resource-busy-and-acquire-with-nowait-specified/</link>
		<comments>http://technoblogy.net/ora-00054-resource-busy-and-acquire-with-nowait-specified/#comments</comments>
		<pubDate>Tue, 23 Nov 2010 15:13:40 +0000</pubDate>
		<dc:creator>Nauman</dc:creator>
				<category><![CDATA[Databases]]></category>
		<category><![CDATA[Oracle]]></category>
		<category><![CDATA[locked session]]></category>
		<category><![CDATA[nowait]]></category>
		<category><![CDATA[objects]]></category>
		<category><![CDATA[ORA-00054]]></category>
		<category><![CDATA[resource busy]]></category>

		<guid isPermaLink="false">http://technoblogy.net/ora-00054-resource-busy-and-acquire-with-nowait-specified/</guid>
		<description><![CDATA[A you are working on a busy database than you will often see this error.

Description

It means that your session is trying to update an ob]]></description>
			<content:encoded><![CDATA[<p>A you are working on a busy database than you will often see this error.</p>
<p><strong>Description</strong></p>
<p>It means that your session is trying to update an object that locked by another session. More specifically, your session has asked for a lock on the same object, but has specified the &#8216;nowait&#8217; clause. The nowait clause, upon finding something locked, returns an error, rather than waiting for the lock to be released.</p>
<p><strong>Solution</strong></p>
<ol>
<li>Run your script some other time, when database becomes idle or the object you want to update is lock free.</li>
<li>Kill the session that has the lock on the object.</li>
</ol>
<p>For killing locked sessions following is the link to post that explain it in detail:</p>
<p><a href="http://technoblogy.net/killing-locked-sessions-in-oracle/">http://technoblogy.net/killing-locked-sessions-in-oracle/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://technoblogy.net/ora-00054-resource-busy-and-acquire-with-nowait-specified/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Calculating difference of dates in Oracle</title>
		<link>http://technoblogy.net/calculating-difference-of-dates-in-oracle/</link>
		<comments>http://technoblogy.net/calculating-difference-of-dates-in-oracle/#comments</comments>
		<pubDate>Wed, 18 Nov 2009 16:28:37 +0000</pubDate>
		<dc:creator>Nauman</dc:creator>
				<category><![CDATA[Oracle]]></category>
		<category><![CDATA[date]]></category>
		<category><![CDATA[datediff]]></category>
		<category><![CDATA[difference]]></category>
		<category><![CDATA[subtraction]]></category>

		<guid isPermaLink="false">http://technoblogy.net/calculating-difference-of-dates-in-oracle/</guid>
		<description><![CDATA[How to calculate difference between two dates in oracle, as subtraction of dates returns numeric value as difference. With some slight changes/enhancements we can track back the subtraction values to some readable date formats: Here are some examples, these can also be amended for user convenience: SQL&#62; SELECT floor(((date1-date2)*24*60*60)/3600) 2 &#124;&#124; ' HOURS ' &#124;&#124; [...]]]></description>
			<content:encoded><![CDATA[<p>How to calculate difference between two dates in oracle, as subtraction of dates returns numeric value as difference. With some slight changes/enhancements we can track back the subtraction values to some readable date formats:</p>
<p>Here are some examples, these can also be amended for user convenience:</p>
<blockquote><pre>SQL&gt; SELECT floor(((date1-date2)*24*60*60)/3600)
  2         || ' HOURS ' ||
  3         floor((((date1-date2)*24*60*60) -
  4         floor(((date1-date2)*24*60*60)/3600)*3600)/60)
  5         || ' MINUTES ' ||
  6         round((((date1-date2)*24*60*60) -
  7         floor(((date1-date2)*24*60*60)/3600)*3600 -
  8         (floor((((date1-date2)*24*60*60) -
  9         floor(((date1-date2)*24*60*60)/3600)*3600)/60)*60) ))
 10         || ' SECS ' time_difference
 11    FROM dates;

TIME_DIFFERENCE
--------------------------------------------------------------------------------
24 HOURS 0 MINUTES 0 SECS
1 HOURS 0 MINUTES 0 SECS
0 HOURS 1 MINUTES 0 SECS</pre>
</blockquote>
<blockquote><pre>SQL&gt; SELECT to_number( to_char(to_date('1','J') +
  2         (date1 - date2), 'J') - 1)  days,
  3         to_char(to_date('00:00:00','HH24:MI:SS') +
  4         (date1 - date2), 'HH24:MI:SS') time
  5   FROM dates;

      DAYS TIME
---------- --------
         1 00:00:00
         0 01:00:00
         0 00:01:00</pre>
</blockquote>
<blockquote><pre>SQL&gt; select numtodsinterval(date1-date2,'day') time_difference from dates;

TIME_DIFFERENCE
----------------------------------------------------------------
+000000001 00:00:00.000000000
+000000000 01:00:00.000000000
+000000000 00:01:00.000000000</pre>
</blockquote>
<blockquote><pre>SQL&gt; SELECT floor((date1-date2)*24)
  2         || ' HOURS ' ||
  3         mod(floor((date1-date2)*24*60),60)
  5         || ' MINUTES ' ||
  6         mod(floor((date1-date2)*24*60*60),60)
 10         || ' SECS ' time_difference
 11    FROM dates;

TIME_DIFFERENCE
--------------------------------------------------------------------------------
24 HOURS 0 MINUTES 0 SECS
1 HOURS 0 MINUTES 0 SECS
0 HOURS 1 MINUTES 0 SECS</pre>
</blockquote>
<pre>&nbsp;</pre>
<blockquote></blockquote>
<pre>&nbsp;</pre>
]]></content:encoded>
			<wfw:commentRss>http://technoblogy.net/calculating-difference-of-dates-in-oracle/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ORA-38029 : object statistics are locked Recently</title>
		<link>http://technoblogy.net/ora-38029-object-statistics-are-locked-recently/</link>
		<comments>http://technoblogy.net/ora-38029-object-statistics-are-locked-recently/#comments</comments>
		<pubDate>Thu, 05 Nov 2009 13:43:04 +0000</pubDate>
		<dc:creator>Nauman</dc:creator>
				<category><![CDATA[Oracle]]></category>
		<category><![CDATA[dba_tab_statistics]]></category>
		<category><![CDATA[lock]]></category>
		<category><![CDATA[object statistics]]></category>
		<category><![CDATA[unlock]]></category>

		<guid isPermaLink="false">http://technoblogy.net/ora-38029-object-statistics-are-locked-recently/</guid>
		<description><![CDATA[This error comes when analyzing tables in oracle. Basic issue in this error is&#160; when you import table without data i.e structure/schema only, oracle will lock table statistics. You can view all the locked tables in schema by executing following query: select table_name, stattype_locked from dba_tab_statistics where owner = &#8216;MBS&#8217; and stattype_locked is not null; [...]]]></description>
			<content:encoded><![CDATA[<p>This error comes when analyzing tables in oracle. Basic issue in this error is&#160; when you import table without data i.e structure/schema only, oracle will lock table statistics.</p>
<p>You can view all the locked tables in schema by executing following query:</p>
<blockquote><p>select table_name, stattype_locked </p>
<p>from dba_tab_statistics </p>
<p>where owner = &#8216;MBS&#8217; and stattype_locked is not null;</p>
</blockquote>
<p>Then how to unlock them, following query will help us to sort this issue:</p>
<blockquote><p>select &#8216;exec DBMS_STATS.UNLOCK_TABLE_STATS (&#8221;&#8217;|| owner ||&#8221;&#8217;,&#8221;&#8217;|| table_name ||&#8221;&#8217;);&#8217; from dba_tab_statistics where owner = &#8216;MBS&#8217; and stattype_locked is not null;</p>
</blockquote>
<p>or you can do that for every single table:</p>
<blockquote><p>exec DBMS_STATS.UNLOCK_TABLE_STATS(&#8216;owner&#8217;,'table name&#8217;);</p>
</blockquote>
]]></content:encoded>
			<wfw:commentRss>http://technoblogy.net/ora-38029-object-statistics-are-locked-recently/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Creating Table dynamically in Oracle Procedure</title>
		<link>http://technoblogy.net/creating-table-dynamically-in-oracle-procedure/</link>
		<comments>http://technoblogy.net/creating-table-dynamically-in-oracle-procedure/#comments</comments>
		<pubDate>Thu, 05 Nov 2009 07:36:03 +0000</pubDate>
		<dc:creator>Nauman</dc:creator>
				<category><![CDATA[Oracle]]></category>
		<category><![CDATA[create table]]></category>
		<category><![CDATA[execute immediate]]></category>
		<category><![CDATA[procedure]]></category>

		<guid isPermaLink="false">http://technoblogy.net/creating-table-dynamically-in-oracle-procedure/</guid>
		<description><![CDATA[How can we create a table inside an Oracle procedure. &#34;CREATE TABLE tableName AS&#34;. We cannot execute this statement in procedures because upon creation of procedure it would give syntax error. We can implement this with the help of EXECUTE IMMEDIATE command and then dynamically create table. create or replace procedure Proc1 as begin execute [...]]]></description>
			<content:encoded><![CDATA[<p>How can we create a table inside an Oracle procedure.</p>
<p>&quot;CREATE TABLE <em>tableName</em> AS&quot;. We cannot execute this statement in procedures because upon creation of procedure it would give syntax error.</p>
<p>We can implement this with the help of EXECUTE IMMEDIATE command and then dynamically create table.</p>
<blockquote><p>create or replace procedure Proc1 as      <br />begin       <br />execute immediate &#8216;create table NewTable(column1 integer )&#8217;;       <br />end ;</p>
</blockquote>
]]></content:encoded>
			<wfw:commentRss>http://technoblogy.net/creating-table-dynamically-in-oracle-procedure/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Killing Locked Sessions in Oracle</title>
		<link>http://technoblogy.net/killing-locked-sessions-in-oracle/</link>
		<comments>http://technoblogy.net/killing-locked-sessions-in-oracle/#comments</comments>
		<pubDate>Thu, 05 Nov 2009 07:34:55 +0000</pubDate>
		<dc:creator>Nauman</dc:creator>
				<category><![CDATA[Oracle]]></category>
		<category><![CDATA[killing]]></category>
		<category><![CDATA[locked session]]></category>

		<guid isPermaLink="false">http://technoblogy.net/killing-locked-sessions-in-oracle/</guid>
		<description><![CDATA[Many a times user sessions are locked in some DML/DDL operation, than how to unlock those sessions because a new step or operation could not be done on the specific object that is locked. Some really easy steps to unlock an object or kill a session in oracle are as follows: To view locked sessions [...]]]></description>
			<content:encoded><![CDATA[<p>Many a times user sessions are locked in some DML/DDL operation, than how to unlock those sessions because a new step or operation could not be done on the specific object that is locked.</p>
<p>Some really easy steps to unlock an object or kill a session in oracle are as follows:</p>
<p>To view locked sessions in oracle:</p>
<blockquote><blockquote>
<p>select oracle_username,object_id,session_id from v$locked_object;</p>
<p>ORACLE_USERNAME OBJECT_ID SESSION_ID        <br />&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212; &#8212;&#8212;&#8212;- &#8212;&#8212;&#8212;-         <br />Lock_1 321876 130         <br />Lock_2 320431 130         <br />Lock_3 320429 130</p>
</blockquote>
</blockquote>
<p>Now checking the object that are locked, and that are not accessible:</p>
<blockquote><p>select object_name from dba_objects where object_id = 321876;      <br />OBJECT_NAME       <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;&#8211;       <br />Table_1</p>
</blockquote>
<p>Now you know which object is being locked and what is the object id whole session is to be killed.</p>
<p>First retrieve the serial# of object ID:</p>
<blockquote><p>select sid,serial# from v$session where sid=130;      <br />SID SERIAL#       <br />&#8212;&#8212;&#8212;- &#8212;&#8212;&#8212;-       <br />130 8655</p>
</blockquote>
<p>Now killing this session:</p>
<blockquote><p>alter system kill session &#8217;130,8655&#8242;;      <br />System altered.</p>
</blockquote>
<p>Now you can check by executing the first query again to see whether the locked session is still locked or not.</p>
]]></content:encoded>
			<wfw:commentRss>http://technoblogy.net/killing-locked-sessions-in-oracle/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Creating Custom Functions in Oracle</title>
		<link>http://technoblogy.net/creating-custom-functions-in-oracle/</link>
		<comments>http://technoblogy.net/creating-custom-functions-in-oracle/#comments</comments>
		<pubDate>Thu, 05 Nov 2009 07:34:15 +0000</pubDate>
		<dc:creator>Nauman</dc:creator>
				<category><![CDATA[Oracle]]></category>
		<category><![CDATA[custom]]></category>
		<category><![CDATA[function]]></category>
		<category><![CDATA[parameters]]></category>

		<guid isPermaLink="false">http://technoblogy.net/creating-custom-functions-in-oracle/</guid>
		<description><![CDATA[Here it is a simple procedure to create and call a custom function in Oracle. A custom function is a simple PL/SQL subprogram that is used to calculate a value. It creation syntax is almost same as of procedure except it has a RETURN clause that is used to return the computed value. Syntax of [...]]]></description>
			<content:encoded><![CDATA[<p>Here it is a simple procedure to create and call a custom function in Oracle. A custom function is a simple PL/SQL subprogram that is used to calculate a value. It creation syntax is almost same as of procedure except it has a RETURN clause that is used to return the computed value.</p>
<p>Syntax of creating a custom function:</p>
<blockquote><p>CREATE [OR REPLACE] FUNCTION function_name      <br />[ (parameter [,parameter]) ]       <br />RETURN return_datatype       <br />IS | AS       <br />[declaration_section]       <br />BEGIN       <br />executable_section       <br />[EXCEPTION       <br />exception_section]       <br />END [function_name];</p>
</blockquote>
<p>Custom functions may have zero or more parameters in place. There are three types of parameters that can be defined in a custom function.</p>
<ol>
<li><strong>IN:</strong> This parameter can be called from a procedure or a function. The value of this parameter cannot be overwritten by procedure or function. </li>
<li><strong>OUT:</strong> This parameter cannot be called from a procedure or function, but its value can be overwritten from them. </li>
<li><strong>IN OUT:</strong> It has both the properties of above type. As it can be called from procedure and functions and also can be overwritten by them. </li>
</ol>
<p>Some examples of creating and calling custom functions:</p>
<ul>
<li>Function without parameters. </li>
</ul>
<p><a href="http://technoblogy.net/wp-content/uploads/2009/11/FUNC1.jpg"><img title="FUNC1" style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="226" alt="FUNC1" src="http://technoblogy.net/wp-content/uploads/2009/11/FUNC1_thumb.jpg" width="349" border="0" /></a> </p>
<p>&#160;</p>
<p>&#160;</p>
<p>&#160;</p>
<p>&#160;</p>
<p>&#160;</p>
<p>&#160;</p>
<p>&#160;</p>
<p>&#160;</p>
<p>&#160;</p>
<p>Function with parameter.</p>
<p><a href="http://technoblogy.net/wp-content/uploads/2009/11/FUNC2.jpg"><img title="FUNC2" style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="223" alt="FUNC2" src="http://technoblogy.net/wp-content/uploads/2009/11/FUNC2_thumb.jpg" width="381" border="0" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://technoblogy.net/creating-custom-functions-in-oracle/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to check Numeric value in Oracle</title>
		<link>http://technoblogy.net/how-to-check-numeric-value-in-oracle/</link>
		<comments>http://technoblogy.net/how-to-check-numeric-value-in-oracle/#comments</comments>
		<pubDate>Thu, 05 Nov 2009 07:33:45 +0000</pubDate>
		<dc:creator>Nauman</dc:creator>
				<category><![CDATA[Oracle]]></category>
		<category><![CDATA[function]]></category>
		<category><![CDATA[numeric]]></category>

		<guid isPermaLink="false">http://technoblogy.net/how-to-check-numeric-value-in-oracle/</guid>
		<description><![CDATA[Currently i could not find any suitable function for checking numeric value on some column. There are many workarounds to achieve this functionality, either cast the column value in Numeric and check, but this can create an exception if not properly coded. Another workaround for this problem is by using the combination of LENGTH and [...]]]></description>
			<content:encoded><![CDATA[<p>Currently i could not find any suitable function for checking numeric value on some column. There are many workarounds to achieve this functionality, either cast the column value in Numeric and check, but this can create an exception if not properly coded.</p>
<p>Another workaround for this problem is by using the combination of LENGTH and TRANSLATE function:</p>
<blockquote><p>LENGTH(TRANSLATE( mystr , &#8217;0123456789A&#8217; , &#8216;A&#8217; ))</p>
</blockquote>
<p>if above function returns null that means &quot;mystr&quot; contains only numbers , but if it is not null then the field is not numeric.</p>
]]></content:encoded>
			<wfw:commentRss>http://technoblogy.net/how-to-check-numeric-value-in-oracle/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

