<?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/opensearch/1.1/' xmlns:georss='http://www.georss.org/georss' xmlns:thr='http://purl.org/syndication/thread/1.0' xmlns:gd='http://schemas.google.com/g/2005' gd:etag='W/&quot;C0ECSX4_eSp7ImA9WhdXFUg.&quot;'><id>tag:blogger.com,1999:blog-7311849932450755853</id><updated>2011-08-28T10:14:28.041-07:00</updated><title>ORACLE LIVE EXAMPLES</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://himanshu-oracle.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7311849932450755853/posts/default?redirect=false&amp;v=2'/><link rel='alternate' type='text/html' href='http://himanshu-oracle.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Himanshu</name><uri>http://www.blogger.com/profile/01802895914380136446</uri><email>noreply@blogger.com</email></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>4</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry gd:etag='W/&quot;D0AGSHg4cSp7ImA9WxNVE0s.&quot;'><id>tag:blogger.com,1999:blog-7311849932450755853.post-4729758923190095151</id><published>2009-10-23T23:26:00.000-07:00</published><updated>2009-10-23T23:28:49.639-07:00</updated><app:edited xmlns:app='http://www.w3.org/2007/app'>2009-10-23T23:28:49.639-07:00</app:edited><title>Find segments with corrupted block from alert log with ORA-01578</title><content type='html'>&lt;span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: medium; "&gt;&lt;pre&gt;1. Get the list of corrupted blocks  grep 'ORA-01578' alert_DB.log | sort -u &gt; tmp.txt &lt;/pre&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:monospace;"&gt;&lt;span class="Apple-style-span" style="white-space: pre;"&gt;&lt;span class="Apple-style-span" style="font-family: arial, sans-serif; white-space: normal; "&gt;&lt;pre&gt;2. Generate SQL script to find segments with corrupted blocks  cat tmp.txt | awk '{ printf("%s %s\n", $8, $11); }' | \ awk -F\, '{ printf ("%s %s\n", $1, $2); }' | \ awk -F\) '{ printf("%s\n", $1); }' | \ awk '{printf ("SELECT SEGMENT_NAME, SEGMENT_TYPE, RELATIVE_FNO FROM DBA_EXTENTS WHERE FILE_ID = %s AND %s BETWEEN BLOCK_ID AND BLOCK_ID + BLOCKS - 1;\n", $1, $2); }' &gt; find_segs.sql &lt;/pre&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:monospace;"&gt;&lt;span class="Apple-style-span" style="white-space: pre;"&gt;&lt;span class="Apple-style-span" style="font-family: arial, sans-serif; white-space: normal; "&gt;&lt;pre&gt;3. Run SQL to find out which objects have corrupted blocks  SQLPLUS&gt; col SEGMENT_NAME format a30 SQLPLUS&gt; spool corrupted_segments.log SQLPLUS&gt; @find_segs SQLPLUS&gt; spool off&lt;/pre&gt;&lt;pre&gt;&lt;span class="Apple-style-span" style="font-family: arial, sans-serif; white-space: normal; "&gt;&lt;pre&gt;4. Sort the output to remove duplicates  sort -u corrupted_segments.log &lt;/pre&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:monospace;"&gt;&lt;span class="Apple-style-span" style="white-space: pre;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/span&gt;&lt;/pre&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7311849932450755853-4729758923190095151?l=himanshu-oracle.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://himanshu-oracle.blogspot.com/feeds/4729758923190095151/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://himanshu-oracle.blogspot.com/2009/10/find-segments-with-corrupted-block-from.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7311849932450755853/posts/default/4729758923190095151?v=2'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7311849932450755853/posts/default/4729758923190095151?v=2'/><link rel='alternate' type='text/html' href='http://himanshu-oracle.blogspot.com/2009/10/find-segments-with-corrupted-block-from.html' title='Find segments with corrupted block from alert log with ORA-01578'/><author><name>Himanshu</name><uri>http://www.blogger.com/profile/01802895914380136446</uri><email>noreply@blogger.com</email></author><thr:total>0</thr:total></entry><entry gd:etag='W/&quot;CkYBRHc6fyp7ImA9WxNSE00.&quot;'><id>tag:blogger.com,1999:blog-7311849932450755853.post-412943141746973136</id><published>2009-08-26T08:21:00.000-07:00</published><updated>2009-08-26T08:22:35.917-07:00</updated><app:edited xmlns:app='http://www.w3.org/2007/app'>2009-08-26T08:22:35.917-07:00</app:edited><title>How to send email from 10g Oracle Database (UTL_MAIL)</title><content type='html'>Heres a simple solution to send out emails from 10g Database sql prompt.&lt;br /&gt;This solution will be really helpful if the OS utility (mailx, sendmail) is restricted for end users.&lt;br /&gt;Steps to enable Mailing from Database&lt;br /&gt;1. sqlplus ‘/ as sysdba’2. @$ORACLE_HOME/rdbms/admin/utlmail.sql3. @$ORACLE_HOME/rdbms/admin/prvtmail.plb4. Set smtp_server information in init.ora or spfile.oraalter system set smtp_out_server = ‘SMTP_SERVER_IP_ADDRESS:SMTP_PORT’ scope=both;25 = Default SMTP Port&lt;br /&gt;If instance had been started with spfile&lt;br /&gt;eg: alter system set smtp_out_server = ‘172.25.90.165:25′ scope=both;&lt;br /&gt;If instance had been started with pfilealter system set smtp_out_server = ‘172.25.90.165:25′;Also make below entry in your initSID.ora&lt;br /&gt;smtp_out_server = ‘172.25.90.165:25′&lt;br /&gt;Thats It, your database is configured to send emails ….&lt;br /&gt;How to send an email&lt;br /&gt;1. sqlplus ‘/ as sysdba’2. exec utl_mail.send((sender =&gt; ‘oraclepitstop@wordpress.com’, recipients =&gt; ‘oraclepitstop@wordpress.com’, subject =&gt; ‘Testing UTL_MAIL Option’, message =&gt; ‘blah blah blah’);3. Check the inbox of the email id, to verify the email receipt.&lt;br /&gt;To enable other DB users to use this functionality, grant execute permission on UTL_MAIL package.&lt;br /&gt;eg: grant execute on utl_mail to apps;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7311849932450755853-412943141746973136?l=himanshu-oracle.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://himanshu-oracle.blogspot.com/feeds/412943141746973136/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://himanshu-oracle.blogspot.com/2009/08/how-to-send-email-from-10g-oracle.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7311849932450755853/posts/default/412943141746973136?v=2'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7311849932450755853/posts/default/412943141746973136?v=2'/><link rel='alternate' type='text/html' href='http://himanshu-oracle.blogspot.com/2009/08/how-to-send-email-from-10g-oracle.html' title='How to send email from 10g Oracle Database (UTL_MAIL)'/><author><name>Himanshu</name><uri>http://www.blogger.com/profile/01802895914380136446</uri><email>noreply@blogger.com</email></author><thr:total>0</thr:total></entry><entry gd:etag='W/&quot;DkMMQ3g_eSp7ImA9WxNSEko.&quot;'><id>tag:blogger.com,1999:blog-7311849932450755853.post-4478559489290583975</id><published>2009-08-26T01:10:00.000-07:00</published><updated>2009-08-26T01:14:42.641-07:00</updated><app:edited xmlns:app='http://www.w3.org/2007/app'>2009-08-26T01:14:42.641-07:00</app:edited><title>Internal view for Oracle to track features used</title><content type='html'>&lt;span class="Apple-style-span"   style=" color: rgb(42, 42, 42);  font-family:Verdana;font-size:11px;"&gt;&lt;p style="line-height: 1.5em; margin-top: 0px; margin-right: 0px; margin-bottom: 15px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;In 10g there is a new view called DBA_FEATURE_USAGE_STATISTICS which keeps features have been used.&lt;/p&gt;&lt;p style="line-height: 1.5em; margin-top: 0px; margin-right: 0px; margin-bottom: 15px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;Here is description of some of the columns:&lt;br /&gt;name – feature name&lt;br /&gt;first_usage_date – first date when the feature was used&lt;br /&gt;last_usage_date – latest date when it was detected the feature was used&lt;br /&gt;last_sample_date – latest date when the sample was taken&lt;br /&gt;last_sample_period – time in seconds between sample taken at last_sample_date and sample before last_sample_date&lt;br /&gt;currently_used – value is TRUE or FALSE, TRUE if the feature was used since it was last checked&lt;/p&gt;&lt;p style="line-height: 1.5em; margin-top: 0px; margin-right: 0px; margin-bottom: 15px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;SQL&gt; SELECT name, first_usage_date, last_usage_date, last_sample_date, last_sample_period FROM dba_feature_usage_statistics WHERE currently_used = ‘TRUE’;&lt;/p&gt;&lt;p style="line-height: 1.5em; margin-top: 0px; margin-right: 0px; margin-bottom: 15px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;NAME FIRST_USA LAST_USAG LAST_SAMP&lt;br /&gt;—————————————- ——— ——— ———&lt;br /&gt;Locally Managed Tablespaces (user) 30-SEP-08 08-FEB-09 08-FEB-09&lt;br /&gt;Multiple Block Sizes 25-NOV-08 08-FEB-09 08-FEB-09&lt;br /&gt;Partitioning (system) 30-SEP-08 08-FEB-09 08-FEB-09&lt;br /&gt;Protection Mode – Maximum Performance 30-SEP-08 08-FEB-09 08-FEB-09&lt;br /&gt;Segment Advisor 07-OCT-08 08-FEB-09 08-FEB-09&lt;br /&gt;Streams (system) 30-SEP-08 08-FEB-09 08-FEB-09&lt;br /&gt;Virtual Private Database (VPD) 30-SEP-08 08-FEB-09 08-FEB-09&lt;br /&gt;Change-Aware Incremental Backup 02-DEC-08 08-FEB-09 08-FEB-09&lt;br /&gt;Recovery Area 30-SEP-08 08-FEB-09 08-FEB-09&lt;br /&gt;Streams (user) 30-SEP-08 08-FEB-09 08-FEB-09&lt;/p&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7311849932450755853-4478559489290583975?l=himanshu-oracle.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://himanshu-oracle.blogspot.com/feeds/4478559489290583975/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://himanshu-oracle.blogspot.com/2009/08/internal-view-for-oracle-to-track.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7311849932450755853/posts/default/4478559489290583975?v=2'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7311849932450755853/posts/default/4478559489290583975?v=2'/><link rel='alternate' type='text/html' href='http://himanshu-oracle.blogspot.com/2009/08/internal-view-for-oracle-to-track.html' title='Internal view for Oracle to track features used'/><author><name>Himanshu</name><uri>http://www.blogger.com/profile/01802895914380136446</uri><email>noreply@blogger.com</email></author><thr:total>0</thr:total></entry><entry gd:etag='W/&quot;CkcHQ3Y_fyp7ImA9WxNSEko.&quot;'><id>tag:blogger.com,1999:blog-7311849932450755853.post-9090451018481062265</id><published>2009-08-25T23:58:00.000-07:00</published><updated>2009-08-26T00:00:32.847-07:00</updated><app:edited xmlns:app='http://www.w3.org/2007/app'>2009-08-26T00:00:32.847-07:00</app:edited><title>Enable and Disable Automatic Snapshots</title><content type='html'>&lt;span class="Apple-style-span" style="font-family: Verdana; color: rgb(42, 42, 42); font-size: 11px; "&gt;&lt;p style="line-height: 1.5em; margin-top: 0px; margin-right: 0px; margin-bottom: 15px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;&lt;span style="color: rgb(0, 0, 0); "&gt;exec dbms_scheduler.enable(’GATHER_STATS_JOB’)  – (Default)&lt;/span&gt;&lt;/p&gt;&lt;p style="line-height: 1.5em; margin-top: 0px; margin-right: 0px; margin-bottom: 15px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;exec dbms_scheduler.disable(’GATHER_STATS_JOB’)&lt;/p&gt;&lt;p style="line-height: 1.5em; margin-top: 0px; margin-right: 0px; margin-bottom: 15px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;-----------------------------------------------------------------------------&lt;/p&gt;&lt;p style="line-height: 1.5em; margin-top: 0px; margin-right: 0px; margin-bottom: 15px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;we can also display list of stats as follows :&lt;/p&gt;&lt;p style="line-height: 1.5em; margin-top: 0px; margin-right: 0px; margin-bottom: 15px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;&lt;span class="Apple-style-span" style="line-height: normal; "&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="line-height: 1.5em; margin-top: 0px; margin-right: 0px; margin-bottom: 15px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;SQL&gt; set lines 100 pages 999&lt;br /&gt;SQL&gt; select snap_id, snap_level, to_char(begin_interval_time, ‘dd/mm/yy hh24:mi:ss’) starting&lt;br /&gt;2  from dba_hist_snapshot&lt;br /&gt;3  order by 1;&lt;/p&gt;&lt;p style="line-height: 1.5em; margin-top: 0px; margin-right: 0px; margin-bottom: 15px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;SNAP_ID SNAP_LEVEL STARTING&lt;br /&gt;———- ———- —————–&lt;br /&gt;11950          1 27/07/09 23:00:24&lt;br /&gt;11951          1 28/07/09 00:00:25&lt;br /&gt;11952          1 28/07/09 01:00:26&lt;br /&gt;11953          1 28/07/09 02:00:27&lt;br /&gt;11954          1 28/07/09 03:00:28&lt;br /&gt;11955          1 28/07/09 04:00:30&lt;br /&gt;11956          1 28/07/09 05:00:31&lt;br /&gt;11957          1 28/07/09 06:00:31&lt;br /&gt;11958          1 28/07/09 07:00:32&lt;br /&gt;11959          1 28/07/09 08:00:33&lt;br /&gt;11960          1 28/07/09 09:00:34&lt;br /&gt;11961          1 28/07/09 10:00:35&lt;br /&gt;11962          1 28/07/09 11:00:36&lt;br /&gt;11963          1 28/07/09 12:00:37&lt;br /&gt;11964          1 28/07/09 13:00:38&lt;br /&gt;11965          1 28/07/09 14:00:39&lt;br /&gt;11966          1 28/07/09 15:00:40&lt;br /&gt;11967          1 28/07/09 16:00:41&lt;br /&gt;11968          1 28/07/09 17:00:43&lt;br /&gt;11969          1 28/07/09 18:00:43&lt;br /&gt;11970          1 28/07/09 19:00:45&lt;br /&gt;11971          1 28/07/09 20:00:46&lt;br /&gt;11972          1 28/07/09 21:00:46&lt;br /&gt;11973          1 28/07/09 22:00:47&lt;br /&gt;11974          1 28/07/09 23:00:49&lt;br /&gt;11975          1 29/07/09 00:00:50&lt;/p&gt;&lt;p style="line-height: 1.5em; margin-top: 0px; margin-right: 0px; margin-bottom: 15px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;&lt;span class="Apple-style-span" style="line-height: normal; "&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="line-height: 1.5em; margin-top: 0px; margin-right: 0px; margin-bottom: 15px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;If you want to change the retention police for the snapshot to 20 days:&lt;/p&gt;&lt;p style="line-height: 1.5em; margin-top: 0px; margin-right: 0px; margin-bottom: 15px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;exec dbms_workload_repository.modify_snapshot_settings (retention =&gt; 20*24*60);&lt;/p&gt;&lt;p style="line-height: 1.5em; margin-top: 0px; margin-right: 0px; margin-bottom: 15px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;&lt;br /&gt;&lt;/p&gt;&lt;/span&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7311849932450755853-9090451018481062265?l=himanshu-oracle.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://himanshu-oracle.blogspot.com/feeds/9090451018481062265/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://himanshu-oracle.blogspot.com/2009/08/enable-and-disable-automatic-snapshots.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7311849932450755853/posts/default/9090451018481062265?v=2'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7311849932450755853/posts/default/9090451018481062265?v=2'/><link rel='alternate' type='text/html' href='http://himanshu-oracle.blogspot.com/2009/08/enable-and-disable-automatic-snapshots.html' title='Enable and Disable Automatic Snapshots'/><author><name>Himanshu</name><uri>http://www.blogger.com/profile/01802895914380136446</uri><email>noreply@blogger.com</email></author><thr:total>0</thr:total></entry></feed>