<?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>TechCorner &#187; database</title>
	<atom:link href="http://www.benh.org/techblog/category/database/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.benh.org/techblog</link>
	<description>web 2.0, tools, software reviews, tweaks and latest technology</description>
	<lastBuildDate>Sun, 02 Nov 2008 12:55:07 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>How to find free/used temporary table space in Oracle</title>
		<link>http://www.benh.org/techblog/2006/07/find-out-usedfree-space-in-a-temporary-tablespace/</link>
		<comments>http://www.benh.org/techblog/2006/07/find-out-usedfree-space-in-a-temporary-tablespace/#comments</comments>
		<pubDate>Sat, 29 Jul 2006 04:21:00 +0000</pubDate>
		<dc:creator>benedict herold</dc:creator>
				<category><![CDATA[database]]></category>
		<category><![CDATA[dba]]></category>
		<category><![CDATA[oracle]]></category>
		<category><![CDATA[sql]]></category>

		<guid isPermaLink="false">http://www.benh.org/techie/2006/07/how-do-i-find-usedfree-space-in-a-temporary-tablespace-in-oracle/</guid>
		<description><![CDATA[
			
				
			
		



If you&#8217;re a freak who work around with Oracle as backend, you would face the sitution where the oracle temporary space would be exhausted.
The usage temporary tablespace can&#8217;t be found out exactly using DBA_FREE_SPACE. To find out the true value of temporary table space we may need to use V$TEMP_SPACE_HEADER data dictonary.
SELECT tablespace_name, SUM(bytes_used), SUM(bytes_free)
FROM [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.benh.org%2Ftechblog%2F2006%2F07%2Ffind-out-usedfree-space-in-a-temporary-tablespace%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.benh.org%2Ftechblog%2F2006%2F07%2Ffind-out-usedfree-space-in-a-temporary-tablespace%2F&amp;source=BenedictHerold&amp;style=normal&amp;service=bit.ly" height="61" width="50" /><br />
			</a>
		</div>
<p><script type="text/javascript"><!--
google_ad_client = "pub-6794173585297574";
//TechCornerWP-Post
google_ad_slot = "5914478042";
google_ad_width = 336;
google_ad_height = 280;
//--></script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script><br />
If you&#8217;re a freak who work around with Oracle as backend, you would face the sitution where the oracle temporary space would be exhausted.</p>
<p>The usage temporary tablespace can&#8217;t be found out exactly using DBA_FREE_SPACE. To find out the true value of temporary table space we may need to use V$TEMP_SPACE_HEADER data dictonary.</p>
<p><code>SELECT tablespace_name, SUM(bytes_used), SUM(bytes_free)<br />
FROM   V$temp_space_header<br />
GROUP  BY tablespace_name;<br />
</code></p>
<p><span id="more-1"></span></p>
<p>If you&#8217;re looking out to find out the usage of other table space we need to use the following script.<br />
<code><br />
CLEAR<br />
SET HEAD ON<br />
SET VERIFY OFF<br />
spool file<br />
col tspace form a25 Heading "Tablespace"<br />
col tot_ts_size form 99999999999999 Heading "Size (Mb)"<br />
col free_ts_size form 99999999999999 Heading "Free (Mb)"<br />
col ts_pct form 9999 Heading "% Free"<br />
col ts_pct1 form 9999 Heading "% Used"<br />
break on report<br />
compute sum of free_ts_size on report<br />
compute sum of tot_ts_size on report<br />
SELECT /* + RULE */<br />
df.tablespace_name tspace,<br />
df.bytes / (1024 * 1024) tot_ts_size,<br />
SUM(fs.bytes) / (1024 * 1024) free_ts_size,<br />
nvl(round(SUM(fs.bytes) * 100 / df.bytes),<br />
1) ts_pct,<br />
round((df.bytes - SUM(fs.bytes)) * 100 / df.bytes) ts_pct1<br />
FROM dba_free_space fs,<br />
(SELECT tablespace_name,<br />
SUM(bytes) bytes<br />
FROM dba_data_files<br />
GROUP BY tablespace_name) df<br />
WHERE fs.tablespace_name(+) = df.tablespace_name<br />
GROUP BY df.tablespace_name,<br />
df.bytes<br />
UNION ALL<br />
SELECT /* + RULE */<br />
df.tablespace_name tspace,<br />
fs.bytes / (1024 * 1024) tot_ts_size,<br />
SUM(df.bytes_free) / (1024 * 1024) free_ts_size,<br />
nvl(round((SUM(fs.bytes) - df.bytes_used) * 100 / fs.bytes),<br />
1) ts_pct,<br />
round((SUM(fs.BYTES) - df.BYTES_free) * 100 / fs.bytes) ts_pct1<br />
FROM dba_temp_files fs,<br />
(SELECT tablespace_name,<br />
bytes_free,<br />
bytes_used<br />
FROM V$temp_space_header<br />
GROUP BY tablespace_name,<br />
bytes_free,<br />
bytes_used) df<br />
WHERE fs.tablespace_name(+) = df.tablespace_name<br />
GROUP BY df.tablespace_name,<br />
fs.bytes,<br />
df.bytes_free,<br />
df.BYTES_used<br />
ORDER BY 4 DESC<br />
/<br />
spool off<br />
</code></p>
<p>To find the size of table different technique has to be used.</p>
<img src="http://www.benh.org/techblog/?ak_action=api_record_view&id=1&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.benh.org/techblog/2006/07/find-out-usedfree-space-in-a-temporary-tablespace/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Finding locked objects in Oracle</title>
		<link>http://www.benh.org/techblog/2006/07/finding-locked-objects-in-oracle/</link>
		<comments>http://www.benh.org/techblog/2006/07/finding-locked-objects-in-oracle/#comments</comments>
		<pubDate>Wed, 26 Jul 2006 12:21:00 +0000</pubDate>
		<dc:creator>benedict herold</dc:creator>
				<category><![CDATA[database]]></category>
		<category><![CDATA[dba]]></category>
		<category><![CDATA[oracle]]></category>
		<category><![CDATA[sql]]></category>

		<guid isPermaLink="false">http://www.benh.org/techie/2006/07/finding-locked-objects-in-oracle/</guid>
		<description><![CDATA[
			
				
			
		



if you&#8217;re wondering why particular query or procedure is talking a long such a long time to run; then make sure you check out whether the object you&#8217;re accessing is locked or not.
there are quite a few dba views available to make our task less complicated. you can use the below query which will return [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.benh.org%2Ftechblog%2F2006%2F07%2Ffinding-locked-objects-in-oracle%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.benh.org%2Ftechblog%2F2006%2F07%2Ffinding-locked-objects-in-oracle%2F&amp;source=BenedictHerold&amp;style=normal&amp;service=bit.ly" height="61" width="50" /><br />
			</a>
		</div>
<p><script type="text/javascript"><!--
google_ad_client = "pub-6794173585297574";
//TechCornerWP-Post
google_ad_slot = "5914478042";
google_ad_width = 336;
google_ad_height = 280;
//--></script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script><br />
<span style="font-size: 85%"><span style="font-family: verdana">if you&#8217;re wondering why particular query or procedure is talking a long such a long time to run; then make sure you check out whether the object you&#8217;re accessing is locked or not.</span></span></p>
<p><span style="font-family: verdana">there are quite a few dba views available to make our task less complicated. you can use the below query which will return you the list of locked objects.</span><br />
<span style="font-family: courier new; font-size: 100%"><br />
</span><code>SELECT<br />
c.owner,<br />
c.object_name,<br />
c.object_type,<br />
b.sid,<br />
b.serial#,<br />
b.status,<br />
b.osuser,<br />
b.machine<br />
FROM<br />
v$locked_object a ,<br />
v$session b,<br />
dba_objects c<br />
WHERE<br />
b.sid = a.session_id<br />
AND<br />
a.object_id = c.object_id;</code></p>
<p><span style="font-size: 85%"><span style="font-family: verdana">you can now decide whether to kill the job/ process or someother roundaway to remove the lock obtained on the particular object.</span></span></p>
<img src="http://www.benh.org/techblog/?ak_action=api_record_view&id=5&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.benh.org/techblog/2006/07/finding-locked-objects-in-oracle/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Oracle server uptime</title>
		<link>http://www.benh.org/techblog/2006/07/oracle-server-uptime/</link>
		<comments>http://www.benh.org/techblog/2006/07/oracle-server-uptime/#comments</comments>
		<pubDate>Sun, 23 Jul 2006 04:33:00 +0000</pubDate>
		<dc:creator>benedict herold</dc:creator>
				<category><![CDATA[database]]></category>
		<category><![CDATA[oracle]]></category>
		<category><![CDATA[sql]]></category>
		<category><![CDATA[uptime]]></category>

		<guid isPermaLink="false">http://www.benh.org/techie/2006/07/how-to-find-the-uptime-of-the-oracle-database/</guid>
		<description><![CDATA[
			
				
			
		

The following query works well with Oracle 9i. i&#8217;ve no clue whether this works with others too or not.

SELECT to_char(startup_time,'DD-MON-YYYY HH24:MI:SS') "DB Startup Time"
FROM   sys.v_$instance;

even there is possiblity to find the startup time by quering logon_time from sys.v_$session view.

]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.benh.org%2Ftechblog%2F2006%2F07%2Foracle-server-uptime%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.benh.org%2Ftechblog%2F2006%2F07%2Foracle-server-uptime%2F&amp;source=BenedictHerold&amp;style=normal&amp;service=bit.ly" height="61" width="50" /><br />
			</a>
		</div>
<p><!--adsense#ads--><br />
<span style="font-size: 85%"><span style="font-family: verdana">The following query works well with Oracle 9i. i&#8217;ve no clue whether this works with others too or not.</span></span><br />
<code><br />
SELECT to_char(startup_time,'DD-MON-YYYY HH24:MI:SS') "DB Startup Time"<br />
FROM   sys.v_$instance;<br />
</code><br />
<span style="font-size: 85%"><span style="font-family: verdana">even there is possiblity to find the startup time by quering logon_time from sys.v_$session view.<br />
</span></span></p>
<img src="http://www.benh.org/techblog/?ak_action=api_record_view&id=2&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.benh.org/techblog/2006/07/oracle-server-uptime/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Oracle Hidden Parameters</title>
		<link>http://www.benh.org/techblog/2006/07/oracle-hidden-parameters/</link>
		<comments>http://www.benh.org/techblog/2006/07/oracle-hidden-parameters/#comments</comments>
		<pubDate>Wed, 19 Jul 2006 04:57:00 +0000</pubDate>
		<dc:creator>benedict herold</dc:creator>
				<category><![CDATA[database]]></category>
		<category><![CDATA[dba]]></category>
		<category><![CDATA[oracle]]></category>

		<guid isPermaLink="false">http://www.benh.org/techie/2006/07/how-to-get-the-list-of-all-hidden-oracle-parameters/</guid>
		<description><![CDATA[
			
				
			
		

Oracle initialization or INIT.ORA parameters with an underscore in front are hidden or unsupported parameters.  One can get a list of all hidden parameters by executing this query:

select *
from   SYS.X$KSPPI
where  substr(KSPPINM,1,1) = '_';
The following query displays parameter names with their current value:

select a.ksppinm  "Parameter", b.ksppstvl "Session Value", c.ksppstvl "Instance Value"
from [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.benh.org%2Ftechblog%2F2006%2F07%2Foracle-hidden-parameters%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.benh.org%2Ftechblog%2F2006%2F07%2Foracle-hidden-parameters%2F&amp;source=BenedictHerold&amp;style=normal&amp;service=bit.ly" height="61" width="50" /><br />
			</a>
		</div>
<p><!--adsense#ads--></p>
<p style="font-family: verdana"><span style="font-size: 85%">Oracle initialization or INIT.ORA parameters with an underscore in front are hidden or unsupported parameters.  One can get a list of all hidden parameters by executing this query:</span><br />
<code><br />
select *<br />
from   SYS.X$KSPPI<br />
where  substr(KSPPINM,1,1) = '_';</code></p>
<p style="font-family: verdana"><span style="font-size: 85%">The following query displays parameter names with their current value:</span><br />
<code><br />
select a.ksppinm  "Parameter", b.ksppstvl "Session Value", c.ksppstvl "Instance Value"<br />
from x$ksppi a, x$ksppcv b, x$ksppsv c<br />
where a.indx = b.indx and a.indx = c.indx<br />
and substr(ksppinm,1,1)='_'<br />
order by a.ksppinm;</code><span id="more-4"></span></p>
<p style="font-family: verdana"><span style="font-weight: bold; font-size: 85%">Remember:</span><span style="font-size: 85%"> Thou shall not play with undocumented parameters! Using undocumented parameters without the consent of Oracle Support will make your database &#8220;un-supported&#8221;. You will be on your own if the parameters you&#8217;ve set cause problems or data corruption. </span></p>
<img src="http://www.benh.org/techblog/?ak_action=api_record_view&id=4&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.benh.org/techblog/2006/07/oracle-hidden-parameters/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Rename Oracle database username</title>
		<link>http://www.benh.org/techblog/2006/07/rename-oracle-database-username/</link>
		<comments>http://www.benh.org/techblog/2006/07/rename-oracle-database-username/#comments</comments>
		<pubDate>Wed, 19 Jul 2006 04:44:00 +0000</pubDate>
		<dc:creator>benedict herold</dc:creator>
				<category><![CDATA[database]]></category>
		<category><![CDATA[dba]]></category>
		<category><![CDATA[oracle]]></category>

		<guid isPermaLink="false">http://www.benh.org/techie/2006/07/is-it-possible-to-rename-a-database-user-schema/</guid>
		<description><![CDATA[
			
				
			
		

No, this is not available till now  in Oracle &#38; been noted down as a enhancement request.
Still here is a workaround way of doing that:

Do a user-level export of user A
create new user B
import system/manager from user=A to user=B
drop user A

]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.benh.org%2Ftechblog%2F2006%2F07%2Frename-oracle-database-username%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.benh.org%2Ftechblog%2F2006%2F07%2Frename-oracle-database-username%2F&amp;source=BenedictHerold&amp;style=normal&amp;service=bit.ly" height="61" width="50" /><br />
			</a>
		</div>
<p><!--adsense#ads--></p>
<p style="font-family: verdana"><span style="font-size: 85%">No, this is not available till now  in Oracle &amp; been noted down as a enhancement request.</span></p>
<p>Still here is a workaround way of doing that:</p>
<ol class="bb-list" style="list-style-type: circle; font-family: verdana">
<li><span style="font-size: 85%">Do a user-level export of user A</span></li>
<li><span style="font-size: 85%">create new user B</span></li>
<li><span style="font-size: 85%">import system/manager from user=A to user=B</span></li>
<li><span style="font-size: 85%">drop user A</span></li>
</ol>
<img src="http://www.benh.org/techblog/?ak_action=api_record_view&id=3&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.benh.org/techblog/2006/07/rename-oracle-database-username/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
