<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-7448526803143529116</id><updated>2024-10-04T02:35:23.114+05:30</updated><category term="Cold Backup"/><category term="DB ID change"/><category term="Drop database"/><category term="Drop oracle database"/><category term="How to take cold backup"/><category term="Oracle DB ID change"/><category term="SAP oracle"/><category term="brtools"/><category term="brtools password change"/><category term="change password brtools"/><category term="database"/><category term="dataguard sync issues"/><category term="dataguard sync problems"/><category term="oracle cold backup"/><category term="oracle database cold backup"/><category term="oracle password change"/><category term="roll forward"/><category term="standby"/><category term="standby roll forward"/><category term="standby sync issues"/><title type='text'>Oracle Bullets</title><subtitle type='html'>Bullets that help you in firing the database</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://oraclebullets.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7448526803143529116/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://oraclebullets.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Chaitanya</name><uri>http://www.blogger.com/profile/02904723174833201645</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh1RD22VqvjkhwATyYtzIKpRWkAQYPOjv8xB0LcOr2Y8mWmBdQJCvBAAGxkzfVCe95203nS9aiiC7iHlSYKbbNP0MjtsbQFFgS6uojmev4_RKzD2aWBctWmXTYHW5uNnkE/s220/Chaitu.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>19</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-7448526803143529116.post-7150597457182957451</id><published>2017-01-07T19:09:00.003+05:30</published><updated>2017-01-07T19:09:25.571+05:30</updated><title type='text'></title><content type='html'></content><link rel='replies' type='application/atom+xml' href='http://oraclebullets.blogspot.com/feeds/7150597457182957451/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://oraclebullets.blogspot.com/2017/01/blog-post_7.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7448526803143529116/posts/default/7150597457182957451'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7448526803143529116/posts/default/7150597457182957451'/><link rel='alternate' type='text/html' href='http://oraclebullets.blogspot.com/2017/01/blog-post_7.html' title=''/><author><name>Chaitanya</name><uri>http://www.blogger.com/profile/02904723174833201645</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh1RD22VqvjkhwATyYtzIKpRWkAQYPOjv8xB0LcOr2Y8mWmBdQJCvBAAGxkzfVCe95203nS9aiiC7iHlSYKbbNP0MjtsbQFFgS6uojmev4_RKzD2aWBctWmXTYHW5uNnkE/s220/Chaitu.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7448526803143529116.post-4620319042583291974</id><published>2017-01-07T19:09:00.001+05:30</published><updated>2017-01-07T19:09:23.171+05:30</updated><title type='text'></title><content type='html'></content><link rel='replies' type='application/atom+xml' href='http://oraclebullets.blogspot.com/feeds/4620319042583291974/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://oraclebullets.blogspot.com/2017/01/blog-post.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7448526803143529116/posts/default/4620319042583291974'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7448526803143529116/posts/default/4620319042583291974'/><link rel='alternate' type='text/html' href='http://oraclebullets.blogspot.com/2017/01/blog-post.html' title=''/><author><name>Chaitanya</name><uri>http://www.blogger.com/profile/02904723174833201645</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh1RD22VqvjkhwATyYtzIKpRWkAQYPOjv8xB0LcOr2Y8mWmBdQJCvBAAGxkzfVCe95203nS9aiiC7iHlSYKbbNP0MjtsbQFFgS6uojmev4_RKzD2aWBctWmXTYHW5uNnkE/s220/Chaitu.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7448526803143529116.post-4539859928456444469</id><published>2015-09-11T15:19:00.000+05:30</published><updated>2015-09-11T15:19:11.764+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="brtools"/><category scheme="http://www.blogger.com/atom/ns#" term="brtools password change"/><category scheme="http://www.blogger.com/atom/ns#" term="change password brtools"/><category scheme="http://www.blogger.com/atom/ns#" term="oracle password change"/><category scheme="http://www.blogger.com/atom/ns#" term="SAP oracle"/><title type='text'>Change password using BRCONNECT</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;h2 style=&quot;text-align: left;&quot;&gt;
Change password - BRCONNECT&lt;/h2&gt;
&lt;br /&gt;
To change the schema password using BRCONNECT an SAP utility to administer the oracle database,&lt;br /&gt;
&lt;br /&gt;
Please execute the following command.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;i&gt;brconnect -u / -c -f chpass -o system -p manager&lt;/i&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
-u is user to connect to system (/ is root as sysdba)&lt;br /&gt;
&lt;br /&gt;
-c is used to force the action&lt;br /&gt;
&lt;br /&gt;
-f is function, chpass is change password&lt;br /&gt;
&lt;br /&gt;
-o is the schema user&lt;br /&gt;
&lt;br /&gt;
-p is the new password that needs to be set.&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://oraclebullets.blogspot.com/feeds/4539859928456444469/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://oraclebullets.blogspot.com/2015/09/change-password-using-brconnect.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7448526803143529116/posts/default/4539859928456444469'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7448526803143529116/posts/default/4539859928456444469'/><link rel='alternate' type='text/html' href='http://oraclebullets.blogspot.com/2015/09/change-password-using-brconnect.html' title='Change password using BRCONNECT'/><author><name>Chaitanya</name><uri>http://www.blogger.com/profile/02904723174833201645</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh1RD22VqvjkhwATyYtzIKpRWkAQYPOjv8xB0LcOr2Y8mWmBdQJCvBAAGxkzfVCe95203nS9aiiC7iHlSYKbbNP0MjtsbQFFgS6uojmev4_RKzD2aWBctWmXTYHW5uNnkE/s220/Chaitu.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7448526803143529116.post-3115969604441917539</id><published>2015-09-11T14:48:00.003+05:30</published><updated>2015-09-11T14:54:07.155+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Cold Backup"/><category scheme="http://www.blogger.com/atom/ns#" term="How to take cold backup"/><category scheme="http://www.blogger.com/atom/ns#" term="oracle cold backup"/><category scheme="http://www.blogger.com/atom/ns#" term="oracle database cold backup"/><title type='text'>Cold backup</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
How to take a cold backup&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
$&amp;gt; cd /oracle/backup/SID&lt;br /&gt;
&lt;br /&gt;
$&amp;gt; mkdir -p /oracle/backup/SID/log&lt;br /&gt;
&lt;br /&gt;
create the pfile from the current spfile.&lt;br /&gt;
&lt;br /&gt;
$&amp;gt; sqlplus / as sysdba&lt;br /&gt;
&lt;br /&gt;
SQL&amp;gt; alter system checkpoint;&lt;br /&gt;
SQL&amp;gt; shutdown immediate;&lt;br /&gt;
SQL&amp;gt; startup mount;&lt;br /&gt;
SQL&amp;gt; create pfile=&#39;/oracle/backup/SID/pfile`date +%d%m%Y`.ora&#39; from spfile;&lt;br /&gt;
&lt;br /&gt;
Create the backup script&lt;br /&gt;
&lt;br /&gt;
Database needs to be put in mount state.&lt;br /&gt;
&lt;br /&gt;
While backing up the database backup the current control file as well to disk seperately.&lt;br /&gt;
&lt;br /&gt;
$&amp;gt; vi RMAN_cold_backup.sh&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;export ORACLE_HOME=/oracle/product/11.2.0&lt;br /&gt;
&amp;nbsp;export ORACLE_SID=SID&lt;br /&gt;
&amp;nbsp;export PATH=$ORACLE_HOME/bin:$PATH&lt;br /&gt;
&amp;nbsp;export LD_LIBRARY_PATH=$ORACLE_HOME/lib:$LD_LIBRARY_PATH&lt;br /&gt;
&amp;nbsp;rman target / log=/oracle/backup/SID/log/SID`date +%d%m%Y`.log &amp;lt;&lt;eof p=&quot;&quot;&gt;&amp;nbsp; RUN {&lt;br /&gt;
&amp;nbsp;ALLOCATE CHANNEL disk1 DEVICE TYPE DISK FORMAT ‘/oracle/backup/SID/SID_%U’;&lt;br /&gt;
&amp;nbsp;ALLOCATE CHANNEL disk2 DEVICE TYPE DISK FORMAT ‘/oracle/backup/SID/SID_%U’;&lt;br /&gt;
&amp;nbsp;ALLOCATE CHANNEL disk3 DEVICE TYPE DISK FORMAT ‘/oracle/backup/SID/SID_%U’;&lt;br /&gt;
&amp;nbsp;BACKUP AS COMPRESSED BACKUPSET DATABASE;&lt;br /&gt;
&amp;nbsp;BACKUP CURRENT CONTROLFILE FORMAT ‘/oracle/backup/SID/cntrl_%s_%p_%t’;&lt;br /&gt;
&amp;nbsp;RELEASE CHANNEL disk1;&lt;br /&gt;
&amp;nbsp;RELEASE CHANNEL disk2;&lt;br /&gt;
&amp;nbsp;RELEASE CHANNEL disk3;&lt;br /&gt;
&amp;nbsp;}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Change the permission of the file RMAN_cold_backup.sh to have execute permissions.&lt;br /&gt;
&lt;br /&gt;
navigate to the directory which have the script&lt;br /&gt;
&lt;br /&gt;
cd /oracle/backup/SID&lt;br /&gt;
&lt;br /&gt;
./RMAN_cold_backup.sh&lt;br /&gt;
&lt;br /&gt;
once the script completes sucessfully, you can open the database.&lt;br /&gt;
&lt;br /&gt;
$&amp;gt; sqlplus / as sysdba&lt;br /&gt;
&lt;br /&gt;
SQL&amp;gt; alter database open;&lt;br /&gt;
&lt;br /&gt;
Database Opened.&lt;br /&gt;
&lt;br /&gt;
SQL&amp;gt; exit&lt;br /&gt;
&lt;/eof&gt;&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://oraclebullets.blogspot.com/feeds/3115969604441917539/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://oraclebullets.blogspot.com/2015/09/cold-backup.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7448526803143529116/posts/default/3115969604441917539'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7448526803143529116/posts/default/3115969604441917539'/><link rel='alternate' type='text/html' href='http://oraclebullets.blogspot.com/2015/09/cold-backup.html' title='Cold backup'/><author><name>Chaitanya</name><uri>http://www.blogger.com/profile/02904723174833201645</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh1RD22VqvjkhwATyYtzIKpRWkAQYPOjv8xB0LcOr2Y8mWmBdQJCvBAAGxkzfVCe95203nS9aiiC7iHlSYKbbNP0MjtsbQFFgS6uojmev4_RKzD2aWBctWmXTYHW5uNnkE/s220/Chaitu.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7448526803143529116.post-124935922547378370</id><published>2015-09-11T14:48:00.002+05:30</published><updated>2015-09-11T14:52:04.024+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="database"/><category scheme="http://www.blogger.com/atom/ns#" term="Drop database"/><category scheme="http://www.blogger.com/atom/ns#" term="Drop oracle database"/><title type='text'>Drop oracle database</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;h2 style=&quot;text-align: left;&quot;&gt;
&lt;b&gt;How to Drop Oracle Database&lt;/b&gt;&lt;/h2&gt;
&lt;br /&gt;
If you want to drop your database it is wise to take an offline backup before you drop your database. if incase it is required to restore the database back we can use this backup.&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;http://oraclebullets.blogspot.com/2015/09/cold-backup.html&quot; target=&quot;_blank&quot;&gt;Cold Backup&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
Check if database is up and running&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;i&gt;$&amp;gt; ps -ef | &amp;nbsp;grep pmon&lt;/i&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
if this returns a process with the database sid then the DB is running.&lt;br /&gt;
&lt;br /&gt;
login to sqlplus as sysdba&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;i&gt;$&amp;gt; sqlplus / as sysdba&lt;/i&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
shutdown the database to start it in restrict mode&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;i&gt;SQL&amp;gt; shut immediate;&lt;/i&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
put the database in mount restrict mode&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;i&gt;SQL&amp;gt; startup restrict mount;&lt;/i&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;i&gt;ORACLE instance started.&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;&lt;br /&gt;&lt;/i&gt;
&lt;i&gt;Database mounted.&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
issues the following command to drop the database.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;i&gt;SQL&amp;gt; drop database;&lt;/i&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Database dropped.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;i&gt;SQL&amp;gt; exit&lt;/i&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://oraclebullets.blogspot.com/feeds/124935922547378370/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://oraclebullets.blogspot.com/2015/09/drop-oracle-database.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7448526803143529116/posts/default/124935922547378370'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7448526803143529116/posts/default/124935922547378370'/><link rel='alternate' type='text/html' href='http://oraclebullets.blogspot.com/2015/09/drop-oracle-database.html' title='Drop oracle database'/><author><name>Chaitanya</name><uri>http://www.blogger.com/profile/02904723174833201645</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh1RD22VqvjkhwATyYtzIKpRWkAQYPOjv8xB0LcOr2Y8mWmBdQJCvBAAGxkzfVCe95203nS9aiiC7iHlSYKbbNP0MjtsbQFFgS6uojmev4_RKzD2aWBctWmXTYHW5uNnkE/s220/Chaitu.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7448526803143529116.post-2998469858634934163</id><published>2015-09-08T12:05:00.000+05:30</published><updated>2015-09-08T12:23:29.466+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="dataguard sync issues"/><category scheme="http://www.blogger.com/atom/ns#" term="dataguard sync problems"/><category scheme="http://www.blogger.com/atom/ns#" term="roll forward"/><category scheme="http://www.blogger.com/atom/ns#" term="standby"/><category scheme="http://www.blogger.com/atom/ns#" term="standby roll forward"/><category scheme="http://www.blogger.com/atom/ns#" term="standby sync issues"/><title type='text'>Standby Roll forward</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
When there is a big archivelog gap that has to be applied on the standby database, then it is wise to have to go ahead with a roll forward of the standby.&lt;br /&gt;
&lt;br /&gt;
To get the standby sync with the primary please follow the steps below.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;i&gt;&lt;u&gt;On standby database&lt;/u&gt;&lt;/i&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
SQL&amp;gt; alter database recover managed standby database cancel;&lt;br /&gt;
&lt;br /&gt;
SQL&amp;gt; select current_scn from v$database;&lt;br /&gt;
&lt;br /&gt;
-- If there are no READ ONLY Tablespaces/datafiles in database use the below query to find the current SCN number.&lt;br /&gt;
SQL&amp;gt; select min(fhscn) from x$kcvfh;&lt;br /&gt;
&lt;br /&gt;
-- If there are any READ ONLY tablespaced/datafiles in database use the below query to find the current SCN number&lt;br /&gt;
SQL&amp;gt; select min(f.fhscn) from x$kcvfh f, v$datafile d&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt; &amp;nbsp;where f.hxfil =d.file#&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;and d.enabled != &#39;READ ONLY&#39; ;&lt;br /&gt;
&lt;br /&gt;
If the output from v$database view and x$kcvfh are different please proceed by taking the SCN number from X$KCVFH view.&lt;br /&gt;
&lt;br /&gt;
Now open a new session of the primary database in a new window.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;i&gt;&lt;u&gt;&lt;b&gt;On Primary database&lt;/b&gt;&lt;/u&gt;&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Go to RMAN to take an incremental backup of the database from the SCN number noted in the standby database.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
rman target /&lt;br /&gt;
&lt;br /&gt;
RMAN&amp;gt; run {&lt;br /&gt;
2&amp;gt; allocate channel C1 device type disk;&lt;br /&gt;
3&amp;gt; backup as compressed backupset incremental from SCN 1966714724 database format &#39;/oracle/backup/tostdby_%U&#39; filesperset=10 tag &#39;FOR STANDBY&#39;;&lt;br /&gt;
4&amp;gt; release channel C1;&lt;br /&gt;
5&amp;gt; }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Take the control file backup for standby database.&lt;br /&gt;
&lt;br /&gt;
rman&amp;gt; backup current controlfile for standby format &#39;/oracle/backup/cntrltostdby_%U&#39; tag &#39;FOR STANDBY&#39;;&lt;br /&gt;
&lt;br /&gt;
exit from RMAN&lt;br /&gt;
&lt;br /&gt;
navigate to the folder in which the backups are taken&lt;br /&gt;
&lt;br /&gt;
$&amp;gt; cd /oracle/backup&lt;br /&gt;
&lt;br /&gt;
copy the files over to the standby database server using the scp command (or by any command that serves the purpose)&lt;br /&gt;
&lt;br /&gt;
$&amp;gt; scp to* oracle@hostname:/oracle/backup&lt;br /&gt;
$&amp;gt; scp cntrl* oralce@hotname:/oracle/backup&lt;br /&gt;
&lt;br /&gt;
once the files are copied over to the standby database server. close the primary session.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;i&gt;&lt;u&gt;On standby database server&lt;/u&gt;&lt;/i&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Remove the control files&lt;br /&gt;
&lt;br /&gt;
rm /oracle/oradata/cntrl/cntrl*&lt;br /&gt;
rm /oracle/cntrl1/cntrl*&lt;br /&gt;
rm /oracle/cntrl2/cntrl*&lt;br /&gt;
&lt;br /&gt;
login to sql prompt to shutdown the database and start in nomount to restore the control file in respective locations from the backup taken in primary database server.&lt;br /&gt;
&lt;br /&gt;
sqlplus / as sysdba&lt;br /&gt;
&lt;br /&gt;
SQL&amp;gt; shutdown immediate;&lt;br /&gt;
&lt;br /&gt;
SQL&amp;gt; startup nomount&lt;br /&gt;
&lt;br /&gt;
SQL&amp;gt; exit&lt;br /&gt;
&lt;br /&gt;
$&amp;gt; rman target /&lt;br /&gt;
&lt;br /&gt;
RMAN&amp;gt; restore standby controlfile from &#39;/oracle/backup/cntrlforstandby_rdqffbhg_1_1&#39;;&lt;br /&gt;
&lt;br /&gt;
RMAN&amp;gt; sql &#39;alter database mount standby database&#39;;&lt;br /&gt;
RMAN&amp;gt; sql &#39;ALTER DATABASE RECOVER MANAGED STANDBY DATABASE CANCEL&#39;;&lt;br /&gt;
&lt;br /&gt;
Catalog the backup pieces to the RMAN&lt;br /&gt;
&lt;br /&gt;
RMAN&amp;gt; catalog backuppiece &#39;/oracle/backup/forstandby_qnqff9e6_1_1&#39;;&lt;br /&gt;
RMAN&amp;gt; catalog backuppiece &#39;/oracle/backup/forstandby_qoqff9tb_1_1&#39;;&lt;br /&gt;
RMAN&amp;gt; catalog backuppiece &#39;/oracle/backup/forstandby_rbqffalj_1_1&#39;;&lt;br /&gt;
RMAN&amp;gt; catalog backuppiece &#39;/oracle/backup/forstandby_rcqffb96_1_1&#39;;&lt;br /&gt;
&lt;br /&gt;
RMAN&amp;gt; sql &#39;ALTER DATABASE RECOVER MANAGED STANDBY DATABASE CANCEL&#39;;&lt;br /&gt;
&lt;br /&gt;
RMAN&amp;gt; run{&lt;br /&gt;
2 allocate channel C1 device type disk;&lt;br /&gt;
3 recover database noredo;&lt;br /&gt;
4 release channel C1;&lt;br /&gt;
5 }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
RMAN&amp;gt; sql &#39;ALTER DATABASE RECOVER MANAGED STANDBY DATABASE USING CURRENT LOGFILE DISCONNECT FROM SESSION&#39;;&lt;br /&gt;
&lt;br /&gt;
RMAN&amp;gt; exit&lt;br /&gt;
&lt;br /&gt;
Once every thing is done successfully, please login to the DB and see if the current archivelogs are being applied.&lt;br /&gt;
&lt;br /&gt;
$&amp;gt; sqlplus / as sysdba&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
SQL&amp;gt; select max(sequence#) from v$archived_log;&lt;br /&gt;
SQL&amp;gt; set lines 200;&lt;br /&gt;
SQL&amp;gt; select dest_id,status,error from v$archive_dest;&lt;br /&gt;
SQL&amp;gt; select PROCESS,PID,STATUS,THREAD#,SEQUENCE# from &amp;nbsp;v$managed_standby;&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://oraclebullets.blogspot.com/feeds/2998469858634934163/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://oraclebullets.blogspot.com/2015/09/standby-roll-forward.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7448526803143529116/posts/default/2998469858634934163'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7448526803143529116/posts/default/2998469858634934163'/><link rel='alternate' type='text/html' href='http://oraclebullets.blogspot.com/2015/09/standby-roll-forward.html' title='Standby Roll forward'/><author><name>Chaitanya</name><uri>http://www.blogger.com/profile/02904723174833201645</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh1RD22VqvjkhwATyYtzIKpRWkAQYPOjv8xB0LcOr2Y8mWmBdQJCvBAAGxkzfVCe95203nS9aiiC7iHlSYKbbNP0MjtsbQFFgS6uojmev4_RKzD2aWBctWmXTYHW5uNnkE/s220/Chaitu.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7448526803143529116.post-4319671779826592189</id><published>2015-08-19T16:13:00.002+05:30</published><updated>2015-09-08T12:06:42.155+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="DB ID change"/><category scheme="http://www.blogger.com/atom/ns#" term="Oracle DB ID change"/><title type='text'>Change DB ID in oracle</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
There are two ways to change the DB ID.&lt;br /&gt;
&lt;br /&gt;
The DB ID is the unique identifier of a DB. This is a randomly generated number that is assigned to the database at the time of creation. typically this would be a 10 digit number.&lt;br /&gt;
&lt;br /&gt;
If there are scenarios to change the DB ID then please follow any of the two ways discussed below.&lt;br /&gt;
&lt;br /&gt;
Case 1:&lt;br /&gt;
-------&lt;br /&gt;
&lt;br /&gt;
Usage of nid utility which is in $ORACLE_HOME/bin location&lt;br /&gt;
-----------------------------------------------------------&lt;br /&gt;
DB Name - TEST&lt;br /&gt;
&lt;br /&gt;
Login to sqlplus as sysdba&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
$&amp;gt; sqlplus / as sysdba&lt;br /&gt;
&lt;br /&gt;
SQL&amp;gt;select dbid form v$database; -- to check the current DB ID of the database.&lt;br /&gt;
&lt;br /&gt;
SQL&amp;gt;shutdown immediate&lt;br /&gt;
&lt;br /&gt;
start the database in mount state so that the control file is read and all the other datafiles are read.&lt;br /&gt;
&lt;br /&gt;
SQL&amp;gt; startup mount;&lt;br /&gt;
&lt;br /&gt;
SQL&amp;gt; exit&lt;br /&gt;
&lt;br /&gt;
on the OS command prompt execute the following command.&lt;br /&gt;
&lt;br /&gt;
$&amp;gt;nid target=TEST&lt;br /&gt;
&lt;br /&gt;
It will prompt for password. password is the sys account&#39;s password.&lt;br /&gt;
&lt;br /&gt;
password - sys password&lt;br /&gt;
&lt;br /&gt;
Once the password is accepted it will ask whether to change the DB ID or not. Press &#39;Y&#39;&lt;br /&gt;
&lt;br /&gt;
change database ID of database DBNAMR (Y/[N]) =&amp;gt; Y&lt;br /&gt;
&lt;br /&gt;
proceeding with operation&lt;br /&gt;
..........&lt;br /&gt;
.........&lt;br /&gt;
.&lt;br /&gt;
.&lt;br /&gt;
&lt;br /&gt;
DBNEWID- completed successfully.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here you will see that the DB ID is modified in control files and changed changed in datafiles.&lt;br /&gt;
&lt;br /&gt;
Also, all the previous backups and archivelog backups will be unusable.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
connect to sqlplus&lt;br /&gt;
&lt;br /&gt;
sqlplus / as sysdba&lt;br /&gt;
&lt;br /&gt;
open the database using reset logs as the DBID is changed the DB must be opened using resetlogs&lt;br /&gt;
&lt;br /&gt;
SQL&amp;gt; alter database open resetlogs;&lt;br /&gt;
&lt;br /&gt;
SQL&amp;gt; select dbid form v$database; -- now a new ID is assigned to the database.&lt;br /&gt;
&lt;br /&gt;
SQL&amp;gt; shutdown immediate;&lt;br /&gt;
&lt;br /&gt;
SQL&amp;gt; startup;&lt;br /&gt;
&lt;br /&gt;
The DB ID is changed.&lt;br /&gt;
&lt;br /&gt;
Take a full backup of the database and archivelogs if any.&lt;br /&gt;
-------------------------&lt;br /&gt;
Case 2:&lt;br /&gt;
------------------------&lt;br /&gt;
&lt;br /&gt;
Using dbms_backup_restore pacakge.&lt;br /&gt;
&lt;br /&gt;
Login to sqlplus&lt;br /&gt;
&lt;br /&gt;
$&amp;gt; sqlplus / as sysdba&lt;br /&gt;
&lt;br /&gt;
SQL&amp;gt; select dbid from v$database; -- To note the current DB ID&lt;br /&gt;
&lt;br /&gt;
Take the control file to trace backup&lt;br /&gt;
&lt;br /&gt;
sql&amp;gt; alrer database backup controlfile to trace as &#39;/home/oracle/trace.sql&#39; reuse; -- reuse will be used to replace the existing trace files if any on the location.&lt;br /&gt;
&lt;br /&gt;
SQL&amp;gt; shutdown immediate;&lt;br /&gt;
&lt;br /&gt;
SQL&amp;gt; exit&lt;br /&gt;
&lt;br /&gt;
open the trace file and remove all the commented lines and -------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
$&amp;gt; remove reuse instead put set also remove noresetlogs put resetlogs in create controlfile statement&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
sqlplus / as sysdba&lt;br /&gt;
&lt;br /&gt;
SQL&amp;gt; startup mount;&lt;br /&gt;
&lt;br /&gt;
SQL&amp;gt; select name,dbid form v$database;&lt;br /&gt;
&lt;br /&gt;
SQL&amp;gt; execute dbms_backup_restore.zeroDbid(0);&lt;br /&gt;
&lt;br /&gt;
PL/SQL procedure successfully completed.&lt;br /&gt;
&lt;br /&gt;
SQL&amp;gt; select name,dbid form v$database; - output comes as is becuase its still in dynamic performance views&lt;br /&gt;
&lt;br /&gt;
SQL&amp;gt; shutdown immediate;&lt;br /&gt;
&lt;br /&gt;
SQL&amp;gt; exit&lt;br /&gt;
&lt;br /&gt;
$&amp;gt; delete all the control files&lt;br /&gt;
&lt;br /&gt;
sqlplus / as sysdba&lt;br /&gt;
&lt;br /&gt;
SQL&amp;gt; @/home/oracle/trace.sql&lt;br /&gt;
&lt;br /&gt;
controlfile created,&lt;br /&gt;
&lt;br /&gt;
SQL&amp;gt; alter database open resetlogs;&lt;br /&gt;
&lt;br /&gt;
database altered&lt;br /&gt;
&lt;br /&gt;
SQL&amp;gt; select name,dbid from v$database;&lt;br /&gt;
&lt;br /&gt;
DB is will be changed.&lt;br /&gt;
&lt;br /&gt;
Take a full backup of the database and archivelogs if any.&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://oraclebullets.blogspot.com/feeds/4319671779826592189/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://oraclebullets.blogspot.com/2015/08/change-db-id-in-oracle.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7448526803143529116/posts/default/4319671779826592189'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7448526803143529116/posts/default/4319671779826592189'/><link rel='alternate' type='text/html' href='http://oraclebullets.blogspot.com/2015/08/change-db-id-in-oracle.html' title='Change DB ID in oracle'/><author><name>Chaitanya</name><uri>http://www.blogger.com/profile/02904723174833201645</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh1RD22VqvjkhwATyYtzIKpRWkAQYPOjv8xB0LcOr2Y8mWmBdQJCvBAAGxkzfVCe95203nS9aiiC7iHlSYKbbNP0MjtsbQFFgS6uojmev4_RKzD2aWBctWmXTYHW5uNnkE/s220/Chaitu.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7448526803143529116.post-2215474134400811154</id><published>2010-10-07T14:20:00.000+05:30</published><updated>2010-10-07T14:20:48.855+05:30</updated><title type='text'>Snapshot standby database Oracle 11g dataguard new feature.</title><content type='html'>&lt;strong&gt;&lt;u&gt;Snapshot Standby Database&lt;/u&gt;&lt;/strong&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Oracle 11g introduces a new Feature in Dataguard – the Snapshot Standby Database which can be in read-write mode. A snapshot standby database is a fully updatable standby database that is created by converting a physical standby database into a snapshot standby database.&lt;br /&gt;
&lt;br /&gt;
As this database is in the read-write mode it is possible to process transactions apart from the primary database (used for Real Application Testing). It still maintains protection by archiving the logs that are shipped from the primary database.&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;&lt;em&gt;Characteristics of snapshot standby database:&lt;/em&gt;&lt;/strong&gt;&lt;br /&gt;
&lt;br /&gt;
1. Snapshot standby database receives the logs but does not apply the redo data.&lt;br /&gt;
&lt;br /&gt;
2. Redo data received from the primary database is applied automatically once the standby database is converted back into a physical standby database.&lt;br /&gt;
&lt;br /&gt;
3. All updates that were made in the snapshot standby database will be discarded when it is converted back to physical standby database.&lt;br /&gt;
&lt;br /&gt;
4. Snapshot standby database cannot be the candidate for a switchover or failover. A snapshot standby database must first be converted back into a physical standby database before performing a role transition.&lt;br /&gt;
&lt;br /&gt;
5. After a switchover or failover between the primary database and one of the physical or logical standby databases in a configuration, the snapshot standby database can receive redo data from the new primary database after the role transition.&lt;br /&gt;
&lt;br /&gt;
6. Snapshot standby database cannot be the only standby database in a Maximum Protection Data Guard configuration.&lt;br /&gt;
&lt;br /&gt;
Steps to Convert Physical Standby Database to the Snapshot Standby Database&lt;br /&gt;
&lt;br /&gt;
The conversion from physical standby to snapshot standby database and vice versa can be done in three ways.&lt;br /&gt;
&lt;br /&gt;
1. Dataguard Broker.&lt;br /&gt;
&lt;br /&gt;
2. Enterprise Manager.&lt;br /&gt;
&lt;br /&gt;
3. Manual method. This can be done by issuing the below SQL command in the physical standby database. &lt;br /&gt;
&lt;br /&gt;
&lt;em&gt;SQL&amp;gt; ALTER DATABASE CONVERT TO SNAPSHOT STANDBY;&lt;/em&gt;&lt;br /&gt;
&lt;br /&gt;
1. If flash recovery is not already configured, configure it as shown below:&lt;br /&gt;
&lt;br /&gt;
first set the size of the recovery area&lt;br /&gt;
&lt;br /&gt;
&lt;em&gt;SQL&amp;gt; alter system set db_recovery_file_dest_size=’xxxx’;&lt;/em&gt;&lt;br /&gt;
&lt;br /&gt;
2. Next, set the location&lt;br /&gt;
&lt;br /&gt;
&lt;em&gt;SQL&amp;gt; alter system set db_recovery_file_dest=’yyyy’;&lt;/em&gt;&lt;br /&gt;
&lt;br /&gt;
3. Bring the physical standby database to mount stage:&lt;br /&gt;
&lt;br /&gt;
4. Stop managed recovery if it is active and then convert the physical standby database to snapshot standby database&lt;br /&gt;
&lt;br /&gt;
&lt;em&gt;SQL&amp;gt; alter database convert to snapshot standby;&lt;/em&gt;&lt;br /&gt;
&lt;br /&gt;
The database is dismounted during conversion and must be restarted after the conversion completes.&lt;br /&gt;
&lt;br /&gt;
The database is now ready for transactions.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
When a physical standby database is converted into a snapshot standby database, an implicit restore point is created and this restore point is used to flashback a snapshot standby database to its original state when it is converted back into a physical standby database from a snapshot standby database.&lt;br /&gt;
&lt;br /&gt;
5. Steps to Convert the Snapshot Standby Database Back to the Physical Standby Database:&lt;br /&gt;
&lt;br /&gt;
1. Shutdown the snapshot standby database&lt;br /&gt;
&lt;br /&gt;
2. Bring the database to the mount state&lt;br /&gt;
&lt;br /&gt;
3. Issue the following command&lt;br /&gt;
&lt;br /&gt;
&lt;em&gt;SQL&amp;gt; alter database convert to physical standby;&lt;/em&gt;&lt;br /&gt;
&lt;br /&gt;
6. Shutdown the database and mount it again&lt;br /&gt;
&lt;br /&gt;
&lt;em&gt;SQL&amp;gt; select open_mode, database_role from v$database;&lt;/em&gt;&lt;br /&gt;
&lt;br /&gt;
You are now ready to start the media recovery process.&lt;br /&gt;
&lt;br /&gt;
Once a snapshot standby database has been converted back into a physical standby database and restarted – start the process of applying the redo logs and all of the redo received by the snapshot standby database will be applied to the physical standby database to roll it forward.</content><link rel='replies' type='application/atom+xml' href='http://oraclebullets.blogspot.com/feeds/2215474134400811154/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://oraclebullets.blogspot.com/2010/10/snapshot-standby-database-oracle-11g.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7448526803143529116/posts/default/2215474134400811154'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7448526803143529116/posts/default/2215474134400811154'/><link rel='alternate' type='text/html' href='http://oraclebullets.blogspot.com/2010/10/snapshot-standby-database-oracle-11g.html' title='Snapshot standby database Oracle 11g dataguard new feature.'/><author><name>Chaitanya</name><uri>http://www.blogger.com/profile/02904723174833201645</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh1RD22VqvjkhwATyYtzIKpRWkAQYPOjv8xB0LcOr2Y8mWmBdQJCvBAAGxkzfVCe95203nS9aiiC7iHlSYKbbNP0MjtsbQFFgS6uojmev4_RKzD2aWBctWmXTYHW5uNnkE/s220/Chaitu.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7448526803143529116.post-6140971160897015633</id><published>2010-08-25T09:49:00.005+05:30</published><updated>2010-08-25T09:53:43.122+05:30</updated><title type='text'>Manual cleanup of failed CRS installation (10gR2)</title><content type='html'>&lt;strong&gt;&lt;u&gt;Manual cleanup of&amp;nbsp;CRS installation&lt;/u&gt;&lt;/strong&gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
At times we will have to perform a manual cleanup of failed CRS installation or some old CRS installation that was done. &lt;br /&gt;
&lt;br /&gt;
Oracle provides two scripts to cleanup the CRS, The names and location of the scripts are given below. &lt;br /&gt;
&lt;br /&gt;
1) Run &lt;em&gt;rootdelete.sh&lt;/em&gt; script located at &lt;strong&gt;‘$ORA_CRS_HOME/install’&lt;/strong&gt; directory&lt;br /&gt;
&lt;br /&gt;
2) Run &lt;em&gt;rootdeinstall.sh&lt;/em&gt; script located at &lt;strong&gt;‘$ORA_CRS_HOME/install’&lt;/strong&gt; directory&lt;br /&gt;
&lt;br /&gt;
If the CRSHOME is deleted before running the above mentioned scripts then, one can follow the following steps to cleanup the CRS manually.&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;&lt;em&gt;&lt;u&gt;Note:&lt;/u&gt;&lt;/em&gt;&lt;/strong&gt; The locations used in the following cleanup process are based on the LINUX platform, the locations may slightly differ with the corresponding flavor of the OS.&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;Manual Cleanup of CRS on LINUX&lt;/strong&gt;&lt;br /&gt;
&lt;br /&gt;
1. Remove below mentioned files as root user on ALL NODES that form a CLUSTER&lt;br /&gt;
&lt;br /&gt;
rm /etc/oracle/*&lt;br /&gt;
&lt;br /&gt;
rm -f /etc/init.d/init.cssd&lt;br /&gt;
&lt;br /&gt;
rm -f /etc/init.d/init.crs&lt;br /&gt;
&lt;br /&gt;
rm -f /etc/init.d/init.crsd&lt;br /&gt;
&lt;br /&gt;
rm -f /etc/init.d/init.evmd&lt;br /&gt;
&lt;br /&gt;
rm -f /etc/rc2.d/K96init.crs&lt;br /&gt;
&lt;br /&gt;
rm -f /etc/rc2.d/S96init.crs&lt;br /&gt;
&lt;br /&gt;
rm -f /etc/rc3.d/K96init.crs&lt;br /&gt;
&lt;br /&gt;
rm -f /etc/rc3.d/S96init.crs&lt;br /&gt;
&lt;br /&gt;
rm -f /etc/rc5.d/K96init.crs&lt;br /&gt;
&lt;br /&gt;
rm -f /etc/rc5.d/S96init.crs&lt;br /&gt;
&lt;br /&gt;
rm -Rf /etc/oracle/scls_scr&lt;br /&gt;
&lt;br /&gt;
rm -f /etc/inittab.crs&lt;br /&gt;
&lt;br /&gt;
cp /etc/inittab.orig /etc/inittab&lt;br /&gt;
&lt;br /&gt;
2. If the &lt;em&gt;EVM, CRS&lt;/em&gt; and &lt;em&gt;CSS&lt;/em&gt; processes are not already down then kill them off as root user on ALL NODES&lt;br /&gt;
&lt;br /&gt;
ps -ef | grep evm &lt;br /&gt;
&lt;br /&gt;
kill &lt;em&gt;&#39;evm_pid&#39;&lt;/em&gt;&lt;evm_pid&gt;&lt;evm pid=&quot;&quot;&gt;&lt;br /&gt;
&lt;br /&gt;
ps -ef | grep crs&lt;br /&gt;
&lt;br /&gt;
kill &lt;em&gt;&#39;crs_pid&#39;&lt;crs_pid&gt;&lt;crs pid=&quot;&quot;&gt;&lt;/em&gt;&lt;br /&gt;
&lt;br /&gt;
ps -ef | grep css &lt;br /&gt;
&lt;br /&gt;
kill &lt;em&gt;&#39;css_pid&#39;&lt;css_pid&gt;&lt;css pid=&quot;&quot;&gt;&lt;/em&gt;&lt;br /&gt;
&lt;br /&gt;
3. Remove the files in /var/tmp/.oracle or /tmp/.oracle on ALL NODES&lt;br /&gt;
&lt;br /&gt;
rm -f /var/tmp/.oracle/*&lt;br /&gt;
&lt;br /&gt;
or&lt;br /&gt;
&lt;br /&gt;
rm -f /tmp/.oracle/*&lt;br /&gt;
&lt;br /&gt;
4. Make sure that you remove the ocr.loc at /etc/oracle on ALL NODES&lt;br /&gt;
&lt;br /&gt;
5. De-install the CRS home using the Oracle Universal Installer; this is to remove the CRS home from inventory. Installer may not be able to remove all the files, because CRS home is already deleted, but this will help in cleaning up the inventory.&lt;br /&gt;
&lt;br /&gt;
6. Remove the CRS install location on ALL NODES&lt;br /&gt;
&lt;br /&gt;
7. Remove OCR and Voting disk from shared location from any 1 node&lt;br /&gt;
&lt;br /&gt;
Once these steps are performed then the hosts are ready for the next CRS installation.</content><link rel='replies' type='application/atom+xml' href='http://oraclebullets.blogspot.com/feeds/6140971160897015633/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://oraclebullets.blogspot.com/2010/08/manual-cleanup-of-failed-crs.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7448526803143529116/posts/default/6140971160897015633'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7448526803143529116/posts/default/6140971160897015633'/><link rel='alternate' type='text/html' href='http://oraclebullets.blogspot.com/2010/08/manual-cleanup-of-failed-crs.html' title='Manual cleanup of failed CRS installation (10gR2)'/><author><name>Chaitanya</name><uri>http://www.blogger.com/profile/02904723174833201645</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh1RD22VqvjkhwATyYtzIKpRWkAQYPOjv8xB0LcOr2Y8mWmBdQJCvBAAGxkzfVCe95203nS9aiiC7iHlSYKbbNP0MjtsbQFFgS6uojmev4_RKzD2aWBctWmXTYHW5uNnkE/s220/Chaitu.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7448526803143529116.post-8342142811505565668</id><published>2010-08-18T14:49:00.000+05:30</published><updated>2010-08-18T14:49:25.925+05:30</updated><title type='text'>Data guard broker</title><content type='html'>&lt;strong&gt;&lt;em&gt;&lt;u&gt;Data Guard Broker&lt;/u&gt;&lt;/em&gt;&lt;/strong&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Data guard broker is an assistance utility given along with the Oralce Software, which can be used to create and manage the data guard configurations. Data guard broker consists of server side and client side components.&lt;br /&gt;
&lt;br /&gt;
The server side components include dataguard monitor (DMON) and configuration files. The client side components include Data guard manager and Command line interface (CLI). &lt;br /&gt;
&lt;br /&gt;
Data guard broker manages a data guard configuration using a broker management model. The broker management model is a hierarchial structure comprised of configuration,site and database resources. Broker can manage all three layers of the management model.&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiHwfqc4sZ2xubTFmxYh3P2FfHyQ6shODvFQ6kqMG2v87S9DtWjmj_wuYGHUpnskEoCVfzd16zrycZ8_4aBcI6Sfagd5XT0-m064AdspiDjP0np-ncQA-UW5ahsFsGnj3Tm2Bf5FJEikN1i/s1600/DGBroker+model.JPG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;320&quot; ox=&quot;true&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiHwfqc4sZ2xubTFmxYh3P2FfHyQ6shODvFQ6kqMG2v87S9DtWjmj_wuYGHUpnskEoCVfzd16zrycZ8_4aBcI6Sfagd5XT0-m064AdspiDjP0np-ncQA-UW5ahsFsGnj3Tm2Bf5FJEikN1i/s320/DGBroker+model.JPG&quot; width=&quot;279&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
Dataguard broker can manage the proimary database and upto nine (9) standby databases in one configuration (in Oacle 10g). These nine standby database can be a mixture of physical and logical standby databases. Standby databases can be created using data guard broker. In addition, it can be used to add an existing standby database to a configuration.&lt;br /&gt;
&lt;br /&gt;
When a standby database is created using Data guard broker, broker takes care of the entire set of supportinf files such as SPFILE, oracle net configuration files, etc., if in case an existing standby database is to be added to the data guard configuration, the SPFILE and oracle net files must be explicitly configured manually before the standby database is added to a configuration. If data guard broker is to be used for the management of standby databases, SPFILE must be used on all the databases.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Some of the advantages of using dataguard broker are listed:&lt;br /&gt;
&lt;br /&gt;
1. It is a centralized management tool that can be used to manage the data guard configuration using a CLI / GUI interface.&lt;br /&gt;
&lt;br /&gt;
2. It reduces the complexity of role management services (Switchover and Failover).&lt;br /&gt;
&lt;br /&gt;
3. It provides an extensive health check mechanism for both the primary and standby databases. &lt;br /&gt;
&lt;br /&gt;
4. It can be used to gather useful statistics for fine tuning the log transfer and log appky services.&lt;br /&gt;
&lt;br /&gt;
In oracle 9i Dataguard broker cannot be used with Oracle Real Application Cluster (RAC). RAC support is provided with Oracle 10g.</content><link rel='replies' type='application/atom+xml' href='http://oraclebullets.blogspot.com/feeds/8342142811505565668/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://oraclebullets.blogspot.com/2010/08/data-guard-broker.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7448526803143529116/posts/default/8342142811505565668'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7448526803143529116/posts/default/8342142811505565668'/><link rel='alternate' type='text/html' href='http://oraclebullets.blogspot.com/2010/08/data-guard-broker.html' title='Data guard broker'/><author><name>Chaitanya</name><uri>http://www.blogger.com/profile/02904723174833201645</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh1RD22VqvjkhwATyYtzIKpRWkAQYPOjv8xB0LcOr2Y8mWmBdQJCvBAAGxkzfVCe95203nS9aiiC7iHlSYKbbNP0MjtsbQFFgS6uojmev4_RKzD2aWBctWmXTYHW5uNnkE/s220/Chaitu.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiHwfqc4sZ2xubTFmxYh3P2FfHyQ6shODvFQ6kqMG2v87S9DtWjmj_wuYGHUpnskEoCVfzd16zrycZ8_4aBcI6Sfagd5XT0-m064AdspiDjP0np-ncQA-UW5ahsFsGnj3Tm2Bf5FJEikN1i/s72-c/DGBroker+model.JPG" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7448526803143529116.post-4778436625888459589</id><published>2010-08-17T11:20:00.000+05:30</published><updated>2010-08-17T14:58:47.136+05:30</updated><title type='text'>Obsolete Parameters for 9i</title><content type='html'>The following are the obsolete parameters for 9i&lt;br /&gt;&lt;br /&gt;&lt;table style=&quot;MARGIN: 25px; WIDtd: 25px&quot; cellspacing=&quot;20&quot; cellpadding=&quot;5&quot; align=&quot;left&quot; border=&quot;10&quot;&gt;&lt;br /&gt;&lt;tr&gt; &lt;td&gt;&lt;b&gt;&lt;i&gt; 1 )&lt;/b&gt;&lt;/i&gt; _average_dirties_half_life      &lt;/td&gt;  &lt;td&gt;&lt;b&gt;&lt;i&gt; 2 )&lt;/b&gt;&lt;/i&gt; _lm_statistics                  &lt;/td&gt; &lt;/tr&gt;&lt;tr&gt; &lt;td&gt;&lt;b&gt;&lt;i&gt; 3 )&lt;/b&gt;&lt;/i&gt; allow_partial_sn_results        &lt;/td&gt;  &lt;td&gt;&lt;b&gt;&lt;i&gt; 4 )&lt;/b&gt;&lt;/i&gt; always_anti_join                &lt;/td&gt; &lt;/tr&gt;&lt;tr&gt; &lt;td&gt;&lt;b&gt;&lt;i&gt; 5 )&lt;/b&gt;&lt;/i&gt; always_semi_join                &lt;/td&gt;  &lt;td&gt;&lt;b&gt;&lt;i&gt; 6 )&lt;/b&gt;&lt;/i&gt; arch_io_slaves                  &lt;/td&gt; &lt;/tr&gt;&lt;tr&gt; &lt;td&gt;&lt;b&gt;&lt;i&gt; 7 )&lt;/b&gt;&lt;/i&gt; b_tree_bitmap_plans             &lt;/td&gt;  &lt;td&gt;&lt;b&gt;&lt;i&gt; 8 )&lt;/b&gt;&lt;/i&gt; backup_disk_io_slaves           &lt;/td&gt; &lt;/tr&gt;&lt;tr&gt; &lt;td&gt;&lt;b&gt;&lt;i&gt; 9 )&lt;/b&gt;&lt;/i&gt; cache_size_tdreshold            &lt;/td&gt;  &lt;td&gt;&lt;b&gt;&lt;i&gt; 10 )&lt;/b&gt;&lt;/i&gt; cleanup_rollback_entries        &lt;/td&gt; &lt;/tr&gt;&lt;tr&gt; &lt;td&gt;&lt;b&gt;&lt;i&gt; 11 )&lt;/b&gt;&lt;/i&gt; close_cached_open_cursors       &lt;/td&gt;  &lt;td&gt;&lt;b&gt;&lt;i&gt; 12 )&lt;/b&gt;&lt;/i&gt; compatible_no_recovery          &lt;/td&gt; &lt;/tr&gt;&lt;tr&gt; &lt;td&gt;&lt;b&gt;&lt;i&gt; 13 )&lt;/b&gt;&lt;/i&gt; complex_view_merging            &lt;/td&gt;  &lt;td&gt;&lt;b&gt;&lt;i&gt; 14 )&lt;/b&gt;&lt;/i&gt; cpu_count                       &lt;/td&gt; &lt;/tr&gt;&lt;tr&gt; &lt;td&gt;&lt;b&gt;&lt;i&gt; 15 )&lt;/b&gt;&lt;/i&gt; db_block_checkpoint_batch       &lt;/td&gt;  &lt;td&gt;&lt;b&gt;&lt;i&gt; 16 )&lt;/b&gt;&lt;/i&gt; db_block_lru_extended_statisti &lt;/td&gt; &lt;/tr&gt;&lt;tr&gt; &lt;td&gt;&lt;b&gt;&lt;i&gt; 17 )&lt;/b&gt;&lt;/i&gt; db_block_lru_latches            &lt;/td&gt;  &lt;td&gt;&lt;b&gt;&lt;i&gt; 18 )&lt;/b&gt;&lt;/i&gt; db_block_lru_statistics         &lt;/td&gt; &lt;/tr&gt;&lt;tr&gt; &lt;td&gt;&lt;b&gt;&lt;i&gt; 19 )&lt;/b&gt;&lt;/i&gt; db_block_max_dirty_target       &lt;/td&gt;  &lt;td&gt;&lt;b&gt;&lt;i&gt; 20 )&lt;/b&gt;&lt;/i&gt; db_file_simultaneous_writes     &lt;/td&gt; &lt;/tr&gt;&lt;tr&gt; &lt;td&gt;&lt;b&gt;&lt;i&gt; 21 )&lt;/b&gt;&lt;/i&gt; delayed_logging_block_cleanout &lt;/td&gt;  &lt;td&gt;&lt;b&gt;&lt;i&gt; 22 )&lt;/b&gt;&lt;/i&gt; discrete_transactions_enabled   &lt;/td&gt; &lt;/tr&gt;&lt;tr&gt; &lt;td&gt;&lt;b&gt;&lt;i&gt; 23 )&lt;/b&gt;&lt;/i&gt; distributed_lock_timeout        &lt;/td&gt;  &lt;td&gt;&lt;b&gt;&lt;i&gt; 24 )&lt;/b&gt;&lt;/i&gt; distributed_recovery_connectio &lt;/td&gt; &lt;/tr&gt;&lt;tr&gt; &lt;td&gt;&lt;b&gt;&lt;i&gt; 25 )&lt;/b&gt;&lt;/i&gt; distributed_transactions &lt;/td&gt;  &lt;td&gt;&lt;b&gt;&lt;i&gt; 26 )&lt;/b&gt;&lt;/i&gt; dblink_encrypt_login &lt;/td&gt; &lt;/tr&gt;&lt;tr&gt; &lt;td&gt;&lt;b&gt;&lt;i&gt; 27 )&lt;/b&gt;&lt;/i&gt; fast_full_scan_enabled          &lt;/td&gt;  &lt;td&gt;&lt;b&gt;&lt;i&gt; 28 )&lt;/b&gt;&lt;/i&gt; freeze_DB_for_fast_instance_re &lt;/td&gt; &lt;/tr&gt;&lt;tr&gt; &lt;td&gt;&lt;b&gt;&lt;i&gt; 29 )&lt;/b&gt;&lt;/i&gt; gc_defer_time                   &lt;/td&gt;  &lt;td&gt;&lt;b&gt;&lt;i&gt; 30 )&lt;/b&gt;&lt;/i&gt; gc_latches                      &lt;/td&gt; &lt;/tr&gt;&lt;tr&gt; &lt;td&gt;&lt;b&gt;&lt;i&gt; 31 )&lt;/b&gt;&lt;/i&gt; gc_lck_procs                    &lt;/td&gt;  &lt;td&gt;&lt;b&gt;&lt;i&gt; 32 )&lt;/b&gt;&lt;/i&gt; gc_releasable_locks             &lt;/td&gt; &lt;/tr&gt;&lt;tr&gt; &lt;td&gt;&lt;b&gt;&lt;i&gt; 33 )&lt;/b&gt;&lt;/i&gt; gc_rollback_locks               &lt;/td&gt;  &lt;td&gt;&lt;b&gt;&lt;i&gt; 34 )&lt;/b&gt;&lt;/i&gt; hash_multiblock_io_count        &lt;/td&gt; &lt;/tr&gt;&lt;tr&gt; &lt;td&gt;&lt;b&gt;&lt;i&gt; 35 )&lt;/b&gt;&lt;/i&gt; instance_nodeset                &lt;/td&gt;  &lt;td&gt;&lt;b&gt;&lt;i&gt; 36 )&lt;/b&gt;&lt;/i&gt; job_queue_interval              &lt;/td&gt; &lt;/tr&gt;&lt;tr&gt; &lt;td&gt;&lt;b&gt;&lt;i&gt; 37 )&lt;/b&gt;&lt;/i&gt; job_queue_keep_connections      &lt;/td&gt;  &lt;td&gt;&lt;b&gt;&lt;i&gt; 38 )&lt;/b&gt;&lt;/i&gt; large_pool_min_alloc            &lt;/td&gt; &lt;/tr&gt;&lt;tr&gt; &lt;td&gt;&lt;b&gt;&lt;i&gt; 39 )&lt;/b&gt;&lt;/i&gt; lgwr_io_slaves                  &lt;/td&gt;  &lt;td&gt;&lt;b&gt;&lt;i&gt; 40 )&lt;/b&gt;&lt;/i&gt; lm_locks                        &lt;/td&gt; &lt;/tr&gt;&lt;tr&gt; &lt;td&gt;&lt;b&gt;&lt;i&gt; 41 )&lt;/b&gt;&lt;/i&gt; lm_procs                        &lt;/td&gt;  &lt;td&gt;&lt;b&gt;&lt;i&gt; 42 )&lt;/b&gt;&lt;/i&gt; lm_procs                        &lt;/td&gt; &lt;/tr&gt;&lt;tr&gt; &lt;td&gt;&lt;b&gt;&lt;i&gt; 43 )&lt;/b&gt;&lt;/i&gt; lm_ress                         &lt;/td&gt;  &lt;td&gt;&lt;b&gt;&lt;i&gt; 44 )&lt;/b&gt;&lt;/i&gt; lock_sga_areas                  &lt;/td&gt; &lt;/tr&gt;&lt;tr&gt; &lt;td&gt;&lt;b&gt;&lt;i&gt; 45 )&lt;/b&gt;&lt;/i&gt; log_block_checksum              &lt;/td&gt;  &lt;td&gt;&lt;b&gt;&lt;i&gt; 46 )&lt;/b&gt;&lt;/i&gt; log_files                       &lt;/td&gt; &lt;/tr&gt;&lt;tr&gt; &lt;td&gt;&lt;b&gt;&lt;i&gt; 47 )&lt;/b&gt;&lt;/i&gt; log_simultaneous_copies         &lt;/td&gt;  &lt;td&gt;&lt;b&gt;&lt;i&gt; 48 )&lt;/b&gt;&lt;/i&gt; log_small_entry_max_size     &lt;/td&gt; &lt;/tr&gt;&lt;tr&gt; &lt;td&gt;&lt;b&gt;&lt;i&gt; 49 )&lt;/b&gt;&lt;/i&gt; log_archive_buffers &lt;/td&gt;  &lt;td&gt;&lt;b&gt;&lt;i&gt; 50 )&lt;/b&gt;&lt;/i&gt; log_archive_buffer_size &lt;/td&gt; &lt;/tr&gt;&lt;tr&gt; &lt;td&gt;&lt;b&gt;&lt;i&gt; 51 )&lt;/b&gt;&lt;/i&gt; ogms_home                       &lt;/td&gt;  &lt;td&gt;&lt;b&gt;&lt;i&gt; 52 )&lt;/b&gt;&lt;/i&gt; ops_admin_group                 &lt;/td&gt; &lt;/tr&gt;&lt;tr&gt; &lt;td&gt;&lt;b&gt;&lt;i&gt; 53 )&lt;/b&gt;&lt;/i&gt; ops_interconnects               &lt;/td&gt;  &lt;td&gt;&lt;b&gt;&lt;i&gt; 54 )&lt;/b&gt;&lt;/i&gt; optimizer_percent_parallel      &lt;/td&gt; &lt;/tr&gt;&lt;tr&gt; &lt;td&gt;&lt;b&gt;&lt;i&gt; 55 )&lt;/b&gt;&lt;/i&gt; optimizer_search_limit          &lt;/td&gt;  &lt;td&gt;&lt;b&gt;&lt;i&gt; 56 )&lt;/b&gt;&lt;/i&gt; parallel_default_max_instances &lt;/td&gt; &lt;/tr&gt;&lt;tr&gt; &lt;td&gt;&lt;b&gt;&lt;i&gt; 57 )&lt;/b&gt;&lt;/i&gt; parallel_min_message_pool       &lt;/td&gt;  &lt;td&gt;&lt;b&gt;&lt;i&gt; 58 )&lt;/b&gt;&lt;/i&gt; parallel_server_idle_time       &lt;/td&gt; &lt;/tr&gt;&lt;tr&gt; &lt;td&gt;&lt;b&gt;&lt;i&gt; 59 )&lt;/b&gt;&lt;/i&gt; parallel_transaction_resource_ &lt;/td&gt;  &lt;td&gt;&lt;b&gt;&lt;i&gt; 60 )&lt;/b&gt;&lt;/i&gt; push_join_predicate             &lt;/td&gt; &lt;/tr&gt;&lt;tr&gt; &lt;td&gt;&lt;b&gt;&lt;i&gt; 61 )&lt;/b&gt;&lt;/i&gt; row_cache_cursors               &lt;/td&gt;  &lt;td&gt;&lt;b&gt;&lt;i&gt; 62 )&lt;/b&gt;&lt;/i&gt; sequence_cache_entries          &lt;/td&gt; &lt;/tr&gt;&lt;tr&gt; &lt;td&gt;&lt;b&gt;&lt;i&gt; 63 )&lt;/b&gt;&lt;/i&gt; sequence_cache_hash_buckets     &lt;/td&gt;  &lt;td&gt;&lt;b&gt;&lt;i&gt; 64 )&lt;/b&gt;&lt;/i&gt; shared_pool_reserved_min_alloc &lt;/td&gt; &lt;/tr&gt;&lt;tr&gt; &lt;td&gt;&lt;b&gt;&lt;i&gt; 65 )&lt;/b&gt;&lt;/i&gt; snapshot_refresh_interval       &lt;/td&gt;  &lt;td&gt;&lt;b&gt;&lt;i&gt; 66 )&lt;/b&gt;&lt;/i&gt; snapshot_refresh_keep_connecti &lt;/td&gt; &lt;/tr&gt;&lt;tr&gt; &lt;td&gt;&lt;b&gt;&lt;i&gt; 67 )&lt;/b&gt;&lt;/i&gt; snapshot_refresh_processes      &lt;/td&gt;  &lt;td&gt;&lt;b&gt;&lt;i&gt; 68 )&lt;/b&gt;&lt;/i&gt; sort_direct_writes              &lt;/td&gt; &lt;/tr&gt;&lt;tr&gt; &lt;td&gt;&lt;b&gt;&lt;i&gt; 69 )&lt;/b&gt;&lt;/i&gt; sort_multiblock_read_count      &lt;/td&gt;  &lt;td&gt;&lt;b&gt;&lt;i&gt; 70 )&lt;/b&gt;&lt;/i&gt; sort_read_fac                   &lt;/td&gt; &lt;/tr&gt;&lt;tr&gt; &lt;td&gt;&lt;b&gt;&lt;i&gt; 71 )&lt;/b&gt;&lt;/i&gt; sort_spacemap_size              &lt;/td&gt;  &lt;td&gt;&lt;b&gt;&lt;i&gt; 72 )&lt;/b&gt;&lt;/i&gt; sort_write_buffer_size          &lt;/td&gt; &lt;/tr&gt;&lt;tr&gt; &lt;td&gt;&lt;b&gt;&lt;i&gt; 73 )&lt;/b&gt;&lt;/i&gt; sort_write_buffers              &lt;/td&gt;  &lt;td&gt;&lt;b&gt;&lt;i&gt; 74 )&lt;/b&gt;&lt;/i&gt; spin_count                      &lt;/td&gt; &lt;/tr&gt;&lt;tr&gt; &lt;td&gt;&lt;b&gt;&lt;i&gt; 75 )&lt;/b&gt;&lt;/i&gt; temporary_table_locks           &lt;/td&gt;  &lt;td&gt;&lt;b&gt;&lt;i&gt; 76 )&lt;/b&gt;&lt;/i&gt; text_enable                     &lt;/td&gt; &lt;/tr&gt;&lt;tr&gt; &lt;td&gt;&lt;b&gt;&lt;i&gt; 77 )&lt;/b&gt;&lt;/i&gt; use_ism &lt;/td&gt; &lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;</content><link rel='replies' type='application/atom+xml' href='http://oraclebullets.blogspot.com/feeds/4778436625888459589/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://oraclebullets.blogspot.com/2010/08/obsolete-parameters-for-9i.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7448526803143529116/posts/default/4778436625888459589'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7448526803143529116/posts/default/4778436625888459589'/><link rel='alternate' type='text/html' href='http://oraclebullets.blogspot.com/2010/08/obsolete-parameters-for-9i.html' title='Obsolete Parameters for 9i'/><author><name>Chaitanya</name><uri>http://www.blogger.com/profile/02904723174833201645</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh1RD22VqvjkhwATyYtzIKpRWkAQYPOjv8xB0LcOr2Y8mWmBdQJCvBAAGxkzfVCe95203nS9aiiC7iHlSYKbbNP0MjtsbQFFgS6uojmev4_RKzD2aWBctWmXTYHW5uNnkE/s220/Chaitu.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7448526803143529116.post-7948101441614157692</id><published>2010-07-21T22:07:00.000+05:30</published><updated>2010-07-21T22:10:46.424+05:30</updated><title type='text'>RAC User Equivalence - RSA and DSA</title><content type='html'>&lt;strong&gt;&lt;span style=&quot;font-weight:bold;&quot;&gt;Why to use both the RSA and DSA while configuring SSH for User Equivalence?&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;There are two versions of the SSH protocol; version 1 uses RSA and version 2 uses DSA, so we will create both types of keys to ensure that SSH can use either version. The ssh-keygen program will generate public and private keys of either type depending upon the parameters passed to it.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Most SSH clients support both SSH protocols (SSH1 and SSH2). SSH2 is regarded as a more secure protocol, so many users like to make certain it is used first, before any connection using SSH1 is attempted (this is in case the remote server doesn&#39;t support your primary protocol selection, it can fall back to the other). It is highly recommended that users should configure their clients for the SSH2 protocol for the first connection attempt.&lt;br /&gt;&lt;br /&gt;    * The SSH1 protocol supports RSA keys.&lt;br /&gt;    * The SSH2 protocol supports RSA and DSA keys.&lt;br /&gt;&lt;br /&gt;In order to make sure that the connection is success, we use both RSA and DSA while configuring SSH for user equivalence.&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-weight:bold;&quot;&gt;Usage for RSA:&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-style:italic;&quot;&gt;ssh-keygen -t rsa&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-weight:bold;&quot;&gt;Usage for DSA:&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-style:italic;&quot;&gt;ssh-keygen -t dsa&lt;/span&gt;</content><link rel='replies' type='application/atom+xml' href='http://oraclebullets.blogspot.com/feeds/7948101441614157692/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://oraclebullets.blogspot.com/2010/07/rac-user-equivalence-rsa-and-dsa.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7448526803143529116/posts/default/7948101441614157692'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7448526803143529116/posts/default/7948101441614157692'/><link rel='alternate' type='text/html' href='http://oraclebullets.blogspot.com/2010/07/rac-user-equivalence-rsa-and-dsa.html' title='RAC User Equivalence - RSA and DSA'/><author><name>Chaitanya</name><uri>http://www.blogger.com/profile/02904723174833201645</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh1RD22VqvjkhwATyYtzIKpRWkAQYPOjv8xB0LcOr2Y8mWmBdQJCvBAAGxkzfVCe95203nS9aiiC7iHlSYKbbNP0MjtsbQFFgS6uojmev4_RKzD2aWBctWmXTYHW5uNnkE/s220/Chaitu.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7448526803143529116.post-625220154221352262</id><published>2009-07-29T15:32:00.000+05:30</published><updated>2009-07-29T15:41:39.860+05:30</updated><title type='text'>Basic Tips for Tuning SQL Statement</title><content type='html'>&lt;strong&gt;Subquery versus Joins:&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;The main difference between subquery and join is:&lt;br /&gt; &lt;br /&gt;• subquery is faster when we have to retrieve data from large number of tables. Because it becomes tedious to join more tables. Join is faster to retrieve data from database when we have less number of tables &lt;br /&gt;• subquery retrieve the data depending on certain condition or manipulation in inner query. Where as joins will join the entire data depending on the conditions.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;While using Order by Operator:&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;• Don&#39;t use ORDER BY in your SELECT statements unless you really need to, as it adds a lot of extra overhead.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;While Using AND operator:&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;If you have a WHERE clause that includes expressions connected by two or more AND operators, Oracle Server will evaluate them from left to right in the order they are written. &lt;br /&gt;Locate the least likely true AND expression first. This way, if the AND expression is false, the clause will end immediately, saving time. If both parts of an AND expression are equally likely being false, put the least complex AND expression first.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Using Where Clause:&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;• When you have a choice of using the IN or the EXISTS clause in your SQL,   Use the EXISTS clause, as it is usually more efficient and its performance is good.&lt;br /&gt;• If you use LIKE in your WHERE clause, try to use one or more leading character in the clause, if at all possible For example, use: LIKE &#39;m%&#39; not: LIKE &#39;%m‘.&lt;br /&gt;• If you use a leading character in your LIKE clause, then the Query Optimizer has the ability to potentially use an index to perform the query. &lt;br /&gt;• If the leading character in a LIKE clause is a wildcard, the Query Optimizer will not be able to use an index, and a table scan must be run, which will reduce performance and will take more time. &lt;br /&gt;• When you have a choice of using the IN or the BETWEEN clauses in your SQL, use the BETWEEN clause, as it is much more efficient.&lt;br /&gt;&lt;br /&gt;• &lt;strong&gt;For example: &lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;em&gt;SELECT emp_id, emp_name FROM employee WHERE emp_id IN (1000, 1001, 1002, 1003, 1004);&lt;/em&gt; &lt;br /&gt;&lt;br /&gt;is much less efficient than this: &lt;br /&gt;&lt;br /&gt;&lt;em&gt;SELECT emp_id, emp_name FROM employee WHERE emp_id BETWEEN 1000 and 1004;&lt;/em&gt;&lt;br /&gt;&lt;br /&gt;If your SELECT statement includes an IN operator along with a list of values to be tested in the query :-&lt;br /&gt;&lt;br /&gt;• Order the list of values so that the most frequently found values are placed at the first of the list, and the less frequently found values are placed at the end of the list. &lt;br /&gt;• This can speed performance because the IN option returns true as soon as any of the values in the list produce a match. The sooner the match is made, the faster the query completes.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Returning data from Select Statement:&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;• Do not return the column data that you do no need in you queries.&lt;br /&gt;• You should avoid using SELECT * when returning data from tables.&lt;br /&gt;• Select only the columns that you need. For example, you should not use SELECT * to return all the columns from a table if you don&#39;t need all the data from each column.&lt;br /&gt;• In addition, using SELECT * prevents the use of covered indexes, further  potentially hurting query performance.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Using the UNION statement:&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;• The  UNION statement performs equivalent of a SELECT DISTINCT on the final result set. &lt;br /&gt;• UNION takes the results of two recordsets, combines them, and then performs a SELECT DISTINCT in order to eliminate any duplicate rows. Example :-&lt;br /&gt;&lt;br /&gt;&lt;em&gt;SELECT column_name1, column_name2 FROM table_name1 WHERE column_name1 = some_value &lt;br /&gt;UNION &lt;br /&gt;SELECT column_name1, column_name2 FROM table_name1 WHERE column_name2 = some_value;&lt;/em&gt;&lt;br /&gt;&lt;br /&gt;• You can write the same query as: &lt;br /&gt;&lt;br /&gt;&lt;em&gt;SELECT DISTINCT column_name1, column_name2 FROM table_name1 WHERE column_name1 = some_value OR column_name2 = some_value&lt;/em&gt;&lt;br /&gt;&lt;br /&gt;It will boost the performance of your sql queries.</content><link rel='replies' type='application/atom+xml' href='http://oraclebullets.blogspot.com/feeds/625220154221352262/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://oraclebullets.blogspot.com/2009/07/basic-tips-for-tuning-sql-statement.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7448526803143529116/posts/default/625220154221352262'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7448526803143529116/posts/default/625220154221352262'/><link rel='alternate' type='text/html' href='http://oraclebullets.blogspot.com/2009/07/basic-tips-for-tuning-sql-statement.html' title='Basic Tips for Tuning SQL Statement'/><author><name>Chaitanya</name><uri>http://www.blogger.com/profile/02904723174833201645</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh1RD22VqvjkhwATyYtzIKpRWkAQYPOjv8xB0LcOr2Y8mWmBdQJCvBAAGxkzfVCe95203nS9aiiC7iHlSYKbbNP0MjtsbQFFgS6uojmev4_RKzD2aWBctWmXTYHW5uNnkE/s220/Chaitu.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7448526803143529116.post-8935486642630513755</id><published>2009-07-15T15:07:00.000+05:30</published><updated>2009-07-16T13:26:42.788+05:30</updated><title type='text'>ORACLE Recyclebin</title><content type='html'>There are two recyclebin views present in ORACLE : &lt;br /&gt;&lt;strong&gt;1. USER_RECYCLEBIN&lt;/strong&gt; and &lt;br /&gt;&lt;strong&gt;2. DBA_RECYCLEBIN. &lt;/strong&gt;&lt;br /&gt;For convenience, when we are firing queries at RECYCLEBIN which is a public synonym that points to USER_RECYCLEBIN. The RECYCLEBIN is enabled by default in 10g, but one can turn it on or off with the RECYCLEBIN init parameter, at the session level or system level. &lt;br /&gt;&lt;br /&gt;Let’s say RECYCLEBIN is enabled, any tables that we drop are not actually getting deleted. Instead, Oracle just renames that particular table which has been dropped and all its associated objects (indexes, triggers, LOB segments, etc) to a system-generated name that begins with BIN$. &lt;br /&gt;&lt;br /&gt;For example, consider this simple table:&lt;br /&gt;&lt;br /&gt;&lt;em&gt;SQL&gt; Create table test (num number);&lt;br /&gt;Table created.&lt;br /&gt;SQL&gt; Insert into test values (1);&lt;br /&gt;1 row created.&lt;br /&gt;SQL&gt; Insert into test values (2);&lt;br /&gt;1 row created.&lt;br /&gt;SQL&gt; Insert into test values (3);&lt;br /&gt;1 row created.&lt;br /&gt;SQL&gt; Select * from test;&lt;br /&gt;       NUM&lt;br /&gt;----------&lt;br /&gt;         1&lt;br /&gt;         2&lt;br /&gt;         3&lt;/em&gt;&lt;br /&gt;&lt;br /&gt;If the RECYCLEBIN init parameter is set to ON (the default in 10g), then the dropped table will placed in the RECYCLEBIN:&lt;br /&gt;&lt;br /&gt;&lt;em&gt;SQL&gt; drop table test;&lt;br /&gt;Table dropped. &lt;br /&gt;SQL&gt; Select object_name, original_name, type, can_undrop, can_purge, droptime from recyclebin;&lt;br /&gt;OBJECT_NAME                    ORIGINAL_NAME                    TYPE                      CAN_DROP CAN_PURGE DROPTIME&lt;br /&gt;------------------------------ -------------------------------- ------------------------- --- --- ------------------------&lt;br /&gt;BIN$brwK19W3F/7gRAADuhyf0w==$0 TEST                             TABLE                     YES          YES         2009-07-15:10:50:33&lt;/em&gt;&lt;br /&gt;&lt;br /&gt;What has happened to the table is that when we dropped it that has got renamed. The table data is still there and can be queried just like a normal table:&lt;br /&gt;&lt;br /&gt;Note: the table name must be in quotes (“ “)&lt;br /&gt;&lt;br /&gt;&lt;em&gt;SQL&gt; select * from &quot;BIN$brwK19W3F/7gRAADuhyf0w==$0&quot;;&lt;br /&gt;       NUM&lt;br /&gt;    ----------&lt;br /&gt;         1&lt;br /&gt;         2&lt;br /&gt;         3&lt;/em&gt;&lt;br /&gt;&lt;br /&gt;Since the table data is still there, we can &quot;undrop&quot; the table. This operation is known as a &quot;flashback drop&quot;. This operation will simply rename the BIN$... table to its original name:&lt;br /&gt;&lt;br /&gt;&lt;em&gt;SQL&gt; Flashback table &quot;BIN$brwK19W3F/7gRAADuhyf0w==$0&quot; to before drop;&lt;br /&gt;Flashback complete.&lt;br /&gt;SQL&gt; select * from test;&lt;br /&gt;       NUM&lt;br /&gt;     ----------&lt;br /&gt;         1&lt;br /&gt;         2&lt;br /&gt;         3&lt;/em&gt;&lt;br /&gt;&lt;br /&gt;It&#39;s important to know that after you&#39;ve dropped a table, it has only been renamed; the table segments still exist there in your tablespace, unchanged, occupying space. This space still counts against your user tablespace quotas, as well as filling up the tablespace. It will not be reclaimed until you get the table out of the recyclebin. You can remove an object from the recyclebin by restoring it, or by purging it from the recyclebin. &lt;br /&gt;&lt;br /&gt;&lt;em&gt;SQL&gt; select object_name, original_name, type, can_undrop, can_purge, droptime from recyclebin;&lt;br /&gt;Object_name                   original_name type can_undrop can_purge droptime&lt;br /&gt;--------------------------------------------------------------------------------&lt;br /&gt;BIN$brwK19W3F/7gRAADuhyf0w==$0 TEST                         TABLE        YES                  YES                    2009-07-09:12:26:22&lt;br /&gt;SQL&gt; purge table “BIN$brwK19W3F/7gRAADuhyf0w==$0” ;&lt;br /&gt;Table purged.&lt;br /&gt;SQL&gt; select * from recyclebin;&lt;br /&gt;No rows returned.&lt;/em&gt;&lt;br /&gt;&lt;br /&gt;You have several purge options. You can also purge everything from the USER_RECYCLEBIN using PURGE RECYCLEBIN; a user with DBA privileges can purge everything from all recyclebins using DBA_RECYCLEBIN; and finally, you can purge recyclebin objects by schema and user with PURGE TABLESPACE USER.&lt;br /&gt;Unless you purge them, Oracle will leave objects in the recyclebin until the tablespace runs out of space, or until you hit your user quota on the tablespace. At that point, Oracle purges the objects one at a time, starting with the ones dropped the longest time ago, until there is enough space for the current operation. If the tablespace data files are AUTOEXTEND ON, Oracle will purge recyclebin objects before it autoextends a datafile.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Dealing with dropped table versions&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Just as you can wind up with several versions of a file with the same name in the Windows recycle bin, you can wind up with several versions of a table in the Oracle recyclebin also. For example, if we create and drop the TEST table twice, we&#39;ll have two versions in the recyclebin:&lt;br /&gt;&lt;br /&gt;&lt;em&gt;SQL&gt; create table test (test_col varchar2(10));&lt;br /&gt;Table created.&lt;br /&gt;SQL&gt;  insert into test values (&#39;Version 1&#39;);&lt;br /&gt;1 row created.&lt;br /&gt;SQL&gt;  commit;&lt;br /&gt;Commit complete.&lt;br /&gt;SQL&gt; drop table test;&lt;br /&gt;Table dropped.&lt;br /&gt;SQL&gt; create table test (test_col varchar2(10));&lt;br /&gt;Table created.&lt;br /&gt;SQL&gt; insert into test values(&#39;Version 2&#39;);&lt;br /&gt;1 row created.&lt;br /&gt;SQL&gt;  commit;&lt;br /&gt;Commit complete.&lt;br /&gt;SQL&gt;  drop table test;&lt;br /&gt;Table dropped.&lt;br /&gt;&lt;br /&gt;SQL&gt; select object_name, original_name, type, can_undrop as &quot;UND&quot;, can_purge as &quot;PUR&quot;, droptime  fro&lt;br /&gt;m recyclebin;&lt;br /&gt;&lt;br /&gt;OBJECT_NAME                    ORIGINAL_NAME                    TYPE                      UND PUR DROPTIME&lt;br /&gt;------------------------------ -------------------------------- ------------------------- --- --- --&lt;br /&gt;BIN$brrGkpUUF7vgRAADuhyf0w==$0 TEST                             TABLE                     YES YES 2009-07-15:08:48:05&lt;br /&gt;BIN$brrGkpUVF7vgRAADuhyf0w==$0 TEST                             TABLE                     YES YES 2009-07-15:08:48:31&lt;/em&gt;&lt;br /&gt;&lt;br /&gt;Now query the two dropped tables to verify that whether they are different:&lt;br /&gt;&lt;br /&gt;&lt;em&gt;SQL&gt; select * from &quot;BIN$brrGkpUUF7vgRAADuhyf0w==$0&quot;;&lt;br /&gt;TEST_COL&lt;br /&gt;----------&lt;br /&gt;Version 1&lt;br /&gt;SQL&gt; select * from &quot;BIN$brrGkpUVF7vgRAADuhyf0w==$0&quot;;&lt;br /&gt;TEST_COL&lt;br /&gt;----------&lt;br /&gt;Version 2&lt;/em&gt;&lt;br /&gt;&lt;br /&gt;Now we are going to issue a FLASHBACK DROP command for TEST, which version will Oracle restore?&lt;br /&gt;&lt;br /&gt;&lt;em&gt;SQL&gt; flashback table test to before drop;&lt;br /&gt;Flashback complete.&lt;br /&gt;SQL&gt; select * from test;&lt;br /&gt;TEST_COL&lt;br /&gt;----------&lt;br /&gt;Version 2&lt;/em&gt;&lt;br /&gt;&lt;br /&gt;Oracle will always restore the most recent version of the dropped object. If we want the previous version then we can select the new BIN$... name of the TEST from the recyclebin and we can perform flashback query operation on the BIN$... table as follows. This will restore the required version of the TEST table.&lt;br /&gt;&lt;br /&gt;&lt;em&gt;SQL&gt; select * from &quot;BIN$brrGkpUUF7vgRAADuhyf0w==$0&quot;;&lt;br /&gt;TEST_COL&lt;br /&gt;----------&lt;br /&gt;Version 1&lt;br /&gt;SQL&gt; select * from &quot;BIN$brrGkpUVF7vgRAADuhyf0w==$0&quot;;&lt;br /&gt;TEST_COL&lt;br /&gt;----------&lt;br /&gt;Version 2&lt;/em&gt;&lt;br /&gt;&lt;br /&gt;Now we want to restore the Version 1 table then we need to capture the BIN$... name of the TEST table i.e., &lt;br /&gt;&lt;strong&gt;BIN$brrGkpUUF7vgRAADuhyf0w==$0&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Now issue the flash back query as follows it will restore the required version of the TEST table.&lt;br /&gt;&lt;br /&gt;&lt;em&gt;SQL&gt; flashback table &quot;BIN$brrGkpUUF7vgRAADuhyf0w==$0&quot; to before drop;&lt;br /&gt;Flashback complete.&lt;br /&gt;SQL&gt; select * from test;&lt;br /&gt;TEST_COL&lt;br /&gt;----------&lt;br /&gt;Version 1&lt;/em&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Going with DEPENDENT OBJECTS&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;In a modern RDBMS, Most will have indexes, constraints, and/or triggers some stand alone. When a table is dropped ORALCE drops the dependent objects associated with it. When you drop a table with the recyclebin enabled, the table and its dependent objects get renamed, but still have the same structure as before. The triggers and indexes get modified to point to the new BIN$ table name. (Any stored procedures that referenced the original object, will be invalidated.) &lt;br /&gt;&lt;br /&gt;For example:&lt;br /&gt;&lt;br /&gt;&lt;em&gt;SQL&gt; create table test (test_col varchar2(10));&lt;br /&gt;Table created.&lt;br /&gt;SQL&gt; create index ind_test_col on test(test_col);&lt;br /&gt;Index created.&lt;br /&gt;SQL&gt; insert into test values (&#39;Version 1&#39;);&lt;br /&gt;1 row created.&lt;br /&gt;SQL&gt; commit;&lt;br /&gt;Commit complete.&lt;br /&gt;SQL&gt; select object_name, original_name, type, can_undrop, can_purge, droptime, base_object, purge_object from recyclebin;&lt;br /&gt;OBJECT_NAME                    ORIGINAL_NAME                    TYPE                      CAN_UNDROP CAN_PURGE DROPTIME            BASE_OBJECT PURGE_OBJECT&lt;br /&gt;------------------------------ -------------------------------- ------------------------- --- --- --&lt;br /&gt;BIN$brwK19WxF/7gRAADuhyf0w==$0 IND_TEST_COL               INDEX                     NO  YES 2009-07-15:10:18:46       53649        53650&lt;br /&gt;BIN$brwK19WyF/7gRAADuhyf0w==$0 TEST                             TABLE                     YES YES 2009-07-15:10:18:46       53649        53649&lt;br /&gt;SQL&gt; flashback table test to before drop;&lt;br /&gt;Flashback complete.&lt;br /&gt;&lt;br /&gt;SQL&gt; select object_name, original_name, type, can_undrop, can_purge, droptime, base_object, purge_object from recyclebin;&lt;br /&gt;no rows selected&lt;/em&gt;&lt;br /&gt;&lt;br /&gt;The RECYCLEBIN views have a few other columns that make the relationship between TEST and IND_TEST_COL clear:&lt;br /&gt;The PURGE_OBJECT column is the object number of the object itself; eg. the object number of IND_TEST_COL is 53650. Note the value of the BASE_OBJECT column for IND_TEST_COL: 53649, the object number of the associated version of the TEST table.&lt;br /&gt;If we FLASHBACK DROP the TEST table, its index will be restored - but Oracle will not rename it to its original name. It will retain its BIN$.. name:&lt;br /&gt;&lt;br /&gt;&lt;em&gt;SQL&gt; select index_name from user_indexes where table_name=&#39;TEST&#39;;&lt;br /&gt;INDEX_NAME&lt;br /&gt;------------------------------&lt;br /&gt;BIN$brwK19WxF/7gRAADuhyf0w==$0&lt;br /&gt;&lt;br /&gt;SQL&gt; drop table test;&lt;br /&gt;Table dropped.&lt;br /&gt;SQL&gt; select object_name, original_name, type, can_undrop, can_purge, droptime, base_object, purge_object from recyclebin;&lt;br /&gt;OBJECT_NAME                    ORIGINAL_NAME                    TYPE                      CAN_UNDROP CAN_PURGE DROPTIME            BASE_OBJECT PURGE_OBJECT&lt;br /&gt;------------------------------ -------------------------------- ------------------------- --- --- --&lt;br /&gt;BIN$brwK19WzF/7gRAADuhyf0w==$1 BIN$brwK19WxF/7gRAADuhyf0w==$0   INDEX                     NO  YES 2009-07-15:10:43:33   &lt;br /&gt;BIN$brwK19W0F/7gRAADuhyf0w==$0 TEST                             TABLE                     YES YES 2009-07-15:10:43:33       53649        53649&lt;/em&gt;&lt;br /&gt;&lt;br /&gt;Note the values in the CAN_UNDROP and CAN_PURGE columns for the index. An index cannot be undropped without the table - so CAN_UNDROP is set to NO. It can, however, be purged without purging the table:&lt;br /&gt;&lt;br /&gt;&lt;em&gt;SQL&gt; purge index &quot;BIN$brwK19WzF/7gRAADuhyf0w==$1&quot;;&lt;br /&gt;Index purged.&lt;/em&gt;&lt;br /&gt;&lt;br /&gt;Now, if we restore the table, it will be restored without the index:&lt;br /&gt;&lt;br /&gt;&lt;em&gt;SQL&gt; select index_name from user_indexes where table_name=&#39;TEST&#39;;&lt;br /&gt;no rows selected&lt;/em&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;LIMITATIONS&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;A few types of dependent objects are not handled like the simple index above.&lt;br /&gt;&lt;br /&gt;o Bitmap join indexes are not put in the recyclebin when their base table is dropped, and not retrieved when the table is restored with FLASHBACK DROP. &lt;br /&gt;&lt;br /&gt;o The same applies for materialized view logs; when you drop a table, all mview logs defined on that table are permanently dropped, not put in the recyclebin. &lt;br /&gt;&lt;br /&gt;o Referential integrity constraints that reference another table are lost when the table is put in the recyclebin and then restored. &lt;br /&gt;&lt;br /&gt;If space limitations force Oracle to start purging objects from the recyclebin, it purges indexes first. If you FLASHBACK DROP a table whose associated indexes have already been purged, it will be restored without the indexes.</content><link rel='replies' type='application/atom+xml' href='http://oraclebullets.blogspot.com/feeds/8935486642630513755/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://oraclebullets.blogspot.com/2009/07/oracle-recyclebin.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7448526803143529116/posts/default/8935486642630513755'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7448526803143529116/posts/default/8935486642630513755'/><link rel='alternate' type='text/html' href='http://oraclebullets.blogspot.com/2009/07/oracle-recyclebin.html' title='ORACLE Recyclebin'/><author><name>Chaitanya</name><uri>http://www.blogger.com/profile/02904723174833201645</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh1RD22VqvjkhwATyYtzIKpRWkAQYPOjv8xB0LcOr2Y8mWmBdQJCvBAAGxkzfVCe95203nS9aiiC7iHlSYKbbNP0MjtsbQFFgS6uojmev4_RKzD2aWBctWmXTYHW5uNnkE/s220/Chaitu.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7448526803143529116.post-1294179074934528470</id><published>2009-07-09T11:49:00.000+05:30</published><updated>2009-07-16T13:27:07.331+05:30</updated><title type='text'>Finding the “Floating” calendar dates:</title><content type='html'>Using the SQL we can find the floating calendar dates, such as the second Tuesday of the month, with modular arithmetic and brute force reasoning.&lt;br /&gt;&lt;br /&gt;To calculate the second Tuesday of the month, this depends on the day of the week of the first day of the month. But we need to know which month is this? Obviously, all we need to know are the month and year, but it’s easier if we start with a date as such. For testing purposes, the following table can be used.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;em&gt;&lt;strong&gt;Create table month_date (month_date date);&lt;br /&gt;Insert into month_date values(date ‘2009-04-01’);&lt;br /&gt;Insert into month_date values(date ‘2009-05-01’);&lt;br /&gt;Insert into month_date values(date ‘2009-06-01’);&lt;br /&gt;Insert into month_date values(date ‘2009-07-01’);&lt;/strong&gt;&lt;/em&gt;&lt;br /&gt;&lt;br /&gt;So, given a date, the first day of a month, what date is the second Tuesday of that month? The process begins by calculating the day of the week for the first day of the month.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Day-of-week function:&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Even though standard SQL doesn’t provide any function to give the day of the week for any date, most of the database systems do.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;ORACLE provides a function:&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;em&gt;TO_CHAR(DATE,’D’);&lt;/em&gt;&lt;br /&gt;&lt;br /&gt;The essence of this function is that it will return a number between 0 and 6 or 1 and 7.Sometimes 0 or 1 is Sunday and 6 or 7 is Saturday, and sometime 0 or 1 is Monday and 6 or 7 is Sunday. This depends on how the NLS_TERRITORY parameter is set.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Note:&lt;/strong&gt; We follow that 1 is Sunday and 7 is Saturday in our example.&lt;br /&gt;&lt;strong&gt;-----&lt;/strong&gt;&lt;br /&gt; &lt;br /&gt;&lt;strong&gt;The Formula:&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;To convert the first day of the month into second Tuesday of the month simply involves manipulating the day of the week of the first day with in an arithmetic formula. Before we see the formula, we should know what happens when the first day of the month falls on each day of the week from Sunday through Saturday.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Lets see this:&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;1. A Sunday, the third is a Tuesday, so the tenth is the second Tuesday&lt;br /&gt;2. A Monday, the second is Tuesday, so the ninth is the second Tuesday&lt;br /&gt;3. A Tuesday, the eighth is the second Tuesday&lt;br /&gt;4. A Wednesday, the seventh is the next Tuesday and fourteenth is the second Tuesday.&lt;br /&gt;5. A Thursday, the sixth is the next Tuesday and thirteenth is the second Tuesday&lt;br /&gt;6. A Friday, the fifth is the next Tuesday and the twelfth is the second Tuesday&lt;br /&gt;7. A Saturday, the fourth is the next Tuesday and the eleventh is the second Tuesday&lt;br /&gt;&lt;br /&gt;This gives us all the possibilities. So now we have to reduce these facts to formula.&lt;br /&gt;&lt;table BORDER = 1&gt;&lt;br /&gt;&lt;tr&gt; &lt;tH&gt;A&lt;/tH&gt; &lt;tH&gt;B&lt;/tH&gt; &lt;tH&gt;C&lt;/tH&gt; &lt;tH&gt;D&lt;/tH&gt; &lt;tH&gt;E&lt;/tH&gt; &lt;/tr&gt;&lt;br /&gt;&lt;tr&gt; &lt;TH&gt;1ST&lt;/TH&gt; &lt;TH&gt;WEEK DAY&lt;/TH&gt; &lt;TH&gt;10-B&lt;/TH&gt; &lt;TH&gt;C MOD 7&lt;/TH&gt; &lt;TH&gt;D+7&lt;/TH&gt; &lt;/TR&gt;&lt;br /&gt;&lt;tr&gt; &lt;TH&gt;SUN&lt;/TH&gt; &lt;TH&gt;1&lt;/TH&gt; &lt;TH&gt;9&lt;/TH&gt; &lt;TH&gt;2&lt;/TH&gt; &lt;TH&gt;9&lt;/TH&gt; &lt;/TR&gt; &lt;tr&gt; &lt;TH&gt;MON&lt;/TH&gt; &lt;TH&gt;2&lt;/TH&gt; &lt;TH&gt;8&lt;/TH&gt; &lt;TH&gt;1&lt;/TH&gt; &lt;TH&gt;8&lt;/TH&gt; &lt;/TR&gt;&lt;tr&gt; &lt;TH&gt;TUE&lt;/TH&gt; &lt;TH&gt;3&lt;/TH&gt; &lt;TH&gt;7&lt;/TH&gt; &lt;TH&gt;0&lt;/TH&gt; &lt;TH&gt;7&lt;/TH&gt; &lt;/TR&gt; &lt;tr&gt; &lt;TH&gt;WED&lt;/TH&gt; &lt;TH&gt;4&lt;/TH&gt; &lt;TH&gt;6&lt;/TH&gt; &lt;TH&gt;6&lt;/TH&gt; &lt;TH&gt;13&lt;/TH&gt; &lt;/TR&gt; &lt;tr&gt; &lt;TH&gt;THU&lt;/TH&gt; &lt;TH&gt;5&lt;/TH&gt; &lt;TH&gt;5&lt;/TH&gt; &lt;TH&gt;5&lt;/TH&gt; &lt;TH&gt;12&lt;/TH&gt; &lt;/TR&gt; &lt;tr&gt; &lt;TH&gt;FRI&lt;/TH&gt; &lt;TH&gt;6&lt;/TH&gt; &lt;TH&gt;4&lt;/TH&gt; &lt;TH&gt;4&lt;/TH&gt; &lt;TH&gt;11&lt;/TH&gt; &lt;/TR&gt; &lt;tr&gt; &lt;TH&gt;SAT&lt;/TH&gt; &lt;TH&gt;7&lt;/TH&gt; &lt;TH&gt;3&lt;/TH&gt; &lt;TH&gt;3&lt;/TH&gt; &lt;TH&gt;10&lt;/TH&gt; &lt;/TR&gt; &lt;/table&gt; &lt;br /&gt;&lt;br /&gt;The first column (A) is the day of the week of the first day of the month; and the second column is the numerical equivalent of this day using the range from 1 to 7.&lt;br /&gt;The important data in the above table is the last column; which is the number of days to add to the date of the first day of the month.&lt;br /&gt;&lt;br /&gt;&lt;em&gt;So, the formula can be derived as follows.&lt;/em&gt;&lt;br /&gt;&lt;br /&gt;1. Find B, the day of the week of the first day of the month, using &lt;br /&gt;1-Sunday……7-Saturday.&lt;br /&gt;&lt;br /&gt;2. Subtract this number from 10 to get C: &lt;br /&gt;With Sunday -1 …. Saturday – 7, Tuesday would be 3.&lt;br /&gt;The number 3-B is the offset (relative to the first of the month) for a Tuesday, but it might be in the current month or the previous month; 10-B is also a Tuesday, and so are 17-B and 24-B.&lt;br /&gt;You should choose to subtract 10 because you want C to be positive for all inputs. Because you need D to be positive in the next step, but a negative value for C would result in a negative value for D. this is because -1%7 gives -1 on most systems.&lt;br /&gt;&lt;br /&gt;3. Divide by 7 and keep remainder to get D value.&lt;br /&gt;D is also the offset for a Tuesday, and D in the range of 0 to 6. every day in the first week has an offset between 0 to 6. So D is the first Tuesday of the month.&lt;br /&gt;&lt;br /&gt;4. Add 7 to get E.&lt;br /&gt;That takes the range of E from 7 to 13. Every day in the second week has an offset in the range of 7-13.&lt;br /&gt;&lt;br /&gt;5. Take the result and add that number of days to the date of the first day of the month.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Implementing this on ORACLE database:&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;em&gt;SELECT TO_CHAR (month_date, &#39;dd-mon-yyyy&#39;) AS first_day_of_month,&lt;br /&gt;       TO_CHAR ((  (month_date)&lt;br /&gt;                 + MOD ((10 - TO_CHAR ((month_date), &#39;d&#39;)), 7)&lt;br /&gt;                 + 7&lt;br /&gt;                ),&lt;br /&gt;                &#39;dd-mon-yyyy&#39;&lt;br /&gt;               ) AS second_tuesday_of_month&lt;br /&gt;  FROM month_date&lt;/em&gt;&lt;br /&gt;&lt;br /&gt;&lt;em&gt;&lt;strong&gt;OUTPUT&lt;br /&gt;*******&lt;/strong&gt;&lt;/em&gt;&lt;br /&gt;&lt;table BORDER = 3&gt; &lt;tr&gt; &lt;tH&gt;FIRST_DAY_OF_MONTH&lt;/tH&gt; &lt;tH&gt;SECOND_TUESDAY_OF_MONTH&lt;/tH&gt; &lt;/tr&gt; &lt;tr&gt; &lt;TH&gt;01-apr-2009&lt;/TH&gt; &lt;TH&gt;14-apr-2009&lt;/TH&gt; &lt;br /&gt;&lt;/TR&gt; &lt;tr&gt; &lt;TH&gt;01-may-2009&lt;/TH&gt; &lt;TH&gt;12-may-2009&lt;/TH&gt; &lt;/TR&gt; &lt;tr&gt; &lt;TH&gt;01-jun-2009&lt;/TH&gt; &lt;TH&gt;09-jun-2009&lt;/TH&gt; &lt;/TR&gt; &lt;tr&gt;&lt;br /&gt;&lt;TH&gt;01-jul-2009&lt;/TH&gt; &lt;TH&gt;14-jul-2009&lt;/TH&gt; &lt;/TR&gt; &lt;/table&gt;&lt;br /&gt;&lt;br /&gt;Hope this is useful for you guys.</content><link rel='replies' type='application/atom+xml' href='http://oraclebullets.blogspot.com/feeds/1294179074934528470/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://oraclebullets.blogspot.com/2009/07/finding-floating-calendar-dates.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7448526803143529116/posts/default/1294179074934528470'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7448526803143529116/posts/default/1294179074934528470'/><link rel='alternate' type='text/html' href='http://oraclebullets.blogspot.com/2009/07/finding-floating-calendar-dates.html' title='Finding the “Floating” calendar dates:'/><author><name>Chaitanya</name><uri>http://www.blogger.com/profile/02904723174833201645</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh1RD22VqvjkhwATyYtzIKpRWkAQYPOjv8xB0LcOr2Y8mWmBdQJCvBAAGxkzfVCe95203nS9aiiC7iHlSYKbbNP0MjtsbQFFgS6uojmev4_RKzD2aWBctWmXTYHW5uNnkE/s220/Chaitu.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7448526803143529116.post-6163903839899976145</id><published>2009-06-16T11:11:00.000+05:30</published><updated>2009-07-04T10:58:14.502+05:30</updated><title type='text'>Dedicated server Vs Shared Server:</title><content type='html'>&lt;em&gt;&lt;strong&gt;Dedicated server:&lt;/strong&gt;&lt;/em&gt;&lt;br /&gt;&lt;br /&gt;--&gt; The user process and the server process are separate all together.&lt;br /&gt;--&gt; In a dedicated server environment each user process has its own server process.&lt;br /&gt;--&gt; To take the advantage of distributed processing the user process and server process can run on different machines.&lt;br /&gt;--&gt; The dedicated server exists even when a user process is not making any database requests, at this particular point of time the server process remains idle.&lt;br /&gt;--&gt; The ratio between the user process and server process in a dedicated server environment will be one – to – one.&lt;br /&gt; If the user and server process are on the same machine then the interface in use will be IPC (Inter Process Communication) mechanism.&lt;br /&gt;&lt;br /&gt;&lt;em&gt;&lt;strong&gt;Shared server:&lt;/strong&gt;&lt;/em&gt;&lt;br /&gt;&lt;br /&gt;--&gt; Generally we go to shared server in order to increase the server efficiency.&lt;br /&gt;--&gt; In an OLTP (On Line Transaction Processing) environment, at the time of order entry the server process will be in the idle state for almost 90 % of the time. Due to this we are not able to actually utilize the system resources which are getting wasted.&lt;br /&gt;--&gt; Unlike dedicated server processes, a shared server process can process can process any request which comes, instead waiting for a particular request.&lt;br /&gt;--&gt; In a shared server the client (User) process hits the dispatcher which in turn assigns the request to any one of the server processes which is free at that particular point of time.&lt;br /&gt;--&gt; The PMON process registers the location and load of the dispatcher with the listener, enabling the listener to forward the requests to least utilized dispatcher.&lt;br /&gt;--&gt; A dispatched can support multiple client connection concurrently.&lt;br /&gt;&lt;br /&gt;&lt;em&gt;&lt;strong&gt;Benefits of Shared server:&lt;/strong&gt;&lt;/em&gt;&lt;br /&gt;&lt;br /&gt;--&gt; Reduces the number of server process which are idle.&lt;br /&gt;--&gt; Reduces the umber of processes against an instance.&lt;br /&gt;--&gt; Load balancing is achieved.&lt;br /&gt;--&gt; The number of possible users can be increased.&lt;br /&gt;&lt;br /&gt;&lt;em&gt;&lt;strong&gt;Note:&lt;/strong&gt;&lt;/em&gt;&lt;br /&gt;&lt;br /&gt;A dedicated server can be used at –&lt;br /&gt;--&gt; The time of connecting as a SYSDBA to start up / shutdown / at the time of performing recovery.&lt;br /&gt;--&gt; When batch jobs are executed as there will be minimal / no idle time as such.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href=&quot;http://feedburner.google.com/fb/a/mailverify?&lt;br /&gt;uri=OracleBullets&amp;amp;loc=en_US&quot;&gt;Subscribe to Oracle Bullets by Email&lt;/a&gt;</content><link rel='replies' type='application/atom+xml' href='http://oraclebullets.blogspot.com/feeds/6163903839899976145/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://oraclebullets.blogspot.com/2009/06/dedicated-server-vs-shared-server.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7448526803143529116/posts/default/6163903839899976145'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7448526803143529116/posts/default/6163903839899976145'/><link rel='alternate' type='text/html' href='http://oraclebullets.blogspot.com/2009/06/dedicated-server-vs-shared-server.html' title='Dedicated server Vs Shared Server:'/><author><name>Chaitanya</name><uri>http://www.blogger.com/profile/02904723174833201645</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh1RD22VqvjkhwATyYtzIKpRWkAQYPOjv8xB0LcOr2Y8mWmBdQJCvBAAGxkzfVCe95203nS9aiiC7iHlSYKbbNP0MjtsbQFFgS6uojmev4_RKzD2aWBctWmXTYHW5uNnkE/s220/Chaitu.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7448526803143529116.post-6569816012449211191</id><published>2009-06-16T10:40:00.000+05:30</published><updated>2009-07-04T10:58:34.690+05:30</updated><title type='text'>Gist of Materialized views:</title><content type='html'>People might be aware of Snapshots in ORACLE, now in recent versions of ORACLE the place of snapshots has been occupied by MATERIALIZED VIEWS. These materialized views have many uses:&lt;br /&gt;&lt;br /&gt;1. We can copy the data from one instance to other with the same format, and we can query against the materialized view directly.&lt;br /&gt;2. We can copy the aggregated (Summarized) data from one instance to other instance and we can fire queries against the materialized view directly.&lt;br /&gt;3. We can create a summarized (aggregated) version of a table, the interesting point here is that if we query the base table, then the query is automatically be rewritten to use the materialized view.&lt;br /&gt;&lt;br /&gt;Let’s have examples for each of the above uses of the materialized views.&lt;br /&gt;&lt;br /&gt;1. Here all the code is in our local database LOCALDB. We have a remote database RMDB, where there is a table named employee. However, one time per day our materialized view wakes up, dips into the RMDB and grabs the data and brings the same to LOCALDB.&lt;br /&gt;&lt;br /&gt;Because of this we can fire the required queries to the materialized view even though we don’t have access to the RMDB.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;In our LOCALDB:&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;em&gt;Create materialized view emp_mview_ex1&lt;br /&gt;Refresh complete&lt;br /&gt;Start with sysdate&lt;br /&gt;Next sysdate+1 as &lt;br /&gt;Select emp_name, dept_name  from employee@RMDB_dblink;&lt;/em&gt;&lt;br /&gt;&lt;br /&gt;Now we can query the Materialized view as such&lt;br /&gt;&lt;br /&gt;&lt;em&gt;Select * from emp_mview_ex1;&lt;/em&gt;&lt;br /&gt;&lt;br /&gt;2. Now let’s discuss about the summary (aggregated) table example. Even her all the code is in the local database LOCALDB. We have a employee table in the RMDB, now this data is summarized daily – getting the number of employees per department, as well as the average salary in that particular department.&lt;br /&gt;&lt;br /&gt;Even, here we can fire queries against our local database LOCALDB with no access to the RMDB, aside from the refreshing the materialized view daily.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;In our LOCALDB:&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;em&gt;Create materialized view emp_mview_ex2&lt;br /&gt;Refresh complete &lt;br /&gt;Start with sysdate&lt;br /&gt;Next sysdate+1 as&lt;br /&gt;Select dept_name,count(*), avg(salary) from employee@RMDB_dblink; group by dept_name;&lt;/em&gt;&lt;br /&gt;&lt;br /&gt;Now we can query the Materialized view,&lt;br /&gt;&lt;br /&gt;&lt;em&gt;Select * from emp_mview_ex2;&lt;/em&gt;&lt;br /&gt;&lt;br /&gt;3. Now the interesting use of the materialized view query rewrite. A materialized view is built with the help of a base table and data is summarized, The ORACLE optimizer is smart enough in such a way that it can realize that when a query is fired on a base table, the data is already been aggregated in a materialized view, and will go with the data in the materialized view.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;In our LOCALDB:&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;em&gt;Create materialized view emp_mview_ex3&lt;br /&gt;Refresh complete&lt;br /&gt;Start with sysdate&lt;br /&gt;Next sysdate+1 as &lt;br /&gt;Select dept_name, count(*) from employee group by dept_name;&lt;/em&gt;&lt;br /&gt;&lt;br /&gt;Now we query the LOCALDB with the base table n the from clause&lt;br /&gt;&lt;br /&gt;&lt;em&gt;Select dept_name, count(*) from employee group by dept_name;&lt;/em&gt;&lt;br /&gt;&lt;br /&gt;Even though the query is fired against the base table, at the time of execution the optimizer will switch to the existing materialized view with the information already aggregated (summarized) and it will use the emp_mview_ex3 instead.&lt;br /&gt;&lt;br /&gt;To make optimizer to think of using the existing materialized views there are some init.ora parameters to be set they are:&lt;br /&gt;&lt;br /&gt;1. &lt;em&gt;&lt;strong&gt;query_rewrite_enabled &lt;/strong&gt;&lt;/em&gt;needs to be set to a value TRUE and we should have the &lt;em&gt;‘query rewrite’ system privilege&lt;/em&gt;.&lt;br /&gt;2. If the materialized view has to be refreshed based on a schedule the it is going to use &lt;em&gt;&lt;strong&gt;dbms_job &lt;/strong&gt;&lt;/em&gt;to do so, so &lt;em&gt;job_queue_processes &lt;/em&gt;needs to be some value &gt; 0.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href=&quot;http://feedburner.google.com/fb/a/mailverify?uri=OracleBullets&amp;amp;loc=en_US&quot;&gt;Subscribe to Oracle Bullets by Email&lt;/a&gt;</content><link rel='replies' type='application/atom+xml' href='http://oraclebullets.blogspot.com/feeds/6569816012449211191/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://oraclebullets.blogspot.com/2009/06/gist-of-materialized-views-people-might.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7448526803143529116/posts/default/6569816012449211191'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7448526803143529116/posts/default/6569816012449211191'/><link rel='alternate' type='text/html' href='http://oraclebullets.blogspot.com/2009/06/gist-of-materialized-views-people-might.html' title='Gist of Materialized views:'/><author><name>Chaitanya</name><uri>http://www.blogger.com/profile/02904723174833201645</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh1RD22VqvjkhwATyYtzIKpRWkAQYPOjv8xB0LcOr2Y8mWmBdQJCvBAAGxkzfVCe95203nS9aiiC7iHlSYKbbNP0MjtsbQFFgS6uojmev4_RKzD2aWBctWmXTYHW5uNnkE/s220/Chaitu.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7448526803143529116.post-1607895472946754227</id><published>2009-06-12T10:14:00.000+05:30</published><updated>2009-07-04T10:59:30.880+05:30</updated><title type='text'>Generating random numbers and strings in Oracle is easier</title><content type='html'>For testing purposes at times we may need some test data, for this we might need to generate some random numbers or strings. People may write their own Random number generation scripts, but even ORACLE is providing a package for generating the random numbers and strings as well. This may be useful to in creating the auto generated passwords in a web page.&lt;br /&gt;&lt;br /&gt;The fact is that Oracle provides us with a random number generation package. When this package is used to generate the random numbers it is faster than writing our own random generation scripts in PL/SQL. This Random generator package is not only used to generate the numbers and strings but this can be used to generate the alpha numeric strings also with the desired size (number of characters).&lt;br /&gt;&lt;br /&gt;&lt;h4&gt;&lt;strong&gt;&lt;em&gt;Bullet:&lt;/em&gt;&lt;/strong&gt; &lt;/h4&gt;&lt;br /&gt;&lt;br /&gt;&lt;h4&gt;&lt;em&gt;&lt;strong&gt;DBMS_RANDOM package&lt;/strong&gt;&lt;/em&gt;&lt;/h4&gt;&lt;br /&gt;The DBMS_RANDOM package which is provided by ORACLE will generate random data in character, numeric or alphanumeric formats. The size of the random values which are to be generated can also be specified. &lt;br /&gt;This package can be created using the script dbmsrand.sql available in the &lt;ORACLE_HOME&gt;/RDBMS/ADMIN directory. &lt;br /&gt;&lt;br /&gt;The following are the functions that are present in the package which can be used to serve the purpose of generating random numbers and strings. &lt;br /&gt;&lt;em&gt;RANDOM&lt;/em&gt; – This function is used to generate the random numbers. &lt;br /&gt;&lt;br /&gt;&lt;em&gt;VALUE&lt;/em&gt; – This function is used to generate random numbers from the range provided. The range will be taken as 0-1 if nothing is provided.&lt;br /&gt;&lt;br /&gt;&lt;em&gt;STRING&lt;/em&gt; – This function is used to generate the strings either in upper case or lower case or alphanumeric format. &lt;br /&gt;&lt;br /&gt;• The first argument of the functions takes the following values which will define the string type to be generated. &lt;br /&gt;• U - Upper case &lt;br /&gt;• L - Lower case &lt;br /&gt;• A - Alphanumeric &lt;br /&gt;• X - Alphanumeric with upper case alphabets. &lt;br /&gt;• P - Printable characters only. &lt;br /&gt;&lt;br /&gt;If we use any character other than these characters the output will be in Upper case.&lt;br /&gt;The second argument will be the size of the random number / string to be generated.&lt;br /&gt;Oracle documentation says that it is necessary to initialize the package before using the random number generator. Oracle by default initializes the package with the seed value as the current user name, current time down to the second and the current session id. &lt;br /&gt;&lt;br /&gt;&lt;em&gt;INITIALIZE&lt;/em&gt; - Initialize the package to proceed with the number generation. &lt;br /&gt;Provide a number (seed) as input to the routine.&lt;br /&gt;&lt;br /&gt;&lt;em&gt;SEED&lt;/em&gt; - Used to change the seed value. It is used in the internal algorithm to generate values. Setting this will generate the random numbers in an order that will be similar in multiple sessions. Refer to the example below.&lt;br /&gt;&lt;br /&gt;&lt;em&gt;TERMINATE&lt;/em&gt; - Close the process of random number generation. &lt;br /&gt;&lt;br /&gt;&lt;h4&gt;&lt;strong&gt;Examples:&lt;/strong&gt;&lt;/h4&gt;&lt;br /&gt;Below are some of the examples of using the package.&lt;br /&gt;&lt;br /&gt;&lt;em&gt;Example 1:&lt;/em&gt; To generate a random number (positive or negative)&lt;br /&gt;Select dbms_random.random from dual;&lt;br /&gt;&lt;br /&gt;       RANDOM&lt;br /&gt;_____________&lt;br /&gt;   1254544778&lt;br /&gt;&lt;br /&gt;&lt;em&gt;Example 2:&lt;/em&gt; To generating a random number between 0 and 1.&lt;br /&gt;SQL&gt; select dbms_random.value from dual;&lt;br /&gt;&lt;br /&gt;        VALUE&lt;br /&gt;_____________&lt;br /&gt;0.98121484036063&lt;br /&gt;&lt;br /&gt;&lt;em&gt;Example 3:&lt;/em&gt; To generating a random number from a range, between 1 to 1000.&lt;br /&gt;SQL&gt; select dbms_random.value(1,1000) num from dual;&lt;br /&gt;&lt;br /&gt;          NUM&lt;br /&gt;_____________&lt;br /&gt;979.825208337552&lt;br /&gt;&lt;br /&gt;&lt;em&gt;Example 4:&lt;/em&gt; To generating a 12 digit random number. &lt;br /&gt;SQL&gt; select dbms_random.value(100000000000, 999999999999) num from dual;&lt;br /&gt;&lt;br /&gt;          NUM&lt;br /&gt;_____________&lt;br /&gt; 886832250758.021&lt;br /&gt;&lt;br /&gt;&lt;em&gt;Example 5: &lt;/em&gt;To generating an upper case string of 20 characters&lt;br /&gt;SQL&gt; select dbms_random.string(&#39;U&#39;, 20) str from dual;&lt;br /&gt;&lt;br /&gt;STR&lt;br /&gt;_______________________&lt;br /&gt;TSKZJBAGRQREGUEBRXIO&lt;br /&gt;&lt;br /&gt;&lt;em&gt;Example 6: &lt;/em&gt;To generating a lower case string of 20 characters&lt;br /&gt;SQL&gt; select dbms_random.string(&#39;L&#39;, 20) str from dual;&lt;br /&gt;&lt;br /&gt;STR&lt;br /&gt;____________________&lt;br /&gt;thfrkllkuhxqeybkcykg&lt;br /&gt;&lt;br /&gt;&lt;em&gt;Example 7: &lt;/em&gt;To generating an alphanumeric string of 20 characters. There is a bug in Oracle 8i that results in special (non-alphanumeric) characters such as &#39;]&#39; in the string. This is resolved in Oracle 9i.&lt;br /&gt;SQL&gt; select dbms_random.string(&#39;A&#39;, 20) str from dual;&lt;br /&gt;&lt;br /&gt;STR&lt;br /&gt;__________________&lt;br /&gt;xWPvLfHYuPWDNFEIHtUI&lt;br /&gt;&lt;br /&gt;&lt;em&gt;Example 8:&lt;/em&gt; To generating an upper case alphanumeric string of 20 characters&lt;br /&gt;SQL&gt; select dbms_random.string(&#39;X&#39;, 20) str from dual;&lt;br /&gt;&lt;br /&gt;STR&lt;br /&gt;________________________&lt;br /&gt;CWWULRKBQLAMCLGYWC4A&lt;br /&gt;&lt;br /&gt;&lt;em&gt;Example 9:&lt;/em&gt; To generating a string of printable 20 characters. This will output a string of all characters that could possibly be printed.&lt;br /&gt;SQL&gt; select dbms_random.string(&#39;P&#39;, 20) str from dual;&lt;br /&gt;&lt;br /&gt;STR&lt;br /&gt;___________________&lt;br /&gt;dsL&amp;B}l?mMUIr?&#39;T1r6{&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href=&quot;http://feedburner.google.com/fb/a/mailverify?uri=OracleBullets&amp;amp;loc=en_US&quot;&gt;Subscribe to Oracle Bullets by Email&lt;/a&gt;</content><link rel='replies' type='application/atom+xml' href='http://oraclebullets.blogspot.com/feeds/1607895472946754227/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://oraclebullets.blogspot.com/2009/06/generation-random-numbers-and-strings.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7448526803143529116/posts/default/1607895472946754227'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7448526803143529116/posts/default/1607895472946754227'/><link rel='alternate' type='text/html' href='http://oraclebullets.blogspot.com/2009/06/generation-random-numbers-and-strings.html' title='Generating random numbers and strings in Oracle is easier'/><author><name>Chaitanya</name><uri>http://www.blogger.com/profile/02904723174833201645</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh1RD22VqvjkhwATyYtzIKpRWkAQYPOjv8xB0LcOr2Y8mWmBdQJCvBAAGxkzfVCe95203nS9aiiC7iHlSYKbbNP0MjtsbQFFgS6uojmev4_RKzD2aWBctWmXTYHW5uNnkE/s220/Chaitu.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7448526803143529116.post-5295261659413307277</id><published>2009-06-09T13:52:00.000+05:30</published><updated>2009-07-04T10:59:30.880+05:30</updated><title type='text'>Running out of Disk Space:</title><content type='html'>A Query which is badly written may even fill up the disk drive even if the disk is large enough. We need to get back the system onto its feet as quickly as possible.&lt;br /&gt;&lt;em&gt;&lt;strong&gt;Temporary Tablespace:&lt;/strong&gt;&lt;/em&gt;&lt;br /&gt;Temporary tablespace generally it holds SQL Execution workspace, intermediate indexes, sub-query information, sorts etc… Generally it is released automatically, but there are situations where this may lead to problems. Issues such as fragmentation, DBMS bugs, badly written queries may cause temporary space to grow till you run out of disk space.&lt;br /&gt;&lt;br /&gt;To housekeep the temporary space in oracle is a common activity. The temporary space is flexible and powerful but it comes with some administration overhead.&lt;br /&gt;&lt;br /&gt;&lt;em&gt;&lt;strong&gt;Bullet:&lt;/strong&gt;&lt;/em&gt;&lt;br /&gt;&lt;br /&gt; Let us assume our database is in /u01/oradata/Chaitanya/ and our temporary space is named as temp01.dbf. We have some free space in u02 to use some space for a specified period of time.  A SYSDBA user can do this.&lt;br /&gt;&lt;br /&gt;Find the name of the current default temporary tablespace&lt;br /&gt;&lt;br /&gt;&lt;em&gt;SELECT property_value FROM database_properties&lt;br /&gt;WHERE property_name = &#39;DEFAULT_TEMP_TABLESPACE&#39;;&lt;br /&gt;&lt;br /&gt;PROPERTY_VALUE&lt;br /&gt;-----------------------------&lt;br /&gt;TEMP&lt;/em&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Create a new temporary tablespace to allow the system to operate while we are making the changes:&lt;br /&gt;&lt;br /&gt;&lt;em&gt;CREATE temporary tablespace t1&lt;br /&gt;Tempfile ‘/u02/Chaitanya_temp/t01.dbf’&lt;br /&gt;Size 512M reuse autoextend on next 10M maxsize unlimited&lt;br /&gt;Extent management local uniform size 256K;&lt;/em&gt;&lt;br /&gt;&lt;br /&gt;Bring the new temporary tablespace online&lt;br /&gt;&lt;br /&gt;&lt;em&gt;ALTER DATABASE&lt;br /&gt;Tempfile ‘u02/Chaitanya_temp/t01.dbf’&lt;br /&gt;ONLINE ;&lt;/em&gt;&lt;br /&gt;&lt;br /&gt;Change the New temporary tablespce as the default temporary tablespace&lt;br /&gt;&lt;br /&gt;&lt;em&gt;Alter database default temporary tablespace t1;&lt;/em&gt;&lt;br /&gt;&lt;br /&gt;Drop the old temporary tablespace which is using the disk space&lt;br /&gt;&lt;br /&gt;&lt;em&gt;Drop tablespace temp including the contents and datafiles;&lt;/em&gt;&lt;br /&gt;&lt;br /&gt;We are running with the new temporary tablespace but what we really wanted to do is recreate the old space in old partition and use the same. While we are doing so, we can restrict the size of the new space as 0.5 GB / 1 Gb, and allow it to grow till some extent let it be 4 GB.&lt;br /&gt;&lt;br /&gt;&lt;em&gt;Create temporary tablespace temp&lt;br /&gt;Tempfile ‘u01/oradata/chaitanya/temp01.dbf’&lt;br /&gt;Size 512M reuse autoextend on next 10M maxsize 4096M&lt;br /&gt;Extent management local uniform size 256K;&lt;/em&gt;&lt;br /&gt;&lt;br /&gt;Now we have to switch every thing back to using this final temp tablespace, and delete the temporary tablespce which we have created for the temporary use (/u02/Chaitanya_temp/t1)&lt;br /&gt;&lt;br /&gt;&lt;em&gt;Alter database &lt;br /&gt;Tempfile ‘u01/oradata/Chaitanya/temp01.dbf’&lt;br /&gt;ONLINE;&lt;/em&gt;&lt;br /&gt;&lt;br /&gt;&lt;em&gt;Alter database default temporary tablespace temp;&lt;/em&gt;&lt;br /&gt;&lt;br /&gt;&lt;em&gt;Drop tablespace t1 including contents and datafiles;&lt;/em&gt;&lt;br /&gt;&lt;br /&gt;Please post your comments on this Bullet.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href=&quot;http://feedburner.google.com/fb/a/mailverify?uri=OracleBullets&amp;amp;loc=en_US&quot;&gt;Subscribe to Oracle Bullets by Email&lt;/a&gt;</content><link rel='replies' type='application/atom+xml' href='http://oraclebullets.blogspot.com/feeds/5295261659413307277/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://oraclebullets.blogspot.com/2009/06/running-out-of-disk-space-query-which.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7448526803143529116/posts/default/5295261659413307277'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7448526803143529116/posts/default/5295261659413307277'/><link rel='alternate' type='text/html' href='http://oraclebullets.blogspot.com/2009/06/running-out-of-disk-space-query-which.html' title='Running out of Disk Space:'/><author><name>Chaitanya</name><uri>http://www.blogger.com/profile/02904723174833201645</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh1RD22VqvjkhwATyYtzIKpRWkAQYPOjv8xB0LcOr2Y8mWmBdQJCvBAAGxkzfVCe95203nS9aiiC7iHlSYKbbNP0MjtsbQFFgS6uojmev4_RKzD2aWBctWmXTYHW5uNnkE/s220/Chaitu.jpg'/></author><thr:total>0</thr:total></entry></feed>