<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss xmlns:atom="http://www.w3.org/2005/Atom" xmlns:openSearch="http://a9.com/-/spec/opensearch/1.1/" xmlns:georss="http://www.georss.org/georss" xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr="http://purl.org/syndication/thread/1.0" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0"><channel><atom:id>tag:blogger.com,1999:blog-7668553736104330014</atom:id><lastBuildDate>Sun, 27 Nov 2011 23:24:29 +0000</lastBuildDate><category>Interview Questions</category><title>Oracle Dba's Area for DBA to share thier views</title><description>Oracle DBA's are invited and Share their Knowledge. This site is all about Oracle and Oracle Dba's Theory. All DBA's are invited to share their knowledge. And this sites contains useful topics related to oracle tools.</description><link>http://oracledbarea.blogspot.com/</link><managingEditor>noreply@blogger.com (Jafar Ali)</managingEditor><generator>Blogger</generator><openSearch:totalResults>15</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/OracleDbasArea" /><feedburner:info uri="oracledbasarea" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7668553736104330014.post-6321146774033155339</guid><pubDate>Sun, 24 Aug 2008 13:05:00 +0000</pubDate><atom:updated>2008-08-24T18:38:39.115+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">Interview Questions</category><title>Interview Questions IV</title><description>&lt;p&gt;&lt;b style=""&gt;&lt;span style="font-size: 14pt;"&gt;Differentiate between TRUNCATE and DELETE&lt;span class="tdvamseel"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;    &lt;p&gt;&lt;span style="font-size: 14pt;"&gt;&lt;span style=""&gt; &lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;table class="MsoNormalTable" style="width: 361.65pt;" border="1" cellpadding="0" cellspacing="1" width="482"&gt;  &lt;tbody&gt;&lt;tr style=""&gt;   &lt;td style="padding: 0.75pt;"&gt;   &lt;p style="text-align: center;" align="center"&gt;&lt;strong&gt;&lt;span style="font-size: 14pt;"&gt;RUNCATE&lt;/span&gt;&lt;/strong&gt;&lt;span style="font-size: 14pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0.75pt;"&gt;   &lt;p style="text-align: center;" align="center"&gt;&lt;strong&gt;&lt;span style="font-size: 14pt;"&gt;DELETE&lt;/span&gt;&lt;/strong&gt;&lt;span style="font-size: 14pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr style=""&gt;   &lt;td style="padding: 0.75pt;"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 14pt;"&gt;It is a DDL statement&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0.75pt;"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 14pt;"&gt;It is a DML statement&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr style=""&gt;   &lt;td style="padding: 0.75pt;"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 14pt;"&gt;It is a one way trip,   cannot ROLLBACK&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0.75pt;"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 14pt;"&gt;We can Rollback&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr style=""&gt;   &lt;td style="padding: 0.75pt;"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 14pt;"&gt;Doesn't have selective   features (where clause)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0.75pt;"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 14pt;"&gt;Has&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr style=""&gt;   &lt;td style="padding: 0.75pt;"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 14pt;"&gt;Doesn't fire &lt;a href="http://www.geekinterview.com/question_details/2538" target="_new"&gt;&lt;span class="klink"&gt;&lt;span style="font-family: &amp;quot;Tahoma&amp;quot;,&amp;quot;sans-serif&amp;quot;; color: green;"&gt;database&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;   triggers&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0.75pt;"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 14pt;"&gt;Does&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr style=""&gt;   &lt;td style="padding: 0.75pt;"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 14pt;"&gt;It requires disabling of   referential constraints.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0.75pt;"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 14pt;"&gt;Does not require&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 14pt;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;b style=""&gt;&lt;span style="font-size: 14pt;"&gt;Display the number value in Words?&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;    &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 14pt;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;br /&gt;SQL&gt; select sal, (to_char(to_date(sal,'j'), 'jsp'))&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 14pt;"&gt;from emp;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 14pt;"&gt;the output like,&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 14pt;"&gt;SAL (TO_CHAR(TO_DATE(SAL,'J'),'JSP'))&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 14pt;"&gt;--------- -----------------------------------------------------&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 14pt;"&gt;800 eight hundred&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 14pt;"&gt;1600 one thousand six hundred&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 14pt;"&gt;1250 one thousand two hundred fifty&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 14pt;"&gt;If you want to add some text like, Rs. Three Thousand only.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 14pt;"&gt;SQL&gt; select sal "&lt;a href="http://www.geekinterview.com/question_details/2508" target="_new"&gt;&lt;span class="klink"&gt;&lt;span style="font-family: &amp;quot;Tahoma&amp;quot;,&amp;quot;sans-serif&amp;quot;; color: green;"&gt;Salary&lt;/span&gt;&lt;/span&gt;&lt;/a&gt; ",&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 14pt;"&gt;(' Rs. '|| (to_char(to_date(sal,'j'), 'Jsp'))|| ' only.'))&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 14pt;"&gt;"Sal in Words" from emp&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 14pt;"&gt;/&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 14pt;"&gt;Salary Sal in Words&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 14pt;"&gt;------- ------------------------------------------------------&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 14pt;"&gt;800 Rs. Eight Hundred only.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 14pt;"&gt;1600 Rs. One Thousand Six Hundred only.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 14pt;"&gt;1250 Rs. One Thousand Two Hundred Fifty only.&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;br /&gt;&lt;span style="font-size: 14pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;b&gt;&lt;span style="font-size: 14pt;"&gt;How to get the 25th row of a table&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;&lt;span class="tdvamseel"&gt;&lt;span style="font-size: 14pt;"&gt;select * from emp where rowid=(select max(rowid) from emp where rownum&lt;26)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span class="tdvamseel"&gt;&lt;span style="font-size: 14pt;"&gt;OR&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-size: 14pt; color: rgb(0, 0, 240);"&gt;elect&lt;/span&gt;&lt;span style="font-size: 14pt;"&gt; &lt;span style="color: rgb(0, 0, 240);"&gt;*&lt;/span&gt; &lt;span style="color: rgb(0, 0, 240);"&gt;from&lt;/span&gt; Emp &lt;span style="color: rgb(0, 0, 240);"&gt;where&lt;/span&gt; &lt;span style="color: rgb(0, 0, 240);"&gt;rownum&lt;/span&gt; &lt;span style="color: rgb(0, 0, 240);"&gt;&lt;&lt;/span&gt; &lt;span style="color: maroon;"&gt;26&lt;/span&gt; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-size: 14pt; color: rgb(0, 0, 240);"&gt;minus&lt;/span&gt;&lt;span style="font-size: 14pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-size: 14pt; color: rgb(0, 0, 240);"&gt;select&lt;/span&gt;&lt;span style="font-size: 14pt;"&gt; &lt;span style="color: rgb(0, 0, 240);"&gt;*&lt;/span&gt; &lt;span style="color: rgb(0, 0, 240);"&gt;from&lt;/span&gt; Emp &lt;span style="color: rgb(0, 0, 240);"&gt;where&lt;/span&gt; &lt;span style="color: rgb(0, 0, 240);"&gt;rownum&lt;&lt;/span&gt;&lt;span style="color: maroon;"&gt;25&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span class="tdvamseel"&gt;&lt;b style=""&gt;&lt;span style="font-size: 14pt;"&gt;Why equality condition does'nt work with rownum, i'm giving my explanation here&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;span style="font-size: 14pt;"&gt;?&lt;br /&gt;&lt;br /&gt;&lt;span class="tdvamseel"&gt;the query &lt;/span&gt;&lt;br /&gt;&lt;span class="tdvamseel"&gt;select * from emp where rownum=25;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="tdvamseel"&gt;it fetches first record makes it rownum 1 as it does'nt match the where criteria, the record discarded&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="tdvamseel"&gt;it fetches 2nd record makes it rownum 1 again&lt;/span&gt;&lt;br /&gt;&lt;span class="tdvamseel"&gt;that is why rownum=x does'nt work&lt;/span&gt;&lt;br /&gt; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;b style=""&gt;&lt;span style="font-size: 14pt;"&gt;How do we display the column values of a table? &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;    &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 14pt;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size: 14pt; color: rgb(0, 0, 240);"&gt;&lt;span style=""&gt; &lt;/span&gt;DECLARE&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-size: 14pt; color: rgb(0, 0, 240);"&gt;CURSOR&lt;/span&gt;&lt;span style="font-size: 14pt;"&gt; cr_data&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-size: 14pt; color: rgb(0, 0, 240);"&gt;IS&lt;/span&gt;&lt;span style="font-size: 14pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-size: 14pt; color: rgb(0, 0, 240);"&gt;SELECT&lt;/span&gt;&lt;span style="font-size: 14pt;"&gt; &lt;span style="color: red;"&gt;ROWID&lt;/span&gt;&lt;span style="color: rgb(0, 0, 240);"&gt;,&lt;/span&gt; a&lt;span style="color: rgb(0, 0, 240);"&gt;.*&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-size: 14pt; color: rgb(0, 0, 240);"&gt;FROM&lt;/span&gt;&lt;span style="font-size: 14pt;"&gt; fnd_user a &lt;span style="color: rgb(0, 0, 240);"&gt;where&lt;/span&gt; &lt;span style="color: rgb(0, 0, 240);"&gt;rownum&lt;/span&gt; &lt;span style="color: rgb(0, 0, 240);"&gt;&lt;&lt;/span&gt; &lt;span style="color: maroon;"&gt;10&lt;/span&gt;&lt;span style="color: rgb(0, 0, 240);"&gt;;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-size: 14pt; color: black;"&gt;l_table_name &lt;/span&gt;&lt;span style="font-size: 14pt; color: red;"&gt;VARCHAR2&lt;/span&gt;&lt;span style="font-size: 14pt; color: rgb(0, 0, 240);"&gt;(&lt;/span&gt;&lt;span style="font-size: 14pt; color: maroon;"&gt;2000&lt;/span&gt;&lt;span style="font-size: 14pt; color: rgb(0, 0, 240);"&gt;)&lt;/span&gt;&lt;span style="font-size: 14pt; color: black;"&gt; &lt;/span&gt;&lt;span style="font-size: 14pt; color: rgb(0, 0, 240);"&gt;:=&lt;/span&gt;&lt;span style="font-size: 14pt; color: black;"&gt; &lt;/span&gt;&lt;span style="font-size: 14pt; color: red;"&gt;'FND_USER'&lt;/span&gt;&lt;span style="font-size: 14pt; color: rgb(0, 0, 240);"&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-size: 14pt; color: rgb(0, 0, 240);"&gt;-- IMP--This table name should be same as your from table in the above cursor&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-size: 14pt;"&gt;l_value &lt;span style="color: red;"&gt;VARCHAR2&lt;/span&gt; &lt;span style="color: rgb(0, 0, 240);"&gt;(&lt;/span&gt;&lt;span style="color: maroon;"&gt;2000&lt;/span&gt;&lt;span style="color: rgb(0, 0, 240);"&gt;);&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-size: 14pt;"&gt;l_str &lt;span style="color: red;"&gt;VARCHAR2&lt;/span&gt; &lt;span style="color: rgb(0, 0, 240);"&gt;(&lt;/span&gt;&lt;span style="color: maroon;"&gt;2000&lt;/span&gt;&lt;span style="color: rgb(0, 0, 240);"&gt;);&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-size: 14pt; color: rgb(0, 0, 240);"&gt;CURSOR&lt;/span&gt;&lt;span style="font-size: 14pt;"&gt; column_names &lt;span style="color: rgb(0, 0, 240);"&gt;(&lt;/span&gt;p_table_name &lt;span style="color: red;"&gt;VARCHAR2&lt;/span&gt;&lt;span style="color: rgb(0, 0, 240);"&gt;)&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-size: 14pt; color: rgb(0, 0, 240);"&gt;IS&lt;/span&gt;&lt;span style="font-size: 14pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-size: 14pt; color: rgb(0, 0, 240);"&gt;SELECT&lt;/span&gt;&lt;span style="font-size: 14pt;"&gt; &lt;span style="color: rgb(0, 0, 240);"&gt;*&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-size: 14pt; color: rgb(0, 0, 240);"&gt;FROM&lt;/span&gt;&lt;span style="font-size: 14pt;"&gt; all_tab_columns&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-size: 14pt; color: rgb(0, 0, 240);"&gt;WHERE&lt;/span&gt;&lt;span style="font-size: 14pt;"&gt; table_name &lt;span style="color: rgb(0, 0, 240);"&gt;=&lt;/span&gt; p_table_name&lt;span style="color: rgb(0, 0, 240);"&gt;;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-size: 14pt; color: rgb(0, 0, 240);"&gt;-- You can use order by clause here if you want.&lt;/span&gt;&lt;span style="font-size: 14pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-size: 14pt; color: rgb(0, 0, 240);"&gt;BEGIN&lt;/span&gt;&lt;span style="font-size: 14pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-size: 14pt; color: rgb(0, 0, 240);"&gt;FOR&lt;/span&gt;&lt;span style="font-size: 14pt;"&gt; cr_rec &lt;span style="color: rgb(0, 0, 240);"&gt;IN&lt;/span&gt; cr_data&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-size: 14pt; color: rgb(0, 0, 240);"&gt;LOOP&lt;/span&gt;&lt;span style="font-size: 14pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;i&gt;&lt;span style="font-size: 14pt; color: green;"&gt;-- We should pass the same Table Name&lt;/span&gt;&lt;/i&gt;&lt;span style="font-size: 14pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-size: 14pt; color: rgb(0, 0, 240);"&gt;FOR&lt;/span&gt;&lt;span style="font-size: 14pt;"&gt; cr_columc_rec &lt;span style="color: rgb(0, 0, 240);"&gt;IN&lt;/span&gt; column_names &lt;span style="color: rgb(0, 0, 240);"&gt;(&lt;/span&gt;l_table_name&lt;span style="color: rgb(0, 0, 240);"&gt;)&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-size: 14pt; color: rgb(0, 0, 240);"&gt;LOOP&lt;/span&gt;&lt;span style="font-size: 14pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-size: 14pt;"&gt;l_str &lt;span style="color: rgb(0, 0, 240);"&gt;:=&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-size: 14pt; color: red;"&gt;'Select '&lt;/span&gt;&lt;span style="font-size: 14pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-size: 14pt;"&gt;|| cr_columc_rec&lt;span style="color: rgb(0, 0, 240);"&gt;.&lt;/span&gt;column_name&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-size: 14pt;"&gt;|| &lt;span style="color: red;"&gt;' from '&lt;/span&gt;||l_table_name||&lt;span style="color: red;"&gt;' where rowid = '&lt;/span&gt;||chr&lt;span style="color: rgb(0, 0, 240);"&gt;(&lt;/span&gt;&lt;span style="color: maroon;"&gt;39&lt;/span&gt;&lt;span style="color: rgb(0, 0, 240);"&gt;)&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-size: 14pt;"&gt;|| cr_rec&lt;span style="color: rgb(0, 0, 240);"&gt;.&lt;/span&gt;&lt;span style="color: red;"&gt;ROWID&lt;/span&gt;||chr&lt;span style="color: rgb(0, 0, 240);"&gt;(&lt;/span&gt;&lt;span style="color: maroon;"&gt;39&lt;/span&gt;&lt;span style="color: rgb(0, 0, 240);"&gt;);&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-size: 14pt;"&gt;DBMS_OUTPUT&lt;span style="color: rgb(0, 0, 240);"&gt;.&lt;/span&gt;put_line &lt;span style="color: rgb(0, 0, 240);"&gt;(&lt;/span&gt;&lt;span style="color: red;"&gt;'Query is '&lt;/span&gt; || l_str&lt;span style="color: rgb(0, 0, 240);"&gt;);&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-size: 14pt; color: rgb(0, 0, 240);"&gt;EXECUTE&lt;/span&gt;&lt;span style="font-size: 14pt;"&gt; &lt;span style="color: rgb(0, 0, 240);"&gt;IMMEDIATE&lt;/span&gt; l_str&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-size: 14pt; color: rgb(0, 0, 240);"&gt;INTO&lt;/span&gt;&lt;span style="font-size: 14pt;"&gt; l_value&lt;span style="color: rgb(0, 0, 240);"&gt;;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-size: 14pt;"&gt;DBMS_OUTPUT&lt;span style="color: rgb(0, 0, 240);"&gt;.&lt;/span&gt;put_line &lt;span style="color: rgb(0, 0, 240);"&gt;(&lt;/span&gt; &lt;span style="color: red;"&gt;'Column is '&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-size: 14pt;"&gt;|| cr_columc_rec&lt;span style="color: rgb(0, 0, 240);"&gt;.&lt;/span&gt;column_name&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-size: 14pt;"&gt;|| &lt;span style="color: red;"&gt;' and Value is '&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-size: 14pt;"&gt;|| l_value&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-size: 14pt; color: rgb(0, 0, 240);"&gt;);&lt;/span&gt;&lt;span style="font-size: 14pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-size: 14pt; color: rgb(0, 0, 240);"&gt;END&lt;/span&gt;&lt;span style="font-size: 14pt;"&gt; &lt;span style="color: rgb(0, 0, 240);"&gt;LOOP;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-size: 14pt; color: rgb(0, 0, 240);"&gt;END&lt;/span&gt;&lt;span style="font-size: 14pt;"&gt; &lt;span style="color: rgb(0, 0, 240);"&gt;LOOP;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-size: 14pt; color: rgb(0, 0, 240);"&gt;END;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;span style="font-size: 14pt; color: rgb(0, 0, 240);"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;b style=""&gt;&lt;span style="font-size: 14pt;"&gt;Tell me the difference between instead of trigger, database trigger, and schema trigger?&lt;span style="color: rgb(0, 0, 240);"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;&lt;span class="tdvamseel"&gt;&lt;span style="font-size: 14pt;"&gt;Instead of trigger : A view cannot be updated , so if the user tries to update a view, then this trigger can be used , where we can write the code so that the data will be updated in the table, from which the view was created. Database trigger : this trigger will be fired when a database event ( dml operation ) occurs in the &lt;a href="http://www.geekinterview.com/question_details/36655" target="_new"&gt;&lt;span class="klink"&gt;&lt;span style="font-family: &amp;quot;Trebuchet MS&amp;quot;,&amp;quot;sans-serif&amp;quot;; color: green;"&gt;database table&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;, like insert , update or delete. System triggers : this trigger will fire for database events like dtartup / shutdown of the &lt;a href="http://www.geekinterview.com/question_details/36655" target="_new"&gt;&lt;span class="klink"&gt;&lt;span style="font-family: &amp;quot;Trebuchet MS&amp;quot;,&amp;quot;sans-serif&amp;quot;; color: green;"&gt;server&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;, logon / logoff of the user, and server errors ... and also for the ddl events, like alter, drop, truncate etc.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;span class="tdvamseel"&gt;&lt;span style="font-size: 14pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;b&gt;&lt;span style="font-size: 14pt;"&gt;What is the diff between %Rowtype and %type?&lt;/span&gt;&lt;/b&gt;&lt;span style="font-size: 14pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;div class="MsoNormal" style="text-align: center;" align="center"&gt;&lt;span style="font-size: 14pt;"&gt;  &lt;hr align="center" size="2" width="100%"&gt;  &lt;/span&gt;&lt;/div&gt;  &lt;p&gt;&lt;span style="font-size: 14pt;"&gt;%Rowtype means associating a single variable to a entire row.(It is one way of Declaring a composite plsql datatype &lt;strong&gt;"RECORD")&lt;/strong&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-size: 14pt;"&gt;%type means associating a single variable to a particular column in table.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-size: 14pt;"&gt;both %Rowtype and %type declarations are known as Anchored Declarations in plsql . &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;br /&gt; &lt;p&gt;&lt;b&gt;&lt;span style="font-size: 14pt;"&gt;Wat is difference between Cursor and Ref Cursor ?&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;  &lt;p style="margin-left: 0.5in; text-indent: -0.25in;"&gt;&lt;!--[if !supportLists]--&gt;&lt;span style="font-size: 14pt; font-family: Symbol;"&gt;&lt;span style=""&gt;·&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal;"&gt;        &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;!--[endif]--&gt;&lt;span class="tdvamseel"&gt;&lt;span style="font-size: 14pt;"&gt;Cursor is static one and ref cursor is dynamic with return type&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: 14pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-size: 14pt;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-size: 14pt;"&gt;Example for cursor:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-size: 14pt;"&gt;declare&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-size: 14pt;"&gt;cursor c1 is select * from emp;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-size: 14pt;"&gt;begin&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-size: 14pt;"&gt;for r1 in c1 loop&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-size: 14pt;"&gt;dbms_output.put_line(r1.empno||'  '||r1.ename);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-size: 14pt;"&gt;end loop;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-size: 14pt;"&gt;end;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-size: 14pt;"&gt;/&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-size: 14pt;"&gt;Example for ref cursor&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-size: 14pt; color: rgb(0, 0, 240);"&gt;CREATE&lt;/span&gt;&lt;span style="font-size: 14pt;"&gt; &lt;span style="color: rgb(0, 0, 240);"&gt;OR&lt;/span&gt; &lt;span style="color: rgb(0, 0, 240);"&gt;REPLACE&lt;/span&gt; &lt;span style="color: rgb(0, 0, 240);"&gt;package&lt;/span&gt; emp_data &lt;span style="color: rgb(0, 0, 240);"&gt;is&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;i&gt;&lt;span style="font-size: 14pt; color: green;"&gt;-- Author : RPSINGH&lt;/span&gt;&lt;/i&gt;&lt;span style="font-size: 14pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;i&gt;&lt;span style="font-size: 14pt; color: green;"&gt;-- Created : 8/17/2006 12:54:03 AM&lt;/span&gt;&lt;/i&gt;&lt;span style="font-size: 14pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;i&gt;&lt;span style="font-size: 14pt; color: green;"&gt;-- Purpose : displaying the data from different tables&lt;/span&gt;&lt;/i&gt;&lt;span style="font-size: 14pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;i&gt;&lt;span style="font-size: 14pt; color: green;"&gt;-- Public type declarations&lt;/span&gt;&lt;/i&gt;&lt;span style="font-size: 14pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-size: 14pt; color: rgb(0, 0, 240);"&gt;type&lt;/span&gt;&lt;span style="font-size: 14pt;"&gt; my_cur &lt;span style="color: rgb(0, 0, 240);"&gt;is&lt;/span&gt; &lt;span style="color: rgb(0, 0, 240);"&gt;ref&lt;/span&gt; &lt;span style="color: rgb(0, 0, 240);"&gt;cursor;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;i&gt;&lt;span style="font-size: 14pt; color: green;"&gt;-- Public constant declarations&lt;/span&gt;&lt;/i&gt;&lt;span style="font-size: 14pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;i&gt;&lt;span style="font-size: 14pt; color: green;"&gt;-- Public variable declarations&lt;/span&gt;&lt;/i&gt;&lt;span style="font-size: 14pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;i&gt;&lt;span style="font-size: 14pt; color: green;"&gt;-- &lt;a href="http://www.geekinterview.com/question_details/35980" target="_new"&gt;&lt;span class="klink"&gt;&lt;span style="font-family: &amp;quot;Tahoma&amp;quot;,&amp;quot;sans-serif&amp;quot;; color: green; text-decoration: none;"&gt;Public function&lt;/span&gt;&lt;/span&gt;&lt;/a&gt; and procedure declarations&lt;/span&gt;&lt;/i&gt;&lt;span style="font-size: 14pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-size: 14pt; color: rgb(0, 0, 240);"&gt;procedure&lt;/span&gt;&lt;span style="font-size: 14pt;"&gt; tabledata&lt;span style="color: rgb(0, 0, 240);"&gt;(&lt;/span&gt;tname &lt;span style="color: rgb(0, 0, 240);"&gt;in&lt;/span&gt; &lt;span style="color: red;"&gt;varchar2&lt;/span&gt;&lt;span style="color: rgb(0, 0, 240);"&gt;,&lt;/span&gt; v_cur &lt;span style="color: rgb(0, 0, 240);"&gt;out&lt;/span&gt; my_cur&lt;span style="color: rgb(0, 0, 240);"&gt;);&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-size: 14pt; color: rgb(0, 0, 240);"&gt;end&lt;/span&gt;&lt;span style="font-size: 14pt;"&gt; emp_data&lt;span style="color: rgb(0, 0, 240);"&gt;;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-size: 14pt; color: rgb(0, 0, 240);"&gt;/&lt;/span&gt;&lt;span style="font-size: 14pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-size: 14pt; color: rgb(0, 0, 240);"&gt;CREATE&lt;/span&gt;&lt;span style="font-size: 14pt; color: black;"&gt; &lt;/span&gt;&lt;span style="font-size: 14pt; color: rgb(0, 0, 240);"&gt;OR&lt;/span&gt;&lt;span style="font-size: 14pt; color: black;"&gt; &lt;/span&gt;&lt;span style="font-size: 14pt; color: rgb(0, 0, 240);"&gt;REPLACE&lt;/span&gt;&lt;span style="font-size: 14pt; color: black;"&gt; &lt;/span&gt;&lt;span style="font-size: 14pt; color: rgb(0, 0, 240);"&gt;PACKAGE&lt;/span&gt;&lt;span style="font-size: 14pt; color: black;"&gt; &lt;/span&gt;&lt;span style="font-size: 14pt; color: rgb(0, 0, 240);"&gt;BODY&lt;/span&gt;&lt;span style="font-size: 14pt; color: black;"&gt; EMP_DATA &lt;/span&gt;&lt;span style="font-size: 14pt; color: rgb(0, 0, 240);"&gt;IS&lt;/span&gt;&lt;span style="font-size: 14pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-size: 14pt; color: rgb(0, 0, 240);"&gt;procedure&lt;/span&gt;&lt;span style="font-size: 14pt; color: black;"&gt; tabledata&lt;/span&gt;&lt;span style="font-size: 14pt; color: rgb(0, 0, 240);"&gt;(&lt;/span&gt;&lt;span style="font-size: 14pt; color: black;"&gt;tname &lt;/span&gt;&lt;span style="font-size: 14pt; color: rgb(0, 0, 240);"&gt;in&lt;/span&gt;&lt;span style="font-size: 14pt; color: black;"&gt; &lt;/span&gt;&lt;span style="font-size: 14pt; color: red;"&gt;varchar2&lt;/span&gt;&lt;span style="font-size: 14pt; color: rgb(0, 0, 240);"&gt;,&lt;/span&gt;&lt;span style="font-size: 14pt; color: black;"&gt;v_cur &lt;/span&gt;&lt;span style="font-size: 14pt; color: rgb(0, 0, 240);"&gt;out&lt;/span&gt;&lt;span style="font-size: 14pt; color: black;"&gt; my_cur&lt;/span&gt;&lt;span style="font-size: 14pt; color: rgb(0, 0, 240);"&gt;)&lt;/span&gt;&lt;span style="font-size: 14pt; color: black;"&gt; &lt;/span&gt;&lt;span style="font-size: 14pt; color: rgb(0, 0, 240);"&gt;is&lt;/span&gt;&lt;span style="font-size: 14pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-size: 14pt; color: rgb(0, 0, 240);"&gt;begin&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-size: 14pt; color: rgb(0, 0, 240);"&gt;OPEN V_CUR FOR&lt;/span&gt;&lt;span style="font-size: 14pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-size: 14pt; color: red;"&gt;'SELECT * FROM '&lt;/span&gt;&lt;span style="font-size: 14pt; color: rgb(0, 0, 240);"&gt;||TNAME;&lt;/span&gt;&lt;span style="font-size: 14pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-size: 14pt; color: rgb(0, 0, 240);"&gt;end&lt;/span&gt;&lt;span style="font-size: 14pt; color: black;"&gt; tabledata&lt;/span&gt;&lt;span style="font-size: 14pt; color: rgb(0, 0, 240);"&gt;;&lt;/span&gt;&lt;span style="font-size: 14pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-size: 14pt; color: rgb(0, 0, 240);"&gt;end&lt;/span&gt;&lt;span style="font-size: 14pt; color: black;"&gt; emp_data&lt;/span&gt;&lt;span style="font-size: 14pt; color: rgb(0, 0, 240);"&gt;;&lt;/span&gt;&lt;span style="font-size: 14pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-size: 14pt; color: rgb(0, 0, 240);"&gt;/&lt;/span&gt;&lt;span style="font-size: 14pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-size: 14pt; color: rgb(0, 0, 240);"&gt;Now to use this code:&lt;/span&gt;&lt;span style="font-size: 14pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-size: 14pt; color: rgb(0, 0, 240);"&gt;declare&lt;/span&gt;&lt;span style="font-size: 14pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-size: 14pt; color: rgb(0, 0, 240);"&gt;v_cur employees%rowtype;&lt;/span&gt;&lt;span style="font-size: 14pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-size: 14pt; color: rgb(0, 0, 240);"&gt;C_CUR EMP_DATA.MY_CUR;&lt;/span&gt;&lt;span style="font-size: 14pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-size: 14pt; color: rgb(0, 0, 240);"&gt;begin&lt;/span&gt;&lt;span style="font-size: 14pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-size: 14pt; color: rgb(0, 0, 240);"&gt;emp_data.tabledata('EMPLOYEES', C_CUR);&lt;/span&gt;&lt;span style="font-size: 14pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-size: 14pt; color: rgb(0, 0, 240);"&gt;LOOP&lt;/span&gt;&lt;span style="font-size: 14pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-size: 14pt; color: rgb(0, 0, 240);"&gt;FETCH C_CUR INTO V_CUR;&lt;/span&gt;&lt;span style="font-size: 14pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-size: 14pt; color: rgb(0, 0, 240);"&gt;EXIT WHEN C_CUR%NOTFOUND;&lt;/span&gt;&lt;span style="font-size: 14pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-size: 14pt; color: rgb(0, 0, 240);"&gt;DBMS_OUTPUT.PUT_LINE(V_CUR.FIRST_NAME||'  '||V_CUR.LAST_NAME);&lt;/span&gt;&lt;span style="font-size: 14pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-size: 14pt; color: rgb(0, 0, 240);"&gt;END LOOP;&lt;/span&gt;&lt;span style="font-size: 14pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-size: 14pt; color: rgb(0, 0, 240);"&gt;END;&lt;/span&gt;&lt;span style="font-size: 14pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-size: 14pt; color: rgb(0, 0, 240);"&gt;/&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-size: 14pt;"&gt;Cursor is a structure which points to a memory locations&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-size: 14pt;"&gt;While Ref-cursor is a data structure which point to a object which intern points to Memory locations.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-size: 14pt;"&gt;&lt;span style=""&gt; &lt;/span&gt;Advantage of having Ref-cursor is &lt;b style=""&gt;that&lt;span style="color: fuchsia;"&gt; we can pass dynamically the Ref-cursor as a parameter to a procedure.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;b style=""&gt;&lt;span style="font-size: 14pt;"&gt;Can we create a table using with Procedure or Function?&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;&lt;span class="tdvamseel"&gt;&lt;span style="font-size: 14pt;"&gt;DECLARE&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: 14pt;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="tdvamseel"&gt;BEGIN &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="tdvamseel"&gt;EXECUTE IMMEDIATE 'create table employee(empno number(3),ename varchar2(10))';&lt;/span&gt;&lt;br /&gt;&lt;span class="tdvamseel"&gt;END;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;b style=""&gt;What is the Mutating trigger error?&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span class="tdvamseel"&gt;&lt;b style=""&gt;&lt;span style="font-size: 14pt;"&gt;Mutating error:- occurs when row level trigger accesses same table on which it is based while executing or the table currently being modified by the DML statements&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;span class="tdvamseel"&gt;&lt;span style="font-size: 14pt;"&gt;.&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: 14pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;br /&gt;&lt;br /&gt;&lt;a href="http://tinyurl.com/5rg2b9"&gt;&lt;img src="http://tinyurl.com/3ddf3l" /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7668553736104330014-6321146774033155339?l=oracledbarea.blogspot.com' alt='' /&gt;&lt;/div&gt;</description><link>http://feedproxy.google.com/~r/OracleDbasArea/~3/hBFpHfc3ixs/interview-questions-iv.html</link><author>noreply@blogger.com (Jafar Ali)</author><thr:total>3</thr:total><feedburner:origLink>http://oracledbarea.blogspot.com/2008/08/interview-questions-iv.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7668553736104330014.post-8273054395901384160</guid><pubDate>Sun, 24 Aug 2008 12:57:00 +0000</pubDate><atom:updated>2008-08-24T18:33:50.954+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">Interview Questions</category><title>Interview Questions III</title><description>&lt;div style="text-align: justify;"&gt;&lt;br /&gt; &lt;/div&gt;&lt;p style="text-align: justify;"&gt;&lt;span style="font-size:85%;"&gt;&lt;b style=""&gt;&lt;span style="font-size: 14pt;"&gt;Difference between decode and case.&lt;br /&gt;In which case we are using case and in which case we are using decode?&lt;br /&gt;With an example?&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="text-align: justify;"&gt;  &lt;/div&gt;&lt;p style="text-align: justify;"&gt;&lt;span style="font-size:85%;"&gt;&lt;span class="tdvamseel"&gt;&lt;span style="font-size: 14pt;"&gt;Ans:- decode is a function where case is expression .&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: 14pt;"&gt;&lt;br /&gt;          &lt;span class="tdvamseel"&gt;decode gives result different when using null  see below&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="tdvamseel"&gt;SQL&gt; select decode( null,null,1,0) from dual;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="tdvamseel"&gt;DECODE(NULL,NULL,1,0)&lt;/span&gt;&lt;br /&gt;&lt;span class="tdvamseel"&gt;---------------------&lt;/span&gt;&lt;br /&gt;&lt;span class="tdvamseel"&gt;                    1&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;  &lt;span class="tdvamseel"&gt;SQL&gt;select case null when null then 1 else 0 end from dual&lt;/span&gt;&lt;br /&gt;&lt;span class="tdvamseel"&gt;SQL&gt; /&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="tdvamseel"&gt;CASENULLWHENNULLTHEN1ELSE0END&lt;/span&gt;&lt;br /&gt;&lt;span class="tdvamseel"&gt;-----------------------------&lt;/span&gt;&lt;br /&gt;&lt;span class="tdvamseel"&gt;                            0&lt;/span&gt;&lt;br /&gt;&lt;span class="tdvamseel"&gt;but see here&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="text-align: justify;"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-size: 14pt;"&gt;&lt;span class="tdvamseel"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="tdvamseel"&gt;SQL&gt; select case when null is null then 1 else 0 end from dual;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="tdvamseel"&gt;CASEWHENNULLISNULLTHEN1ELSE0END&lt;/span&gt;&lt;br /&gt;&lt;span class="tdvamseel"&gt;-------------------------------&lt;/span&gt;&lt;br /&gt;&lt;span class="tdvamseel"&gt;                              1&lt;/span&gt;&lt;br /&gt;&lt;br /&gt; &lt;span class="tdvamseel"&gt;The Main Difference is that&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="text-align: justify;"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-size: 14pt;"&gt;&lt;span class="tdvamseel"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="tdvamseel"&gt; 1) Decode cannot be used in Where clause but Case can.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="text-align: justify;"&gt;  &lt;/div&gt;&lt;p style="margin-left: 0.5in; text-indent: -0.25in; text-align: justify;"&gt;&lt;!--[if !supportLists]--&gt;&lt;span style="font-size:85%;"&gt;&lt;span class="tdvamseel"&gt;&lt;span style="font-size: 14pt;"&gt;&lt;span style=""&gt;2)&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal;"&gt;     &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="tdvamseel"&gt;&lt;span style="font-size: 14pt;"&gt;In Decode Else can be specifed in the statement it self but in Case a seperate statement has to be written.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin-left: 0.5in; text-indent: -0.25in; text-align: justify;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;span class="tdvamseel"&gt;&lt;span style="font-size: 14pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;!--[endif]--&gt;&lt;/p&gt;&lt;div style="text-align: justify;"&gt;  &lt;/div&gt;&lt;p style="text-align: justify;" class="MsoNormal"&gt;&lt;span style="font-size:85%;"&gt;&lt;b&gt;&lt;span style="font-size: 14pt;"&gt;What are the advantages and disadvantages of View?...&lt;/span&gt;&lt;/b&gt;&lt;span style="font-size: 14pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="text-align: justify;"&gt;  &lt;/div&gt;&lt;div style="text-align: justify;" class="MsoNormal"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-size: 14pt;"&gt;  &lt;hr align="center" size="2" width="100%"&gt;  &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;  &lt;/div&gt;&lt;p style="text-align: justify;"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-size: 14pt;"&gt;advantages&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="text-align: justify;"&gt;  &lt;/div&gt;&lt;p style="text-align: justify;"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-size: 14pt;"&gt;1. hiding the data.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="text-align: justify;"&gt;  &lt;/div&gt;&lt;p style="text-align: justify;"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-size: 14pt;"&gt;2. you can use two tables data in view.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="text-align: justify;"&gt;  &lt;/div&gt;&lt;p style="text-align: justify;"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-size: 14pt;"&gt;3. &lt;a href="http://www.geekinterview.com/question_details/29078" target="_new"&gt;&lt;span class="klink"&gt;&lt;span style="font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;; color: green;"&gt;security&lt;/span&gt;&lt;/span&gt;&lt;/a&gt; will be there.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="text-align: justify;"&gt;  &lt;/div&gt;&lt;p style="text-align: justify;"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-size: 14pt;"&gt;disadvantages&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="text-align: justify;"&gt;  &lt;/div&gt;&lt;p style="text-align: justify;"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-size: 14pt;"&gt;1.when table is not there view will not work.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="text-align: justify;"&gt;  &lt;/div&gt;&lt;p style="text-align: justify;"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-size: 14pt;"&gt;2. dml is not possible if that is more than one table.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="text-align: justify;"&gt;  &lt;/div&gt;&lt;p style="text-align: justify;"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-size: 14pt;"&gt;3. it is also &lt;a href="http://www.geekinterview.com/question_details/29078" target="_new"&gt;&lt;span class="klink"&gt;&lt;span style="font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;; color: green;"&gt;database object&lt;/span&gt;&lt;/span&gt;&lt;/a&gt; so it will occupy the space.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="text-align: justify;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-size: 14pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="text-align: justify;"&gt;  &lt;/div&gt;&lt;p style="text-align: justify;"&gt;&lt;span style="font-size:85%;"&gt;&lt;b style=""&gt;&lt;span style="font-size: 14pt;"&gt;Explain what is mutation and what is mutating table and how this mutation problem is solved in a table?&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="text-align: justify;"&gt;  &lt;/div&gt;&lt;p style="text-align: justify;"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-size: 14pt;"&gt;Mutation happens in case of triggers. A 'Mutating table’ is a table which is being updated by Insert, update or delete triggers. It can also be a table which is being updated when delete cascade is run.   &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="text-align: justify;"&gt;  &lt;/div&gt;&lt;p style="text-align: justify;"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-size: 14pt;"&gt;Mutation occurs when a trigger is trying to update a row which it is using currently. To solve this either we have to use intermediate table or a view so that it can choose from one while updating the other.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="text-align: justify;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-size: 14pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="text-align: justify;"&gt;  &lt;/div&gt;&lt;p style="text-align: justify;"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-size: 14pt;"&gt;&lt;span style="font-weight: bold;"&gt;What is the difference between single quote (') and double quote(") in relates to using in &lt;/span&gt;&lt;a style="font-weight: bold;" href="http://www.geekinterview.com/question_details/25168" target="_new"&gt;&lt;span class="klink"&gt;&lt;span style="font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;; color: green;"&gt;SQL&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;span style="font-weight: bold;"&gt;. When do you use 'xxx' and "xxx"? what is the difference both of them?&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="text-align: justify;"&gt;  &lt;/div&gt;&lt;div style="text-align: justify;"&gt;  &lt;/div&gt;&lt;p style="text-align: justify;"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-size: 14pt;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:100%;"&gt;&lt;strong style="font-weight: bold;"&gt;&lt;span style="font-size: 14pt; color: rgb(0, 51, 0);"&gt;Single quote is used to write a character string or character in sql query.&lt;/span&gt;&lt;/strong&gt;&lt;span style="font-size: 14pt; font-weight: bold;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="text-align: justify; font-weight: bold;"&gt;  &lt;/div&gt;&lt;p style="text-align: justify; font-weight: bold;"&gt;&lt;span style="font-size:100%;"&gt;&lt;strong&gt;&lt;span style="font-size: 14pt; color: rgb(0, 51, 0);"&gt;but,double quotes are used to print the name in sql screen.&lt;/span&gt;&lt;/strong&gt;&lt;span style="font-size: 14pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="text-align: justify; font-weight: bold;"&gt;  &lt;/div&gt;&lt;p style="text-align: justify; font-weight: bold;"&gt;&lt;span style="font-size:100%;"&gt;&lt;strong&gt;&lt;span style="font-size: 14pt; color: rgb(0, 51, 0);"&gt;for eg:-&lt;/span&gt;&lt;/strong&gt;&lt;span style="font-size: 14pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="text-align: justify; font-weight: bold;"&gt;  &lt;/div&gt;&lt;p style="text-align: justify; font-weight: bold;"&gt;&lt;span style="font-size:100%;"&gt;&lt;strong&gt;&lt;span style="font-size: 14pt; color: rgb(0, 51, 0);"&gt;select sysdate "current date" from dual;&lt;/span&gt;&lt;/strong&gt;&lt;span style="font-size: 14pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="text-align: justify; font-weight: bold;"&gt;  &lt;/div&gt;&lt;p style="text-align: justify; font-weight: bold;"&gt;&lt;span style="font-size:100%;"&gt;&lt;strong&gt;&lt;span style="font-size: 14pt; color: rgb(0, 51, 0);"&gt;current date&lt;/span&gt;&lt;/strong&gt;&lt;span style="font-size: 14pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="text-align: justify; font-weight: bold;"&gt;  &lt;/div&gt;&lt;p style="text-align: justify; font-weight: bold;"&gt;&lt;span style="font-size:100%;"&gt;&lt;strong&gt;&lt;span style="font-size: 14pt; color: rgb(0, 51, 0);"&gt;-----------------&lt;/span&gt;&lt;/strong&gt;&lt;span style="font-size: 14pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="text-align: justify; font-weight: bold;"&gt;  &lt;/div&gt;&lt;p style="text-align: justify;"&gt;&lt;span style="font-size:100%;"&gt;&lt;strong style="font-weight: bold;"&gt;&lt;span style="font-size: 14pt; color: rgb(0, 51, 0);"&gt;24-mar-06.&lt;/span&gt;&lt;/strong&gt;&lt;span style="font-size: 14pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="text-align: justify;"&gt; &lt;br /&gt; &lt;p&gt;&lt;b style=""&gt;&lt;span style="font-size: 14pt;"&gt;How to get first 5 &lt;a href="http://www.geekinterview.com/question_details/22724" target="_new"&gt;&lt;span class="klink"&gt;&lt;span style="font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;; color: green; text-decoration: none;"&gt;Records&lt;/span&gt;&lt;/span&gt;&lt;/a&gt; then next 5 records till end of row count in SQL –Oracle ?&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-size: 14pt;"&gt;elect * from emp where rownum&lt;6&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-size: 14pt;"&gt;Then we can get the next 5 records by the following sql:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-size: 14pt;"&gt;select * from emp where rownum&lt;6&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-size: 14pt;"&gt;and so on..&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-size: 14pt;"&gt;Find the two minimum salaries among table&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-size: 14pt;"&gt;Ans:&lt;span style=""&gt;  &lt;/span&gt;&lt;span class="tdvamseel"&gt;select sal from (select * from &lt;table_name&gt; order by sal asc) where rownum &lt;&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;b style=""&gt;&lt;span style="font-size: 14pt;"&gt;How to get the prime number rows from table ie like1,3,5,7,11&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;    &lt;p&gt;&lt;b style=""&gt;&lt;span style="font-size: 14pt;"&gt;&lt;o:p&gt; &lt;/o:p&gt;Ans :&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-size: 14pt;"&gt;I tried in &lt;a href="http://www.geekinterview.com/question_details/16428" target="_new"&gt;&lt;span class="klink"&gt;&lt;span style="font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;; color: green; text-decoration: none;"&gt;sql&lt;/span&gt;&lt;/span&gt;&lt;/a&gt; but sql is not sufficient.  U may create a function like this&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-size: 14pt;"&gt; create or replace function fn_chk_pm(v_num in number) return number&lt;br /&gt; is&lt;br /&gt; v_flag number:=0;&lt;br /&gt; v_j number:=round(v_num/2);&lt;br /&gt; begin&lt;br /&gt;     for v_cnt in 2..v_j&lt;br /&gt;     loop&lt;br /&gt;           if mod(v_num,v_cnt)=0 then&lt;br /&gt;                  v_flag:=1;&lt;br /&gt;                 exit when v_flag=1;&lt;br /&gt;          end if;&lt;br /&gt;     end loop;&lt;br /&gt; if v_flag=0 then&lt;br /&gt;        return 1;&lt;br /&gt; end if;&lt;br /&gt; if v_flag=1 then&lt;br /&gt;       return 0;&lt;br /&gt; end if;&lt;br /&gt; end;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-size: 14pt;"&gt;Assumuming the table as follows &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-size: 14pt;"&gt;SQL&gt; select * from dummyag;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-size: 14pt;"&gt;      COL1 COL2&lt;br /&gt;---------- -&lt;br /&gt;         2 b&lt;br /&gt;         3 c&lt;br /&gt;         4 d&lt;br /&gt;         1 a&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-size: 14pt;"&gt;I can call it from &lt;a href="http://www.geekinterview.com/question_details/16428" target="_new"&gt;&lt;span class="klink"&gt;&lt;span style="font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;; color: green; text-decoration: none;"&gt;sql statement&lt;/span&gt;&lt;/span&gt;&lt;/a&gt; as follows:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-size: 14pt;"&gt;SQL&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-size: 14pt;"&gt;&lt;br /&gt; 1  select a.rn,a.col1,a.col2 from (select rownum rn,col1,col2 from dummyag)  a&lt;br /&gt;  2  where fn_chk_pm(a.rn)=1&lt;br /&gt;  3* and a.rn!=1&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-size: 14pt;"&gt;With the result,&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-size: 14pt;"&gt;&lt;br /&gt;        RN       COL1 C&lt;br /&gt;---------- ---------- -&lt;br /&gt;         2          3 c&lt;br /&gt;         3          4 d&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-size: 14pt;"&gt;&lt;br /&gt; Ans 2 : &lt;span class="tdvamseel"&gt;((select * from emp where (rowid,1) in (select rowid,mod(rownum,2) from emp)) &lt;/span&gt;&lt;span class="tdvamseel"&gt;Minus &lt;/span&gt;&lt;br /&gt;&lt;span class="tdvamseel"&gt;(select * from emp where (rowid,0) in (select rowid,mod(rownum,3) from emp))) &lt;/span&gt;&lt;span class="tdvamseel"&gt;union&lt;/span&gt;&lt;br /&gt;&lt;span class="tdvamseel"&gt;(select * from emp where (rowid,3) in (select rowid,rownum from emp));&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;a href="http://tinyurl.com/5rg2b9"&gt;&lt;img src="http://tinyurl.com/3ddf3l" /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7668553736104330014-8273054395901384160?l=oracledbarea.blogspot.com' alt='' /&gt;&lt;/div&gt;</description><link>http://feedproxy.google.com/~r/OracleDbasArea/~3/a5nZTYAdYD4/interview-questions-iii.html</link><author>noreply@blogger.com (Jafar Ali)</author><thr:total>2</thr:total><feedburner:origLink>http://oracledbarea.blogspot.com/2008/08/interview-questions-iii.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7668553736104330014.post-8139448322489584430</guid><pubDate>Sun, 17 Aug 2008 14:40:00 +0000</pubDate><atom:updated>2008-08-24T18:35:02.811+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">Interview Questions</category><title>Oracle's Interview question's II</title><description>&lt;div style="text-align: justify;"&gt;&lt;span style="font-weight: bold;"&gt;Bitmap index&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;An index that maintains a binary string of ones and zeros for each distinct value of a column within  the index.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Materialized View &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;A materialized view can help speed queries by storing data in a previously joined&lt;br /&gt;or summarized format. Unlike a traditional view, this stores only the query and runs that query every time the view is accessed; a materialized view stores the results of the query in addition to the SQL statements of the view itself. Because the materialized view already contains the results of the view’s underlying query,&lt;br /&gt;Using a materialized view can be as fast as accessing a single table.&lt;br /&gt;&lt;br /&gt;                               OR&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;What is materialized view?&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;A materialized view is a database object that contains the results of a query. They are local copies of data located remotely, or are used to create summary tables based on aggregations of a table's data. Materialized views, which store data based on remote tables are also, know as snapshots.A materialized view can query tables, views, and other materialized views. Collectively these are called master tables (a replication term) or detail tables (a data warehouse term)&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Alias&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;An alternate name for a column, specified right after the column name in a SELECT statement, seen in the results&lt;br /&gt;Of the query.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;DML (Data Manipulation Language)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Includes INSERT, UPDATE, DELETE, and MERGE statements that operate specifically on database tables. Occasionally, SELECT statements are included in the SQL DML category.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;DUAL&lt;/span&gt;&lt;br /&gt;A special table, owned by the Oracle SYS   user, that has one row and one column.&lt;br /&gt;It is useful for ad hoc queries that don’t require rows from a specific table.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;NULL&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;A NULL is usually used to represent a value that is unknown,&lt;br /&gt;not applicable, or not available.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Why order by clause maintains column number values instead of column names?&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Every Column have unique number in the table, when we write ORDER BY Clause with number then it refers to that unique number and display the result.&lt;br /&gt;&lt;br /&gt;You can see the column Id as per below query&lt;br /&gt;&lt;br /&gt;SELECT COLUMN_NAME, COLUMN_ID FROM USER_TAB_COLUMNS&lt;br /&gt;WHERE TABLE_NAME = 'EMP';&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;What is difference between SQL and SQL*PLUS?&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;&lt;/span&gt;SQL*PLUS is a command line tool where as SQL and PL/SQL language interface and reporting tool. Its a command line tool that allows user to type SQL commands to be executed directly against an Oracle database. SQL is a language used to query the relational database(DML,DCL,DDL). SQL*PLUS commands are used to format query result, Set options, Edit SQL commands and PL/SQL.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;There are 10 rows in Table A and 0 Rows in table B. &lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Select * from A,B&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;How many rows will be retrieved.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Ans : it will not select any row.coz according to this query it has to give cartesian product.that means it will select m into n rowsso 10*0=0&lt;br /&gt;&lt;br /&gt;No Rows Selected.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;What is the difference between Rename and Alias?&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;&lt;/span&gt; Rename is a permanent name given to a Table or Column Whereas Alias is a temporary name given to a table or a column, which do not exist once the SQL statement is executed.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;What is the Difference between stored procedures and anonymous procedure?&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;An external procedure, also sometimes referred to as an external routine, is a procedure stored in a dynamic link library (DLL), or libunit in the case of a Java class method. You register the procedure with the base language, and then call it to perform special-purpose processing. A stored procedure is a group of SQL statements that form a logical unit and perform a particular task. This will be stored in oracle database.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;We have EMP and dept table .how do you get the entire department and corresponding employee details and the department which are not allotted it?&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;We use joins to get details from both the tables that’s kind of joins r called outer joins   to get the missed statements.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;select  e.eno, e.ename, e.deptno&lt;br /&gt;from emp e, dept d&lt;br /&gt;where  (+)e.deptno=d.deptno;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;What is Complex View?Where we can use?&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;&lt;/span&gt;Views containing any group functions or joining tables are known as complex views.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Write query for the following questions&lt;/span&gt;&lt;br /&gt;________________________________________&lt;br /&gt;select * from emp where (rowid,0) in (select rowid,mod(rownum,2) from emp)&lt;br /&gt;&lt;br /&gt;select * from emp where (rowid,0) not in (select rowid,mod(rownum,2) from emp)&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;How to retrieving the data from 11th column to n th column in a table.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;select * from emp where rowid in ( select  rowid  from emp where rownum &lt;=&amp;amp;upto minus select rowid from emp where rownum &lt;&amp;amp;startfrom)   &lt;a href="http://tinyurl.com/5rg2b9"&gt;&lt;img src="http://tinyurl.com/3ddf3l" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7668553736104330014-8139448322489584430?l=oracledbarea.blogspot.com' alt='' /&gt;&lt;/div&gt;</description><link>http://feedproxy.google.com/~r/OracleDbasArea/~3/Si937fCxxtk/oracles-interview-questions-ii.html</link><author>noreply@blogger.com (Jafar Ali)</author><thr:total>0</thr:total><feedburner:origLink>http://oracledbarea.blogspot.com/2008/08/oracles-interview-questions-ii.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7668553736104330014.post-1863824967181874686</guid><pubDate>Sun, 17 Aug 2008 14:34:00 +0000</pubDate><atom:updated>2008-08-24T18:34:33.007+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">Interview Questions</category><title>Oracle Interview Questions</title><description>&lt;div style="text-align: justify;"&gt;Oracle FAQ's&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;" class="Section1"&gt;  &lt;p class="MsoNormal"&gt;&lt;b&gt;&lt;span style=""&gt;&lt;span style="font-size:100%;"&gt;1)FOREIGN KEY constraint&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;    &lt;/div&gt;&lt;div&gt;  &lt;/div&gt;&lt;p style="text-align: justify;" class="MsoNormal"&gt;&lt;span style=""&gt;A constraint that establishes a parent child relationship between two tables via one or more common columns. &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="text-align: justify;"&gt;  &lt;/div&gt;&lt;p style="text-align: justify;" class="MsoNormal"&gt;&lt;span style=""&gt;The foreign key in the child table refers to a primary or unique key in the parent table.&lt;/span&gt;&lt;span style=""&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="text-align: justify;"&gt;    &lt;/div&gt;&lt;p style="text-align: justify;" class="MsoNormal"&gt;&lt;span style=""&gt;&lt;o:p&gt;2)&lt;/o:p&gt;&lt;/span&gt;&lt;span style="font-size:100%;"&gt;&lt;b&gt;&lt;span style=""&gt;Transaction&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="text-align: justify;"&gt;&lt;span style=""&gt;A logical unit of work consisting of one or more SQL statements that must all succeed or all fails to keep the database in a logically consistent state. A transfer of&lt;span style=""&gt;  &lt;/span&gt;funds from one bank account is a logical&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;  &lt;/div&gt;&lt;p style="text-align: justify;" class="MsoNormal"&gt;&lt;span style=""&gt;Transaction, in that both the withdrawal from one account and the deposit to another account must succeed for the transaction to succeed.&lt;/span&gt;&lt;span style=""&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="text-align: justify;"&gt;    &lt;/div&gt;&lt;p style="text-align: justify;" class="MsoNormal"&gt;&lt;span style="font-size:100%;"&gt;&lt;b&gt;&lt;span style=""&gt;3)Schema&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="text-align: justify;"&gt;&lt;span style=""&gt;A named group of objects associated with a particular user account, such as tables, indexes, functions, and so forth.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;    &lt;/div&gt;&lt;p style="text-align: justify;" class="MsoNormal"&gt;&lt;span style="font-size:100%;"&gt;&lt;b&gt;&lt;span style=""&gt;4)Relational table&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="text-align: justify;"&gt;    &lt;/div&gt;&lt;p style="text-align: justify;" class="MsoNormal"&gt;&lt;span style=""&gt;The most common form of a table in the Oracle database; the default type created with the&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="text-align: justify;"&gt;  &lt;/div&gt;&lt;p style="text-align: justify;" class="MsoNormal"&gt;&lt;span style=""&gt;CREATE TABLE &lt;/span&gt;&lt;span style=""&gt;statement.&lt;span style=""&gt;  &lt;/span&gt;A relational table is permanent and can be partitioned.&lt;/span&gt;&lt;span style=""&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="text-align: justify;"&gt;&lt;span style=""&gt;&lt;o:p&gt;5)&lt;/o:p&gt;&lt;/span&gt;&lt;span style="font-size:100%;"&gt;&lt;b&gt;&lt;span style=""&gt;External table&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;    &lt;/div&gt;&lt;p style="text-align: justify;" class="MsoNormal"&gt;&lt;span style=""&gt;A table whose definition is stored in the database but whose data is stored externally to the database.&lt;/span&gt;&lt;span style=""&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="text-align: justify;"&gt;    &lt;/div&gt;&lt;p style="text-align: justify;" class="MsoNormal"&gt;&lt;span style="font-size:100%;"&gt;&lt;b&gt;&lt;span style=""&gt;6)Index&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="text-align: justify;"&gt;    &lt;/div&gt;&lt;p style="text-align: justify;" class="MsoNormal"&gt;&lt;span style=""&gt;A database object designed to reduce the amount of time it takes to retrieve rows from a table. An index is created based on one or more columns in the table.&lt;/span&gt;&lt;span style=""&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="text-align: justify;"&gt;    &lt;/div&gt;&lt;p style="text-align: justify;" class="MsoNormal"&gt;&lt;span style="font-size:100%;"&gt;&lt;b&gt;&lt;span style=""&gt;7)Composite index&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="text-align: justify;"&gt;&lt;span style=""&gt;If an index that is created on two or more columns in a table. This is called as Composite index.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;span style=""&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;  &lt;/div&gt;&lt;p style="text-align: justify;" class="MsoNormal"&gt;&lt;span style="font-size:100%;"&gt;&lt;b&gt;&lt;span style=""&gt;8)Sequence&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="text-align: justify;"&gt;    &lt;/div&gt;&lt;p style="text-align: justify;" class="MsoNormal"&gt;&lt;span style=""&gt;It is a database structure that automatically generates a series of numbers typically used to assign primary key values to database tables.&lt;/span&gt;&lt;span style=""&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="text-align: justify;"&gt;    &lt;/div&gt;&lt;p style="text-align: justify;" class="MsoNormal"&gt;&lt;span style="font-size:100%;"&gt;&lt;b style=""&gt;&lt;span style=""&gt;9)Synonyms&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="text-align: justify;"&gt;    &lt;/div&gt;&lt;p style="text-align: justify;" class="MsoNormal"&gt;&lt;span style=""&gt;A &lt;/span&gt;&lt;span style="font-size:100%;"&gt;&lt;i&gt;&lt;span style=""&gt;synonym &lt;/span&gt;&lt;/i&gt;&lt;/span&gt;&lt;span style=""&gt;is an alias for another database object, such as a table, sequence, or view.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="text-align: justify;"&gt;  &lt;/div&gt;&lt;p style="text-align: justify;" class="MsoNormal"&gt;&lt;span style=""&gt;Synonyms provide easier access to database objects outside the user’s schema.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="text-align: justify;"&gt;  &lt;/div&gt;&lt;p style="text-align: justify;" class="MsoNormal"&gt;&lt;span style=""&gt;There are two kinds of synonyms: public and private. Public synonyms are Available to all database users. A private synonym is available only in the session of the schema owner who created it.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="text-align: justify;"&gt;    &lt;/div&gt;&lt;p style="text-align: justify;" class="MsoNormal"&gt;&lt;span style="font-size:100%;"&gt;&lt;b&gt;&lt;span style=""&gt;10)Username&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="text-align: justify;"&gt;    &lt;/div&gt;&lt;p style="text-align: justify;" class="MsoNormal"&gt;&lt;span style=""&gt;An Oracle database account identifier that, along with a password, allows a user to connect to the database.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="text-align: justify;"&gt;    &lt;/div&gt;&lt;p style="text-align: justify;" class="MsoNormal"&gt;&lt;span style="font-size:100%;"&gt;&lt;b&gt;&lt;span style=""&gt;11)Privileges&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="text-align: justify;"&gt;    &lt;/div&gt;&lt;p style="text-align: justify;" class="MsoNormal"&gt;&lt;span style=""&gt;The right to perform a specific action in the database granted by the DBA or other database users.&lt;/span&gt;&lt;span style=""&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="text-align: justify;"&gt;    &lt;/div&gt;&lt;p style="text-align: justify;" class="MsoNormal"&gt;&lt;span style="font-size:100%;"&gt;&lt;b&gt;&lt;span style=""&gt;12)System privileges&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="text-align: justify;"&gt;    &lt;/div&gt;&lt;p style="text-align: justify;" class="MsoNormal"&gt;&lt;span style=""&gt;Privileges that allow users to perform a specific action on one or more database objects or users in the database.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="text-align: justify;"&gt;  &lt;/div&gt;&lt;p style="text-align: justify;" class="MsoNormal"&gt;&lt;span style="font-size:100%;"&gt;&lt;b&gt;&lt;span style=""&gt;13)Object privileges&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="text-align: justify;"&gt;    &lt;/div&gt;&lt;p style="text-align: justify;" class="MsoNormal"&gt;&lt;span style=""&gt;Privileges that allow users to manipulate the contents of database objects in other schemas.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="text-align: justify;"&gt;&lt;span style=""&gt;&lt;o:p&gt;14)&lt;/o:p&gt;&lt;/span&gt;&lt;span style="font-size:100%;"&gt;&lt;b&gt;&lt;span style=""&gt;ROWID&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=""&gt;A unique identifier for a row in a table, maintained automatically in the table by the Oracle server.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;  &lt;/div&gt;&lt;p style="text-align: justify;" class="MsoNormal"&gt;&lt;span style=";font-family:Mono3Frame-Regular;font-size:100%;"  &gt;ROWID&lt;/span&gt;&lt;span style=""&gt;s are unique throughout the database.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="text-align: justify;"&gt;    &lt;/div&gt;&lt;p style="text-align: justify;" class="MsoNormal"&gt;&lt;span style=""&gt;15)&lt;span style="font-weight: bold;"&gt;Unique Index &lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="text-align: justify;"&gt;    &lt;/div&gt;&lt;p style="text-align: justify;" class="MsoNormal"&gt;&lt;span style=""&gt;In a &lt;/span&gt;&lt;span style="font-size:100%;"&gt;&lt;i&gt;&lt;span style=""&gt;Unique index,&lt;/span&gt;&lt;/i&gt;&lt;/span&gt;&lt;span style=""&gt;&lt;span style="font-size:100%;"&gt; there are no duplicate values. An error is returned if you try to insert two rows into a table with the same index column values. By default, an index is nonunique.&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7668553736104330014-1863824967181874686?l=oracledbarea.blogspot.com' alt='' /&gt;&lt;/div&gt;</description><link>http://feedproxy.google.com/~r/OracleDbasArea/~3/-AHVOwsnDm4/oracle-interview-questions.html</link><author>noreply@blogger.com (Jafar Ali)</author><thr:total>0</thr:total><feedburner:origLink>http://oracledbarea.blogspot.com/2008/08/oracle-interview-questions.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7668553736104330014.post-2497031414405972093</guid><pubDate>Sat, 16 Aug 2008 06:52:00 +0000</pubDate><atom:updated>2008-08-16T12:27:36.053+05:30</atom:updated><title>Changing SYSMAN password</title><description>&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;br /&gt;Stop the DB console by using below command on the command prompt.&lt;br /&gt;&lt;br /&gt;$&gt;emctl stop dbconsole&lt;br /&gt;&lt;br /&gt;This should stop dbconsole and the agent.&lt;br /&gt;&lt;br /&gt;Have a check first.&lt;br /&gt;&lt;br /&gt;$&gt;emctl status dbconsole&lt;br /&gt;&lt;br /&gt;$&gt;emctl status agent&lt;br /&gt;&lt;br /&gt;$&gt;sqlplus / as sysdba&lt;br /&gt;&lt;br /&gt;SQL&gt;alter user sysman identified by [New Password];&lt;br /&gt;&lt;br /&gt;Then check the new password by connecting with sysman user. This is to make sure sysman is not locked. Because when the password is changed and you try to reach the OEM, it will lock the sysman user.&lt;br /&gt;&lt;br /&gt;SQL&gt;conn sysman/newpassword&lt;br /&gt;connected.&lt;br /&gt;&lt;br /&gt;if you get&lt;br /&gt;ora-28000: account is locked&lt;br /&gt;&lt;br /&gt;Then unlock it first.&lt;br /&gt;&lt;br /&gt;SQL&gt; alter user sysman account unlock;&lt;br /&gt;&lt;br /&gt;Modifying the emoms.properties file.&lt;br /&gt;&lt;br /&gt;It’s located at ORACLE_HOME/[HOST]_[SID]/sysman/config. Replace HOST with your computer name and SID with your SID.&lt;br /&gt;&lt;br /&gt;There are 2 parameters to modify:&lt;br /&gt;&lt;br /&gt;oracle.sysman.eml.mntr.emdRepPwd= [Your encrypted password]&lt;br /&gt;oracle.sysman.eml.mntr.emdRepPwdEncrypted=True&lt;br /&gt;&lt;br /&gt;Change [Your encrypted password] with your new password in the first parameter (unencrypted current sysman password)&lt;br /&gt;and change True to False in the second parameter.&lt;br /&gt;&lt;br /&gt;As soon as you restart Dbconsole and Oracle agent, it will change false to true and will get encrypted.&lt;br /&gt;&lt;br /&gt;Start the dbconsole&lt;br /&gt;&lt;br /&gt;$&gt;emctl start dbconsole&lt;br /&gt;$&gt;emctl start agent&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7668553736104330014-2497031414405972093?l=oracledbarea.blogspot.com' alt='' /&gt;&lt;/div&gt;</description><link>http://feedproxy.google.com/~r/OracleDbasArea/~3/w6j6yVJZQHE/changing-sysman-password.html</link><author>noreply@blogger.com (Jafar Ali)</author><thr:total>0</thr:total><feedburner:origLink>http://oracledbarea.blogspot.com/2008/08/changing-sysman-password.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7668553736104330014.post-6409428838751116911</guid><pubDate>Thu, 17 Jul 2008 09:28:00 +0000</pubDate><atom:updated>2008-07-17T15:03:05.467+05:30</atom:updated><title>Database recovery using BCV</title><description>&lt;strong&gt;Database Recovery using BCV&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Step 1. –Mounting BCV and User credentials  &lt;br /&gt;&lt;br /&gt;a) Mount BCV on to BCV mounting server (10.27.1.152)&lt;br /&gt;b) Create appropriate oracle user (refer oracle user from Host server) with proper group spec&lt;br /&gt;c) Copy oracle user profile&lt;br /&gt;d) FTP the backup control file from /var/opt/oracle on host server to the BCV server say at $ORACLE_HOME/dbs&lt;br /&gt;e) Cross check all the Filesystem mounted on to BCV mounting server with host server&lt;br /&gt;&lt;br /&gt;All above steps to be done by Server support Team.&lt;br /&gt;&lt;br /&gt;Step2. Database Recovery&lt;br /&gt;&lt;br /&gt;a) Make changes in the Init ora file to read control file copied in step 1.d &lt;br /&gt;&lt;br /&gt;Edit control file entry in the init{SID}.ora &lt;br /&gt;#*.control_files='/u01/app/oracle/product/10g/oradata/ODSPROD/control01.ctl','/u04/oradata/ods1/control02.ctl','/&lt;br /&gt;u05/oradata/ods2/control03.ctl'&lt;br /&gt;*.control_files='/u01/app/oracle/product/10g/dbs/cntrl_bcv.dbf'&lt;br /&gt;*.core_dump_dest='/u01/app/oracle/product/10g/admin/ODSPROD/cdump'&lt;br /&gt;*.cursor_sharing='SIMILAR'&lt;br /&gt;*.db_block_size=8192&lt;br /&gt;&lt;br /&gt;b) Log in as Sysdba and startup database with pfile option as below&lt;br /&gt;&lt;br /&gt;    startup database in mount with pfile=init{SID}.ora&lt;br /&gt;&lt;br /&gt;oracle@sun152&gt;sqlplus&lt;br /&gt;SQL*Plus: Release 10.2.0.1.0 - Production on Wed Dec 26 13:33:50 2007&lt;br /&gt;Copyright (c) 1982, 2005, Oracle.  All rights reserved.&lt;br /&gt;Enter user-name: / as sysdba&lt;br /&gt;Connected to an idle instance.&lt;br /&gt;&lt;br /&gt;SQL&gt; startup mount pfile=initODSPROD.ora&lt;br /&gt;ORACLE instance started.&lt;br /&gt;&lt;br /&gt;Total System Global Area 4.0802E+10 bytes&lt;br /&gt;Fixed Size                  2250696 bytes&lt;br /&gt;Variable Size            3294210104 bytes&lt;br /&gt;Database Buffers         3.7497E+10 bytes&lt;br /&gt;Redo Buffers                8650752 bytes&lt;br /&gt;Database mounted.&lt;br /&gt;SQL&gt;&lt;br /&gt;&lt;br /&gt;SQL&gt; alter database open;&lt;br /&gt;alter database open&lt;br /&gt;*&lt;br /&gt;ERROR at line 1:&lt;br /&gt;ORA-01589: must use RESETLOGS or NORESETLOGS option for database open&lt;br /&gt;&lt;br /&gt;c) Check V$recover_file&lt;br /&gt;Check above V$view for CHANGE# same for all datafiles and also check for any File# missing, to Ensure backup done on proper backup mode&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;d) View V$log to analyze Sequence# of redo logs and note down current redolog group and its filename from v$logfile. &lt;br /&gt;&lt;br /&gt;SQL&gt; Select * from v$log;&lt;br /&gt;&lt;br /&gt;   GROUP#    THREAD#  SEQUENCE#      BYTES    MEMBERS ARC STATUS        FIRST_CHANGE# FIRST_TIM&lt;br /&gt;---------- ---------- ---------- ---------- ---------- --- ---------------- ------------- -------&lt;br /&gt;         5          1      64087  536870912          2 NO  CURRENT           1149658822 25-DEC-07&lt;br /&gt;         8          1      64086  536870912          2 YES INACTIVE          1149657091 25-DEC-07&lt;br /&gt;         7          1      64085  536870912          2 YES INACTIVE          1149466256 25-DEC-07&lt;br /&gt;         6          1      64084  536870912          2 YES INACTIVE          1149380057 25-DEC-07&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;d) Look for achivelog exist for above inactive Sequence#&lt;br /&gt;&lt;br /&gt;    ls –ltr archivelog destination&lt;br /&gt;&lt;br /&gt;-rw-r-----   1 oracle   oinstall 521260544 Dec 25 20:21 1_64084_605464450.arc&lt;br /&gt;-rw-r-----   1 oracle   oinstall 475254784 Dec 25 22:05 1_64085_605464450.arc&lt;br /&gt;-rw-r-----   1 oracle   oinstall 46111744 Dec 25 22:06 1_64086_605464450.arc&lt;br /&gt;&lt;br /&gt;In our case Current is 64087 and we have archive of 64086.&lt;br /&gt;&lt;br /&gt;e)Start Recovering database &lt;br /&gt;&lt;br /&gt;SQL&gt; recover database using BACKUP CONTROLFILE until cancel;&lt;br /&gt;ORA-00279: change 1149657417 generated at 12/25/2007 22:05:09 needed for thread 1&lt;br /&gt;ORA-00289: suggestion : /u03/oradata/archivelogs/1_64086_605464450.arc&lt;br /&gt;ORA-00280: change 1149657417 for thread 1 is in sequence #64086&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Specify log: {&lt;RET&gt;=suggested | filename | AUTO | CANCEL}&lt;br /&gt;&lt;br /&gt;ORA-00279: change 1149658822 generated at 12/25/2007 22:06:37 needed for thread 1&lt;br /&gt;ORA-00289: suggestion : /u03/oradata/archivelogs/1_64087_605464450.arc&lt;br /&gt;ORA-00280: change 1149658822 for thread 1 is in sequence #64087&lt;br /&gt;ORA-00278: log file '/u03/oradata/archivelogs/1_64086_605464450.arc' no longer needed for this recovery&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Specify log: {&lt;RET&gt;=suggested | filename | AUTO | CANCEL}&lt;br /&gt;/u14/oradata/origlogA-NEW/redo5.log  ===========  Supply the path of current redolog group&lt;br /&gt;Log applied.&lt;br /&gt;Media recovery complete.&lt;br /&gt;SQL&gt; alter database open resetlogs;&lt;br /&gt;&lt;br /&gt;Database altered.&lt;br /&gt;&lt;br /&gt;SQL&gt; archive log list.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;F) Shutdown immediate and copy the controlfile from dbs to all 3 original locations, and then then startup.&lt;br /&gt;&lt;br /&gt;G) Check for the temporary tablespace;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7668553736104330014-6409428838751116911?l=oracledbarea.blogspot.com' alt='' /&gt;&lt;/div&gt;</description><link>http://feedproxy.google.com/~r/OracleDbasArea/~3/yUZaJFxU2Nw/database-recovery-using-bcv.html</link><author>noreply@blogger.com (Jafar Ali)</author><thr:total>0</thr:total><feedburner:origLink>http://oracledbarea.blogspot.com/2008/07/database-recovery-using-bcv.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7668553736104330014.post-2326847255197401573</guid><pubDate>Tue, 15 Jul 2008 07:26:00 +0000</pubDate><atom:updated>2008-07-15T13:07:02.316+05:30</atom:updated><title>Creating new control files</title><description>Please follow below steps for creating new controlfiles.&lt;br /&gt;&lt;br /&gt;   1.Make a list of all datafiles and redo log files of the database.&lt;br /&gt;&lt;br /&gt;      If you follow recommendations for control file backups as discussed in "&lt;a href="http://download.oracle.com/docs/cd/B19306_01/server.102/b14231/control.htm#i1006485"&gt;Backing Up Control Files&lt;/a&gt;" , you will already have a list of datafiles and redo log files that reflect the current structure of the database. However, if you have no such list, executing the following statements will produce one.&lt;br /&gt;&lt;br /&gt;      SELECT MEMBER FROM V$LOGFILE;&lt;br /&gt;      SELECT NAME FROM V$DATAFILE; &lt;br /&gt;      SELECT VALUE FROM V$PARAMETER WHERE NAME = 'CONTROL_FILES';&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;      If you have no such lists and your control file has been damaged so that the database cannot be opened, try to locate all of the datafiles and redo log files that constitute the database. Any files not specified in step 5 are not recoverable once a new control file has been created. Moreover, if you omit any of the files that make up the SYSTEM tablespace, you might not be able to recover the database.&lt;br /&gt; &lt;br /&gt;  2.Shut down the database.&lt;br /&gt;&lt;br /&gt;      If the database is open, shut down the database normally if possible. Use the IMMEDIATE or ABORT clauses only as a last resort.&lt;br /&gt;&lt;br /&gt;   3.Back up all datafiles and redo log files of the database or cold backup.&lt;br /&gt;&lt;br /&gt;   4.Start up a new instance in nomount stage.&lt;br /&gt;&lt;br /&gt;      STARTUP NOMOUNT&lt;br /&gt;&lt;br /&gt;   5.Create a new control file for the database using the &lt;a href="http://www.psoug.org/reference/control_file.html"&gt;CREATE CONTROLFILE &lt;/a&gt;statement.&lt;br /&gt;&lt;br /&gt;      When creating a new control file, specify the RESETLOGS clause if you have lost any redo log groups in addition to control files. In this case, you will need to recover from the loss of the redo logs (step 8). You must specify the RESETLOGS clause if you have renamed the database. Otherwise, select the NORESETLOGS clause.&lt;br /&gt;  &lt;br /&gt; 6.Store a backup of the new control file on an offline storage device. &lt;br /&gt;  &lt;br /&gt; 7.Edit the CONTROL_FILES initialization parameter for the database to indicate all of the control files now part of your database as created in step 5 (not including the backup control file). If you are renaming the database, edit the DB_NAME parameter in your pfile to specify the new name.&lt;br /&gt;   &lt;br /&gt;8.Recover the database if necessary. If you are not recovering the database, skip to step 9.&lt;br /&gt;&lt;br /&gt;      If you are creating the control file as part of recovery, recover the database. If the new control file was created using the NORESETLOGS clause (step 5), you can recover the database with complete, closed database recovery.&lt;br /&gt;&lt;br /&gt;      If the new control file was created using the RESETLOGS clause, you must specify USING BACKUP CONTROL FILE. If you have lost online or archived redo logs or datafiles, use the procedures for recovering those files.&lt;br /&gt;&lt;br /&gt;   9.Open the database using one of the following methods:&lt;br /&gt;          &lt;br /&gt;            If you did not perform recovery, or you performed complete, closed database recovery in step 8, open the database normally.&lt;br /&gt;&lt;br /&gt;            ALTER DATABASE OPEN; &lt;br /&gt;          &lt;br /&gt;            If you specified RESETLOGS when creating the control file, use the ALTER DATABASE statement, indicating RESETLOGS.&lt;br /&gt;&lt;br /&gt;            ALTER DATABASE OPEN RESETLOGS;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;The database is now open and available for use.&lt;/strong&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7668553736104330014-2326847255197401573?l=oracledbarea.blogspot.com' alt='' /&gt;&lt;/div&gt;</description><link>http://feedproxy.google.com/~r/OracleDbasArea/~3/NJKsNzG2teM/creating-new-control-files.html</link><author>noreply@blogger.com (Jafar Ali)</author><thr:total>1</thr:total><feedburner:origLink>http://oracledbarea.blogspot.com/2008/07/creating-new-control-files.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7668553736104330014.post-4812018608578692085</guid><pubDate>Mon, 14 Jul 2008 06:18:00 +0000</pubDate><atom:updated>2008-07-14T11:56:34.569+05:30</atom:updated><title>How to rename a datafile</title><description>How to rename/move datafile from one location to another&lt;br /&gt;&lt;br /&gt;There is a need to relocate an Oracle datafile.&lt;br /&gt;&lt;br /&gt;Cause and Prerequisites&lt;br /&gt;&lt;br /&gt;You have created a datafile on the wrong filesystem or drive.&lt;br /&gt;You add a new filesystem(s), drive(s) to the system and want to&lt;br /&gt;redistribute the datafiles.&lt;br /&gt;You restore some datafiles to a new location because the original is not&lt;br /&gt;available any more ( media error )&lt;br /&gt;&lt;br /&gt;Solution&lt;br /&gt;&lt;br /&gt;There are several options to perform this task:&lt;br /&gt;&lt;br /&gt;Option 1)&lt;br /&gt;&lt;br /&gt;Connect to the open database.&lt;br /&gt;Take the tablespace offline:&lt;br /&gt;ALTER TABLESPACE &lt;NAME&gt; OFFLINE;&lt;br /&gt;Copy the datafiles to the new location by using OS commands.&lt;br /&gt;Compare the size of the two files, they have to be the same.&lt;br /&gt;Update the new datafile location with one of this commands:&lt;br /&gt;- ALTER DATABASE RENAME FILE '&lt;old&gt;' TO '&lt;new&gt;';&lt;br /&gt;- ALTER TABLESPACE &lt;NAME&gt; RENAME DATAFILE '&lt;old&gt;' TO '&lt;new&gt;';&lt;br /&gt;Bring the tablespace online with the command&lt;br /&gt;ALTER TABLESPACE &lt;NAME&gt; ONLINE;&lt;br /&gt;Remove at OS level the original file.&lt;br /&gt;You cannot use this method for the SYSTEM tablespace.&lt;br /&gt;&lt;br /&gt;Option 2)&lt;br /&gt;&lt;br /&gt;Stop the database.&lt;br /&gt;Copy the datafiles to the new location by using OS commands.&lt;br /&gt;Mount the database.&lt;br /&gt;STARTUP MOUNT&lt;br /&gt;Update the new datafile location:&lt;br /&gt;ALTER DATABASE RENAME FILE '&lt;old&gt;' TO '&lt;new&gt;';&lt;br /&gt;Open the database.&lt;br /&gt;Remove at OS level the original file.&lt;br /&gt;&lt;br /&gt;Option 3)&lt;br /&gt;&lt;br /&gt;Make a trace file using the command:&lt;br /&gt;ALTER DATABASE BACKUP CONTROLFILE TO TRACE;&lt;br /&gt;Modify datafile pointers in the tracefile generated above to&lt;br /&gt;reflect the changes and rename the file so the extension is "sql".&lt;br /&gt;Copy the datafiles to the new locations.&lt;br /&gt;Run the script created before.&lt;br /&gt;Remove at OS level the original file.&lt;br /&gt;&lt;br /&gt;NOTE: BEFORE making any structural changes to a database, such as renaming&lt;br /&gt;and relocating the datafiles of one or more tablespaces, always completely&lt;br /&gt;backup the database. AFTER making any structural changes to a database,&lt;br /&gt;always perform an immediate and complete backup.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7668553736104330014-4812018608578692085?l=oracledbarea.blogspot.com' alt='' /&gt;&lt;/div&gt;</description><link>http://feedproxy.google.com/~r/OracleDbasArea/~3/KOohLVLFTqQ/how-to-rename-datafile.html</link><author>noreply@blogger.com (Jafar Ali)</author><thr:total>0</thr:total><feedburner:origLink>http://oracledbarea.blogspot.com/2008/07/how-to-rename-datafile.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7668553736104330014.post-2720132162906890563</guid><pubDate>Mon, 14 Jul 2008 05:30:00 +0000</pubDate><atom:updated>2008-07-14T11:07:18.314+05:30</atom:updated><title>How to rename a database?</title><description>Following  are the steps to rename a Database&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;1. Start by making a full database backup of your database (in case you need to restore if this procedure is not                                                                          working). &lt;br /&gt;&lt;br /&gt;2.Execute this command from sqlplus while connected to 'SYS AS SYSDBA':&lt;br /&gt; ALTER DATABASE BACKUP CONTROLFILE TO TRACE RESETLOGS; &lt;br /&gt;&lt;br /&gt;3.Locate the latest dump file in your USER_DUMP_DEST directory (show parameter USER_DUMP_DEST) - rename it to something like dbrename.sql. &lt;br /&gt;&lt;br /&gt;4.Edit dbrename.sql, remove all headers and comments, and change the database's name. Also change "CREATE CONTROLFILE REUSE ..." to "CREATE  CONTROLFILE SET ...".                                                                       &lt;br /&gt;5.Shutdown the database (use SHUTDOWN NORMAL or IMMEDIATE, don't ABORT!) and run dbrename.sql. &lt;br /&gt;&lt;br /&gt;6.Rename the database's global name: &lt;br /&gt; ALTER DATABASE RENAME GLOBAL_NAME TO new_db_name;&lt;br /&gt;&lt;br /&gt;* To rename database you must recreate controlfiles.&lt;br /&gt;* Through the GUI (DBAstudio) you can only BACKUP CONTROLFILE TO TRACE;&lt;br /&gt;* Then find created trace file in your USER_DUMP_DESTINATION catalog.&lt;br /&gt;* It will be something like this:&lt;br /&gt;* The following commands will create a new control file and use it to open the database.&lt;br /&gt;* Data used by the recovery manager will be lost. Additional logs may&lt;br /&gt;  be required for media recovery of offline data files. Use this&lt;br /&gt;  only if the current version of all online logs are available.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Eg:-vi odsprod_ora_22609_cntrl.trc&lt;br /&gt;&lt;br /&gt;STARTUP NOMOUNT&lt;br /&gt;CREATE CONTROLFILE REUSE DATABASE "ODSQA" RESETLOGS  ARCHIVELOG&lt;br /&gt;    MAXLOGFILES 16&lt;br /&gt;    MAXLOGMEMBERS 3&lt;br /&gt;    MAXDATAFILES 100&lt;br /&gt;    MAXINSTANCES 8&lt;br /&gt;    MAXLOGHISTORY 2336&lt;br /&gt;LOGFILE&lt;br /&gt;  GROUP 1 (&lt;br /&gt;    '/u02A/oradata/admin/origlogA/redo01.log',&lt;br /&gt;    '/u02C/oradata/admin/mirrlogA/redo01_2.log'&lt;br /&gt;  ) SIZE 50M,&lt;br /&gt;  GROUP 2 (&lt;br /&gt;    '/u02A/oradata/admin/origlogA/redo02.log',&lt;br /&gt;    '/u02C/oradata/admin/mirrlogA/redo02_2.log'&lt;br /&gt;  ) SIZE 50M,&lt;br /&gt;  GROUP 3 (&lt;br /&gt;    '/u02A/oradata/admin/origlogA/redo03.log',&lt;br /&gt;    '/u02C/oradata/admin/mirrlogA/redo03_2.log'&lt;br /&gt;  ) SIZE 50M,&lt;br /&gt;  GROUP 4 (&lt;br /&gt;    '/u02A/oradata/admin/origlogA/redo04.log',&lt;br /&gt;    '/u02C/oradata/admin/mirrlogA/redo04_2.log'&lt;br /&gt;  ) SIZE 50M,&lt;br /&gt;  GROUP 5 (&lt;br /&gt;    '/u02A/oradata/admin/origlogA/redo05.log',&lt;br /&gt;    '/u02C/oradata/admin/mirrlogA/redo05_2.log'&lt;br /&gt;  ) SIZE 50M,&lt;br /&gt;  GROUP 6 (&lt;br /&gt;    '/u02A/oradata/admin/origlogA/redo06.log',&lt;br /&gt;    '/u02C/oradata/admin/mirrlogA/redo06_2.log'&lt;br /&gt;  ) SIZE 50M&lt;br /&gt;DATAFILE&lt;br /&gt;  '/u01/app/oracle/product/10g/oradata/ODSQA/system01.dbf',&lt;br /&gt;  '/u04/oradata/ods1/undotbs01.dbf',&lt;br /&gt;  '/u01/app/oracle/product/10g/oradata/ODSQA/sysaux01.dbf',&lt;br /&gt;  '/u01/app/oracle/product/10g/oradata/ODSQA/users01.dbf',&lt;br /&gt;  '/u07/oradata/ods4/DSSODS01.dbf',&lt;br /&gt;  '/u06/oradata/ods3/DSSODS02.dbf',&lt;br /&gt;  '/u06/oradata/ods3/EODODS01.DBF',&lt;br /&gt;  '/u06/oradata/ods3/EODODS02.DBF',&lt;br /&gt;  '/u06/oradata/ods3/Datemp01.dbf',&lt;br /&gt;  '/u06/oradata/ods3/EODODS03.DBF',&lt;br /&gt;  '/u06/oradata/ods3/DATEMP02.DBF',&lt;br /&gt;  '/u06/oradata/ods3/EODODS04.DBF',&lt;br /&gt;  '/u06/oradata/ods3/Datemp03.dbf',&lt;br /&gt;  '/u06/oradata/ods3/EODODS05.DBF',&lt;br /&gt;  '/u06/oradata/ods3/Datemp04.dbf',&lt;br /&gt;  '/u06/oradata/ods3/Datemp05.dbf',&lt;br /&gt;  '/u06/oradata/ods3/datemp06.dbf',&lt;br /&gt;  '/u06/oradata/ods3/EODODS06.dbf',&lt;br /&gt;  '/u06/oradata/ods3/Datemp07.dbf',&lt;br /&gt;  '/u06/oradata/ods3/EODODS07.DBF',&lt;br /&gt;  '/u06/oradata/ods3/EODODS08.DBF',&lt;br /&gt;  '/u05/oradata/ods2/datemp07.dbf',&lt;br /&gt;  '/u05/oradata/ods2/Datemp08.dbf',&lt;br /&gt;  '/u05/oradata/ods2/EODODS09.DBF',&lt;br /&gt;  '/u05/oradata/ods2/DSSODS03.dbf'&lt;br /&gt;CHARACTER SET WE8ISO8859P1&lt;br /&gt;;&lt;br /&gt;&lt;br /&gt;7. Recovery is required if any of the datafiles are restored backups,if the last shutdown was not normal or immediate.&lt;br /&gt;           RECOVER DATABASE;&lt;br /&gt;&lt;br /&gt;8. Database can now be opened normally.&lt;br /&gt;           ALTER DATABASE OPEN;&lt;br /&gt;&lt;br /&gt;9. Commands to add tempfiles to temporary tablespaces.&lt;br /&gt;&lt;br /&gt;ALTER TABLESPACE TEMP ADD TEMPFILE '/u05/oradata/ods2/temp01.dbf' SIZE 3077M REUSE                                       AUTOEXTEND ON NEXT 655360  MAXSIZE 32767M;&lt;br /&gt;&lt;br /&gt;ALTER TABLESPACE ODSTEMP ADD TEMPFILE '/u05/oradata/ods2/ODSTEMP02.dbf' SIZE 1024M REUSE AUTOEXTEND ON NEXT 10485760  MAXSIZE 5120M;&lt;br /&gt;&lt;br /&gt;ALTER TABLESPACE ODSTEMP ADD TEMPFILE '/u05/oradata/ods2/ODSTEMP01.DBF' SIZE 2048M REUSE AUTOEXTEND OFF;&lt;br /&gt;&lt;br /&gt;ALTER TABLESPACE ODSTEMP ADD TEMPFILE '/u05/oradata/ods2/ODSTEMP.dbf' SIZE 2048M REUSE AUTOEXTEND OFF;&lt;br /&gt;&lt;br /&gt;ALTER TABLESPACE EODODSTEMP ADD TEMPFILE '/u05/oradata/ods2/EODODSTEMP04' SIZE 2048M REUSE AUTOEXTEND OFF;&lt;br /&gt;&lt;br /&gt;ALTER TABLESPACE EODODSTEMP ADD TEMPFILE '/u05/oradata/ods2/EODODSTEMP03.DBF' SIZE 2048M REUSE AUTOEXTEND OFF;&lt;br /&gt;&lt;br /&gt;ALTER TABLESPACE EODODSTEMP ADD TEMPFILE '/u05/oradata/ods2/EODODSTEMP02.DBF' SIZE 1024M REUSE AUTOEXTEND OFF;&lt;br /&gt;&lt;br /&gt;ALTER TABLESPACE EODODSTEMP ADD TEMPFILE '/u05/oradata/ods2/EODODSTEMP01.DBF' SIZE 1024M REUSE AUTOEXTEND ON NEXT 10485760  MAXSIZE 5120M;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;   Alter User MGMT_VIEW temporary tablespace TEMP;&lt;br /&gt;   Alter User DEVOPS    temporary tablespace TEMP;&lt;br /&gt;   Alter User AKT007    temporary tablespace TEMP;&lt;br /&gt;   Alter User SYSMAN    temporary tablespace TEMP;&lt;br /&gt;   Alter User SYS       temporary tablespace TEMP;&lt;br /&gt;   Alter User SYSTEM    temporary tablespace TEMP;&lt;br /&gt;   Alter User WMSYS     temporary tablespace TEMP;&lt;br /&gt;   Alter User ORDSYS    temporary tablespace TEMP;&lt;br /&gt;   Alter User EXFSYS    temporary tablespace TEMP;&lt;br /&gt;   Alter User XDB       temporary tablespace TEMP;&lt;br /&gt;   Alter User DMSYS     temporary tablespace TEMP;&lt;br /&gt;   Alter User OLAPSYS   temporary tablespace TEMP;&lt;br /&gt;   Alter User MDDATA    temporary tablespace TEMP;&lt;br /&gt;   Alter User SI_INFORMTN_SCHEMA  temporary tablespace TEMP;&lt;br /&gt;   Alter User ORDPLUGINS temporary tablespace TEMP;&lt;br /&gt;   Alter User OUTLN      temporary tablespace TEMP;&lt;br /&gt;   Alter User MDSYS      temporary tablespace TEMP;&lt;br /&gt;   Alter User TSMSYS     temporary tablespace TEMP;&lt;br /&gt;   Alter User CTXSYS     temporary tablespace TEMP;&lt;br /&gt;   Alter User DIP        temporary tablespace TEMP;&lt;br /&gt;   Alter User ANONYMOUS  temporary tablespace TEMP;&lt;br /&gt;   Alter User SCOTT      temporary tablespace TEMP;&lt;br /&gt;&lt;br /&gt;Create TEMPORARY TABLESPACE ODSTEMP TEMPFILE '/u05/oradata/ods2/ODSTEMP02.dbf' SIZE 1024M REUSE AUTOEXTEND ON NEXT 10485760  MAXSIZE 5120M  &lt;br /&gt;EXTENT MANAGEMENT LOCAL UNIFORM SIZE 1M;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;CREATE TEMPORARY TABLESPACE temp2 TEMPFILE '/u02/oradata/TESTDB/temp2_01.dbf' SIZE 5M                              REUSE AUTOEXTEND ON NEXT 1M MAXSIZE unlimited EXTENT MANAGEMENT LOCAL UNIFORM SIZE 1M;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Create TEMPORARY TABLESPACE EODODSTEMP TEMPFILE '/u05/oradata/ods2/EODODSTEMP04' SIZE 2048M REUSE AUTOEXTEND OFF EXTENT MANAGEMENT LOCAL  UNIFORM SIZE 1M                                                &lt;br /&gt;alter database default temporary tablespace ODSTEMP;&lt;br /&gt;&lt;br /&gt;DROP tablespace temp;&lt;br /&gt;&lt;br /&gt;CREATE TEMPORARY TABLESPACE TEMP TEMPFILE '/u05/oradata/ods2/temp01.dbf' SIZE 3077M REUSE AUTOEXTEND ON NEXT 655360  MAXSIZE 32767M&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;10.we have to edit .bash profile&lt;br /&gt;&lt;br /&gt;  vi .profile&lt;br /&gt;   ".profile" 20 lines, 721 characters &lt;br /&gt;  ORACLE_HOME=/u01/app/oracle/product/10g; &lt;br /&gt;  export ORACLE_HOME&lt;br /&gt;  ORACLE_SID=ODSQA;export ORACLE_SID&lt;br /&gt;  ##ORACLE_SID=ODSPROD;export ORACLE_SID&lt;br /&gt;  ORACLE_PATH=/opt/bin;export ORACLE_PATH&lt;br /&gt;  PATH=$ORACLE_HOME/bin:$OPENWINHOME/bin:/usr/sbin/:/usr/ucb/:$PATH;export PATH&lt;br /&gt;  CURRENT_USER=`whoami`;export CURRENT_USER&lt;br /&gt;                            LD_LIBRARY_PATH=$ORACLE_HOME/10.2.0/db_1/lib:$OPENWINHOME/lib:/cdrom/lib;&lt;br /&gt;export LD_LIBRARY_PATH&lt;br /&gt;EDITOR=vi;export EDITOR&lt;br /&gt;ORACLE_DOC=$ORACLE_HOME/doc; export ORACLE_DOC&lt;br /&gt;## Prompt Setup&lt;br /&gt;PS1="`echo $CURRENT_USER`@`hostname | sed 's/\..*//'`&gt;"&lt;br /&gt;## end&lt;br /&gt;#alias bdump='cd /u01/app/oracle/product/10g/admin/ODSPROD/bdump'&lt;br /&gt;  #alias archive='cd /u03/oradata/archivelogs'&lt;br /&gt; #alias pfile='cd /u01/app/oracle/product/10g/dbs'&lt;br /&gt;. ./.profile&lt;br /&gt;&lt;br /&gt;11.edit initalisation parameter file with new database name&lt;br /&gt;&lt;br /&gt;vi initODSQA.ora&lt;br /&gt;&lt;br /&gt;ODSQA.__db_cache_size=10049552384&lt;br /&gt;ODSQA.__java_pool_size=33554432&lt;br /&gt;ODSQA.__large_pool_size=16777216&lt;br /&gt;ODSQA.__shared_pool_size=1660944384&lt;br /&gt;ODSQA.__streams_pool_size=33554432&lt;br /&gt;*.audit_file_dest='/u01/app/oracle/product/10g/admin/ODSQA/adump'&lt;br /&gt;*.background_dump_dest='/u01/app/oracle/product/10g/admin/ODSQA/bdump'&lt;br /&gt;*.compatible='10.2.0.1.0'   &lt;br /&gt;*.control_files='/u01/app/oracle/product/10g/oradata/ODSQA/control01.ctl','/u04/oradata/ods1/control02.ctl','/u05/oradata/ods2/control03.ctl'&lt;br /&gt;*.core_dump_dest='/u01/app/oracle/product/10g/admin/ODSQA/cdump'&lt;br /&gt;*.db_block_size=8192&lt;br /&gt;*.db_domain=''&lt;br /&gt;*.db_file_multiblock_read_count=16&lt;br /&gt;*.db_name='ODSQA'&lt;br /&gt;*.dispatchers='(PROTOCOL=TCP) (SERVICE=ODSQAXDB)'&lt;br /&gt;*.job_queue_processes=10&lt;br /&gt;*.log_archive_dest_1='LOCATION=/u03/oradata/archivelogs/'&lt;br /&gt;*.log_archive_format='%t_%s_%r.arc'&lt;br /&gt;*.open_cursors=300&lt;br /&gt;*.pga_aggregate_target=3221225472&lt;br /&gt;*.processes=300&lt;br /&gt;*.remote_login_passwordfile='EXCLUSIVE'&lt;br /&gt;*.sessions=335&lt;br /&gt;*.sga_target=11811160064&lt;br /&gt;*.undo_management='AUTO'&lt;br /&gt;*.undo_tablespace='UNDOTBS1'&lt;br /&gt;*.user_dump_dest='/u01/app/oracle/product/10g/admin/ODSQA/udump'&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;12.Create necessary folders in corresponding drives(/u01/app/oracle/product/10g/admin/ODSQA/)&lt;br /&gt;     mkdir bdump cdump udump adump&lt;br /&gt;&lt;br /&gt;13.copy control file&lt;br /&gt;/u01/app/oracle/product/10g/oradata/&lt;br /&gt;mkdir ODSQA&lt;br /&gt;oracle@DSS-ODSQA&gt;cp ../ODSPROD//control01.ctl &lt;br /&gt;&lt;br /&gt;CREATE CONTROLFILE REUSE DATABASE "ODSQA" NORESETLOGS NOARCHIVELOG&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;                       &lt;br /&gt;                                                                                                                                        &lt;br /&gt;            * &lt;span style="font-weight:bold;"&gt;DON’T FORGET BACKUP YOUR DATABASE BEFORE SCRIPT EXECUTION! &lt;/span&gt;*  &lt;br /&gt;                                                                                                                                       &lt;br /&gt;Thanks and regards&lt;br /&gt;&lt;br /&gt;Jafar Ali&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7668553736104330014-2720132162906890563?l=oracledbarea.blogspot.com' alt='' /&gt;&lt;/div&gt;</description><link>http://feedproxy.google.com/~r/OracleDbasArea/~3/cTXzAWCMzBY/how-to-rename-database.html</link><author>noreply@blogger.com (Jafar Ali)</author><thr:total>0</thr:total><feedburner:origLink>http://oracledbarea.blogspot.com/2008/07/how-to-rename-database.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7668553736104330014.post-3728433112658234061</guid><pubDate>Thu, 10 Jul 2008 14:40:00 +0000</pubDate><atom:updated>2008-07-10T20:12:29.161+05:30</atom:updated><title>Googlex Link Exchange</title><description>&lt;a href="http://www.blogger.com/&lt;a"&gt;Link&lt;/a&gt; Exchange&lt;/a&gt;
&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7668553736104330014-3728433112658234061?l=oracledbarea.blogspot.com' alt='' /&gt;&lt;/div&gt;</description><link>http://feedproxy.google.com/~r/OracleDbasArea/~3/lAGo2P_hunc/googlex-link-exchange.html</link><author>noreply@blogger.com (Jafar Ali)</author><thr:total>0</thr:total><feedburner:origLink>http://oracledbarea.blogspot.com/2008/07/googlex-link-exchange.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7668553736104330014.post-7408106735881865242</guid><pubDate>Thu, 10 Jul 2008 08:27:00 +0000</pubDate><atom:updated>2008-07-10T14:01:24.109+05:30</atom:updated><title>Oracle FAQS</title><description>Q1.       Which Oracle utility could you use to re-create Oracle tables and their&lt;br /&gt;associated objects under a new schema name and move the associated data from&lt;br /&gt;the previous schema to the new tables?&lt;br /&gt;&lt;br /&gt; A) SQL*Loader&lt;br /&gt; B) Direct-load insert&lt;br /&gt; C) Schema Manager&lt;br /&gt; D) Export/import utilities&lt;br /&gt;&lt;br /&gt;Correct Answer(s):  D) Export/import utilities&lt;br /&gt;&lt;br /&gt;Explanation:&lt;br /&gt;Answer d is correct. Export/import utilities are used to move tables, their&lt;br /&gt;associated objects, and their data from one user to another user. SQL*Loader&lt;br /&gt;is used to load data from external files into Oracle tables. Direct-load&lt;br /&gt;insert writes data directly into Oracle datafiles, without using the buffer&lt;br /&gt;cache. Schema Manager is an OEM utility used to create, edit, and examine&lt;br /&gt;schema objects. It cannot move data from one schema to another.&lt;br /&gt;&lt;br /&gt;Q2.       What is the default port for the host naming method?&lt;br /&gt;&lt;br /&gt; A) 1520&lt;br /&gt; B) 1521&lt;br /&gt; C) 1526&lt;br /&gt; D) 1601&lt;br /&gt; E) Any port may be used.&lt;br /&gt;&lt;br /&gt;Correct Answer(s): B) 1521&lt;br /&gt;&lt;br /&gt;Explanation:&lt;br /&gt;&lt;br /&gt;The correct answer is b. The default port number of 1521 is required when&lt;br /&gt;you configure host naming.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Q3.  What is the purpose of the library cache area of the shared pool?&lt;br /&gt;&lt;br /&gt; A) To store data on data dictionary caches&lt;br /&gt; B) To store data retrieved from data files&lt;br /&gt; C) To store shared SQL and PL/SQL&lt;br /&gt; D) To provide for sort areas&lt;br /&gt;&lt;br /&gt;Correct Answer(s): (C) To store shared SQL and PL/SQL&lt;br /&gt;&lt;br /&gt;Explanation:&lt;br /&gt;&lt;br /&gt;The correct answer is c. The library cache area of the SGA is used to store&lt;br /&gt;shared SQL and PL/SQL. Answer a is incorrect because this is the function of&lt;br /&gt;the data dictionary cache, which is a separate section of the shared pool&lt;br /&gt;from the library cache. Answer b is incorrect because this is the function&lt;br /&gt;of the database buffer pool, which is a separate section of the SGA from the&lt;br /&gt;shared pool, which contains the library cache. Answer d is incorrect because&lt;br /&gt;this is the function of the sort areas provided as a separate section of the&lt;br /&gt;shared pool (in multithreaded servers) or as a part of the user's memory&lt;br /&gt;area in multithreaded server (MTS) mode databases.&lt;br /&gt;&lt;br /&gt;Q4.       After you placed the tablespace LOOKUP_DATA in read-only mode, you took a&lt;br /&gt;backup of LOOKUP_DATA. How often do you need to perform subsequent backups?&lt;br /&gt;&lt;br /&gt; A) Each time a data file is added to the database.&lt;br /&gt; B) Each time the control file is changed.&lt;br /&gt; B) Each time the control file is changed.&lt;br /&gt; C) Each time a database backup is performed.&lt;br /&gt; D) Subsequent backups are not required.&lt;br /&gt;&lt;br /&gt;Correct Answer(s):&lt;br /&gt;&lt;br /&gt; D) Subsequent backups are not required.&lt;br /&gt;&lt;br /&gt;Explanation:&lt;br /&gt;&lt;br /&gt;The correct answer is d. The data in a read-only tablespace is static. You&lt;br /&gt;only need to back up the LOOKUP_DATA tablespace immediately after it becomes&lt;br /&gt;read-only. Answers a, b, and c are incorrect, because read-only tablespaces&lt;br /&gt;don't need to be backed up under these circumstances.&lt;br /&gt;&lt;br /&gt;Your production database has 15 data files spread across three disk drives.&lt;br /&gt;How many backup sets are created by the following command sequence?&lt;br /&gt;&lt;br /&gt;RMAN&gt; RUN {&lt;br /&gt;   2&gt; ALLOCATE CHANNEL c1 TYPE 'SBT_TAPE';&lt;br /&gt;   3&gt; BACKUP&lt;br /&gt;   4&gt; (DATABASE FILESPERSET = 3);&lt;br /&gt;   5&gt; RELEASE CHANNEL c1; }&lt;br /&gt;&lt;br /&gt; A) None&lt;br /&gt; B) One&lt;br /&gt; B) One&lt;br /&gt; C) Two&lt;br /&gt; D) Three&lt;br /&gt; E) Four&lt;br /&gt; F) Five&lt;br /&gt;&lt;br /&gt;Correct Answer(s):&lt;br /&gt;&lt;br /&gt; F) Five&lt;br /&gt;&lt;br /&gt;Explanation:&lt;br /&gt;&lt;br /&gt;The correct answer is f. The FILESPERSET option of the BACKUP command&lt;br /&gt;specifies the number of files included in each backup set. For the sample&lt;br /&gt;command, five backup sets with three files in each backup set will be&lt;br /&gt;created. Answers a, b, c, d, and e are incorrect, because they don't match&lt;br /&gt;the five backup sets the sample command will create.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;What is the minimum number of redo log groups you need to configure for your&lt;br /&gt;Oracle database?&lt;br /&gt;&lt;br /&gt; A) One&lt;br /&gt; B) Two&lt;br /&gt; B) Two&lt;br /&gt; C) Three&lt;br /&gt; D) Four&lt;br /&gt;&lt;br /&gt;Which of the following would be suitable circumstances in which to operate a&lt;br /&gt;database in NOARCHIVELOG mode?&lt;br /&gt;&lt;br /&gt; A) Control files are multiplexed.&lt;br /&gt; B) Redo log files are multiplexed.&lt;br /&gt; B) Redo log files are multiplexed.&lt;br /&gt; C) The database can be shut down regularly to perform OS backups.&lt;br /&gt; D) You can perform online backups while the database is in use.&lt;br /&gt;&lt;br /&gt;Correct Answer(s):&lt;br /&gt;&lt;br /&gt; C) The database can be shut down regularly to perform OS backups.&lt;br /&gt;&lt;br /&gt;Explanation:&lt;br /&gt;&lt;br /&gt;The correct answer is c. If you can regularly shut down a database for&lt;br /&gt;backups, then you could consider operating the database in NOARCHIVELOG mode&lt;br /&gt;if any lost data can be tolerated. Answers a and b are incorrect, because&lt;br /&gt;these files should be multiplexed independent of the database log mode.&lt;br /&gt;Answer d is incorrect, because ARCHIVELOG mode enables you to perform online&lt;br /&gt;backups while the database is open and in use.&lt;br /&gt;&lt;br /&gt;What is the minimum number of redo log groups you need to configure for your&lt;br /&gt;Oracle database?&lt;br /&gt;&lt;br /&gt; A) One&lt;br /&gt; B) Two&lt;br /&gt; B) Two&lt;br /&gt; C) Three&lt;br /&gt; D) Four&lt;br /&gt;&lt;br /&gt;Which of the following would be suitable circumstances in which to operate a&lt;br /&gt;database in NOARCHIVELOG mode?&lt;br /&gt;&lt;br /&gt; A) Control files are multiplexed.&lt;br /&gt; B) Redo log files are multiplexed.&lt;br /&gt; B) Redo log files are multiplexed.&lt;br /&gt; C) The database can be shut down regularly to perform OS backups.&lt;br /&gt; D) You can perform online backups while the database is in use.&lt;br /&gt;&lt;br /&gt;Correct Answer(s):&lt;br /&gt;&lt;br /&gt; C) The database can be shut down regularly to perform OS backups.&lt;br /&gt;&lt;br /&gt;Explanation:&lt;br /&gt;&lt;br /&gt;The correct answer is c. If you can regularly shut down a database for&lt;br /&gt;backups, then you could consider operating the database in NOARCHIVELOG mode&lt;br /&gt;if any lost data can be tolerated. Answers a and b are incorrect, because&lt;br /&gt;these files should be multiplexed independent of the database log mode.&lt;br /&gt;Answer d is incorrect, because ARCHIVELOG mode enables you to perform online&lt;br /&gt;backups while the database is open and in use.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Which of the following statements is NOT true about the recovery catalog?&lt;br /&gt;&lt;br /&gt; A) The recovery catalog should be created in a database that is separate&lt;br /&gt;from the target database.&lt;br /&gt; B) The recovery catalog should be used when stored scripts are required.&lt;br /&gt; B) The recovery catalog should be used when stored scripts are required.&lt;br /&gt; C) The recovery catalog should be used when incremental block level backups&lt;br /&gt;are required.&lt;br /&gt; D) The recovery catalog should be used when historical information about&lt;br /&gt;backup, restore, and recovery operations needs to be retained.&lt;br /&gt; E) The recovery catalog should reside in the same database as the target&lt;br /&gt;database.&lt;br /&gt;&lt;br /&gt;What is the minimum number of redo log groups you need to configure for your&lt;br /&gt;Oracle database?&lt;br /&gt;&lt;br /&gt; A) One&lt;br /&gt; B) Two&lt;br /&gt; B) Two&lt;br /&gt; C) Three&lt;br /&gt; D) Four&lt;br /&gt;&lt;br /&gt;Correct Answer(s):&lt;br /&gt;&lt;br /&gt; B) Two&lt;br /&gt; B) Two&lt;br /&gt;&lt;br /&gt;Explanation:&lt;br /&gt;&lt;br /&gt;The correct answer is b. The LGWR process writes redo log files in a&lt;br /&gt;circular fashion, so two redo log groups are required to support this&lt;br /&gt;operation. By default, Oracle creates two redo log groups. Answers a, b, and&lt;br /&gt;d are incorrect, because they don't match the default number of two.&lt;br /&gt;&lt;br /&gt;Which of the following statements is NOT true about the recovery catalog?&lt;br /&gt;&lt;br /&gt; A) The recovery catalog should be created in a database that is separate&lt;br /&gt;from the target database.&lt;br /&gt; B) The recovery catalog should be used when stored scripts are required.&lt;br /&gt; B) The recovery catalog should be used when stored scripts are required.&lt;br /&gt; C) The recovery catalog should be used when incremental block level backups&lt;br /&gt;are required.&lt;br /&gt; D) The recovery catalog should be used when historical information about&lt;br /&gt;backup, restore, and recovery operations needs to be retained.&lt;br /&gt; E) The recovery catalog should reside in the same database as the target&lt;br /&gt;database.&lt;br /&gt;&lt;br /&gt;What is the minimum number of redo log groups you need to configure for your&lt;br /&gt;Oracle database?&lt;br /&gt;&lt;br /&gt; A) One&lt;br /&gt; B) Two&lt;br /&gt; B) Two&lt;br /&gt; C) Three&lt;br /&gt; D) Four&lt;br /&gt;&lt;br /&gt;Correct Answer(s):&lt;br /&gt;&lt;br /&gt; B) Two&lt;br /&gt; B) Two&lt;br /&gt;&lt;br /&gt;Explanation:&lt;br /&gt;&lt;br /&gt;The correct answer is b. The LGWR process writes redo log files in a&lt;br /&gt;circular fashion, so two redo log groups are required to support this&lt;br /&gt;operation. By default, Oracle creates two redo log groups. Answers a, b, and&lt;br /&gt;d are incorrect, because they don't match the default number of two.&lt;br /&gt;&lt;br /&gt;Which of the following statements is NOT true about the recovery catalog?&lt;br /&gt;&lt;br /&gt; A) The recovery catalog should be created in a database that is separate&lt;br /&gt;from the target database.&lt;br /&gt; B) The recovery catalog should be used when stored scripts are required.&lt;br /&gt; B) The recovery catalog should be used when stored scripts are required.&lt;br /&gt; C) The recovery catalog should be used when incremental block level backups&lt;br /&gt;are required.&lt;br /&gt; D) The recovery catalog should be used when historical information about&lt;br /&gt;backup, restore, and recovery operations needs to be retained.&lt;br /&gt; E) The recovery catalog should reside in the same database as the target&lt;br /&gt;database.&lt;br /&gt;&lt;br /&gt;What is the minimum number of redo log groups you need to configure for your&lt;br /&gt;Oracle database?&lt;br /&gt;&lt;br /&gt; A) One&lt;br /&gt; B) Two&lt;br /&gt; B) Two&lt;br /&gt; C) Three&lt;br /&gt; D) Four&lt;br /&gt;&lt;br /&gt;Correct Answer(s):&lt;br /&gt;&lt;br /&gt; B) Two&lt;br /&gt; B) Two&lt;br /&gt;&lt;br /&gt;Explanation:&lt;br /&gt;&lt;br /&gt;The correct answer is b. The LGWR process writes redo log files in a&lt;br /&gt;circular fashion, so two redo log groups are required to support this&lt;br /&gt;operation. By default, Oracle creates two redo log groups. Answers a, b, and&lt;br /&gt;d are incorrect, because they don't match the default number of two.&lt;br /&gt;&lt;br /&gt;Which EXPORT mode can be used to export all objects owned by user Steve?&lt;br /&gt;&lt;br /&gt; A) Full database&lt;br /&gt; B) Tablespace&lt;br /&gt; B) Tablespace&lt;br /&gt; C) Table&lt;br /&gt; D) User&lt;br /&gt;&lt;br /&gt;Which of the following statements is NOT true about the recovery catalog?&lt;br /&gt;&lt;br /&gt; A) The recovery catalog should be created in a database that is separate&lt;br /&gt;from the target database.&lt;br /&gt; B) The recovery catalog should be used when stored scripts are required.&lt;br /&gt; B) The recovery catalog should be used when stored scripts are required.&lt;br /&gt; C) The recovery catalog should be used when incremental block level backups&lt;br /&gt;are required.&lt;br /&gt; D) The recovery catalog should be used when historical information about&lt;br /&gt;backup, restore, and recovery operations needs to be retained.&lt;br /&gt; E) The recovery catalog should reside in the same database as the target&lt;br /&gt;database.&lt;br /&gt;&lt;br /&gt;Correct Answer(s):&lt;br /&gt;&lt;br /&gt; E) The recovery catalog should reside in the same database as the target&lt;br /&gt;database.&lt;br /&gt;&lt;br /&gt;Explanation:&lt;br /&gt;&lt;br /&gt;The correct answer is e. The recovery catalog should reside in a database&lt;br /&gt;that is separate from the target database. Answers a, b, c, and d are&lt;br /&gt;incorrect, because they are true statements about the recovery catalog.&lt;br /&gt;&lt;br /&gt;Which EXPORT mode can be used to export all objects owned by user Steve?&lt;br /&gt;&lt;br /&gt; A) Full database&lt;br /&gt; B) Tablespace&lt;br /&gt; B) Tablespace&lt;br /&gt; C) Table&lt;br /&gt; D) User&lt;br /&gt;&lt;br /&gt;The answer to today's Question of the Day will appear in tomorrow's mailing.&lt;br /&gt;If you would like to find out the answer immediately, please go to&lt;br /&gt;http://www.examcram.com/studyresource/qod/login.asp  The answer will be&lt;br /&gt;accessible until Apr  3 2002.&lt;br /&gt;&lt;br /&gt;----------------------------------------------------------------------------&lt;br /&gt;      Yesterday's Question of the Day and Answer for Oracle8 DBA: Backup and&lt;br /&gt;Recovery&lt;br /&gt;                            Mar 28 2002&lt;br /&gt;----------------------------------------------------------------------------&lt;br /&gt;Which of the following statements is NOT true about the recovery catalog?&lt;br /&gt;&lt;br /&gt; A) The recovery catalog should be created in a database that is separate&lt;br /&gt;from the target database.&lt;br /&gt; B) The recovery catalog should be used when stored scripts are required.&lt;br /&gt; B) The recovery catalog should be used when stored scripts are required.&lt;br /&gt; C) The recovery catalog should be used when incremental block level backups&lt;br /&gt;are required.&lt;br /&gt; D) The recovery catalog should be used when historical information about&lt;br /&gt;backup, restore, and recovery operations needs to be retained.&lt;br /&gt; E) The recovery catalog should reside in the same database as the target&lt;br /&gt;database.&lt;br /&gt;&lt;br /&gt;Correct Answer(s):&lt;br /&gt;&lt;br /&gt; E) The recovery catalog should reside in the same database as the target&lt;br /&gt;database.&lt;br /&gt;&lt;br /&gt;Explanation:&lt;br /&gt;&lt;br /&gt;The correct answer is e. The recovery catalog should reside in a database&lt;br /&gt;that is separate from the target database. Answers a, b, c, and d are&lt;br /&gt;incorrect, because they are true statements about the recovery catalog.&lt;br /&gt;&lt;br /&gt;Which of the following initialization parameter settings will enable check&lt;br /&gt;summing for the online redo log files?&lt;br /&gt;&lt;br /&gt; A) DB_BLOCK_CHECKSUM=Y&lt;br /&gt; B) DB_BLOCK_CHECKSUM=TRUE&lt;br /&gt; B) DB_BLOCK_CHECKSUM=TRUE&lt;br /&gt; C) LOG_BLOCK_CHECKSUM=Y&lt;br /&gt; D) LOG_BLOCK_CHECKSUM=TRUE&lt;br /&gt;&lt;br /&gt;The answer to today's Question of the Day will appear in tomorrow's mailing.&lt;br /&gt;If you would like to find out the answer immediately, please go to&lt;br /&gt;http://www.examcram.com/studyresource/qod/login.asp  The answer will be&lt;br /&gt;accessible until Apr  4 2002.&lt;br /&gt;&lt;br /&gt;----------------------------------------------------------------------------&lt;br /&gt;      Yesterday's Question of the Day and Answer for Oracle8 DBA: Backup and&lt;br /&gt;Recovery&lt;br /&gt;                            Mar 29 2002&lt;br /&gt;----------------------------------------------------------------------------&lt;br /&gt;Which EXPORT mode can be used to export all objects owned by user Steve?&lt;br /&gt;&lt;br /&gt; A) Full database&lt;br /&gt; B) Tablespace&lt;br /&gt; B) Tablespace&lt;br /&gt; C) Table&lt;br /&gt; D) User&lt;br /&gt;&lt;br /&gt;Correct Answer(s):&lt;br /&gt;&lt;br /&gt; D) User&lt;br /&gt;&lt;br /&gt;Explanation:&lt;br /&gt;&lt;br /&gt;The correct answer is d. The EXPORT user mode will export all the objects in&lt;br /&gt;a user's schema. Users can back up their own schema. A privileged user such&lt;br /&gt;as the DBA can export all objects owned by one or more schemas. Answer a is&lt;br /&gt;incorrect, because it will export all database objects except those owned by&lt;br /&gt;the SYS schema. Answer b is incorrect, because it is an invalid export mode.&lt;br /&gt;Answer c is incorrect, because it will only export specified tables owned by&lt;br /&gt;the user schema.&lt;br /&gt;&lt;br /&gt;When one of the Oracle background processes fails and the database shuts&lt;br /&gt;down, where are the errors recorded?&lt;br /&gt;&lt;br /&gt; A) CORE_DUMP_DEST&lt;br /&gt; B) LOG_ARCHIVE_DEST&lt;br /&gt; B) LOG_ARCHIVE_DEST&lt;br /&gt; C) USER_DUMP_DEST&lt;br /&gt; D) BACKGROUND_DUMP_DEST&lt;br /&gt;&lt;br /&gt;Which of the following initialization parameter settings will enable check&lt;br /&gt;summing for the online redo log files?&lt;br /&gt;&lt;br /&gt; A) DB_BLOCK_CHECKSUM=Y&lt;br /&gt; B) DB_BLOCK_CHECKSUM=TRUE&lt;br /&gt; B) DB_BLOCK_CHECKSUM=TRUE&lt;br /&gt; C) LOG_BLOCK_CHECKSUM=Y&lt;br /&gt; D) LOG_BLOCK_CHECKSUM=TRUE&lt;br /&gt;&lt;br /&gt;Correct Answer(s):&lt;br /&gt;&lt;br /&gt; D) LOG_BLOCK_CHECKSUM=TRUE&lt;br /&gt;&lt;br /&gt;Explanation:&lt;br /&gt;&lt;br /&gt;The correct answer is d. When the LOG_BLOCK_CHECKSUM parameter is set to&lt;br /&gt;TRUE, check summing for the online redo log files will be enabled. Answers a&lt;br /&gt;and c are incorrect, because they are invalid parameter specifications.&lt;br /&gt;Answer b is incorrect, because DB_BLOCK_CHECKSUM parameter applies to check&lt;br /&gt;summing of data files.&lt;br /&gt;&lt;br /&gt;Which of the following commands is used to perform an online backup of the&lt;br /&gt;control file?&lt;br /&gt;&lt;br /&gt; A) ALTER DATABASE BACKUP CONTROLFILE TO TRACE&lt;br /&gt; B) ALTER SYSTEM BACKUP CONTROLFILE TO TRACE&lt;br /&gt; B) ALTER SYSTEM BACKUP CONTROLFILE TO TRACE&lt;br /&gt; C) ALTER SYSTEM BACKUP CONTROLFILE TO &lt;filename&gt;&lt;br /&gt; D) ALTER DATABASE BACKUP CONTROLFILE TO &lt;filename&gt;&lt;br /&gt; E) ALTER SESSION BACKUP CONTROLFILE TO &lt;filename&gt;&lt;br /&gt;&lt;br /&gt;When one of the Oracle background processes fails and the database shuts&lt;br /&gt;down, where are the errors recorded?&lt;br /&gt;&lt;br /&gt; A) CORE_DUMP_DEST&lt;br /&gt; B) LOG_ARCHIVE_DEST&lt;br /&gt; B) LOG_ARCHIVE_DEST&lt;br /&gt; C) USER_DUMP_DEST&lt;br /&gt; D) BACKGROUND_DUMP_DEST&lt;br /&gt;&lt;br /&gt;Correct Answer(s):&lt;br /&gt;&lt;br /&gt; D) BACKGROUND_DUMP_DEST&lt;br /&gt;&lt;br /&gt;Explanation:&lt;br /&gt;&lt;br /&gt;The correct answer is d. When Oracle background processes encounter errors,&lt;br /&gt;they will write the error trace files to the location specified by the&lt;br /&gt;initialization parameter BACKGROUND_DUMP_DEST. Answers a, b, and c are&lt;br /&gt;incorrect, because the background processes don't write error trace files to&lt;br /&gt;these locations.&lt;br /&gt;&lt;br /&gt;How will your backup strategy affect recoverability?&lt;br /&gt;&lt;br /&gt; A) It will help you determine additional storage device needs.&lt;br /&gt; B) It determines whether complete or incomplete recovery can be performed.&lt;br /&gt; B) It determines whether complete or incomplete recovery can be performed.&lt;br /&gt; C) It will help you get management support.&lt;br /&gt; D) It will not affect recoverability.&lt;br /&gt;&lt;br /&gt;Which of the following commands is used to perform an online backup of the&lt;br /&gt;control file?&lt;br /&gt;&lt;br /&gt; A) ALTER DATABASE BACKUP CONTROLFILE TO TRACE&lt;br /&gt; B) ALTER SYSTEM BACKUP CONTROLFILE TO TRACE&lt;br /&gt; B) ALTER SYSTEM BACKUP CONTROLFILE TO TRACE&lt;br /&gt; C) ALTER SYSTEM BACKUP CONTROLFILE TO &lt;filename&gt;&lt;br /&gt; D) ALTER DATABASE BACKUP CONTROLFILE TO &lt;filename&gt;&lt;br /&gt; E) ALTER SESSION BACKUP CONTROLFILE TO &lt;filename&gt;&lt;br /&gt;&lt;br /&gt;Correct Answer(s):&lt;br /&gt;&lt;br /&gt; D) ALTER DATABASE BACKUP CONTROLFILE TO &lt;filename&gt;&lt;br /&gt;&lt;br /&gt;Explanation:&lt;br /&gt;&lt;br /&gt;The correct answer is d. The ALTER DATABASE BACKUP CONTROL-FILE TO&lt;br /&gt;&lt;filename&gt; command is used to take an online backup of the control file.&lt;br /&gt;Answer a is incorrect, because it only creates a text script trace file that&lt;br /&gt;may subsequently be modified and executed to create the binary control file.&lt;br /&gt;Answers b, c, and e are incorrect, because they are invalid command&lt;br /&gt;specifications.&lt;br /&gt;&lt;br /&gt;After you placed the tablespace LOOKUP_DATA in read-only mode, you took a&lt;br /&gt;backup of LOOKUP_DATA. How often do you need to perform subsequent backups?&lt;br /&gt;&lt;br /&gt; A) Each time a data file is added to the database.&lt;br /&gt; B) Each time the control file is changed.&lt;br /&gt; B) Each time the control file is changed.&lt;br /&gt; C) Each time a database backup is performed.&lt;br /&gt; D) Subsequent backups are not required.&lt;br /&gt;&lt;br /&gt;How will your backup strategy affect recoverability?&lt;br /&gt;&lt;br /&gt; A) It will help you determine additional storage device needs.&lt;br /&gt; B) It determines whether complete or incomplete recovery can be performed.&lt;br /&gt; B) It determines whether complete or incomplete recovery can be performed.&lt;br /&gt; C) It will help you get management support.&lt;br /&gt; D) It will not affect recoverability.&lt;br /&gt;&lt;br /&gt;Correct Answer(s):&lt;br /&gt;&lt;br /&gt; B) It determines whether complete or incomplete recovery can be performed.&lt;br /&gt; B) It determines whether complete or incomplete recovery can be performed.&lt;br /&gt;&lt;br /&gt;Explanation:&lt;br /&gt;&lt;br /&gt;The correct answer is b. Your backup strategy determines the type of&lt;br /&gt;recovery that can be performed. Answers a and c are incorrect, because they&lt;br /&gt;don't affect recoverability. Answer d is incorrect, because your backup&lt;br /&gt;strategy does affect recoverability.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7668553736104330014-7408106735881865242?l=oracledbarea.blogspot.com' alt='' /&gt;&lt;/div&gt;</description><link>http://feedproxy.google.com/~r/OracleDbasArea/~3/4up5qii5K2c/oracle-faqs.html</link><author>noreply@blogger.com (Jafar Ali)</author><thr:total>0</thr:total><feedburner:origLink>http://oracledbarea.blogspot.com/2008/07/oracle-faqs.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7668553736104330014.post-4181936271940808293</guid><pubDate>Thu, 10 Jul 2008 08:19:00 +0000</pubDate><atom:updated>2008-07-10T13:56:42.289+05:30</atom:updated><title>The Hot Backup</title><description>3. The Hot Backup.&lt;br /&gt;The ARCHIVELOG function that came in OracleV6 opened up a whole new set of possible backup options, but also caused a lot of heartache until they got it working right.&lt;br /&gt;Good parts about Archivelog:&lt;br /&gt;It gives you 24-hour availability.&lt;br /&gt;It gives you point-in-time recovery.&lt;br /&gt;It allows you to restore without losing any data at all.&lt;br /&gt;It lets you keep the database up, preserving the data in your SGA.&lt;br /&gt;Bad parts about Archivelog:&lt;br /&gt;Administration can be difficult.&lt;br /&gt;Repetitive failed load attempts can create massive logs.&lt;br /&gt;When it gets stuck, the database comes to a halt.&lt;br /&gt;Implementing Archivelog:&lt;br /&gt;To start using Archivelog, simply alter your startup command file:&lt;br /&gt;startup mount exclusive&lt;br /&gt;;connect internal;&lt;br /&gt;alter database archivelog;&lt;br /&gt;archive log start;alter database open;&lt;br /&gt;and startup the database. From then on, the database will be in Archivelog mode until you turn it off (alter database noarchivelog). Note that a failed transaction is still a transaction; Archivelog keeps track of rollback segment extents, so rolled back inserts or deletes affect it just like completed transactions. Turn it off (shutdown, restart with noarchivelog mode) before doing big loads from SQL*Loader.&lt;br /&gt;Another option for controlling the amount of archived redo log entries generated is to use the UNRECOVERABLE keyword, available as of 7.2. UNRECOVERABLE can be used with the CREATE INDEX and CREATE TABLE AS SELECT commands; if it is used, then the transaction will not generate redo entries.&lt;br /&gt;When you start archiving, archived logs will be written every time the redo operation is about to overwrite a previously written logfile. It will write it to the directory indicated by the log_archive_dest parameter in your init.ora file. They will all be the same size (in V6; V7 can have variably sized archive logs) as your redo logs. They will increase in number until they run out of space on their destination device. At that point the database will freeze until you clear more space for them in the log_archive_dest location. SO, have a second location ready to receive them.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Backup strategy for Archivelogs:&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;1. Do each tablespace one at a time. That is, rather than setting them all offline, then backing them up, then setting them back online, do them each separately. You don't want to risk having a system crash while the entire database is in begin backup state; recovery is a mess. Minimize your window of vulnerability by having only one tablespace in backup state at any one time.&lt;br /&gt;&lt;br /&gt;If you are using RAID devices or mirrored disks, in which the loss of a single disk does not cause the loss of a file, then you can simplify your backup procedures by taking all of the tablespaces offline at once, and backing them up as a set.&lt;br /&gt;&lt;br /&gt;2. Before you backup the control file, force an archive log switch. This will update the header information in the control file.&lt;br /&gt;&lt;br /&gt;3. Don't do it during user activity. When in backup state, a tablespace's activity is still written to the archive logs. However, it's written block-by-block rather than byte-by-byte. So changing one record in a tablespace that's being backed up will result in that record's entire block being written to the archive area. NOTE: This is correct only for those platforms where the physical sector size is less than the Oracle logical block size. On systems where the physical disk transfer size is equal to the Oracle block size, then we do not incur the penalty of having to log the entire block. This is true for MVS, VM, and perhaps other systems.&lt;br /&gt;Sample Archive log command file for VMS:&lt;br /&gt;NOTE: See Rama's book for a more complete script; the code is available at the Web site.&lt;br /&gt;&lt;br /&gt;$ dup = "backup/ignore=(noback,interl,label)/log"&lt;br /&gt;$ sqldbaCONNECT INTERNALalter tablespace system begin backup;exit&lt;br /&gt;$ dup u01:[oracle]ora_system.dbs tape1:ora_system.bck/sav&lt;br /&gt;$ sqldbaCONNECT INTERNALalter tablespace system end backup;alter tablespace appl1 begin backup;exit&lt;br /&gt;$ dup u02:[oracle]appl1.dbs tape1:appl1.bck/sav&lt;br /&gt;$ sqldbaCONNECT INTERNALalter tablespace appl1 end backup;exit&lt;br /&gt;$!$! get archive logs&lt;br /&gt;$ rename/log u03:[oracle.arcs]*.arc *.arclogs&lt;br /&gt;$ rename/log u04:[oracle.arcs2]*.arc *.arclogs !secondary arcs dir&lt;br /&gt;$ sqldbaCONNECT INTERNALalter system switch logfile;exit&lt;br /&gt;$ dup u03:[oracle.arcs]*.arclogs,u04:[oracle.arcs2]*.arclogs tape1:logs.bck/sav&lt;br /&gt;$ del/log u03:[oracle.arcs]*.arclogs;0&lt;br /&gt;$ del/log u04:[oracle.arcs2]*.arclogs;0$!$! get control file&lt;br /&gt;$ sqldbaCONNECT INTERNALalter database backup controlfile to 'u01:[oracle]control.bkp' reuse;exit&lt;br /&gt;$ dup u01:[oracle]control.bkp tape1:control.bck/sav&lt;br /&gt;Note: The "alter system switch logfile" command is all but undocumented, (see pg 3-15 of the DBA guide. It refers you to a nonexistent cross-reference). It will NOT show up in the alert log. Don't be alarmed by that; it does actually work.&lt;br /&gt;NEW NOTE: Some people modify the script above to automatically pull the file names from DBA_DATA_FILES, so they don't have to hardcode the file names. I would only do that if the datafiles were all mirrored, so that a media failure wouldn't take down my database.&lt;br /&gt;Integrating the three methods.&lt;br /&gt;Use hot backups for all of your transaction-critical data. As a backup to the hot backups, perform cold backups periodically. As a backup to the physical file backups, use Exports.&lt;br /&gt;If you have a large amount of static data, you may wish to export only certain small tables, while relying on loading programs to re-create the static data when needed. As your database grows larger, the time required to perform Imports will remove Export as a viable backup option for all but the smallest of your tables.&lt;br /&gt;If at all possible in your O/S, it is also a good idea to shadow the disks on which your realtime and archived redo logs reside.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7668553736104330014-4181936271940808293?l=oracledbarea.blogspot.com' alt='' /&gt;&lt;/div&gt;</description><link>http://feedproxy.google.com/~r/OracleDbasArea/~3/Usc536A-vJI/hot-backup.html</link><author>noreply@blogger.com (Jafar Ali)</author><thr:total>0</thr:total><feedburner:origLink>http://oracledbarea.blogspot.com/2008/07/hot-backup.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7668553736104330014.post-1787905998753303394</guid><pubDate>Thu, 10 Jul 2008 08:16:00 +0000</pubDate><atom:updated>2008-07-10T13:49:46.114+05:30</atom:updated><title>Cold Backup</title><description>&lt;strong&gt;1. The Cold Backup.&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Shut down the database and perform a cold backup by going disk by disk and backing up all files in the [oracle] directories. When complete, restart the database.&lt;br /&gt;You may need to put an automated check into your backup program to use cold backups effectively, as several situations can cause the database shutdown to fail. For example, deadlocked users can prevent a SHUTDOWN IMMEDIATE from working. Also, "memory leaks" can keep the database is a suspended mode - in which the only solution is to SHUTDOWN ABORT. So add a script to your shutdown commands that does an independent check to see if the database actually went down.&lt;br /&gt;Some DBAs prefer choose to use the following command sequence:&lt;br /&gt;shutdown abort;&lt;br /&gt;startup;&lt;br /&gt;shutdown immediate;&lt;br /&gt;That way, they can be sure the database goes down via the SHUTDOWN ABORT command, and then shut it down cleanly via the SHUTDOWN IMMEDIATE command. The alternative is to use just a SHUTDOWN IMMEDIATE, followed by a separate command that checks to make sure the shutdown worked&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7668553736104330014-1787905998753303394?l=oracledbarea.blogspot.com' alt='' /&gt;&lt;/div&gt;</description><link>http://feedproxy.google.com/~r/OracleDbasArea/~3/MgxHWIEWCA4/cold-backup.html</link><author>noreply@blogger.com (Jafar Ali)</author><thr:total>0</thr:total><feedburner:origLink>http://oracledbarea.blogspot.com/2008/07/cold-backup.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7668553736104330014.post-3694821607327289949</guid><pubDate>Wed, 09 Jul 2008 13:21:00 +0000</pubDate><atom:updated>2008-07-09T19:00:58.177+05:30</atom:updated><title>Oracle DBA's Daily Duties</title><description>&lt;strong&gt;ORACLE – DATABASE ADMINISTRATOR&lt;/strong&gt;&lt;br /&gt; &lt;br /&gt;POSITION DESCRIPTION:  This position requires the Data Base Administrator (DBA) to work on &lt;a href="http://jobcircle.com/elearning/oracle.html?source=el_jobs" target="_blank"&gt;oracle&lt;/a&gt; databases from a &lt;a href="http://jobcircle.com/elearning/unix.html?source=el_jobs" target="_blank"&gt;unix&lt;/a&gt;/&lt;a href="http://jobcircle.com/elearning/linux.html?source=el_jobs" target="_blank"&gt;linux&lt;/a&gt; command line environment across the normal software life cycle spectrum of development, quality assurance, and production.  The DBA is expected to have excellent knowledge of oracle internals and performance and tuning methods and processes. DUTIES AND RESPONSIBILITIES: &lt;br /&gt;· Implementation of daily and weekly database policies and procedures&lt;br /&gt;· Daily responsibility for database loads, database tuning, &lt;a href="http://jobcircle.com/elearning/management.html?source=el_jobs" target="_blank"&gt;management&lt;/a&gt; of archive logs, journaling systems and preventive maintenance&lt;br /&gt;· Development of tools to analyze the database SGA&lt;br /&gt;· Development and maintenance of reports&lt;br /&gt;· Support of application development&lt;br /&gt;· Processing large datasets and implementation of data conversion routines&lt;br /&gt;· Implementation and verification of tape backup activities&lt;br /&gt;· Rotation of tape media to off site storage weekly&lt;br /&gt;· Primary responsibility for development and test servers&lt;br /&gt;· Client software installation and configuration for each host on the network&lt;br /&gt;· Pre-release activities include functional and capacity review of new software and database changes and identification of performance issues as part of release&lt;br /&gt;· Responsible for systems support as part of 24/7 support rotation.&lt;br /&gt; &lt;br /&gt;&lt;strong&gt;Database Administrators&lt;br /&gt;&lt;/strong&gt;&lt;a name="13356"&gt;&lt;/a&gt;Each database requires at least one database administrator (DBA) to administer it. Because an Oracle database system can be large and can have many users, often this is not a one person job. In such cases, there is a group of DBAs who share responsibility.&lt;br /&gt;&lt;a name="13359"&gt;&lt;/a&gt;A database administrator's responsibilities can include the following tasks:&lt;br /&gt;&lt;a name="866"&gt;&lt;/a&gt;Installing and upgrading the Oracle server and application tools.&lt;br /&gt;&lt;a name="868"&gt;&lt;/a&gt;Allocating system storage and planning future storage requirements for the database system.&lt;br /&gt;&lt;a name="870"&gt;&lt;/a&gt;Creating primary database storage structures (tablespaces) after application developers have designed an application.&lt;br /&gt;&lt;a name="872"&gt;&lt;/a&gt;Creating primary objects (tables, views, indexes) once application developers have designed an application.&lt;br /&gt;&lt;a name="874"&gt;&lt;/a&gt;Modifying the database structure, as necessary, from information given by application developers .&lt;br /&gt;&lt;a name="876"&gt;&lt;/a&gt;Enrolling users and maintaining system security.&lt;br /&gt;&lt;a name="878"&gt;&lt;/a&gt;Ensuring compliance with your Oracle license agreement.&lt;br /&gt;&lt;a name="880"&gt;&lt;/a&gt;Controlling and monitoring user access to the database .&lt;br /&gt;&lt;a name="882"&gt;&lt;/a&gt;Monitoring and optimizing the performance of the database.&lt;br /&gt;&lt;a name="884"&gt;&lt;/a&gt;Planning for backup and recovery of database information.&lt;br /&gt;&lt;a name="886"&gt;&lt;/a&gt;Maintaining archived data on tape.&lt;br /&gt;&lt;a name="888"&gt;&lt;/a&gt;Backing up and restoring the database.&lt;br /&gt;&lt;a name="9155"&gt;&lt;/a&gt;Contacting Oracle Corporation for technical support.&lt;br /&gt; &lt;br /&gt;&lt;strong&gt;Job Responsibilities include:-&lt;/strong&gt;&lt;br /&gt;Created new databases and users, setup RMAN backups, Export, and other monitoring scripts.&lt;br /&gt;Responsible for Oracle 9i logical and physical databases design, implementation and maintenance on NT.&lt;br /&gt;Sizes of the databases varied from 5 GB to 10 GB.&lt;br /&gt;Creating tablespaces and planning the location of data, index and rollback tablespaces redo log files and control files in adherence to the Optimal Flex Architecture.&lt;br /&gt;Defragmentation of tables and indexes for improved performance and effective space management. Managing database security.&lt;br /&gt;Creating and assigning appropriate roles and privileges to users depending on the user activity.&lt;br /&gt;Developed Oracle backup and recovery strategy and scripts. Implemented database refresh using full export.&lt;br /&gt;Used EXPORT/IMPORT to do table level and full database defragmentation.&lt;br /&gt;Performed SQL tuning by using Explain Plan and Tkprof.&lt;br /&gt;Bitmap indexes were used on low cardinality columns as they result in reduced response time for queries and substantial reduction of storage space.&lt;br /&gt;Checking for errors in alert logs and trace files.Designing and developing the screen of the entire master.&lt;br /&gt;Designing and developing of all the printing reports.Designing, developing &amp;amp; implementing automated data backup and restoration procedure.&lt;br /&gt;Providing technical support for database maintenance &amp;amp; disaster Recovery procedure.&lt;br /&gt;Developing stored procedures in PL/SQL for the Oracle application.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7668553736104330014-3694821607327289949?l=oracledbarea.blogspot.com' alt='' /&gt;&lt;/div&gt;</description><link>http://feedproxy.google.com/~r/OracleDbasArea/~3/1q--L2ktplE/oracle-dbas-daily-duties.html</link><author>noreply@blogger.com (Jafar Ali)</author><thr:total>0</thr:total><feedburner:origLink>http://oracledbarea.blogspot.com/2008/07/oracle-dbas-daily-duties.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7668553736104330014.post-2797040890922288904</guid><pubDate>Wed, 09 Jul 2008 12:59:00 +0000</pubDate><atom:updated>2008-07-09T18:36:56.745+05:30</atom:updated><title>Changing DB mode from NoArchivelog to Archive log</title><description>&lt;strong&gt;Issue the following commands to put a database into ARCHVELOG mode:&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;1) Take Back up of Present SPfile by  creating pfile F:\oracle\admin\RISLORA\pfile from present spfile.&lt;br /&gt;2) Shutdown the database by SUTDOWN IMMEDIATE.&lt;br /&gt;3) Take Cold backup of the database in a Disk.&lt;br /&gt;4) Change the parameter in the  pfile.&lt;br /&gt;log_archive_start         = TRUE&lt;br /&gt;log_archive_dest_1      = 'LOCATION=Archive'&lt;br /&gt;log_archive_dest_state_1  = ENABLE&lt;br /&gt;log_archive_format        = %d_%t_%s.arc&lt;br /&gt;5) And make a spfile from the modified pfile in default location .&lt;br /&gt;6) Start the database with spfile.&lt;br /&gt;&lt;br /&gt;****************************************************************&lt;br /&gt;SQL&gt; CONNECT sys AS SYSDBA&lt;br /&gt;SQL&gt; STARTUP MOUNT ;&lt;br /&gt;SQL&gt; ALTER DATABASE ARCHIVELOG;&lt;br /&gt;SQL&gt; ARCHIVE LOG START;&lt;br /&gt;SQL&gt; ALTER DATABASE OPEN;&lt;br /&gt;&lt;br /&gt;NOTE 1: Remember to take a baseline database backup right after enabling archivelog mode. Without it one would not be able to recover. Also, implement an archivelog backup to prevent the archive log directory from filling-up.&lt;br /&gt;################################################################################&lt;br /&gt;using target database controlfile instead of recovery catalogRMAN configuration parameters are:&lt;br /&gt;CONFIGURE CONTROLFILE AUTOBACKUP ON;&lt;br /&gt;CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO 'F:\Backup\rman\ora_cf%F';&lt;br /&gt;&lt;br /&gt;CONFIGURE CHANNEL DEVICE TYPE DISK FORMAT   'F:\Backup\rman\ora_df%t_s%s_s%p';&lt;br /&gt;CONFIGURE SNAPSHOT CONTROLFILE NAME TO 'F:\Backup\rman\SNCFRILDB.ORA';&lt;br /&gt;&lt;br /&gt;Thanks and regards&lt;br /&gt;Jafar&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7668553736104330014-2797040890922288904?l=oracledbarea.blogspot.com' alt='' /&gt;&lt;/div&gt;</description><link>http://feedproxy.google.com/~r/OracleDbasArea/~3/Lb4ZtrnFbx4/changing-db-mode-from-noarchivelog-to.html</link><author>noreply@blogger.com (Jafar Ali)</author><thr:total>0</thr:total><feedburner:origLink>http://oracledbarea.blogspot.com/2008/07/changing-db-mode-from-noarchivelog-to.html</feedburner:origLink></item></channel></rss>

