<?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: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-22611914</id><updated>2012-02-13T18:42:08.064-08:00</updated><category term='Oracle DBA'/><category term='Oracle Data Warehouse'/><category term='MySQL Performance Tuning: System Variables'/><category term='MySQL'/><category term='Learn Piano'/><category term='SQL'/><category term='Perl:Regular Expressions'/><category term='MySQL Performance Tuning'/><category term='Music'/><category term='Ascential DataStage:Admin'/><category term='Cognos Framework Manager'/><category term='Perl'/><category term='MySQL Replication'/><category term='Data Modeling'/><category term='DtataStage'/><category term='Music of the Night'/><category term='Oracle'/><category term='IIS'/><category term='MySQL Data Warehouse'/><category term='Ascential DataStage:Design'/><category term='Data and Information'/><category term='Life'/><category term='Suppercomputer'/><category term='Pictures'/><category term='MySQL DBA'/><category term='Data Warehouse'/><category term='Linux For DBA'/><category term='Intelligent'/><category term='Recipes'/><category term='Data Funny'/><category term='Video'/><category term='Kid Recipes'/><category term='Cognos'/><title type='text'>Data Bob Jr.</title><subtitle type='html'>&lt;a href="http://en.wikipedia.org/wiki/Data"&gt;Data&lt;/a&gt;,  &lt;a href="http://en.wikipedia.org/wiki/Information"&gt;Information&lt;/a&gt;, &lt;a href="http://en.wikipedia.org/wiki/Knowledge"&gt;Knowledge&lt;/a&gt; and &lt;a href="http://en.wikipedia.org/wiki/Life"&gt;Life&lt;/a&gt;</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://databobjr.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/22611914/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://databobjr.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><link rel='next' type='application/atom+xml' href='http://www.blogger.com/feeds/22611914/posts/default?start-index=101&amp;max-results=100'/><author><name>Data Bob Jr.</name><uri>http://www.blogger.com/profile/11965565939904347208</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>108</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-22611914.post-3201417387641810836</id><published>2012-02-04T16:12:00.000-08:00</published><updated>2012-02-04T16:12:32.487-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Video'/><category scheme='http://www.blogger.com/atom/ns#' term='Data Funny'/><title type='text'>THE DAY THE DATA DIED</title><content type='html'>&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;br /&gt;&lt;embed allowfullscreen="true" allowscriptaccess="always" flashvars="playerVars=autoPlay=no" height="248" name="Metacafe_885527" pluginspage="http://www.macromedia.com/go/getflashplayer" src="http://www.metacafe.com/fplayer/885527/the_day_the_data_died_loose_bruce_kerr_parody.swf" type="application/x-shockwave-flash" width="440" wmode="transparent"&gt;&lt;/embed&gt;&lt;br /&gt;&lt;div style="font-size: 12px;"&gt;&lt;a href="http://www.metacafe.com/watch/885527/the_day_the_data_died_loose_bruce_kerr_parody/"&gt;"THE DAY THE DATA DIED"-Loose Bruce Kerr Parody&lt;/a&gt; - &lt;a href="http://www.metacafe.com/"&gt;For more amazing video clips, click here&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/22611914-3201417387641810836?l=databobjr.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://databobjr.blogspot.com/feeds/3201417387641810836/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=22611914&amp;postID=3201417387641810836' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/22611914/posts/default/3201417387641810836'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/22611914/posts/default/3201417387641810836'/><link rel='alternate' type='text/html' href='http://databobjr.blogspot.com/2012/02/day-data-died.html' title='THE DAY THE DATA DIED'/><author><name>Data Bob Jr.</name><uri>http://www.blogger.com/profile/11965565939904347208</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-22611914.post-5075325666138313612</id><published>2012-01-31T20:18:00.000-08:00</published><updated>2012-01-31T20:18:59.338-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Data and Information'/><category scheme='http://www.blogger.com/atom/ns#' term='Video'/><category scheme='http://www.blogger.com/atom/ns#' term='Intelligent'/><title type='text'>What Data Tells Us</title><content type='html'>This year's &lt;a href="http://strataconf.com/strata2012"&gt;Strata ConferenceMaking Data Work,&lt;/a&gt;, will be hell in Santa Clara, California, USA from February 28 to March 1, 2012 &lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;/div&gt;Here is a video from last year's event. &lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;/div&gt;&lt;p\ trtempbr="temp_br"&gt;&lt;br /&gt;&lt;p\ trtempbr="temp_br"&gt;&lt;br /&gt;&lt;div&gt;&lt;iframe allowfullscreen="" frameborder="0" height="315" src="http://www.youtube.com/embed/KWszSUm-x2Y?rel=0" width="560"&gt;&lt;/iframe&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;/div&gt;&lt;strong&gt;Reference: &lt;/strong&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://www.santaclara.org/" target="_blank"&gt;Santa Clara Convention Center&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.google.com/cse?cx=partner-pub-1602461054664536%3Aghaimtmraz9&amp;amp;ie=ISO-8859-1&amp;amp;q=hotel+in+santa+clara%2Cca+usa&amp;amp;sa=Search#gsc.tab=0&amp;amp;gsc.q=hotel%20in%20santa%20clara%2Cca%20usa&amp;amp;gsc.page=1"&gt;Hotel In Santa Clara, CA, USA&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.google.com/cse?cx=partner-pub-1602461054664536%3Aghaimtmraz9&amp;amp;ie=ISO-8859-1&amp;amp;q=restaurant+in+santa+clara%2Cca+usa&amp;amp;sa=Search#gsc.tab=0&amp;amp;gsc.q=restaurants%20in%20santa%20clara%2Cca%20usa"&gt;Restaurants In Santa Clara, CA, USA&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/22611914-5075325666138313612?l=databobjr.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://databobjr.blogspot.com/feeds/5075325666138313612/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=22611914&amp;postID=5075325666138313612' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/22611914/posts/default/5075325666138313612'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/22611914/posts/default/5075325666138313612'/><link rel='alternate' type='text/html' href='http://databobjr.blogspot.com/2012/01/what-data-tells-us.html' title='What Data Tells Us'/><author><name>Data Bob Jr.</name><uri>http://www.blogger.com/profile/11965565939904347208</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://img.youtube.com/vi/KWszSUm-x2Y/default.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-22611914.post-3594488111497905519</id><published>2012-01-28T04:09:00.000-08:00</published><updated>2012-01-28T04:11:20.745-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Music'/><category scheme='http://www.blogger.com/atom/ns#' term='Music of the Night'/><title type='text'>City -- Jackie Chan</title><content type='html'>&lt;b&gt;&lt;b&gt;City by Jackie Chan. Also features NBA star Yao Ming and pianist Lang Lang&lt;/b&gt;&lt;/b&gt;&lt;br /&gt;&lt;div id="Layer1" style="height: 320px; position: absolute; width: 420px; z-index: 1;"&gt;&lt;iframe width="420" height="315" src="http://www.youtube.com/embed/2eP0YVLSGVk?rel=0" frameborder="0" allowfullscreen&gt;&lt;/iframe&gt;&lt;/div&gt;&lt;div id="Layer2" style="float: none; height: 250px; left: 449px; position: relative; width: 250px; z-index: 1;"&gt;&lt;script type="text/javascript"&gt;&lt;!--google_ad_client = "ca-pub-1602461054664536";/* misicofthenight-text-image-250x250-20111212 */google_ad_slot = "8412539377";google_ad_width = 250;google_ad_height = 250;//--&gt;&lt;/script&gt;&lt;script src="http://pagead2.googlesyndication.com/pagead/show_ads.js" type="text/javascript"&gt;&lt;/script&gt;&lt;/div&gt;&lt;div&gt;&lt;/div&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/22611914-3594488111497905519?l=databobjr.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://databobjr.blogspot.com/feeds/3594488111497905519/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=22611914&amp;postID=3594488111497905519' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/22611914/posts/default/3594488111497905519'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/22611914/posts/default/3594488111497905519'/><link rel='alternate' type='text/html' href='http://databobjr.blogspot.com/2012/01/city-jackie-chan.html' title='City -- Jackie Chan'/><author><name>Data Bob Jr.</name><uri>http://www.blogger.com/profile/11965565939904347208</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://img.youtube.com/vi/2eP0YVLSGVk/default.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-22611914.post-8431328662782600608</id><published>2012-01-28T03:56:00.001-08:00</published><updated>2012-01-28T03:56:56.461-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Music'/><category scheme='http://www.blogger.com/atom/ns#' term='Music of the Night'/><title type='text'>Friends -- Richard Clayderman</title><content type='html'>&lt;b&gt;&lt;b&gt;Friends by Richard Clayderman&lt;/b&gt;&lt;/b&gt;&lt;br /&gt;&lt;div id="Layer1" style="height: 320px; position: absolute; width: 420px; z-index: 1;"&gt;&lt;iframe width="420" height="315" src="http://www.youtube.com/embed/VN8NoXPbV1M?rel=0" frameborder="0" allowfullscreen&gt;&lt;/iframe&gt;&lt;/div&gt;&lt;div id="Layer2" style="float: none; height: 250px; left: 449px; position: relative; width: 250px; z-index: 1;"&gt;&lt;script type="text/javascript"&gt;&lt;!--google_ad_client = "ca-pub-1602461054664536";/* misicofthenight-text-image-250x250-20111212 */google_ad_slot = "8412539377";google_ad_width = 250;google_ad_height = 250;//--&gt;&lt;/script&gt;&lt;script src="http://pagead2.googlesyndication.com/pagead/show_ads.js" type="text/javascript"&gt;&lt;/script&gt;&lt;/div&gt;&lt;div&gt;&lt;/div&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/22611914-8431328662782600608?l=databobjr.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://databobjr.blogspot.com/feeds/8431328662782600608/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=22611914&amp;postID=8431328662782600608' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/22611914/posts/default/8431328662782600608'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/22611914/posts/default/8431328662782600608'/><link rel='alternate' type='text/html' href='http://databobjr.blogspot.com/2012/01/friends-richard-clayderman.html' title='Friends -- Richard Clayderman'/><author><name>Data Bob Jr.</name><uri>http://www.blogger.com/profile/11965565939904347208</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://img.youtube.com/vi/VN8NoXPbV1M/default.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-22611914.post-4977119271118445850</id><published>2012-01-26T05:59:00.000-08:00</published><updated>2012-01-28T06:26:14.174-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='IIS'/><category scheme='http://www.blogger.com/atom/ns#' term='Ascential DataStage:Design'/><category scheme='http://www.blogger.com/atom/ns#' term='Ascential DataStage:Admin'/><category scheme='http://www.blogger.com/atom/ns#' term='DtataStage'/><title type='text'>Set up ODBC Connection For IIS DataStage (v.8.5)</title><content type='html'>&lt;h3 class="r"&gt;Configure Access to ODBC Data Source For IIS DataStage (v8.5, Window Server) &lt;/h3&gt;Thie following information can also be found &lt;a href="http://publib.boulder.ibm.com/infocenter/iisinfsv/v8r7/index.jsp?topic=%2Fcom.ibm.swg.im.iis.productization.iisinfsv.install.doc%2Ftopics%2Fwsisinst_config_dsqs.html"&gt;here&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;From the Engine Tier;&lt;br /&gt;· Launch the dos Prompt as Adminstratior&lt;br /&gt;· Change to cd c:\windows\syswow64&lt;br /&gt;· Lounch odbcad32.exe &lt;br /&gt;&lt;br /&gt;&lt;div&gt;&amp;nbsp;&lt;/div&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; C:\Windows\SysWOW64&amp;gt;odbcad32.exe&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&amp;nbsp;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&amp;nbsp;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/-HNntwrx8N10/TyFbsaKeqGI/AAAAAAAAAG4/ev29aLZhl8Q/s1600/iis_odbc85_1.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" gda="true" height="169" src="http://4.bp.blogspot.com/-HNntwrx8N10/TyFbsaKeqGI/AAAAAAAAAG4/ev29aLZhl8Q/s320/iis_odbc85_1.jpg" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div align="left" class="separator" style="clear: both; text-align: center;"&gt;﻿&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;· Select a ODBC driver that you want to use, for example, SQL server. Make sure to only use drivers that are provided by IBM&lt;/div&gt;&lt;div style="text-align: left;"&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&amp;nbsp;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&amp;nbsp;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/-BffDuFjAweQ/TyFbwJf20mI/AAAAAAAAAHA/wNNvkCcWI_M/s1600/iis_odbc85_2.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" gda="true" height="228" src="http://3.bp.blogspot.com/-BffDuFjAweQ/TyFbwJf20mI/AAAAAAAAAHA/wNNvkCcWI_M/s320/iis_odbc85_2.jpg" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;br /&gt;&lt;/div&gt;· Define the DSN Connection by select the System DSN tab, then select ADD. Give the DSN a name, and provide the server, user id and password. You can also specify a default database.&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&amp;nbsp;&lt;/div&gt;When you are done, make sure to test the connection. It all is fine, you should be able to see the DSN from the IIS components such as DataStage or Information Analyzer.&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&amp;nbsp;&lt;/div&gt;&lt;strong&gt;Related Note:&lt;/strong&gt; &lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://databobjr.blogspot.com/2011/12/configuring-datastage-v85-parallel.html"&gt;Configuring the DataStage v8.5 Parallel Engine On Windows&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://databobjr.blogspot.com/2011/10/start-websphere-infosphere-server-using.html"&gt;Start WebSphere InfoSphere Server Using Administrator User in Window 2008 Server&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&amp;nbsp;&lt;/div&gt;&lt;div&gt;&lt;script type="text/javascript"&gt;&lt;!--google_ad_client = "ca-pub-1602461054664536";/* datastage-fooder-banner-468x60-20111004 */google_ad_slot = "2233647456";google_ad_width = 468;google_ad_height = 60;//--&gt;&lt;/script&gt;&lt;script src="http://pagead2.googlesyndication.com/pagead/show_ads.js" type="text/javascript"&gt;&lt;/script&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/22611914-4977119271118445850?l=databobjr.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://databobjr.blogspot.com/feeds/4977119271118445850/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=22611914&amp;postID=4977119271118445850' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/22611914/posts/default/4977119271118445850'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/22611914/posts/default/4977119271118445850'/><link rel='alternate' type='text/html' href='http://databobjr.blogspot.com/2012/01/set-up-odbc-connection-for-iis.html' title='Set up ODBC Connection For IIS DataStage (v.8.5)'/><author><name>Data Bob Jr.</name><uri>http://www.blogger.com/profile/11965565939904347208</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/-HNntwrx8N10/TyFbsaKeqGI/AAAAAAAAAG4/ev29aLZhl8Q/s72-c/iis_odbc85_1.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-22611914.post-3633424499191358558</id><published>2012-01-26T05:46:00.000-08:00</published><updated>2012-01-28T03:43:53.011-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Data Warehouse'/><category scheme='http://www.blogger.com/atom/ns#' term='Oracle DBA'/><category scheme='http://www.blogger.com/atom/ns#' term='Oracle'/><title type='text'>Find Oracle Table Size, Number Of Columns and Rows</title><content type='html'>&lt;br /&gt;&lt;strong&gt;Query to Find Table Size, Number of Rows and Columns in a Oracle Database&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;Here is a query that gives the table size which include number of columns, number of rows and table data size in MB. I found these information are helpful during the data warehouse design phase.&lt;br /&gt;&lt;div style="display: block; float: right; height: 260px; margin: 3px; width: 310px;"&gt;&lt;script type="text/javascript"&gt;&lt;!--google_ad_client = "ca-pub-1602461054664536";/* BodyAD-image-text-300x250-20100423 */google_ad_slot = "2838716459";google_ad_width = 300;google_ad_height = 250;//--&gt;&lt;/script&gt;&lt;script src="http://pagead2.googlesyndication.com/pagead/show_ads.js" type="text/javascript"&gt;&lt;/script&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&amp;nbsp;select col.table_name,&lt;/div&gt;col.col_cnt as column_count,&lt;br /&gt;rc.row_cnt as row_count,&lt;br /&gt;s.size_in_MB as table_size_in_MB&lt;br /&gt;from&lt;br /&gt;(&lt;br /&gt;/* number of columns */&lt;br /&gt;SELECT upper(table_name), COUNT(*) col_cnt,&lt;br /&gt;FROM dba_tab_columns&lt;br /&gt;WHERE owner = 'V500'&lt;br /&gt;group by upper(table_name)&lt;br /&gt;) col&lt;br /&gt;&lt;br /&gt;join &lt;br /&gt;&lt;br /&gt;(&lt;br /&gt;/* number of rows */&lt;br /&gt;select&lt;br /&gt;table_name,&lt;br /&gt;to_number(extractvalue(xmltype(dbms_xmlgen.getxml('select count(*) c from '||table_name)),'/ROWSET/ROW/C')) as row_cnt &lt;br /&gt;from dba_tables&lt;br /&gt;where (iot_type != 'IOT_OVERFLOW'or iot_type is null) &lt;br /&gt;and owner = 'SCOTT'&lt;br /&gt;) rc &lt;br /&gt;on upper(col.table_name) = upper(rc.table_name)&lt;br /&gt;&lt;br /&gt;&lt;div&gt;join &lt;/div&gt;&lt;br /&gt;(&lt;br /&gt;/* table size in MB */&lt;br /&gt;SELECT&lt;br /&gt;owner, table_name, (sum(bytes)/1024/1024) size_in_MB&lt;br /&gt;FROM&lt;br /&gt;(SELECT segment_name table_name, owner, bytes&lt;br /&gt;FROM dba_segments&lt;br /&gt;WHERE segment_type = 'TABLE'&lt;br /&gt;and owner = 'SCOTT'&lt;br /&gt;)&lt;br /&gt;&lt;br /&gt;&lt;div&gt;group by owner, table_name&lt;/div&gt;&lt;br /&gt;) s&lt;br /&gt;on upper(col.table_name) = upper(s.table_name);&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;strong&gt;Related Notes:&lt;/strong&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://databobjr.blogspot.com/2012/01/retrieve-oracle-table-column-name-and.html"&gt;Query To Retrieve Oracle Table Column Name And Data Type&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://databobjr.blogspot.com/2012/01/find-current-running-sql-statements-in.html"&gt;Find Current Running SQL Statements In Oracle &lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;div&gt;&lt;script type="text/javascript"&gt;&lt;!--google_ad_client = "ca-pub-1602461054664536";/* oracledba-fooder-banner-468x60-20100511 */google_ad_slot = "5574621840";google_ad_width = 468;google_ad_height = 60;//--&gt;&lt;/script&gt;&lt;script src="http://pagead2.googlesyndication.com/pagead/show_ads.js" type="text/javascript"&gt;&lt;/script&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/22611914-3633424499191358558?l=databobjr.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://databobjr.blogspot.com/feeds/3633424499191358558/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=22611914&amp;postID=3633424499191358558' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/22611914/posts/default/3633424499191358558'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/22611914/posts/default/3633424499191358558'/><link rel='alternate' type='text/html' href='http://databobjr.blogspot.com/2012/01/retrieve-oracle-table-size-number.html' title='Find Oracle Table Size, Number Of Columns and Rows'/><author><name>Data Bob Jr.</name><uri>http://www.blogger.com/profile/11965565939904347208</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-22611914.post-6303814291180800725</id><published>2012-01-26T05:37:00.000-08:00</published><updated>2012-01-28T03:36:49.857-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Data Warehouse'/><category scheme='http://www.blogger.com/atom/ns#' term='Oracle DBA'/><category scheme='http://www.blogger.com/atom/ns#' term='Oracle'/><title type='text'>Retrieve Oracle Table Column Name And Data Type</title><content type='html'>&lt;strong&gt;Query to Get&amp;nbsp; Oolumn Names and Data Type of&amp;nbsp; an Oracle&amp;nbsp; Table&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&amp;nbsp;&lt;/div&gt;Here is at query that retrieves column names and their data type of Oracle tables in a database. I found it handy to have a searchable copy of the source tables and their column name and data types when doing data profiling, modeling and mapping.&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&amp;nbsp;&lt;/div&gt;select owner, &lt;br /&gt;&lt;div&gt;&amp;nbsp;table_name,&lt;br /&gt;&amp;nbsp;column_name, &lt;br /&gt;&amp;nbsp;data_type || decode(data_type,'DATE', ' ', '(' || data_length || decode(data_scale,null,'', ',' || data_scale) || ')' ) as&amp;nbsp;&amp;nbsp; Data_Type, &lt;br /&gt;nullable,&lt;br /&gt;&amp;nbsp;data_default &lt;br /&gt;from dba_tab_columns &lt;br /&gt;where owner in('SCOTT','MARY') ; &lt;br /&gt;&lt;br /&gt;&lt;div&gt;&amp;nbsp;&lt;/div&gt;&lt;/area&gt;&lt;/div&gt;If dba_tab_columns is not available, table user_tab_colimns will also work. &lt;br /&gt;&lt;br /&gt;&lt;div&gt;&amp;nbsp;&lt;/div&gt;&lt;div&gt;&lt;script type="text/javascript"&gt;&lt;!--google_ad_client = "ca-pub-1602461054664536";/* oracledba-fooder-banner-468x60-20100511 */google_ad_slot = "5574621840";google_ad_width = 468;google_ad_height = 60;//--&gt;&lt;/script&gt;&lt;script src="http://pagead2.googlesyndication.com/pagead/show_ads.js" type="text/javascript"&gt;&lt;/script&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;strong&gt;Related Notes:&lt;/strong&gt;&lt;/div&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://databobjr.blogspot.com/2012/01/retrieve-oracle-table-size-number.html"&gt;Find Oracle Table Size, Number Of Columns and Rows &lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://databobjr.blogspot.com/2012/01/find-current-running-sql-statements-in.html"&gt;Find Current Running SQL Statements In Oracle&lt;/a&gt; &lt;/li&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/22611914-6303814291180800725?l=databobjr.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://databobjr.blogspot.com/feeds/6303814291180800725/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=22611914&amp;postID=6303814291180800725' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/22611914/posts/default/6303814291180800725'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/22611914/posts/default/6303814291180800725'/><link rel='alternate' type='text/html' href='http://databobjr.blogspot.com/2012/01/retrieve-oracle-table-column-name-and.html' title='Retrieve Oracle Table Column Name And Data Type'/><author><name>Data Bob Jr.</name><uri>http://www.blogger.com/profile/11965565939904347208</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-22611914.post-7441396473439934267</id><published>2012-01-26T05:27:00.000-08:00</published><updated>2012-01-28T03:39:23.529-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='IIS'/><category scheme='http://www.blogger.com/atom/ns#' term='Ascential DataStage:Admin'/><category scheme='http://www.blogger.com/atom/ns#' term='Oracle DBA'/><category scheme='http://www.blogger.com/atom/ns#' term='Oracle'/><category scheme='http://www.blogger.com/atom/ns#' term='DtataStage'/><title type='text'>Find Current Running SQL Statements In Oracle</title><content type='html'>&lt;strong&gt;List Curent Running Queries From Oracle Database Serv er&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&amp;nbsp;&lt;/div&gt;Here was a query I used to check the queries which were submitted by the module “ASBAgent.exe” (the datastage ASB Agent, if you use DataStage). You can remove the module clause and the username clause to see all running queries . &lt;br /&gt;&lt;div style="display: block; float: right; height: 260px; margin: 3px; width: 310px;"&gt;&lt;script type="text/javascript"&gt;&lt;!--google_ad_client = "ca-pub-1602461054664536";/* BodyAD-image-text-300x250-20100423 */google_ad_slot = "2838716459";google_ad_width = 300;google_ad_height = 250;//--&gt;&lt;/script&gt;&lt;script src="http://pagead2.googlesyndication.com/pagead/show_ads.js" type="text/javascript"&gt;&lt;/script&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&amp;nbsp;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&amp;nbsp;&lt;/div&gt;SELECT first_load_time, &lt;br /&gt;&amp;nbsp; module, &lt;br /&gt;&amp;nbsp; sql_text, &lt;br /&gt;&amp;nbsp; username, &lt;br /&gt;&amp;nbsp; disk_reads_per_exec, &lt;br /&gt;&amp;nbsp; buffer_gets, &lt;br /&gt;&amp;nbsp; rows_processed, &lt;br /&gt;&amp;nbsp; hit_ratio &lt;br /&gt;&amp;nbsp; FROM &lt;br /&gt;(SELECT module, &lt;br /&gt;&amp;nbsp; sql_text , &lt;br /&gt;&amp;nbsp; u.username , &lt;br /&gt;&amp;nbsp; round((s.disk_reads/decode(s.executions,0,1, s.executions)),2) disk_reads_per_exec, &lt;br /&gt;&amp;nbsp; s.buffer_gets , &lt;br /&gt;&amp;nbsp;&amp;nbsp; 100 - round(100 * s.disk_reads/greatest(s.buffer_gets,1),2) hit_ratio, &lt;br /&gt;&amp;nbsp; s.first_load_time &lt;br /&gt;FROM sys.v_$sql s, sys.all_users u &lt;br /&gt;WHERE s.parsing_user_id=u.user_id &lt;br /&gt;&amp;nbsp; and UPPER(u.username) ='SCOTT'&lt;br /&gt;&amp;nbsp; and module = 'ASBAgent.exe'&lt;br /&gt;) s&lt;br /&gt;order by first_load_time desc;&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&amp;nbsp;&lt;/div&gt;&lt;div&gt;&lt;script type="text/javascript"&gt;&lt;!--google_ad_client = "ca-pub-1602461054664536";/* oracledba-fooder-banner-468x60-20100511 */google_ad_slot = "5574621840";google_ad_width = 468;google_ad_height = 60;//--&gt;&lt;/script&gt;&lt;script src="http://pagead2.googlesyndication.com/pagead/show_ads.js" type="text/javascript"&gt;&lt;/script&gt;&lt;/div&gt;&lt;br /&gt;&lt;strong&gt;Related Notes:&lt;/strong&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://databobjr.blogspot.com/2012/01/retrieve-oracle-table-size-number.html"&gt;Find Oracle Table Size, Number Of Columns and Rows &lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://databobjr.blogspot.com/2012/01/retrieve-oracle-table-column-name-and.html"&gt;Retrieve Oracle Table Column Name And Data Type &lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&amp;nbsp;&amp;nbsp;&lt;/li&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/22611914-7441396473439934267?l=databobjr.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://databobjr.blogspot.com/feeds/7441396473439934267/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=22611914&amp;postID=7441396473439934267' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/22611914/posts/default/7441396473439934267'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/22611914/posts/default/7441396473439934267'/><link rel='alternate' type='text/html' href='http://databobjr.blogspot.com/2012/01/find-current-running-sql-statements-in.html' title='Find Current Running SQL Statements In Oracle'/><author><name>Data Bob Jr.</name><uri>http://www.blogger.com/profile/11965565939904347208</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-22611914.post-8346701392495843940</id><published>2011-12-22T05:01:00.000-08:00</published><updated>2011-12-22T05:32:36.106-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='IIS'/><category scheme='http://www.blogger.com/atom/ns#' term='Ascential DataStage:Admin'/><category scheme='http://www.blogger.com/atom/ns#' term='DtataStage'/><title type='text'>Configuring DataStage v8.5 Parallel Engine (Windows)</title><content type='html'>&lt;b&gt;Configuring the DataStage v8.5 Parallel Engine On Windows&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;&lt;div&gt;The information can be found in &lt;a href="http://publib.boulder.ibm.com/infocenter/iisinfsv/v8r5/index.jsp?topic=/com.ibm.swg.im.iis.productization.iisinfsv.install.doc/topics/wsisinst_config_pe_win.html"&gt;this document.&lt;/a&gt; I added a few points for Windows Server related steps since I am not familiar with Windows Servers.&lt;/div&gt;&lt;br /&gt;&lt;div style="display: block; float: right; height: 260px; margin: 3px; width: 310px;"&gt;&lt;script type="text/javascript"&gt;&lt;!--google_ad_client = "ca-pub-1602461054664536";/* BodyAD-image-text-300x250-20100423 */google_ad_slot = "2838716459";google_ad_width = 300;google_ad_height = 250;//--&gt;&lt;/script&gt;&lt;script src="http://pagead2.googlesyndication.com/pagead/show_ads.js" type="text/javascript"&gt;&lt;/script&gt;&lt;/div&gt;If the parallel engine is installed on a computer that runs Microsoft Windows Server, Standard or Enterprise edition, you can configure the parallel engine for Microsoft Windows Server, 32-bit or 64 bit editions, by editing the Windows Registry and by changing system settings that control available memory. The Windows Registry includes keys that control desktop heap size, swap area size, the number of available TCP connections, and memory management.&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;/div&gt;&lt;strong&gt;1. Before&amp;nbsp;Starting Configuration&lt;/strong&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Log in to Windows Server as the Administrator. &lt;/li&gt;&lt;li&gt;Start the Registry Editor, In Window Server 2008, open the DOS prompt as Administrator (right click on the dos prompt and select “Run as administrator”. From the DOS prompt, enter regedit&lt;/li&gt;&lt;div&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; C:\Windows\system32&amp;gt;regedit&lt;/div&gt;&lt;br /&gt;&lt;li style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;"&gt;Back up the Windows Registry. If you plan to make several changes (for example, to configure the parallel engine), create a single backup before you make all the changes.&amp;nbsp; To backup the registry,&amp;nbsp;From the Registry Editor, select File -&amp;gt; Export and save the registry to a file.&lt;/li&gt;&lt;/ul&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/-w-0jMH4y4W4/TvMvIy8ajOI/AAAAAAAAAGg/lBQjP_9pbaA/s1600/winregedit.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="186" rea="true" src="http://4.bp.blogspot.com/-w-0jMH4y4W4/TvMvIy8ajOI/AAAAAAAAAGg/lBQjP_9pbaA/s320/winregedit.jpg" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/div&gt;&lt;strong&gt;2. Configuring the Windows Registry: Enabling auto-tuning for paged pool size&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;/div&gt;Enable auto-tuning for the paged pool size. Enabling auto-tuning ensures that sufficient memory is available for paged pools.&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;/div&gt;The Windows Server kernel allocates memory in pools. These pools are known as the paged pool and the non-paged pool. Performance degradation and server instability might result if the memory for these pools is exhausted. To avoid this situation, you can enable auto-tuning at server startup by editing the PagedPoolSize registry value in the HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management registry subkey.&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;/div&gt;2.1 Procedure&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;/div&gt;(1.) In the Registry Editor, select the following registry subkey:&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;/div&gt;HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;/div&gt;(2.) in the right pane of the Registry Editor, right-click PagedPoolSize, and click Modify. &lt;br /&gt;(3.) in the Base area, select Hexadecimal.&lt;br /&gt;(4.) In the Value data field, specify 0 (zero). If 0 is already specified, auto-tuning is enabled, and you do not need to change this value. If you must specify a value other than 0, the value data for SystemPages must be 0. &lt;br /&gt;(5.) Click OK. &lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/div&gt;&lt;div&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/div&gt;&lt;strong&gt;3. Configuring the Windows Registry: Enabling auto-tuning for system page size&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;/div&gt;Enable auto-tuning for the system page size. Enabling auto-tuning ensures that sufficient memory is available for page tables and page table entries.&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;/div&gt;To support virtual to physical address translation, the Windows operating system uses page tables and page table entries (PTEs). These tables reside in kernel memory. If not enough memory is allocated for the page tables, Windows might fail to create processes, threads, and I/O buffers. Because the parallel engine creates many processes to run a job, jobs will fail at startup or during run time if Windows does not have enough resources to create processes. &lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;/div&gt;You can enable auto-tuning at server startup by editing the SystemPages registry value in the HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management registry subkey.&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;/div&gt;3.1 Procedure&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;/div&gt;(1.) In the Registry Editor, select the following registry subkey:&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;/div&gt;(2.) In the right pane of the Registry Editor, right-click SystemPages, and click Modify. &lt;br /&gt;(3.) In the Base area, select Hexadecimal.&lt;br /&gt;(4.) In the Value data field, specify 0 (zero). Typically, specifying 0 for this value provides sufficient memory. If the available PTEs are exhausted, however, you can specify the maximum value, 0XFFFFFFFF. If you must specify a value other than 0, the value data for PagedPoolSize must be 0. &lt;br /&gt;&amp;nbsp;(5.) Click OK. &lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;/div&gt;&lt;strong&gt;4 Configuring the Windows registry: Setting the threshold for de-committing memory&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;/div&gt;Set the threshold for de-committing memory. On computers that have 1 GB or more of RAM, setting the threshold to the suggested value improves memory management.&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;/div&gt;When Windows frees memory at a specific address, the memory can remain committed, or it can be de-committed and marked as reserved. You can improve memory management on computers that have 1 GB or more of RAM by editing the HeapDeCommitFreeBlockThreshold registry value in the HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager registry subkey. This registry value specifies the number of contiguous bytes of memory (around the address of the freed memory) above which the block of memory is de-committed. &lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;/div&gt;4.1 Procedure&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;/div&gt;(1.) In the Registry Editor, select the following registry subkey:&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager &lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;/div&gt;(2.) Specify the value data for HeapDeCommitFreeBlockThreshold registry value: &lt;br /&gt;(3.) If the registry value does not exist, click Edit &amp;gt; New &amp;gt; DWORD Value, and type the name of the registry value.&lt;br /&gt;(4.) In the right pane of the Registry Editor, right-click the registry value, and click Modify.&lt;br /&gt;(5.) In the Base area, select Hexadecimal.&lt;br /&gt;(6.) In the Value data field, specify 0x000400. &lt;br /&gt;(7.) Click OK.&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/div&gt;&lt;strong&gt;5 Configuring the Windows registry: Increasing the noninteractive desktop heap size&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;/div&gt;Increase the noninteractive desktop heap size to ensure that a sufficient number of processes can be created and run concurrently.&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;/div&gt;DataStage® processes are created in a specific desktop heap. Each process consumes a small amount of memory from the desktop heap. If you expect to run many InfoSphere DataStage jobs concurrently, increase the size of the noninteractive desktop heap to allow more processes to be created and run concurrently.&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;/div&gt;You increase the size of the noninteractive desktop heap by editing the SharedSection parameter string in the HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\SubSystems registry subkey. The SharedSection parameter string is located in the Windows registry value and uses the following format to specify heap size:&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;/div&gt;SharedSection=xxxx,yyyy,zzzz&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;/div&gt;Where:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;· xxxx specifies the maximum size of the system-wide heap (in kilobytes) &lt;/li&gt;&lt;li&gt;· yyyy specifies the size of each desktop heap &lt;/li&gt;&lt;li&gt;· zzzz specifies the size of the desktop heap that is associated with a noninteractive Windows instance &lt;/li&gt;&lt;/ul&gt;5.1 Procedure&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;/div&gt;(1.) In the Registry Editor, select the following registry subkey:&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;/div&gt;HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\SubSystems&lt;br /&gt;&lt;br /&gt;&lt;div&gt;(2.) In the right pane of the Registry Editor, right-click the Windows registry value, and click Modify. &lt;/div&gt;(3.) In the Value data field, locate the SharedSection parameter string, and change the last SharedSection parameter from 512 to 2048. For example, specify the following values for this parameter:&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&amp;nbsp;&amp;nbsp; SharedSection=1024,3072,2048&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&amp;nbsp;If you cannot change the size of the desktop heap to 2048, try setting the value to 1024. For example, specify the following values for this parameter: &lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;/div&gt;SharedSection=1024,3072,1024&lt;br /&gt;&amp;nbsp;(4.) Click OK. &lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;/div&gt;&lt;strong&gt;6. Configuring the Windows registry: Specifying TCP/IP settings&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&lt;/strong&gt;&lt;br /&gt;&lt;div&gt;&lt;/div&gt;&lt;div&gt;&lt;/div&gt;Specify settings for TCP/IP in the Windows Registry to ensure that the required number of parallel processes can run concurrently. &lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;/div&gt;You specify TCP/IP settings by editing the following registry values in the HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters registry subkey: &lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;/div&gt;MaxUserPort &lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;/div&gt;Specifies the maximum port number for ephemeral TCP ports. &lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;/div&gt;TcpNumConnections &lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;/div&gt;Specifies the maximum number of concurrent connections that TCP can open. This value significantly affects the number of concurrent osh.exe processes that are allowed. If the value for TcpNumConnections is too low, Windows cannot assign TCP ports to stages in parallel jobs, and the parallel jobs cannot run. &lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;/div&gt;These keys are not added to the registry by default.&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;/div&gt;6.1 Procedure&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;/div&gt;(1.) In the Registry Editor, select the following registry subkey:&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;/div&gt;HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;/div&gt;(2.) Specify the following registry values: MaxUserPort and TcpNumConnections. &lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;/div&gt;a. If the registry value does not exist, click Edit &amp;gt; New &amp;gt; DWORD Value, and type the name of the registry value.&lt;br /&gt;b. In the right pane of the Registry Editor, right-click the registry value, and click Modify.&lt;br /&gt;c. In the Base area, select Hexadecimal.&lt;br /&gt;d. In the Value data field, specify the following values: &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Registry value name&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Value data&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Valid range&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; MaxUserPort&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 65534&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;5000 - 65534 (decimal)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; TcpNumConnections&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 65534&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0 - 0xfffffe (65534 decimal)&lt;br /&gt;e. Click OK.&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;/div&gt;&lt;div&gt;&lt;/div&gt;&lt;strong&gt;7 Configuring Windows: Changing swap area size&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;/div&gt;Change the size of the swap area to improve performance.&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;/div&gt;7.1 Procedure&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;/div&gt;(1.) Click Start &amp;gt; Control Panel &amp;gt; System.&lt;br /&gt;(2.) In the System Properties window, click the Advanced tab.&lt;br /&gt;(3.) In the Performance area, click Settings. &lt;br /&gt;(4.) In the Performance Options window, select the Advanced tab. &lt;br /&gt;(5.) In the Virtual memory area, click Change. &lt;br /&gt;(6.) In the Virtual Memory window, specify a value for Maximum size. Set this value to be one to one- and-a-half times larger than the value for physical memory. &lt;br /&gt;(7.) Click Set. &lt;br /&gt;(8.) Click OK three times, and then close the Control Panel window. &lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;strong&gt;&amp;nbsp;8. Configuring Windows: Enable Physical Address Extension (PAE)&lt;/strong&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;/div&gt;Enable /PAE switch. Edit the boot.ini file to remove the /3GB switch and, if necessary, add the /PAE switch. &lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;/div&gt;By default, Windows reserves 2 GB of memory for the kernel and 2 GB of memory for user mode programs. When the /3GB switch is specified in the boot.ini file, 3 GB of memory is reserved for user mode programs, and the amount of kernel memory is reduced by 1 GB. This setting results in an insufficient amount of memory for the kernel. To resolve this problem, remove the /3GB switch, if present from boot.ini file(for Windows Server 2000 or 2003). &lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;/div&gt;In addition, on servers that have more than 4 GB of physical memory installed, specify the /PAE switch in the boot.ini file. For Windows 2008 server, use the BCDEDIT.exe tool (see section 11.8.1 below). The /PAE switch specifies physical address extensions that allow a 32-bit processor to access memory that is above the 4 GB limit. &lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;/div&gt;&lt;strong&gt;8.1 Procedure&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;/div&gt;(1.) Click Start &amp;gt; Control Panel &amp;gt; System.&lt;br /&gt;(2.) In the System Properties window, click the Advanced tab. &lt;br /&gt;(3.) In the Startup and Recovery area, click Settings. &lt;br /&gt;(4.) Click Edit to edit the boot.ini file. &lt;br /&gt;(5.) Remove the /3GB switch, if present. &lt;br /&gt;(6.) On servers that have more than 4 GB of physical memory installed, add the /PAE switch to the boot.ini file. &lt;br /&gt;(7.) Save and close the boot.ini file. &lt;br /&gt;(8.) Click OK twice, and then close the Control Panel window. &lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;/div&gt;&lt;strong&gt;Note:&lt;/strong&gt; There is no boot.ini in Windows Server 2008. To enable PAE in Windows 2008 server, use the Boot Configuration Data Editor, BCDEDIT.EXE, which is located in c:\windows\system32\ and follow the following steps: &lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;/div&gt;(1.) Open Command Prompt with elevated privileges (Run as Administrator) &lt;br /&gt;(2.) Execute the following command &lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;/div&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; BCDEDIT /SET PAE ForceEnabl&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;/div&gt;(3.) To verify, run BCDEDIT without any switch:&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;/div&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; BCDEDIT&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;/div&gt;You should see “PAE ForceEnabl” at the end of the screen.&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/-hLP56FKrgk0/TvMwhB2WXXI/AAAAAAAAAGs/GNhJuGMCROA/s1600/bcdedit.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="234" rea="true" src="http://1.bp.blogspot.com/-hLP56FKrgk0/TvMwhB2WXXI/AAAAAAAAAGs/GNhJuGMCROA/s320/bcdedit.jpg" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;/div&gt;&lt;strong&gt;9 Restart Windows Server&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;/div&gt;After you make changes to the Windows Registry, restart Windows to apply your changes. &lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;/div&gt;&lt;strong&gt;Reference:&amp;nbsp;&lt;/strong&gt;&lt;br /&gt;&lt;div&gt;&lt;/div&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://publib.boulder.ibm.com/infocenter/iisinfsv/v8r5/index.jsp?topic=/com.ibm.swg.im.iis.productization.iisinfsv.install.doc/topics/wsisinst_config_pe_win.html"&gt;Configuring the parallel engine (Windows Server)&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://technet.microsoft.com/en-us/library/cc721886%28WS.10%29.aspx"&gt;Boot Configuration Data Editor Frequently Asked Questions&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.google.com/cse?cx=partner-pub-1602461054664536%3Aghaimtmraz9&amp;amp;ie=ISO-8859-1&amp;amp;q=Configuring+the+DataStage+v8.5+Parallel+Engine+On+Windows&amp;amp;sa=Search#gsc.tab=0&amp;amp;gsc.q=Configuring%20the%20DataStage%20v8.5%20Parallel%20Engine%20On%20Windows&amp;amp;gsc.page=1"&gt;Other references on the web&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;div&gt;&amp;nbsp; &lt;/div&gt;&lt;div&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;/div&gt;&lt;div&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;script type="text/javascript"&gt;&lt;!--google_ad_client = "ca-pub-1602461054664536";/* banner-468x60-20100510 */google_ad_slot = "5479042196";google_ad_width = 468;google_ad_height = 60;//--&gt;&lt;/script&gt;&lt;script src="http://pagead2.googlesyndication.com/pagead/show_ads.js" type="text/javascript"&gt;&lt;/script&gt;&lt;/div&gt;&lt;div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/22611914-8346701392495843940?l=databobjr.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://databobjr.blogspot.com/feeds/8346701392495843940/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=22611914&amp;postID=8346701392495843940' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/22611914/posts/default/8346701392495843940'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/22611914/posts/default/8346701392495843940'/><link rel='alternate' type='text/html' href='http://databobjr.blogspot.com/2011/12/configuring-datastage-v85-parallel.html' title='Configuring DataStage v8.5 Parallel Engine (Windows)'/><author><name>Data Bob Jr.</name><uri>http://www.blogger.com/profile/11965565939904347208</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/-w-0jMH4y4W4/TvMvIy8ajOI/AAAAAAAAAGg/lBQjP_9pbaA/s72-c/winregedit.jpg' height='72' width='72'/><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-22611914.post-552415234818592057</id><published>2011-12-13T00:30:00.000-08:00</published><updated>2011-12-13T00:56:34.732-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Music'/><category scheme='http://www.blogger.com/atom/ns#' term='Music of the Night'/><title type='text'>Music of the Night - Richard Clayderman</title><content type='html'>&lt;b&gt;&lt;b&gt;Misic of the Night by Richard Clayderman&lt;/b&gt;&lt;/b&gt;&lt;br /&gt;&lt;div id="Layer1" style="height: 320px; position: absolute; width: 420px; z-index: 1;"&gt;&lt;iframe allowfullscreen="" frameborder="0" height="315" src="http://www.youtube.com/embed/idJvregDljY" width="420"&gt;&lt;/iframe&gt;&lt;/div&gt;&lt;div id="Layer2" style="float: none; height: 250px; left: 449px; position: relative; width: 250px; z-index: 1;"&gt;&lt;script type="text/javascript"&gt;&lt;!--google_ad_client = "ca-pub-1602461054664536";/* misicofthenight-text-image-250x250-20111212 */google_ad_slot = "8412539377";google_ad_width = 250;google_ad_height = 250;//--&gt;&lt;/script&gt;&lt;script src="http://pagead2.googlesyndication.com/pagead/show_ads.js" type="text/javascript"&gt;&lt;/script&gt;&lt;/div&gt;&lt;div&gt;&lt;/div&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/22611914-552415234818592057?l=databobjr.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://databobjr.blogspot.com/feeds/552415234818592057/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=22611914&amp;postID=552415234818592057' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/22611914/posts/default/552415234818592057'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/22611914/posts/default/552415234818592057'/><link rel='alternate' type='text/html' href='http://databobjr.blogspot.com/2011/12/music-of-night-richard-clayderman.html' title='Music of the Night - Richard Clayderman'/><author><name>Data Bob Jr.</name><uri>http://www.blogger.com/profile/11965565939904347208</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://img.youtube.com/vi/idJvregDljY/default.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-22611914.post-8119668858784211435</id><published>2011-11-21T03:12:00.001-08:00</published><updated>2011-12-06T05:02:53.145-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='MySQL Data Warehouse'/><category scheme='http://www.blogger.com/atom/ns#' term='MySQL'/><category scheme='http://www.blogger.com/atom/ns#' term='Data Warehouse'/><title type='text'>LOAD SLOWLY CHANGING DIMENSION TYPE 2 USING MYSQL STORED PROCEDURE</title><content type='html'>&lt;b&gt;LOAD SLOWLY CHANGING DIMENSION TYPE 2 USING MYSQL STORED PROCEDURE &lt;/b&gt;&lt;br /&gt;&lt;br /&gt;Unlike Oracle (&lt;a href="http://databobjr.blogspot.com/2011/04/load-slowly-changing-dimension-type-2.html"&gt;merge statement&lt;/a&gt;) or other databases, MySQL does not support “upsert” (perform update or insert in one sql statement). Therefore, it requires some coding to achieve both insert and update when loading a type 2 slowly changing dimension.&lt;br /&gt;&lt;br /&gt;&lt;div style="display: block; float: right; height: 260px; margin: 3px; width: 310px;"&gt;&lt;script type="text/javascript"&gt;&lt;!--google_ad_client = "pub-1602461054664536";/* boby-image-text-upper-right-300x250-20100427 */google_ad_slot = "1745059421";google_ad_width = 300;google_ad_height = 250;//--&gt;&lt;/script&gt;&lt;br /&gt;&lt;script src="http://pagead2.googlesyndication.com/pagead/show_ads.js" type="text/javascript"&gt;&lt;/script&gt;&lt;/div&gt;Here was my&amp;nbsp;lab exercise&amp;nbsp; which I used a common dimension, product.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;1. Tables.&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;I created the following tables during my lab exercise.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;1.1 Dimension table: dim_product.&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;This&amp;nbsp;was the product dimension table that we want to keep history of changes of production name, product description, product category and price. &lt;br /&gt;Create table dim_product(&lt;br /&gt;PRODUCT_SID int(12) NOT NULL auto_increment ,&lt;br /&gt;PRODUCT_ID int(12) NOT NULL,&lt;br /&gt;PRODUCT_CATEGORY_ID int(10) not null,&lt;br /&gt;PRODUCT_NAME VARCHAR(50),&lt;br /&gt;PRODUCT_DESCRIPTION VARCHAR(200),&lt;br /&gt;PRICE DECIMAL(10,2),&lt;br /&gt;PRICE_EFFECTIVE_DATE DATEtime,&lt;br /&gt;LAST_MODIFIED_DATE DATEtime,&lt;br /&gt;EFFECTIVE_START_DATE DATEtime,&lt;br /&gt;EFFECTIVE_END_DATE DATEtime,&lt;br /&gt;IS_CURRENT_ROW char(1),&lt;br /&gt;CREATED_DATE DATEtime,&lt;br /&gt;UPDATED_DATE DATEtime,&lt;br /&gt;primary key (product_sid) &lt;br /&gt;);&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;1.2 Staging table: stg_product. &lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;This&amp;nbsp;was the staging table that we will use to store new product records. Assuming production records will transfer to this table first before load into the product dimension.&lt;br /&gt;&lt;br /&gt;create table pcdb.stg_product (&lt;br /&gt;product_id int(12) not null,&lt;br /&gt;product_category_id int(10) not null,&lt;br /&gt;product_name varchar(50),&lt;br /&gt;product_description varchar(200),&lt;br /&gt;price decimal(8,2),&lt;br /&gt;price_effective_date datetime,&lt;br /&gt;last_modified_date datetime,&lt;br /&gt;created_date datetime);&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;1.3 Tempary table: tmp_product. &lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;This is a temporary table that will be used in the store procedure to process data.&lt;br /&gt;&lt;br /&gt;create table tmp_product (&lt;br /&gt;PRODUCT_SID int(12) ,&lt;br /&gt;PRODUCT_ID int(12) NOT NULL,&lt;br /&gt;PRODUCT_CATEGORY_ID int(10) not null,&lt;br /&gt;PRODUCT_NAME VARCHAR(50),&lt;br /&gt;PRODUCT_DESCRIPTION VARCHAR(200),&lt;br /&gt;PRICE DECIMAL(10,2),&lt;br /&gt;PRICE_EFFECTIVE_DATE DATEtime,&lt;br /&gt;LAST_MODIFIED_DATE DATEtime,&lt;br /&gt;created_date datetime,&lt;br /&gt;scd_row_type_id tinyint(2)&lt;br /&gt;);&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;2. The Stored Procedure&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;I created a stored procedure to accomplish the SCD type 2 dimension load in MySQL. Here&amp;nbsp;was the&amp;nbsp;simple store procedure.&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;pre style="background: rgb(240,240,240); border-bottom: rgb(204,204,204) 1px dashed; border-left: rgb(204,204,204) 1px dashed; border-right: rgb(204,204,204) 1px dashed; border-top: rgb(204,204,204) 1px dashed; color: black; height: 1590px; overflow: auto; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 717px; word-wrap: normal;"&gt;use labdb&lt;br /&gt;drop procedure if exists sp_dim_product;&lt;br /&gt;delimiter //&lt;br /&gt;&lt;br /&gt;CREATE PROCEDURE sp_dim_product()&lt;br /&gt;&lt;br /&gt;BEGIN&lt;br /&gt;&lt;br /&gt;/* Procedure name: sp_dim_prodcut&lt;br /&gt;Description: user subscriptions &lt;br /&gt;SCD: Type 2.&lt;br /&gt;Dependence: dim_user_product&lt;br /&gt;Table size: large. keep track changes in product.&lt;br /&gt;*/&lt;br /&gt;&lt;br /&gt;Declare v_start_date datetime;&lt;br /&gt;declare v_load_id int;&lt;br /&gt;declare v_error_msg varchar(200);&lt;br /&gt;declare v_proc_name varchar(36) default 'sp_dim_product'; &lt;br /&gt;declare v_validation tinyint;&lt;br /&gt;declare v_max_data_date datetime;&lt;br /&gt;&lt;br /&gt;DECLARE EXIT HANDLER FOR SQLEXCEPTION &lt;br /&gt;BEGIN &lt;br /&gt;set v_error_msg =concat('Procedure ',v_proc_name,' Encounter SQLEXCEPTION Error: Error code unknown');&lt;br /&gt;SELECT v_error_msg; &lt;br /&gt;END;&lt;br /&gt;&lt;br /&gt;truncate table tmp_product;&lt;br /&gt;&lt;br /&gt;insert into tmp_product(&lt;br /&gt;PRODUCT_SID ,&lt;br /&gt;PRODUCT_ID ,&lt;br /&gt;PRODUCT_CATEGORY_ID ,&lt;br /&gt;PRODUCT_NAME ,&lt;br /&gt;PRODUCT_DESCRIPTION ,&lt;br /&gt;PRICE ,&lt;br /&gt;PRICE_EFFECTIVE_DATE ,&lt;br /&gt;LAST_MODIFIED_DATE ,&lt;br /&gt;EFFECTIVE_START_DATE ,&lt;br /&gt;EFFECTIVE_END_DATE ,&lt;br /&gt;IS_CURRENT_ROW ,&lt;br /&gt;scd_row_type_id ,&lt;br /&gt;)&lt;br /&gt;select &lt;br /&gt;ifnull(d.product_sid,0),&lt;br /&gt;p.product_id,&lt;br /&gt;p.product_category_id,&lt;br /&gt;p.product_name,&lt;br /&gt;p.product_description,&lt;br /&gt;p.price,&lt;br /&gt;p.price_effective_date,&lt;br /&gt;p.last_modified_date,&lt;br /&gt;p.last_modified_date as effective_start_date,&lt;br /&gt;'2050/12/31' as effective_end_date,&lt;br /&gt;'T',&lt;br /&gt;( case when d.product_sid is null then 1 &lt;br /&gt;when (d.product_sid is not null and&lt;br /&gt;(p.product_category_id &amp;lt;&amp;gt; d.product_category_id or&lt;br /&gt;p.product_name &amp;lt;&amp;gt; d.product_name or&lt;br /&gt;p.product_description &amp;lt;&amp;gt; d.PRODUCT_DESCRIPTION or&lt;br /&gt;p.price &amp;lt;&amp;gt; d.price) &lt;br /&gt;) then 2&lt;br /&gt;else 0 &lt;br /&gt;end) as scd_row_type_id ,&lt;br /&gt;now()&lt;br /&gt;from stg_product p&lt;br /&gt;left join dim_product d &lt;br /&gt;on (p.product_id = d.product_id and d.is_current_row = 'T')&lt;br /&gt;;&lt;br /&gt;&lt;br /&gt;update dim_product d, tmp_product t&lt;br /&gt;set d.is_current_row = 'F', &lt;br /&gt;d.EFFECTIVE_END_DATE = t.LAST_MODIFIED_DATE,&lt;br /&gt;updated_date = now()&lt;br /&gt;where d.product_sid = t.product_sid&lt;br /&gt;and t.scd_row_type_id = 2;&lt;br /&gt;&lt;br /&gt;insert into dim_product(&lt;br /&gt;PRODUCT_ID ,&lt;br /&gt;PRODUCT_CATEGORY_ID ,&lt;br /&gt;PRODUCT_NAME ,&lt;br /&gt;PRODUCT_DESCRIPTION ,&lt;br /&gt;PRICE ,&lt;br /&gt;PRICE_EFFECTIVE_DATE ,&lt;br /&gt;LAST_MODIFIED_DATE ,&lt;br /&gt;EFFECTIVE_START_DATE ,&lt;br /&gt;EFFECTIVE_END_DATE ,&lt;br /&gt;IS_CURRENT_ROW ,&lt;br /&gt;CREATED_DATE ,&lt;br /&gt;UPDATED_DATE &lt;br /&gt;)&lt;br /&gt;select PRODUCT_ID ,&lt;br /&gt;PRODUCT_CATEGORY_ID ,&lt;br /&gt;PRODUCT_NAME ,&lt;br /&gt;PRODUCT_DESCRIPTION ,&lt;br /&gt;PRICE ,&lt;br /&gt;PRICE_EFFECTIVE_DATE ,&lt;br /&gt;LAST_MODIFIED_DATE ,&lt;br /&gt;LAST_MODIFIED_DATE ,&lt;br /&gt;EFFECTIVE_END_DATE ,&lt;br /&gt;IS_CURRENT_ROW ,&lt;br /&gt;now() ,&lt;br /&gt;now()&lt;br /&gt;from tmp_product&lt;br /&gt;where scd_row_type_id in (1,2)&lt;br /&gt;;&lt;br /&gt;&lt;br /&gt;commit;&lt;br /&gt;&lt;br /&gt;END;&lt;br /&gt;//&lt;br /&gt;&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;&lt;strong&gt;3 How it works&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;A slowly changing dimension type 2 (SCD2) is defined to keep track changes of attributes in the underlying source table. While there are many attributes in a table, the business rules decide what changes to track. Here, for demonstration purpose, I choose to keep track of changes of each of the following attributes: production name, product description, and product category and price. &lt;br /&gt;&lt;br /&gt;In the procedure, I used left outer join on product id, between the dimension table (existing records) and the staging table (new and modified records). For the new records, the product_sid will be null because they were not in the dimention table and I used a scd_row_type_id=1 flag to indicate that they were new records and assigned each of them with a ‘0’ poduct_sid. For the existing records, there would be a product_sid for each record and I used a scd_row_type_id=2 flag to indicate that they were modified exiting records. &lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;pre style="background: rgb(240,240,240); border-bottom: rgb(204,204,204) 1px dashed; border-left: rgb(204,204,204) 1px dashed; border-right: rgb(204,204,204) 1px dashed; border-top: rgb(204,204,204) 1px dashed; color: black; height: 477px; overflow: auto; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 650px; word-wrap: normal;"&gt;select &lt;br /&gt;ifnull(d.product_sid,0),&lt;br /&gt;p.product_id,&lt;br /&gt;p.product_category_id,&lt;br /&gt;p.product_name,&lt;br /&gt;p.product_description,&lt;br /&gt;p.price,&lt;br /&gt;p.price_effective_date,&lt;br /&gt;p.last_modified_date,&lt;br /&gt;p.last_modified_date as effective_start_date,&lt;br /&gt;'2050/12/31' as effective_end_date,&lt;br /&gt;'T',&lt;br /&gt;(&amp;nbsp;case when d.product_sid is null then 1 &lt;br /&gt;when (d.product_sid is not null and&lt;br /&gt;(p.product_category_id &amp;lt;&amp;gt; d.product_category_id or&lt;br /&gt;p.product_name &amp;lt;&amp;gt; d.product_name or&lt;br /&gt;p.product_description &amp;lt;&amp;gt; d.PRODUCT_DESCRIPTION or&lt;br /&gt;p.price &amp;lt;&amp;gt; d.price) &lt;br /&gt;) then 2&lt;br /&gt;else 0 &lt;br /&gt;end) as scd_row_type_id ,&lt;br /&gt;now()&lt;br /&gt;from stg_product p&lt;br /&gt;left join dim_product d &lt;br /&gt;on (p.product_id = d.product_id and d.is_current_row = 'T')&lt;br /&gt;;&lt;br /&gt;&lt;br /&gt;update dim_product d, tmp_product t&lt;br /&gt;set d.is_current_row = 'F', &lt;br /&gt;d.EFFECTIVE_END_DATE = t.LAST_MODIFIED_DATE,&lt;br /&gt;updated_date = now()&lt;br /&gt;where d.product_sid = t.product_sid&lt;br /&gt;and t.scd_row_type_id = 2;&lt;br /&gt;&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;To identify the modified records, I used a case statement. By following the business rules, I compared each of the attributes to see if any of the attributes were modified. If it was, assigned a ‘2’ to the scd_row_type_id flag. &lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;pre style="background: rgb(240,240,240); border-bottom: rgb(204,204,204) 1px dashed; border-left: rgb(204,204,204) 1px dashed; border-right: rgb(204,204,204) 1px dashed; border-top: rgb(204,204,204) 1px dashed; color: black; height: 108px; overflow: auto; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 650px; word-wrap: normal;"&gt;( case when d.product_sid is null then 1 &lt;br /&gt;when (d.product_sid is not null and&lt;br /&gt;(p.product_category_id &amp;lt;&amp;gt; d.product_category_id or&lt;br /&gt;p.product_name &amp;lt;&amp;gt; d.product_name or&lt;br /&gt;p.product_description &amp;lt;&amp;gt; d.PRODUCT_DESCRIPTION or&lt;br /&gt;p.price &amp;lt;&amp;gt; d.price) )&lt;br /&gt; then 2&lt;br /&gt;&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;To indicate the current record, I created a column called IS_CURRENT_ROW and set it to ‘T’ it was a current row. For existing (history) records, I set it to the IS_CURRENT_ROW to ‘F’. &lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;pre style="background: rgb(240,240,240); border-bottom: rgb(204,204,204) 1px dashed; border-left: rgb(204,204,204) 1px dashed; border-right: rgb(204,204,204) 1px dashed; border-top: rgb(204,204,204) 1px dashed; color: black; height: 101px; overflow: auto; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 650px; word-wrap: normal;"&gt;update dim_product d, tmp_product t&lt;br /&gt;set d.is_current_row = 'F', &lt;br /&gt;d.EFFECTIVE_END_DATE = t.LAST_MODIFIED_DATE,&lt;br /&gt;updated_date = now()&lt;br /&gt;where d.product_sid = t.product_sid&lt;br /&gt;and t.scd_row_type_id = 2;&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;At the end of the procedure, I inserted both the new and modified records which the t.scd_row_type_id was ‘1’ or ‘2’. Please note that records had not been modified, would had scd_row_type_id = 0 and would not be inserted into the dimention table.&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;pre style="background: rgb(240,240,240); border-bottom: rgb(204,204,204) 1px dashed; border-left: rgb(204,204,204) 1px dashed; border-right: rgb(204,204,204) 1px dashed; border-top: rgb(204,204,204) 1px dashed; color: black; height: 407px; overflow: auto; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 650px; word-wrap: normal;"&gt;insert into dim_product(&lt;br /&gt;PRODUCT_ID ,&lt;br /&gt;PRODUCT_CATEGORY_ID ,&lt;br /&gt;PRODUCT_NAME ,&lt;br /&gt;PRODUCT_DESCRIPTION ,&lt;br /&gt;PRICE ,&lt;br /&gt;PRICE_EFFECTIVE_DATE ,&lt;br /&gt;LAST_MODIFIED_DATE ,&lt;br /&gt;EFFECTIVE_START_DATE ,&lt;br /&gt;EFFECTIVE_END_DATE ,&lt;br /&gt;IS_CURRENT_ROW ,&lt;br /&gt;CREATED_DATE ,&lt;br /&gt;UPDATED_DATE &lt;br /&gt;)&lt;br /&gt;select PRODUCT_ID ,&lt;br /&gt;PRODUCT_CATEGORY_ID ,&lt;br /&gt;PRODUCT_NAME ,&lt;br /&gt;PRODUCT_DESCRIPTION ,&lt;br /&gt;PRICE ,&lt;br /&gt;PRICE_EFFECTIVE_DATE ,&lt;br /&gt;LAST_MODIFIED_DATE ,&lt;br /&gt;LAST_MODIFIED_DATE ,&lt;br /&gt;EFFECTIVE_END_DATE ,&lt;br /&gt;IS_CURRENT_ROW ,&lt;br /&gt;now() ,&lt;br /&gt;now()&lt;br /&gt;from tmp_product&lt;br /&gt;where scd_row_type_id in (1,2)&lt;br /&gt;;&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;To test the procedure, first run the following query to insert two records into the staging table: &lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;pre style="background: rgb(240,240,240); border-bottom: rgb(204,204,204) 1px dashed; border-left: rgb(204,204,204) 1px dashed; border-right: rgb(204,204,204) 1px dashed; border-top: rgb(204,204,204) 1px dashed; color: black; height: 148px; overflow: auto; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 1074px; word-wrap: normal;"&gt;truncate table stg_product;&lt;br /&gt;&lt;br /&gt;insert into stg_product ( PRODUCT_ID, PRODUCT_CATEGORY_ID, PRODUCT_NAME,PRODUCT_DESCRIPTION,PRICE,PRICE_EFFECTIVE_DATE, LAST_MODIFIED_DATE, CREATED_DATE)&lt;br /&gt;values (1,8,'Apple iPad 36 GB','Apple iPad 36 GB with case', 800,now(),now(),now());&lt;br /&gt;&lt;br /&gt;insert into stg_product ( PRODUCT_ID, PRODUCT_CATEGORY_ID, PRODUCT_NAME,PRODUCT_DESCRIPTION,PRICE,PRICE_EFFECTIVE_DATE, LAST_MODIFIED_DATE,CREATED_DATE)&lt;br /&gt;values (2,7,'Canon 12 MPIX Digital Camera','Canon 12 MPIX Digital Camera, Zoon Len, Case', 150,now(),now(),now());&lt;br /&gt;&lt;br /&gt;commit;&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;Check the stage tables to make sure the records are there. &lt;br /&gt;&lt;br /&gt;MySQL&amp;gt;select * from stg_product; &lt;br /&gt;&lt;br /&gt;Now run the store procedure which was created in section 2. After running the procedure, run the following query to check the records in the dim_product table. &lt;br /&gt;&lt;br /&gt;MySQL&amp;gt;select * from dim_product; &lt;br /&gt;&lt;br /&gt;There should be two rows in the dimension table with the column effective_start_date, effective_end_date and is_current_row populated. Now, let’s find out how the merge statement handles SCD Type 2 records. To begin, run the following queries against the stage table: &lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;pre style="background: rgb(240,240,240); border-bottom: rgb(204,204,204) 1px dashed; border-left: rgb(204,204,204) 1px dashed; border-right: rgb(204,204,204) 1px dashed; border-top: rgb(204,204,204) 1px dashed; color: black; height: 198px; overflow: auto; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 808px; word-wrap: normal;"&gt;update stg_product set price = 700 , price_effective_date = now(), last_modified_date = now() where product_id = 1;&lt;br /&gt;insert into stg_product (&lt;br /&gt;PRODUCT_ID, &lt;br /&gt;PRODUCT_CATEGORY_ID,&lt;br /&gt;PRODUCT_NAME,&lt;br /&gt;PRODUCT_DESCRIPTION,&lt;br /&gt;PRICE,&lt;br /&gt;PRICE_EFFECTIVE_DATE,&lt;br /&gt;LAST_MODIFIED_DATE,&lt;br /&gt;CREATED_DATE)&lt;br /&gt;values (3,6,'EPSon Color Printer',&lt;br /&gt;'EPSon color print with high definition photo prints', 200,now(),now(),now());&lt;br /&gt;commit;&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;The above statements updated a record where product_id equal to 1 to change it price to 700, and inserted one more new record, product_id 3, into the stg_product table. To help understand what the records set looks like from the select statement that use the left outer join, let’s copy the query and execute it to get the record set. &lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;pre style="background: rgb(240,240,240); border-bottom: rgb(204,204,204) 1px dashed; border-left: rgb(204,204,204) 1px dashed; border-right: rgb(204,204,204) 1px dashed; border-top: rgb(204,204,204) 1px dashed; color: black; height: 379px; overflow: auto; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 650px; word-wrap: normal;"&gt;select &lt;br /&gt;ifnull(d.product_sid,0),&lt;br /&gt;p.product_id,&lt;br /&gt;p.product_category_id,&lt;br /&gt;p.product_name,&lt;br /&gt;p.product_description,&lt;br /&gt;p.price,&lt;br /&gt;p.price_effective_date,&lt;br /&gt;p.last_modified_date,&lt;br /&gt;p.last_modified_date as effective_start_date,&lt;br /&gt;'2050/12/31' as effective_end_date,&lt;br /&gt;'T',&lt;br /&gt;( case when d.product_sid is null then 1 &lt;br /&gt;when (d.product_sid is not null and&lt;br /&gt;(p.product_category_id &amp;lt;&amp;gt; d.product_category_id or&lt;br /&gt;p.product_name &amp;lt;&amp;gt; d.product_name or&lt;br /&gt;p.product_description &amp;lt;&amp;gt; d.PRODUCT_DESCRIPTION or&lt;br /&gt;.price &amp;lt;&amp;gt; d.price) &lt;br /&gt;) then 2&lt;br /&gt;else 0 &lt;br /&gt;end) as scd_row_type_id ,&lt;br /&gt;now()&lt;br /&gt;from stg_product p&lt;br /&gt;left join dim_product d &lt;br /&gt;on (p.product_id = d.product_id and d.is_current_row = 'T')&lt;br /&gt;;&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;As you can see, we have one rows for product_id 1, and one row for the new record, product_id 3. Also, at the end of the row, you can also see that the scd_record_type_id column has two ids for product id 1. One is 2 and the other one is 1. &lt;br /&gt;&lt;br /&gt;Now, run the stored procedure in section 2 to load the data into the dimension table. &lt;br /&gt;&lt;br /&gt;4. Summary&lt;br /&gt;&lt;br /&gt;This purpose of this procedure is to show how to use outer join to maintain a Type 2 slow changing dimention in MySQL. This procedure dose not include all the necessary error checking routines. Also, there are other ‘real world’ situations need to be considered when implementing this procedure. For example, if there are large amount of records have been modified for any given time, there may be a performance issue when performing an update. Also, as the dimension table growth bigger, outer join will get slower. Therefore, other techniques need to be used to make the codes more efficient.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: Arial, Helvetica, sans-serif;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;b&gt;Reference:&lt;/b&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://www.amazon.com/gp/product/059652708X/ref=as_li_tf_tl?ie=UTF8&amp;amp;tag=dat03-20&amp;amp;linkCode=as2&amp;amp;camp=217145&amp;amp;creative=399369&amp;amp;creativeASIN=059652708X"&gt;MySQL Cookbook,Pau DuBois &lt;/a&gt;&lt;img alt="" border="0" height="1" src="http://www.assoc-amazon.com/e/ir?t=dat03-20&amp;amp;l=as2&amp;amp;o=1&amp;amp;a=059652708X&amp;amp;camp=217145&amp;amp;creative=399369" style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0px;" width="1" /&gt; &lt;/li&gt;&lt;li&gt;&lt;a href="http://www.amazon.com/Data-Warehouse-ETL-Toolkit-Techniques/dp/0764567578?ie=UTF8&amp;amp;tag=dat03-20&amp;amp;link_code=btl&amp;amp;camp=213689&amp;amp;creative=392969" target="_blank"&gt;The Data Warehouse ETL Toolkit, Ralph Kimball and Joe Caserta&lt;/a&gt;&lt;img alt="" border="0" height="1" src="http://www.assoc-amazon.com/e/ir?t=dat03-20&amp;amp;l=btl&amp;amp;camp=213689&amp;amp;creative=392969&amp;amp;o=1&amp;amp;a=0764567578" style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0px; padding-bottom: 0px !important; padding-left: 0px !important; padding-right: 0px !important; padding-top: 0px !important;" width="1" /&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.google.com/cse?cx=partner-pub-1602461054664536%3Aghaimtmraz9&amp;amp;ie=ISO-8859-1&amp;amp;q=1.%09MAINTAIN+SLOW+CHANGING+DIMENSION+TYPE+2+USING+MYSQL+STORED+PROCEDURE&amp;amp;sa=Search#gsc.tab=0&amp;amp;gsc.q=MAINTAIN%20SLOW%20CHANGING%20DIMENSION%20TYPE%202%20USING%20MYSQL%20STORED%20PROCEDURE"&gt;Other Reference on the Web&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;Related Note:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&amp;nbsp;&lt;a href="http://databobjr.blogspot.com/2011/03/sql-outer-join-query.html"&gt;&lt;span id="goog_1275856486"&gt;&lt;/span&gt;&lt;span id="goog_1275856487"&gt;&lt;/span&gt;&lt;span id="goog_1275856489"&gt;&lt;/span&gt;&lt;span id="goog_1275856490"&gt;&lt;/span&gt;&lt;span id="goog_1275856492"&gt;&lt;/span&gt;&lt;span id="goog_1275856493"&gt;&lt;/span&gt;&lt;span id="goog_1275856495"&gt;&lt;/span&gt;&lt;span id="goog_1275856496"&gt;&lt;/span&gt;&lt;span id="goog_1275856498"&gt;&lt;/span&gt;&lt;span id="goog_1275856499"&gt;&lt;/span&gt;&lt;span id="goog_1275856502"&gt;&lt;/span&gt;&lt;span id="goog_1275856503"&gt;&lt;/span&gt;&lt;span id="goog_1275856506"&gt;&lt;/span&gt;&lt;span id="goog_1275856507"&gt;&lt;/span&gt;SQL Outer Join&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://databobjr.blogspot.com/2011/04/load-slowly-changing-dimension-type-2.html"&gt;Load Slowly Changing Dimension Type 2 using Oracle Merge Statement&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;&lt;/div&gt;&lt;span style="font-family: Arial, Helvetica, sans-serif;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;div&gt;&lt;script type="text/javascript"&gt;&lt;!--google_ad_client = "ca-pub-1602461054664536";/* mysql-data-warehouse-fooder-banner-468x60-20100520 */google_ad_slot = "3636414118";google_ad_width = 468;google_ad_height = 60;//--&gt;&lt;/script&gt;&lt;script src="http://pagead2.googlesyndication.com/pagead/show_ads.js" type="text/javascript"&gt;&lt;/script&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/22611914-8119668858784211435?l=databobjr.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://databobjr.blogspot.com/feeds/8119668858784211435/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=22611914&amp;postID=8119668858784211435' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/22611914/posts/default/8119668858784211435'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/22611914/posts/default/8119668858784211435'/><link rel='alternate' type='text/html' href='http://databobjr.blogspot.com/2011/11/maintain-slow-changing-dimension-type-2.html' title='LOAD SLOWLY CHANGING DIMENSION TYPE 2 USING MYSQL STORED PROCEDURE'/><author><name>Data Bob Jr.</name><uri>http://www.blogger.com/profile/11965565939904347208</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-22611914.post-3731375673104770361</id><published>2011-11-16T06:18:00.001-08:00</published><updated>2011-11-16T07:10:29.832-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Data Funny'/><title type='text'>iPhone Emergency</title><content type='html'>&lt;br /&gt;&lt;strong&gt;Help! My iPhone dosen't work! &lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div id="Layer1" style="position:absolute; width:448px; height:269px; z-index:1"&gt;&lt;!-- copy video code here --&gt; &lt;div&gt;&lt;object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" height="374" id="ep" width="416"&gt;&lt;param name="allowfullscreen" value="true" /&gt;&lt;param name="allowscriptaccess" value="always" /&gt;&lt;param name="wmode" value="transparent" /&gt;&lt;param name="movie" value="http://i.cdn.turner.com/cnn/.element/apps/cvp/3.0/swf/cnn_416x234_embed.swf?context=embed&amp;videoId=bestoftv/2011/11/15/pkg-moos-iphone-911-call.cnn" /&gt;&lt;param name="bgcolor" value="#000000" /&gt;&lt;embed src="http://i.cdn.turner.com/cnn/.element/apps/cvp/3.0/swf/cnn_416x234_embed.swf?context=embed&amp;videoId=bestoftv/2011/11/15/pkg-moos-iphone-911-call.cnn" type="application/x-shockwave-flash" bgcolor="#000000" allowfullscreen="true" allowscriptaccess="always" width="416" wmode="transparent" height="374"&gt;&lt;/embed&gt;&lt;/object&gt; &lt;/div&gt;&lt;!-- end video code --&gt;&lt;/div&gt;&lt;div id="Layer2" style="position:relative; FLOAT:none;left:449px; width:250px; height:420px; Z-INDEX:1;"&gt;&lt;!-- copy MP3 widget code here --&gt;&lt;script type="text/javascript"&gt;&lt;!--google_ad_client = "pub-1602461054664536";/* datafuny-video-sidead-250x250-20111116 */google_ad_slot = "1542099453";google_ad_width = 250;google_ad_height = 250;//--&gt;&lt;/script&gt;&lt;script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"&gt;&lt;/script&gt;&lt;!-- end widget code here --&gt; &lt;/div&gt;&lt;br&gt;&lt;br&gt;&lt;div&gt;&lt;script type="text/javascript"&gt;&lt;!--google_ad_client = "pub-1602461054664536";/* datafunny-fodder-468x60-20100603 */google_ad_slot = "6949942203";google_ad_width = 468;google_ad_height = 60;//--&gt;&lt;/script&gt;&lt;script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"&gt;&lt;/script&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/22611914-3731375673104770361?l=databobjr.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://databobjr.blogspot.com/feeds/3731375673104770361/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=22611914&amp;postID=3731375673104770361' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/22611914/posts/default/3731375673104770361'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/22611914/posts/default/3731375673104770361'/><link rel='alternate' type='text/html' href='http://databobjr.blogspot.com/2011/11/iphone-emergency.html' title='iPhone Emergency'/><author><name>Data Bob Jr.</name><uri>http://www.blogger.com/profile/11965565939904347208</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-22611914.post-3952671530173432661</id><published>2011-10-04T05:48:00.000-07:00</published><updated>2011-11-05T18:06:13.716-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Ascential DataStage:Admin'/><title type='text'>Start WebSphere InfoSphere Server Using Administrator User in Window 2008 Server</title><content type='html'>&lt;b&gt;Start WebSphere InfoSphere Server Using Administrator User in Window 2008 Server&lt;br /&gt;&lt;/b&gt;&lt;br /&gt;To start the WebSphere InfoSphere server, you must start it with administrator privileges (as an administrator). Otherwise, the services will not start.&lt;br /&gt;To start the services using administrator, from the start menu, click on All Program and then click on IBM WebSphere -&amp;gt;Profile -&amp;gt;InfoSphere&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/-oXTq78k6ZMU/Tor94u8E_iI/AAAAAAAAAF8/mU2sEyCssBI/s1600/win2008_was_win2008s.jpg" imageanchor="1"&gt;&lt;img border="0" height="320px" src="http://3.bp.blogspot.com/-oXTq78k6ZMU/Tor94u8E_iI/AAAAAAAAAF8/mU2sEyCssBI/s320/win2008_was_win2008s.jpg" width="196px" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;Highlight Start the server and right mouse click. Select “Run as Administrator”. In Window server 2008, even though the user is belong to the local administrator group, if you do not select Run as Administrator, the services will not start.&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/-M3ftzvp1qBg/Tor9_72sW2I/AAAAAAAAAGE/LyiksVAhJqU/s1600/win2008_was_un_as_admin.jpg" imageanchor="1"&gt;&lt;img border="0" height="320px" src="http://4.bp.blogspot.com/-M3ftzvp1qBg/Tor9_72sW2I/AAAAAAAAAGE/LyiksVAhJqU/s320/win2008_was_un_as_admin.jpg" width="196px" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;From Control Panel, check the services to make sure they are started.&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;script type="text/javascript"&gt;&lt;!--google_ad_client = "ca-pub-1602461054664536";/* datastage-fooder-banner-468x60-20111004 */google_ad_slot = "2233647456";google_ad_width = 468;google_ad_height = 60;//--&gt;&lt;/script&gt;&lt;br /&gt;&lt;script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"&gt;&lt;/script&gt;&lt;br /&gt;&lt;/div&gt;&lt;div id="wrap" style="position:static;  width:938px; height:20px; left:26px; display:inline; word-wrap:break-word; overflow:hidden; margin:0px auto;"&gt;  &lt;div id="bannerright" style="position:relative; border-width:0px; border-style: solid; border-color:   green; border-right:0px;left:26px;width:728px;height:20px;float:left;vertical-align:middle; display:inline;  word-wrap:   break-word; overflow:hidden; margin-left:0;margin-right:0;margin-top:0;margin-bottom:5px; auto"&gt;&lt;script type="text/javascript"&gt;&lt;!--google_ad_client = "ca-pub-1602461054664536";google_ad_host = "pub-1556223355139109";/* Header_Links_ad_text_728_15 */google_ad_slot = "3453974813";google_ad_width = 728;google_ad_height = 15;//--&gt;&lt;/script&gt;&lt;script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"&gt;&lt;/script&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/22611914-3952671530173432661?l=databobjr.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://databobjr.blogspot.com/feeds/3952671530173432661/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=22611914&amp;postID=3952671530173432661' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/22611914/posts/default/3952671530173432661'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/22611914/posts/default/3952671530173432661'/><link rel='alternate' type='text/html' href='http://databobjr.blogspot.com/2011/10/start-websphere-infosphere-server-using.html' title='Start WebSphere InfoSphere Server Using Administrator User in Window 2008 Server'/><author><name>Data Bob Jr.</name><uri>http://www.blogger.com/profile/11965565939904347208</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/-oXTq78k6ZMU/Tor94u8E_iI/AAAAAAAAAF8/mU2sEyCssBI/s72-c/win2008_was_win2008s.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-22611914.post-4819639880172730539</id><published>2011-07-22T01:28:00.000-07:00</published><updated>2011-07-22T02:21:09.190-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='MySQL Data Warehouse'/><category scheme='http://www.blogger.com/atom/ns#' term='MySQL'/><category scheme='http://www.blogger.com/atom/ns#' term='MySQL DBA'/><title type='text'>Passing Parameters To A MYSQL Query Inside A Shell Script</title><content type='html'>Passing Parameter To A MySQL query Inside A Shell Script.&lt;br /&gt;&lt;br /&gt;From time to time, I found myself need to run some adhoc queries to pull data. I found that it was more convenience to create a shell script that could accept the query files as variable and can pass variables to the query.&lt;br /&gt;&lt;br /&gt;Here is an example. I have a query to pull customer data from a customer table. It looks like this:&lt;br /&gt;&lt;br /&gt;/* script:get_customer_record.sql */&lt;br /&gt;&lt;br /&gt;Select c_id, c_first_name,c_last_name, c_address,&lt;br /&gt;…… &lt;br /&gt;,last_modified_date&lt;br /&gt;from customer&lt;br /&gt;where last_modified_date &amp;gt;=@start_date and last_modified_date &amp;lt;= @end_date;&lt;br /&gt;&lt;br /&gt;@start_date and @end_date are variables to be passed at run time.&lt;br /&gt;&lt;br /&gt;Here is the wrapper shell script:&lt;br /&gt;&lt;br /&gt;&lt;pre pre="" style="background: rgb(240,240,240); border-bottom: rgb(204,204,204) 1px dashed; border-left: rgb(204,204,204) 1px dashed; border-right: rgb(204,204,204) 1px dashed; border-top: rgb(204,204,204) 1px dashed; color: black; overflow: auto; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; word-wrap: normal;"&gt;#!/bin/bash&lt;br /&gt;&lt;br /&gt;## script name; mysql_script_runner.sh&lt;br /&gt;## wrapper script to execute mysql script with variables&lt;br /&gt;&lt;br /&gt;ARGS=4&lt;br /&gt;&lt;br /&gt;if [ $# -ne "$ARGS" ]&lt;br /&gt;then &lt;br /&gt;&lt;br /&gt;&amp;nbsp;echo "you passed $# parameters"&lt;br /&gt;&amp;nbsp;echo "Usage: `basename $0` sql_script_file start_date end_date output_file"&lt;br /&gt;&lt;br /&gt;exit &lt;br /&gt;fi &lt;br /&gt;sql_script=$1 &lt;br /&gt;start_date=$2 &lt;br /&gt;end_date=$3 &lt;br /&gt;output_file=$4 &lt;br /&gt;&lt;br /&gt;#run mysql query with paramenters &lt;br /&gt;&lt;br /&gt;/usr/bin/mysql –uuser_id -ppassword –h mysql-host -A -e "set @start_date=${start_date}; set @end_date=${end_date}; source ${sql_script};" &amp;gt;${data_file};&lt;br /&gt;&lt;br /&gt;exit&lt;br /&gt;&lt;br /&gt;# end of script.&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;To execute the script from command line, I can do something like this:&lt;br /&gt;&lt;br /&gt;# mysql_script_runner.sh get_customer_record.sql ‘2011-06-01’ ‘2011-06-12 23:59:59’ cust_rec.dat&lt;br /&gt;&lt;br /&gt;I can also set it up to run as a cron job with some small changes.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Related Note:&lt;/strong&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://databobjr.blogspot.com/2011/06/get-first-and-last-day-of-month-in-bash.html"&gt;GET FIRST AND LAST DAY OF A MONTH IN BASH SHELL&lt;/a&gt; &lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;div&gt;&lt;script type="text/javascript"&gt;&lt;!--google_ad_client = "ca-pub-1602461054664536";/* mysqladmin-fooder-banner-468x60-20100503 */google_ad_slot = "9515648953";google_ad_width = 468;google_ad_height = 60;//--&gt;&lt;/script&gt;&lt;br /&gt;&lt;script src="http://pagead2.googlesyndication.com/pagead/show_ads.js" type="text/javascript"&gt;&lt;/script&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/22611914-4819639880172730539?l=databobjr.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://databobjr.blogspot.com/feeds/4819639880172730539/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=22611914&amp;postID=4819639880172730539' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/22611914/posts/default/4819639880172730539'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/22611914/posts/default/4819639880172730539'/><link rel='alternate' type='text/html' href='http://databobjr.blogspot.com/2011/07/passing-parameters-to-mysql-query.html' title='Passing Parameters To A MYSQL Query Inside A Shell Script'/><author><name>Data Bob Jr.</name><uri>http://www.blogger.com/profile/11965565939904347208</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-22611914.post-3581733308385327576</id><published>2011-07-05T23:59:00.000-07:00</published><updated>2011-07-06T00:38:37.371-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Video'/><category scheme='http://www.blogger.com/atom/ns#' term='Data Funny'/><title type='text'>Bad Data You'll Cry</title><content type='html'>A song about bad data, BI&amp;nbsp; or both?&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="background: #000000; height: 390px; width: 480px;"&gt;&lt;iframe width="480" height="390" src="http://www.youtube.com/embed/FOTo7eUaVmk?rel=0" frameborder="0" allowfullscreen&gt;&lt;/iframe&gt;&lt;/div&gt;&lt;br /&gt;&lt;div style="font-size: 12px;"&gt;&lt;script type="text/javascript"&gt;&lt;!--google_ad_client = "ca-pub-1602461054664536";/* data-funny-footer */google_ad_slot = "8780070572";google_ad_width = 468;google_ad_height = 60;//--&gt;&lt;/script&gt;&lt;br /&gt;&lt;script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"&gt;&lt;/script&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/22611914-3581733308385327576?l=databobjr.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://databobjr.blogspot.com/feeds/3581733308385327576/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=22611914&amp;postID=3581733308385327576' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/22611914/posts/default/3581733308385327576'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/22611914/posts/default/3581733308385327576'/><link rel='alternate' type='text/html' href='http://databobjr.blogspot.com/2011/07/bad-data-youll-cry.html' title='Bad Data You&apos;ll Cry'/><author><name>Data Bob Jr.</name><uri>http://www.blogger.com/profile/11965565939904347208</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://img.youtube.com/vi/FOTo7eUaVmk/default.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-22611914.post-2668881955238562628</id><published>2011-07-03T22:40:00.000-07:00</published><updated>2011-08-18T02:04:11.614-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Cognos Framework Manager'/><category scheme='http://www.blogger.com/atom/ns#' term='Cognos'/><title type='text'>Cognos Framework Manager</title><content type='html'>&lt;div&gt;&lt;strong&gt;Tutorial on Cognos Framework Manager &lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;I am new to Cognos 10.&amp;nbsp; The last time I used Cognos was more than 10 years ago.&amp;nbsp; I found the following videos tutorials on Cognos Framework Manager and they&amp;nbsp;were very helpfull.&amp;nbsp;Many thanks to the video owners for sharing.&lt;/div&gt;&lt;div&gt;&lt;strong&gt;This video tutorial convers the following topics:&lt;/strong&gt;&lt;br /&gt;&lt;ol&gt;&lt;li&gt;Create data sources&lt;/li&gt;&lt;li&gt;Create project in Framword Manager&lt;/li&gt;&lt;li&gt;Create data modle - DMR&lt;/li&gt;&lt;li&gt;Create Calculaticve fields&lt;/li&gt;&lt;li&gt;Create packages &lt;/li&gt;&lt;/ol&gt;&lt;/div&gt;&lt;div&gt;&lt;iframe allowfullscreen="" frameborder="0" height="349" src="http://www.youtube.com/embed/Pk1nS-HE-xk?rel=0" width="560"&gt;&lt;/iframe&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;strong&gt;The following 5 videoes are tutorials on Cognos Frameword Manager.&lt;/strong&gt;&lt;/div&gt;&lt;div&gt;&lt;strong&gt;1. This video tutorial covers the following topics:&lt;/strong&gt;&lt;br /&gt;&lt;ol&gt;&lt;li&gt;Creat data sources&lt;/li&gt;&lt;li&gt;Creat data models&lt;/li&gt;&lt;/ol&gt;&lt;/div&gt;&lt;div&gt;&lt;iframe width="560" height="345" src="http://www.youtube.com/embed/SLRbT1ZP9Vo" frameborder="0" allowfullscreen&gt;&lt;/iframe&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;strong&gt;2. This video tutorial covers the following topics:&lt;/strong&gt;&lt;br /&gt;&lt;ol&gt;&lt;li&gt;Creat Projects&lt;/li&gt;&lt;li&gt;Creat data sources&lt;/li&gt;&lt;li&gt;Import data structure (meta data)&lt;/li&gt;&lt;li&gt;Creat Cognos objects&lt;/li&gt;&lt;li&gt;Also covers base concepts of dimension and facts&lt;/li&gt;&lt;/ol&gt;&lt;/div&gt;&lt;div&gt;&lt;iframe allowfullscreen="" frameborder="0" height="349" src="http://www.youtube.com/embed/ZqjjAoEz77Q?rel=0" width="560"&gt;&lt;/iframe&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;strong&gt;3.This video tutorial covers the following topics.&lt;/strong&gt;&lt;br /&gt;&lt;ol&gt;&lt;li&gt;Object Type&lt;/li&gt;&lt;li&gt; - Namespace&lt;/li&gt;&lt;li&gt; - Query Object&lt;/li&gt;&lt;li&gt;Also covers base concepts of dimension and facts&lt;/li&gt;&lt;/ol&gt;&lt;/div&gt;&lt;div&gt;&lt;iframe width="560" height="345" src="http://www.youtube.com/embed/FSfh0nNdRtk" frameborder="0" allowfullscreen&gt;&lt;/iframe&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;strong&gt;4.This video tutorial covers the following topics.&lt;/strong&gt;&lt;br /&gt;&lt;ol&gt;&lt;li&gt;Relational data model (DMR)&lt;/li&gt;&lt;li&gt;Measures&lt;/li&gt;&lt;li&gt;Also covers base concepts of dimension and facts&lt;/li&gt;&lt;/ol&gt;&lt;/div&gt;&lt;div&gt;&lt;iframe allowfullscreen="" frameborder="0" height="349" src="http://www.youtube.com/embed/EBTjK0eN0zs?rel=0" width="560"&gt;&lt;/iframe&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;strong&gt;5.This video tutorial covers the following topics.&lt;/strong&gt;&lt;br /&gt;&lt;ol&gt;&lt;li&gt;Drill down&lt;/li&gt;&lt;li&gt;Define hierarchivies&lt;/li&gt;&lt;/ol&gt;&lt;/div&gt;&lt;div&gt;&lt;iframe allowfullscreen="" frameborder="0" height="349" src="http://www.youtube.com/embed/uCfgEJ5LW5Y?rel=0" width="560"&gt;&lt;/iframe&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;strong&gt;6.This video tutorial covers the following topics.&lt;/strong&gt;&lt;br /&gt;&lt;ol&gt;&lt;li&gt;How Cognos stores data&lt;/li&gt;&lt;li&gt;Cognos object type&lt;/li&gt;&lt;li&gt;Create namespace&lt;/li&gt;&lt;li&gt;XML for Cognos model&lt;/li&gt;&lt;li&gt;.cpf file&lt;/li&gt;&lt;/ol&gt;&lt;/div&gt;&lt;div&gt;&lt;iframe allowfullscreen="" frameborder="0" height="349" src="http://www.youtube.com/embed/BM1CiG8lUyk?rel=0" width="560"&gt;&lt;/iframe&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/22611914-2668881955238562628?l=databobjr.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://databobjr.blogspot.com/feeds/2668881955238562628/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=22611914&amp;postID=2668881955238562628' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/22611914/posts/default/2668881955238562628'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/22611914/posts/default/2668881955238562628'/><link rel='alternate' type='text/html' href='http://databobjr.blogspot.com/2011/07/cognos-framework-manager.html' title='Cognos Framework Manager'/><author><name>Data Bob Jr.</name><uri>http://www.blogger.com/profile/11965565939904347208</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://img.youtube.com/vi/Pk1nS-HE-xk/default.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-22611914.post-7256921710194330121</id><published>2011-06-29T22:59:00.000-07:00</published><updated>2011-07-01T07:31:38.203-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Linux For DBA'/><title type='text'>GET FIRST AND LAST DAY OF A MONTH IN BASH SHELL</title><content type='html'>&lt;strong&gt;GET FIRST AND LAST DAY OF A MONTH IN BASH SHELL &lt;/strong&gt;&lt;br /&gt;&lt;br /&gt; &lt;!-- Boby, 300x250 text and image --&gt;&lt;br /&gt;&lt;div style="dir: ltr align:left; display: block; float:right; height: 260px; margin: 3px; width: 310px;"&gt;&lt;script type="text/javascript"&gt;&lt;!--google_ad_client = "ca-pub-1602461054664536";/* dw-bobyad-300x250x20110421 */google_ad_slot = "9084221691";google_ad_width = 300;google_ad_height = 250;//--&gt;&lt;/script&gt;&lt;br /&gt;&lt;script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"&gt;&lt;/script&gt;&lt;br /&gt;&lt;/div&gt;Linux system comes with a date commend. The man page has all the details. The following shows how to get the first date and last day of a month using the date commends in bash shell. &lt;br /&gt;&lt;br /&gt;&lt;strong&gt;First Day, current month&lt;/strong&gt;:&lt;br /&gt;# date -d "-0 month -$(($(date +%d)-1)) days"&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;First Day,&amp;nbsp;last month:&lt;/strong&gt;&lt;br /&gt;# date -d "-1 month -$(($(date +%d)-1)) days"&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Last Day, current month:&lt;/strong&gt;&lt;br /&gt;# date -d "-$(date +%d) days&amp;nbsp;+1 month"&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Last Day, last month:&lt;/strong&gt;&lt;br /&gt;# date -d "-$(date +%d) days&amp;nbsp;-0 month"&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Last Day, month before last month:&lt;/strong&gt;&lt;br /&gt;# date -d "-$(date +%d) days&amp;nbsp;-1 month"&lt;br /&gt;&lt;br /&gt;%d = day of month. &lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;script type="text/javascript"&gt;&lt;!--google_ad_client = "ca-pub-1602461054664536";/* linuxfordba-fooder-banner-468x60-20100504, created 5/4/10 */google_ad_slot = "7828580750";google_ad_width = 468;google_ad_height = 60;//--&gt;&lt;/script&gt;&lt;br /&gt;&lt;script src="http://pagead2.googlesyndication.com/pagead/show_ads.js" type="text/javascript"&gt;&lt;/script&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/22611914-7256921710194330121?l=databobjr.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://databobjr.blogspot.com/feeds/7256921710194330121/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=22611914&amp;postID=7256921710194330121' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/22611914/posts/default/7256921710194330121'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/22611914/posts/default/7256921710194330121'/><link rel='alternate' type='text/html' href='http://databobjr.blogspot.com/2011/06/get-first-and-last-day-of-month-in-bash.html' title='GET FIRST AND LAST DAY OF A MONTH IN BASH SHELL'/><author><name>Data Bob Jr.</name><uri>http://www.blogger.com/profile/11965565939904347208</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-22611914.post-3316001032433238778</id><published>2011-06-28T23:13:00.000-07:00</published><updated>2011-07-01T06:57:02.978-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Recipes'/><category scheme='http://www.blogger.com/atom/ns#' term='Kid Recipes'/><title type='text'>Spinach Eggs Recipe</title><content type='html'>&lt;strong&gt;&lt;span style="font-size: large;"&gt;Spinach Egg&amp;nbsp; Recipe (for kids)&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Ingredients&lt;/strong&gt;&lt;br /&gt;&lt;div style="height: 155px; margin: 3px; width: 600px;"&gt;&lt;div class="separator" style="align: left; display: block; float: right;"&gt;&lt;a href="http://1.bp.blogspot.com/-hbcOgOdn_os/Tgq1IEGUtWI/AAAAAAAAAEo/3MbYSc-NNjU/s1600/spinacheggs.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" i$="true" src="http://1.bp.blogspot.com/-hbcOgOdn_os/Tgq1IEGUtWI/AAAAAAAAAEo/3MbYSc-NNjU/s1600/spinacheggs.jpg" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;ul&gt;&lt;li&gt;3 bunches of &lt;a href="http://www.google.com/cse?cx=partner-pub-1602461054664536%3Aghaimtmraz9&amp;amp;ie=ISO-8859-1&amp;amp;q=buy+spinach+from+local+supermarket&amp;amp;sa=Search"&gt;Spinaches&lt;/a&gt; (about 2 lb)&lt;/li&gt;&lt;li&gt;3 &lt;a href="http://www.google.com/cse?cx=partner-pub-1602461054664536%3Aghaimtmraz9&amp;amp;ie=ISO-8859-1&amp;amp;q=buy+eggs+from+local+supermarket&amp;amp;sa=Search"&gt;eggs&lt;/a&gt;&lt;/li&gt;&lt;li&gt;Salt&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.amazon.com/Bertolli-Lucca-Extra-Virgin-Olive/dp/B001DQQV30?ie=UTF8&amp;amp;tag=dat03-20&amp;amp;link_code=btl&amp;amp;camp=213689&amp;amp;creative=392969" target="_blank"&gt;Oliver Oil&lt;/a&gt;&lt;img alt="" border="0" height="1px" src="http://www.assoc-amazon.com/e/ir?t=dat03-20&amp;amp;l=btl&amp;amp;camp=213689&amp;amp;creative=392969&amp;amp;o=1&amp;amp;a=B001DQQV30" style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0px; padding-bottom: 0px !important; padding-left: 0px !important; padding-right: 0px !important; padding-top: 0px !important;" width="1px" /&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.google.com/cse?cx=partner-pub-1602461054664536%3Aghaimtmraz9&amp;amp;ie=ISO-8859-1&amp;amp;q=buy+sugar+from+local+supermarket&amp;amp;sa=Search"&gt;Sugar&lt;/a&gt;&lt;/li&gt;&lt;li&gt;A small slice of butter.&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.amazon.com/Roland-Oyster-Sauce-64-Ounce-Pack/dp/B001EQ5LA8?ie=UTF8&amp;amp;tag=dat03-20&amp;amp;link_code=btl&amp;amp;camp=213689&amp;amp;creative=392969" target="_blank"&gt;Oyster Sauce &lt;/a&gt;&lt;img alt="" border="0" height="1px" src="http://www.assoc-amazon.com/e/ir?t=dat03-20&amp;amp;l=btl&amp;amp;camp=213689&amp;amp;creative=392969&amp;amp;o=1&amp;amp;a=B001EQ5LA8" style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0px; padding-bottom: 0px !important; padding-left: 0px !important; padding-right: 0px !important; padding-top: 0px !important;" width="1px" /&gt;(optional)&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.google.com/cse?cx=partner-pub-1602461054664536%3Aghaimtmraz9&amp;ie=ISO-8859-1&amp;q=buy+Mrs.+Dash+Seasoning+Blend+from+local+supermarket&amp;sa=Search"&gt;Mrs. Dash Seasoning Blend&lt;/a&gt;(optional)&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;br /&gt;&lt;strong&gt;Instructions&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;1. Clean the Spinaches.&lt;br /&gt;&lt;br /&gt;&lt;div style="height: 200px; margin: 3px; width: 600px;"&gt;&lt;div class="separator" style="align: left; display: block; float: right;"&gt;&lt;a href="http://2.bp.blogspot.com/-ZX7u7XY2DbQ/Tgnq3DAqh5I/AAAAAAAAAEk/QY3r88ErwT0/s1600/mixeggs.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" i$="true" src="http://2.bp.blogspot.com/-ZX7u7XY2DbQ/Tgnq3DAqh5I/AAAAAAAAAEk/QY3r88ErwT0/s1600/mixeggs.jpg" /&gt;&lt;/a&gt;&lt;/div&gt;2. Prepare the eggs. In a small bowl, Put a bit of salt and a 1/3 of coffee spoon of Oliver oil. Beat eggs and mix well until color and texture are uniform throughout. &lt;/div&gt;&lt;br /&gt;&lt;div style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; height: 200px; margin: 3px; width: 600px;"&gt;&lt;div class="separator" style="align: left; display: block; float: right;"&gt;&lt;a href="http://3.bp.blogspot.com/-v1QaKXPQ3z8/Tgq39MVEeAI/AAAAAAAAAEw/kQinI3Ko1d0/s1600/eggskin.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" i$="true" src="http://3.bp.blogspot.com/-v1QaKXPQ3z8/Tgq39MVEeAI/AAAAAAAAAEw/kQinI3Ko1d0/s1600/eggskin.jpg" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;"&gt;3. Heat the pan, add one tea spoon of Oliver Oil in to the pan and let it heat up. Pour the egg mixture into the pan. Set the burner on low. Flip the egg to let both sides of the eggs to developing a leathery brown skin. Make sure not to over cook.&lt;/div&gt;&lt;/div&gt;&lt;div style="height: 200px; margin: 3px; width: 600px;"&gt;&lt;div class="separator" style="align: left; display: block; float: right;"&gt;&lt;a href="http://3.bp.blogspot.com/-RVKos597glI/Tgq5C4GMbpI/AAAAAAAAAE0/s79I9CPo8Fc/s1600/chapeggs.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" i$="true" src="http://3.bp.blogspot.com/-RVKos597glI/Tgq5C4GMbpI/AAAAAAAAAE0/s79I9CPo8Fc/s1600/chapeggs.jpg" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;"&gt;&lt;/div&gt;4. Chap eggs into small pieces and set aside.&lt;/div&gt;&lt;div style="height: 200px; margin: 3px; width: 600px;"&gt;&lt;div class="separator" style="align: left; display: block; float: right;"&gt;&lt;a href="http://1.bp.blogspot.com/-oGyBE28nwIY/Tgq5_dvZI4I/AAAAAAAAAE4/X9_Kof9tSb4/s1600/boilspinaach.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" i$="true" src="http://1.bp.blogspot.com/-oGyBE28nwIY/Tgq5_dvZI4I/AAAAAAAAAE4/X9_Kof9tSb4/s1600/boilspinaach.jpg" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;5. Boil hot water in a pot. When the water is boil, put Spinaches into the hot water for 30 seconds. &lt;/div&gt;&lt;div style="height: 200px; margin: 3px; width: 600px;"&gt;&lt;div class="separator" style="align: left; display: block; float: right;"&gt;&lt;a href="http://4.bp.blogspot.com/-wHALp5WrEdE/Tgq6wgLhQBI/AAAAAAAAAE8/qcUS0pNTHlY/s1600/cookedspinach.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" i$="true" src="http://4.bp.blogspot.com/-wHALp5WrEdE/Tgq6wgLhQBI/AAAAAAAAAE8/qcUS0pNTHlY/s1600/cookedspinach.jpg" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;6. Put Spinaches into a basket and wait for the water to drain out.&lt;/div&gt;&lt;br /&gt;&lt;div style="height: 200px; margin: 3px; width: 600px;"&gt;&lt;div class="separator" style="align: left; display: block; float: right;"&gt;&lt;a href="http://2.bp.blogspot.com/-1JBVf6rVWKw/Tgq7fZ1XkJI/AAAAAAAAAFA/N4ZgS2ZJx04/s1600/spinacheggmix.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" i$="true" src="http://2.bp.blogspot.com/-1JBVf6rVWKw/Tgq7fZ1XkJI/AAAAAAAAAFA/N4ZgS2ZJx04/s1600/spinacheggmix.jpg" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;7. Chap the Spinaches into small pieces and mix them with the eggs in saucepan. Add one coffer spoon of sugar and a slice of butter. Optionally, add one spoon of Oyster Source (optional) and a coffee spoon of Mrs. &lt;a href="http://www.amazon.com/Mrs-Dash-Original-Seasoning-Blend-6-75/dp/B000QV5198?ie=UTF8&amp;amp;tag=dat03-20&amp;amp;link_code=btl&amp;amp;camp=213689&amp;amp;creative=392969" target="_blank"&gt;Mrs. Dash Seasoning Blend&lt;/a&gt;&lt;img alt="" border="0" height="1px" src="http://www.assoc-amazon.com/e/ir?t=dat03-20&amp;amp;l=btl&amp;amp;camp=213689&amp;amp;creative=392969&amp;amp;o=1&amp;amp;a=B000QV5198" style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0px; padding-bottom: 0px !important; padding-left: 0px !important; padding-right: 0px !important; padding-top: 0px !important;" width="1px" /&gt;. Please make sure that &lt;a href="http://www.google.com/cse?cx=partner-pub-1602461054664536%3Aghaimtmraz9&amp;amp;ie=ISO-8859-1&amp;amp;q=buy+oyster+sauce+from+local+supermarket&amp;amp;sa=Search"&gt;Oyster Sauce&lt;/a&gt; will be fine with the people who you want to serve. Some kids, may not like &lt;a href="http://www.google.com/cse?cx=partner-pub-1602461054664536%3Aghaimtmraz9&amp;amp;ie=ISO-8859-1&amp;amp;q=buy+oyster+sauce+from+local+supermarket&amp;amp;sa=Search"&gt;Oyster Sauce&lt;/a&gt;. Heat and stir the mix for about 30 seconds.&lt;/div&gt;&lt;br /&gt;&lt;div style="height: 200px; margin: 3px; width: 600px;"&gt;&lt;div class="separator" style="align: left; display: block; float: right;"&gt;&lt;a href="http://2.bp.blogspot.com/-uMHaSU3Z7qU/Tgq8zTTmIXI/AAAAAAAAAFE/NyzBp_ILHiM/s1600/eggmold.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" i$="true" src="http://2.bp.blogspot.com/-uMHaSU3Z7qU/Tgq8zTTmIXI/AAAAAAAAAFE/NyzBp_ILHiM/s1600/eggmold.jpg" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;8. Put the eggs and spinaches mix into an egg molds. And it ready to server&lt;/div&gt;&lt;br /&gt;&lt;div style="height: 134px; margin: 3px; width: 600px;"&gt;&lt;div class="separator" style="align: left; display: block;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;After Dinner Books:&lt;/b&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://www.amazon.com/Scrambled-Eggs-Super-Dr-Seuss/dp/0394800850?ie=UTF8&amp;amp;tag=dat03-20&amp;amp;link_code=btl&amp;amp;camp=213689&amp;amp;creative=392969" target="_blank"&gt;Scrambeled Eggs Supper! By Dr. Seuss&lt;/a&gt; &lt;div&gt;&lt;img alt="" border="0" height="1px" src="http://www.assoc-amazon.com/e/ir?t=dat03-20&amp;amp;l=btl&amp;amp;camp=213689&amp;amp;creative=392969&amp;amp;o=1&amp;amp;a=0394800850" style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0px; padding-bottom: 0px !important; padding-left: 0px !important; padding-right: 0px !important; padding-top: 0px !important;" width="1px" /&gt;&lt;/div&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;script type="text/javascript"&gt;&lt;!--google_ad_client = "ca-pub-1602461054664536";/* footer-recipe-468x60-20110628 */google_ad_slot = "8430835904";google_ad_width = 468;google_ad_height = 60;//--&gt;&lt;/script&gt;&lt;br /&gt;&lt;script src="http://pagead2.googlesyndication.com/pagead/show_ads.js" type="text/javascript"&gt;&lt;/script&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/22611914-3316001032433238778?l=databobjr.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://databobjr.blogspot.com/feeds/3316001032433238778/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=22611914&amp;postID=3316001032433238778' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/22611914/posts/default/3316001032433238778'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/22611914/posts/default/3316001032433238778'/><link rel='alternate' type='text/html' href='http://databobjr.blogspot.com/2011/06/spinach-eggs-recipe.html' title='Spinach Eggs Recipe'/><author><name>Data Bob Jr.</name><uri>http://www.blogger.com/profile/11965565939904347208</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/-hbcOgOdn_os/Tgq1IEGUtWI/AAAAAAAAAEo/3MbYSc-NNjU/s72-c/spinacheggs.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-22611914.post-5536795091017756454</id><published>2011-06-21T21:48:00.000-07:00</published><updated>2011-06-21T22:18:58.975-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Video'/><category scheme='http://www.blogger.com/atom/ns#' term='Data Funny'/><title type='text'>SQL Jam</title><content type='html'>&lt;div style="dir: ltr align:left; display: block; float: right; height: 600px; margin: 3px; width: 180px;"&gt;&lt;script type="text/javascript"&gt;&lt;!--google_ad_client = "ca-pub-1602461054664536";/* video-side-ad-160x600-20110311 */google_ad_slot = "0317990982";google_ad_width = 160;google_ad_height = 600;//--&gt;&lt;/script&gt;&lt;br /&gt;&lt;script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"&gt;&lt;/script&gt;&lt;/div&gt;&lt;div&gt;A funny SQL song ...&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;iframe width="480" height="390" src="http://www.youtube.com/embed/X7EyRNjITXU?rel=0" frameborder="0" allowfullscreen&gt;&lt;/iframe&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;script type="text/javascript"&gt;&lt;!--google_ad_client = "ca-pub-1602461054664536";/* datafunny-fodder-468x60-20100603 */google_ad_slot = "6949942203";google_ad_width = 468;google_ad_height = 60;//--&gt;&lt;/script&gt;&lt;br /&gt;&lt;script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"&gt;&lt;/script&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/22611914-5536795091017756454?l=databobjr.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://databobjr.blogspot.com/feeds/5536795091017756454/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=22611914&amp;postID=5536795091017756454' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/22611914/posts/default/5536795091017756454'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/22611914/posts/default/5536795091017756454'/><link rel='alternate' type='text/html' href='http://databobjr.blogspot.com/2011/06/sql-jam.html' title='SQL Jam'/><author><name>Data Bob Jr.</name><uri>http://www.blogger.com/profile/11965565939904347208</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://img.youtube.com/vi/X7EyRNjITXU/default.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-22611914.post-7877991418800679991</id><published>2011-04-20T23:07:00.000-07:00</published><updated>2011-11-05T18:08:17.793-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Oracle Data Warehouse'/><category scheme='http://www.blogger.com/atom/ns#' term='Oracle'/><category scheme='http://www.blogger.com/atom/ns#' term='SQL'/><title type='text'>Load Slowly Changing Dimension Type 2 using Oracle Merge Statement</title><content type='html'>&lt;strong&gt;&lt;span style="font-family: Arial, Helvetica, sans-serif; font-size: large;"&gt;&amp;nbsp;Load Slowly Changing Dimension Type 2 using Oracle Merge Statement&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;By using Oracle Merge statement, we are able to perform an insert and update statements (sometime referred to as “upsert”) in one query. The merge statement primarily useful in data warehousing situations, especially when maintaining Type 2 Slowly changing dimension (SCD2), where large amounts of data are commonly inserted and updated &lt;br /&gt;&lt;div style="dir: ltr align:left; display: block; float: right; height: 260px; margin: 3px; width: 310px;"&gt;&lt;script type="text/javascript"&gt;&lt;!--google_ad_client = "ca-pub-1602461054664536";/* dw-bobyad-300x250x20110421 */google_ad_slot = "9084221691";google_ad_width = 300;google_ad_height = 250;//--&gt;&lt;/script&gt;&lt;br /&gt;&lt;script src="http://pagead2.googlesyndication.com/pagead/show_ads.js" type="text/javascript"&gt;&lt;/script&gt;&lt;/div&gt;&lt;br /&gt;&lt;b&gt;1. Tables&lt;/b&gt;&lt;br /&gt;&lt;strong&gt;&lt;/strong&gt;&lt;br /&gt;To explore how the merge statement works, let’s use the following set of tables &lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Product dimension table: dim_product. &lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;/strong&gt;&lt;br /&gt;CREATE TABLE DIM_PRODUCT&lt;br /&gt;(&lt;br /&gt;PRODUCT_SID NUMBER NOT NULL,&lt;br /&gt;PRODUCT_ID NUMBER NOT NULL,&lt;br /&gt;PRODUCT_CATEGORY_ID NUMBER,&lt;br /&gt;PRODUCT_NAME VARCHAR2(50 CHAR),&lt;br /&gt;PRODUCT_DESCRIPTION VARCHAR2(200 CHAR),&lt;br /&gt;PRICE NUMBER(8,2),&lt;br /&gt;PRICE_EFFECTIVE_DATE DATE,&lt;br /&gt;LAST_MODIFIED_DATE DATE,&lt;br /&gt;EFFECTIVE_START_DATE DATE,&lt;br /&gt;EFFECTIVE_END_DATE DATE,&lt;br /&gt;IS_CURRENT_ROW VARCHAR2(1 CHAR)&lt;br /&gt;CREATED_DATE DATE,&lt;br /&gt;UPDATED_DATE DATE&lt;br /&gt;);&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Source stage table: stg_product. &lt;/strong&gt;&lt;br /&gt;This is a stage table use to store the newly modified product records from the product table.&lt;br /&gt;&lt;br /&gt;CREATE TABLE STG_PRODUCT&lt;br /&gt;(&lt;br /&gt;PRODUCT_ID NUMBER NOT NULL,&lt;br /&gt;PRODUCT_CATEGORY_ID NUMBER,&lt;br /&gt;PRODUCT_NAME VARCHAR2(50 CHAR),&lt;br /&gt;PRODUCT_DESCRIPTION VARCHAR2(200 CHAR),&lt;br /&gt;PRICE NUMBER(8,2),&lt;br /&gt;PRICE_EFFECTIVE_DATE DATE,&lt;br /&gt;LAST_MODIFIED_DATE DATE,&lt;br /&gt;CREATED_DATE DATE&lt;br /&gt;); &lt;br /&gt;&lt;br /&gt;Let’s also created a sequence to use for the dim_product dimension table ‘s surrogate keys.&lt;br /&gt;&lt;br /&gt;CREATE SEQUENCE s_dim_product&lt;br /&gt;START WITH 1&lt;br /&gt;MAXVALUE 9999999999999999999999999999&lt;br /&gt;MINVALUE 1&lt;br /&gt;NOCYCLE&lt;br /&gt;CACHE 20&lt;br /&gt;NOORDER;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;2. SCD Logics and the Merge Query&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;A slowly changing dimension type 2 (SCD2) is defined to keep track changes of attributes in the underlying source table. While there are many attributes in a table, the business rules decide what changes to track. Here, for demonstration purpose, let’s choose to keep track of changes of each attribute in the underlying product source table, which is to keep history of production name, product description, and product category and price changes. &lt;br /&gt;&lt;br /&gt;The merger statement provides the abilities to perform insert and update with only one select statement based upon a join condition. Rows already in the target table that match the join condition are updated; otherwise, a row is inserted using values from a separate subquery. The details of the merge statement can be found from the &lt;a href="http://download.oracle.com/docs/cd/B28359_01/server.111/b28286/statements_9016.htm"&gt;oracle documentation online.&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://download.oracle.com/docs/cd/B28359_01/server.111/b28286/statements_9016.htm"&gt;http://download.oracle.com/docs/cd/B28359_01/server.111/b28286/statements_9016.htm&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;An SCD2 normally has three additional columns. The data effective start and end date of the record, and a flag to indicate the current record. To maintain histories, a new record is created to store the changing attributes while we keep the exiting records as histories. To help achieve that, a small utility table with only tow records in it is created. In this utility table, one record indicates the insert flag and the other indicates the update flag. Here the table structure:&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Utility table: scd_row_type.&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;CREATE TABLE SCD_ROW_TYPE&lt;br /&gt;(&lt;br /&gt;SCD_ROW_TYPE_ID NUMBER NOT NULL,&lt;br /&gt;SCD_ROW_TYPE_DESCRIPTION VARCHAR2(20 CHAR)&lt;br /&gt;);&lt;br /&gt;&lt;br /&gt;After creating the table, insert the following records into the table:&lt;br /&gt;&lt;br /&gt;Insert into scd_row_type(scd_row_type_id,scd_row_description) values(1,’For Insert’);&lt;br /&gt;Insert into scd_row_type(scd_row_type_id,scd_row_description) values(2,’For Update’);&lt;br /&gt;&lt;br /&gt;Now we are ready to construct the merge query&lt;br /&gt;&lt;div&gt;&lt;pre style="background: rgb(240,240,240); border-bottom: rgb(204,204,204) 1px dashed; border-left: rgb(204,204,204) 1px dashed; border-right: rgb(204,204,204) 1px dashed; border-top: rgb(204,204,204) 1px dashed; color: black; overflow: auto; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; word-wrap: normal;"&gt;MERGE INTO dim_product p&lt;br /&gt;USING ( SELECT DECODE(s.scd_row_type_id,1,-6789,m.product_sid) as product_sid,&lt;br /&gt;                   PRODUCT_ID,&lt;br /&gt;                   PRODUCT_CATEGORY_ID,&lt;br /&gt;                   PRODUCT_NAME,&lt;br /&gt;                   PRODUCT_DESCRIPTION,&lt;br /&gt;                   PRICE,&lt;br /&gt;                   PRICE_EFFECTIVE_DATE,&lt;br /&gt;                   LAST_MODIFIED_DATE,&lt;br /&gt;                   CREATED_DATE,&lt;br /&gt;                   m.scd_row_type_id&lt;br /&gt;              FROM    (SELECT dp.product_sid,&lt;br /&gt;                              sp.PRODUCT_ID,&lt;br /&gt;                              sp.PRODUCT_CATEGORY_ID,&lt;br /&gt;                              sp.PRODUCT_NAME,&lt;br /&gt;                              sp.PRODUCT_DESCRIPTION,&lt;br /&gt;                              sp.PRICE,&lt;br /&gt;                              sp.PRICE_EFFECTIVE_DATE,&lt;br /&gt;                              sp.LAST_MODIFIED_DATE,&lt;br /&gt;                              sp.CREATED_DATE,&lt;br /&gt;                              CASE&lt;br /&gt;                                 WHEN dp.product_id IS NULL&lt;br /&gt;                                 THEN&lt;br /&gt;                                    1&lt;br /&gt;                                 WHEN (dp.product_category_id !=&lt;br /&gt;                                          sp.product_category_id&lt;br /&gt;                                       OR dp.product_name != sp.product_name&lt;br /&gt;                                       OR DP.PRODUCT_DESCRIPTION !=&lt;br /&gt;                                             sp.product_description&lt;br /&gt;                                       OR dp.price != sp.price&lt;br /&gt;                                       OR dp.price_effective_date !=&lt;br /&gt;                                             sp.price_effective_date)&lt;br /&gt;                                 THEN&lt;br /&gt;                                    2&lt;br /&gt;                                 ELSE&lt;br /&gt;                                    0&lt;br /&gt;                              END&lt;br /&gt;                                 AS scd_row_type_id&lt;br /&gt;                         FROM    stg_product sp&lt;br /&gt;                              LEFT JOIN&lt;br /&gt;                                 Dim_product dp&lt;br /&gt;                              ON (sp.product_id = dp.product_id and  dp.is_current_row = 'Y')&lt;br /&gt;                     ) m&lt;br /&gt;                   JOIN  scd_row_type s&lt;br /&gt;                   ON (s.scd_row_type_id &amp;lt;= m.scd_row_type_id)&lt;br /&gt;                   ) mp&lt;br /&gt;        ON  (p.product_sid = mp.product_sid)&lt;br /&gt;when matched then&lt;br /&gt;   update set P.EFFECTIVE_END_DATE = mp.LAST_MODIFIED_DATE, is_current_row = 'N', updated_date = sysdate&lt;br /&gt;when NOT matched then&lt;br /&gt;insert (P.PRODUCT_SID,P.PRODUCT_ID,P.PRODUCT_CATEGORY_ID, P.PRODUCT_NAME, P.PRODUCT_DESCRIPTION, P.PRICE, p.PRICE_EFFECTIVE_DATE,P.LAST_MODIFIED_DATE,&lt;br /&gt; p.effective_start_date,P.EFFECTIVE_END_DATE,is_current_row, created_date,&lt;br /&gt; updated_date )&lt;br /&gt; values (s_dim_product.nextval,mp.PRODUCT_ID,mp.PRODUCT_CATEGORY_ID,mp.PRODUCT_NAME,&lt;br /&gt; mp.PRODUCT_DESCRIPTION, mp.PRICE,mp.price_effective_date,&lt;br /&gt;mp.LAST_MODIFIED_DATE,mp.last_modified_date,&lt;br /&gt; to_date('2099-12-31 00:00:00','YYYY-MM-DD HH24:MI:SS'),’Y', sysdate,sysdate);&lt;br /&gt;  commit;&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;&lt;b&gt;3. How it works &lt;/b&gt;&lt;br /&gt;&lt;br /&gt;To make it easier to understand how the merge statement work when we actually perform some tests with data. First, let’s issue the following insert statements to create two records in the stage table. &lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;pre style="background: rgb(240,240,240); border-bottom: rgb(204,204,204) 1px dashed; border-left: rgb(204,204,204) 1px dashed; border-right: rgb(204,204,204) 1px dashed; border-top: rgb(204,204,204) 1px dashed; color: black; overflow: auto; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; word-wrap: normal;"&gt;truncate table stg_product;&lt;br /&gt;&lt;br /&gt;insert into stg_product ( PRODUCT_ID, PRODUCT_CATEGORY_ID,  PRODUCT_NAME,PRODUCT_DESCRIPTION,PRICE,PRICE_EFFECTIVE_DATE,  LAST_MODIFIED_DATE,  CREATED_DATE)&lt;br /&gt;        values (1,8,'Apple iPad 36 GB','Apple iPad 36 GB with case', 800,sysdate,sysdate,sysdate);&lt;br /&gt;&lt;br /&gt;insert into stg_product ( PRODUCT_ID, PRODUCT_CATEGORY_ID,  PRODUCT_NAME,PRODUCT_DESCRIPTION,PRICE,PRICE_EFFECTIVE_DATE,  LAST_MODIFIED_DATE,CREATED_DATE)&lt;br /&gt;         values (2,7,'Canon 12 MPIX Digital Camera','Canon 12 MPIX Digital Camera, Zoon Len, Case', 150,sysdate,sysdate,sysdate);&lt;br /&gt;&lt;br /&gt;commit;&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;Check the stage table to make sure the records are there. &lt;br /&gt;&lt;br /&gt;Sqlplus&amp;gt;select * from stg_product; &lt;br /&gt;&lt;br /&gt;Now run the merge statement which was created in section 2. Once the merge query statement was executed, run the following query to checked the records in the dim_product table. &lt;br /&gt;&lt;br /&gt;Sqlplus&amp;gt;select * from dim_product; &lt;br /&gt;&lt;br /&gt;There should be two rows in the dimension table with the column effective_start_date, effective_end_date and is_current_row populated. Now, let’s find out how the merge statement handles SCD Type 2 records. To begin, run the following queries against the stage table: &lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;pre style="background: rgb(240,240,240); border-bottom: rgb(204,204,204) 1px dashed; border-left: rgb(204,204,204) 1px dashed; border-right: rgb(204,204,204) 1px dashed; border-top: rgb(204,204,204) 1px dashed; color: black; overflow: auto; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; word-wrap: normal;"&gt;update stg_product set price = 700 , price_effective_date = sysdate, last_modified_date = sysdate where product_id = 1;&lt;br /&gt;&lt;br /&gt;insert into stg_product (&lt;br /&gt;PRODUCT_ID, &lt;br /&gt;PRODUCT_CATEGORY_ID,&lt;br /&gt;PRODUCT_NAME,&lt;br /&gt;PRODUCT_DESCRIPTION,&lt;br /&gt;PRICE,&lt;br /&gt;PRICE_EFFECTIVE_DATE,&lt;br /&gt;LAST_MODIFIED_DATE,&lt;br /&gt;CREATED_DATE)&lt;br /&gt;values (3,6,'EPSon Color Printer',&lt;br /&gt;'EPSon color print with high definition photo prints', 200,sysdate,sysdate,sysdate);&lt;br /&gt; commit;&lt;br /&gt;&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;The above statements updated a record where product_id equal to 1 to change it price to 700, and inserted one more new record, product_id 3, into the stg_product table. To help understand what the records set looks like from the using clause of the merge statement, let’s copy the query and execute it to get the record set. &lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;pre style="background: rgb(240,240,240); border-bottom: rgb(204,204,204) 1px dashed; border-left: rgb(204,204,204) 1px dashed; border-right: rgb(204,204,204) 1px dashed; border-top: rgb(204,204,204) 1px dashed; color: black; overflow: auto; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; word-wrap: normal;"&gt;SELECT DECODE(s.scd_row_type_id,1,-6789,m.product_sid) as product_sid,&lt;br /&gt;                   PRODUCT_ID,&lt;br /&gt;                   PRODUCT_CATEGORY_ID,&lt;br /&gt;                   PRODUCT_NAME,&lt;br /&gt;                   PRODUCT_DESCRIPTION,&lt;br /&gt;                   PRICE,&lt;br /&gt;                   PRICE_EFFECTIVE_DATE,&lt;br /&gt;                   LAST_MODIFIED_DATE,&lt;br /&gt;                   CREATED_DATE,&lt;br /&gt;                   m.scd_row_type_id,&lt;br /&gt;         s.scd_row_type_id&lt;br /&gt;              FROM    (SELECT dp.product_sid,&lt;br /&gt;                              sp.PRODUCT_ID,&lt;br /&gt;                              sp.PRODUCT_CATEGORY_ID,&lt;br /&gt;                              sp.PRODUCT_NAME,&lt;br /&gt;                              sp.PRODUCT_DESCRIPTION,&lt;br /&gt;                              sp.PRICE,&lt;br /&gt;                              sp.PRICE_EFFECTIVE_DATE,&lt;br /&gt;                              sp.LAST_MODIFIED_DATE,&lt;br /&gt;                              sp.CREATED_DATE,&lt;br /&gt;                              CASE&lt;br /&gt;                                 WHEN dp.product_id IS NULL&lt;br /&gt;                                 THEN&lt;br /&gt;                                    1&lt;br /&gt;                                 WHEN (dp.product_category_id !=&lt;br /&gt;                                          sp.product_category_id&lt;br /&gt;                                       OR dp.product_name != sp.product_name&lt;br /&gt;                                       OR DP.PRODUCT_DESCRIPTION !=&lt;br /&gt;                                             sp.product_description&lt;br /&gt;                                       OR dp.price != sp.price&lt;br /&gt;                                       OR dp.price_effective_date !=&lt;br /&gt;                                             sp.price_effective_date)&lt;br /&gt;                                 THEN&lt;br /&gt;                                    2&lt;br /&gt;                                 ELSE&lt;br /&gt;                                    0&lt;br /&gt;                              END&lt;br /&gt;                                 AS scd_row_type_id&lt;br /&gt;                         FROM    stg_product sp&lt;br /&gt;                              LEFT JOIN&lt;br /&gt;                                 Dim_product dp&lt;br /&gt;                              ON (sp.product_id = dp.product_id and  dp.is_current_row = 'Y')&lt;br /&gt;                     ) m&lt;br /&gt;                   JOIN  scd_row_type s&lt;br /&gt;                   ON (s.scd_row_type_id &amp;lt;= m.scd_row_type_id)&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;Examine the result set, it should look something like: &lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;pre style="background: rgb(240,240,240); border-bottom: rgb(204,204,204) 1px dashed; border-left: rgb(204,204,204) 1px dashed; border-right: rgb(204,204,204) 1px dashed; border-top: rgb(204,204,204) 1px dashed; color: black; height: 100px; overflow: auto; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; word-wrap: normal;"&gt;PRODUCT_SID PRODUCT_ID PRODUCT_CATEGORY_ID PRODUCT_NAME         PRODUCT_DESCRIPTION                                 PRICE   PRICE_EFFECTIVE_DATE LAST_MODIFIED_DATE  CREATED_DATE   SCD_ROW_TYPE_ID&lt;br /&gt;-6789            1            8            Apple iPad 36 GB     Apple iPad 36 GB with the latest createst           700    4/19/2011 2:11        4/19/2011 2:11     4/19/2011 2:10   2&lt;br /&gt;62               1            8            Apple iPad 36 GB     Apple iPad 36 GB with the latest createst           700    4/19/2011 2:11        4/19/2011 2:11     4/19/2011 2:10   2&lt;br /&gt;                 3            6            EPSon Color Printer  EPSon color print with high definition photo prints 200    4/19/2011 2:11        4/19/2011 2:11     4/19/2011 2:11   1&lt;br /&gt;&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;As you can see, we have two rows for product_id 1, and one row for the new record, product_id 3. Also, at the end of the row, you can also see that the scd_record_type_id column has two ids for product id 1. One is 2 and the other one is 1. for the one the that has a scd_record_type_id equql to 1, the product_sid is changed to –6789. Therefore, this record will be used for insert. The logic that define which record to update or insert was defined in the case statement: &lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;pre style="background: rgb(240,240,240); border-bottom: rgb(204,204,204) 1px dashed; border-left: rgb(204,204,204) 1px dashed; border-right: rgb(204,204,204) 1px dashed; border-top: rgb(204,204,204) 1px dashed; color: black; overflow: auto; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; word-wrap: normal;"&gt;(CASE&lt;br /&gt;   WHEN dp.product_id IS NULL&lt;br /&gt;     THEN  1&lt;br /&gt;   WHEN (dp.product_category_id != sp.product_category_id&lt;br /&gt;          OR dp.product_name != sp.product_name&lt;br /&gt;          OR DP.PRODUCT_DESCRIPTION != sp.product_description&lt;br /&gt;          OR dp.price != sp.price&lt;br /&gt;          OR dp.price_effective_date != sp.price_effective_date)&lt;br /&gt;     THEN  2&lt;br /&gt;   ELSE    0&lt;br /&gt; END) AS scd_row_type_id&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;If the product_id is not existing in the dim_product table, it is a new record. Therefore, it is assigned a 1 and it will be inserted. If any of the changes occurred to an existing record, it is an update and is assigned a 2. Otherwise, any identical record will be assign a 0. The join statement: &lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;pre style="background: rgb(240,240,240); border-bottom: rgb(204,204,204) 1px dashed; border-left: rgb(204,204,204) 1px dashed; border-right: rgb(204,204,204) 1px dashed; border-top: rgb(204,204,204) 1px dashed; color: black; overflow: auto; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; word-wrap: normal;"&gt;JOIN  scd_row_type s&lt;br /&gt;                   ON (s.scd_row_type_id &amp;lt;= m.scd_row_type_id)&lt;br /&gt;&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;takes only record with a scd_record_type_id that is 1 or greater since the scd_record_type table only have two records, scd_record_type_id 1 and 2. Therefore, any record that with a scd_record_type = 0 (identically records) will not be included in the final result set. To create a type 2 record, which is a existing record that has one or more new attributes, we change the existing product_sid to a dummy number, -6789, by using the decode statement: &lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;pre style="background: rgb(240,240,240); border-bottom: rgb(204,204,204) 1px dashed; border-left: rgb(204,204,204) 1px dashed; border-right: rgb(204,204,204) 1px dashed; border-top: rgb(204,204,204) 1px dashed; color: black; overflow: auto; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; word-wrap: normal;"&gt;DECODE(s.scd_row_type_id,1,-6789,m.product_sid) as product_sid&lt;br /&gt;&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;We choose this number because we had define the surrogate key of the dim_product table to only use positive value for keys. Hence, it will be inserted into the dimension. The "when matched" and "when not matched" clauses in the merge statement are self-explanatory. We matched the record set with the dim_product table on the product_sid key. If it matched, we set the is_current_row flag to ‘N’ and sent the effective_end_date to the last_modified_date. If it was not matched, records will be insert into the dimension table. Now, run the merge statement in section 2 to load the data into the dimension table. &lt;br /&gt;&lt;br /&gt;&lt;b&gt;4. Summary &lt;/b&gt;&lt;br /&gt;&lt;br /&gt;As it is stated in the &lt;a href="http://download.oracle.com/docs/cd/B28359_01/server.111/b28286/statements_9016.htm"&gt;Oracle documentation&lt;/a&gt;, the &lt;a href="http://download.oracle.com/docs/cd/B28359_01/server.111/b28286/statements_9016.htm"&gt;MERGE&lt;/a&gt; statement can be used to select rows from one or more sources for update or insertion into a table or view. You can specify conditions to determine whether to update or insert into the target table or view. &lt;br /&gt;&lt;br /&gt;This statement is a convenient way to combine multiple operations. It lets you avoid multiple INSERT, UPDATE, and DELETE DML statements. Therefore, it is helpful in loading data into a slowly changing dimension type 2 table. &lt;br /&gt;&lt;br /&gt;MERGE is a deterministic statement. You cannot update the same row of the target table multiple times in the same MERGE statement. Oracle Database does not implement fine-grained access control during MERGE statements.&lt;br /&gt;&lt;br /&gt;&amp;nbsp;If you are using the fine-grained access control feature on the target table or tables, then use equivalent INSERT and UPDATE statements instead of MERGE to avoid error messages and to ensure correct access control.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="dir: ltr align:left; display: block; float: right; height: 260px; margin: 3px; width: 260px;"&gt;&lt;script type="text/javascript"&gt;&lt;!--google_ad_client = "ca-pub-1602461054664536";/* oracle-dw-body-ad-250x250-20110421 */google_ad_slot = "6024336371";google_ad_width = 250;google_ad_height = 250;//--&gt;&lt;/script&gt;&lt;br /&gt;&lt;script src="http://pagead2.googlesyndication.com/pagead/show_ads.js" type="text/javascript"&gt;&lt;/script&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Reference:&lt;/b&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://download.oracle.com/docs/cd/B28359_01/server.111/b28286/statements_9016.htm"&gt;Oracle Online Documentations&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.amazon.com/Oracle-Database-Complete-Reference-Osborne/dp/0071598758?ie=UTF8&amp;amp;tag=dat03-20&amp;amp;link_code=btl&amp;amp;camp=213689&amp;amp;creative=392969" target="_blank"&gt;Oracle Database 11g The Complete Reference,Kevin Loney, Oracle Press&lt;/a&gt;&lt;img alt="" border="0" height="1px" src="http://www.assoc-amazon.com/e/ir?t=dat03-20&amp;amp;l=btl&amp;amp;camp=213689&amp;amp;creative=392969&amp;amp;o=1&amp;amp;a=0071598758" style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0px; padding-bottom: 0px !important; padding-left: 0px !important; padding-right: 0px !important; padding-top: 0px !important;" width="1px" /&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.amazon.com/Data-Warehouse-Toolkit-Complete-Dimensional/dp/0471200247?ie=UTF8&amp;amp;tag=dat03-20&amp;amp;link_code=btl&amp;amp;camp=213689&amp;amp;creative=392969" target="_blank"&gt;The Data Warehouse toolkit, Ralph Kimball and Margy Ross&lt;/a&gt;&lt;img alt="" border="0" height="1px" src="http://www.assoc-amazon.com/e/ir?t=dat03-20&amp;amp;l=btl&amp;amp;camp=213689&amp;amp;creative=392969&amp;amp;o=1&amp;amp;a=0471200247" style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0px; padding-bottom: 0px !important; padding-left: 0px !important; padding-right: 0px !important; padding-top: 0px !important;" width="1px" /&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.amazon.com/Data-Warehouse-ETL-Toolkit-Techniques/dp/0764567578?ie=UTF8&amp;amp;tag=dat03-20&amp;amp;link_code=btl&amp;amp;camp=213689&amp;amp;creative=392969" target="_blank"&gt;The Data Warehouse ETL Toolkit, Ralph Kimball and Joe Caserta&lt;/a&gt;&lt;img alt="" border="0" height="1px" src="http://www.assoc-amazon.com/e/ir?t=dat03-20&amp;amp;l=btl&amp;amp;camp=213689&amp;amp;creative=392969&amp;amp;o=1&amp;amp;a=0764567578" style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0px; padding-bottom: 0px !important; padding-left: 0px !important; padding-right: 0px !important; padding-top: 0px !important;" width="1px" /&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.google.com/custom?q=oracle%20merge%20statement&amp;amp;spell=1&amp;amp;ie=UTF-8&amp;amp;cx=partner-pub-1602461054664536%3Aghaimtmraz9&amp;amp;sa=Search&amp;amp;adkw=AELymgU66Qh_HJ5iydqRJvW0fpjuvbdGEhrT4jVo3RUFE_tejEIq1n9JnH7wlN93ct6joDk7GAto0AouUhkgy4Cc4iM58mZYDrJoIju6ObLin1A4dns9fq8&amp;amp;cof=AH%3Aleft%3BALC%3A000033%3BBGC%3AFFFFFF%3BCX%3AData%2520Bob%2520Jr%252E%3BDIV%3ACCCCCC%3BFORID%3A13%3BGALT%3A0066CC%3BL%3Ahttp%3A%2F%2Fwww.google.com%2Fintl%2Fen%2Fimages%2Flogos%2Fcustom_search_logo_sm.gif%3BLC%3A000033%3BLH%3A30%3BLP%3A1%3BT%3A000000%3BVLC%3AFF6FCF%3B&amp;amp;hl=en&amp;amp;oe=ISO-8859-1&amp;amp;safe=active&amp;amp;client=pub-1602461054664536&amp;amp;channel=1119855433"&gt;Other Reference on the Web&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;Related Note:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&amp;nbsp;&lt;a href="http://databobjr.blogspot.com/2011/03/sql-outer-join-query.html"&gt;&lt;span id="goog_1275856486"&gt;&lt;/span&gt;&lt;span id="goog_1275856487"&gt;&lt;/span&gt;&lt;span id="goog_1275856489"&gt;&lt;/span&gt;&lt;span id="goog_1275856490"&gt;&lt;/span&gt;&lt;span id="goog_1275856492"&gt;&lt;/span&gt;&lt;span id="goog_1275856493"&gt;&lt;/span&gt;&lt;span id="goog_1275856495"&gt;&lt;/span&gt;&lt;span id="goog_1275856496"&gt;&lt;/span&gt;&lt;span id="goog_1275856498"&gt;&lt;/span&gt;&lt;span id="goog_1275856499"&gt;&lt;/span&gt;&lt;span id="goog_1275856502"&gt;&lt;/span&gt;&lt;span id="goog_1275856503"&gt;&lt;/span&gt;&lt;span id="goog_1275856506"&gt;&lt;/span&gt;&lt;span id="goog_1275856507"&gt;&lt;/span&gt;SQL Outer Join&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;&lt;/div&gt;&lt;div&gt;&lt;script type="text/javascript"&gt;&lt;!--google_ad_client = "ca-pub-1602461054664536";/* oracle-dw-footer-468x60-20110421 */google_ad_slot = "3313791769";google_ad_width = 468;google_ad_height = 60;//--&gt;&lt;/script&gt;&lt;br /&gt;&lt;script src="http://pagead2.googlesyndication.com/pagead/show_ads.js" type="text/javascript"&gt;&lt;/script&gt;&lt;/div&gt;&lt;div id="wrap" style="position:static;  width:938px; height:20px; left:26px; display:inline; word-wrap:break-word; overflow:hidden; margin:0px auto;"&gt;  &lt;div id="bannerright" style="position:relative; border-width:0px; border-style: solid; border-color:   green; border-right:0px;left:26px;width:728px;height:20px;float:left;vertical-align:middle; display:inline;  word-wrap:   break-word; overflow:hidden; margin-left:0;margin-right:0;margin-top:0;margin-bottom:5px; auto"&gt;&lt;script type="text/javascript"&gt;&lt;!--google_ad_client = "ca-pub-1602461054664536";google_ad_host = "pub-1556223355139109";/* Header_Links_ad_text_728_15 */google_ad_slot = "3453974813";google_ad_width = 728;google_ad_height = 15;//--&gt;&lt;/script&gt;&lt;script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"&gt;&lt;/script&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/22611914-7877991418800679991?l=databobjr.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://databobjr.blogspot.com/feeds/7877991418800679991/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=22611914&amp;postID=7877991418800679991' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/22611914/posts/default/7877991418800679991'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/22611914/posts/default/7877991418800679991'/><link rel='alternate' type='text/html' href='http://databobjr.blogspot.com/2011/04/load-slowly-changing-dimension-type-2.html' title='Load Slowly Changing Dimension Type 2 using Oracle Merge Statement'/><author><name>Data Bob Jr.</name><uri>http://www.blogger.com/profile/11965565939904347208</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-22611914.post-4538986435356829422</id><published>2011-04-06T07:32:00.000-07:00</published><updated>2011-04-06T08:37:46.101-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Music'/><category scheme='http://www.blogger.com/atom/ns#' term='Video'/><category scheme='http://www.blogger.com/atom/ns#' term='Learn Piano'/><title type='text'>Learn To Play Piano: If We Hold On Together</title><content type='html'>&lt;div style="display: block; float: right; height: 600px; margin: 3px; width: 180px;"&gt;&lt;script type="text/javascript"&gt;&lt;!--google_ad_client = "ca-pub-1602461054664536";/* video-side-ad-160x600-20110311 */google_ad_slot = "0317990982";google_ad_width = 160;google_ad_height = 600;//--&gt;&lt;/script&gt;&lt;br /&gt;&lt;script src="http://pagead2.googlesyndication.com/pagead/show_ads.js" type="text/javascript"&gt;&lt;/script&gt;&lt;/div&gt;&lt;br /&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif;"&gt;The piano sheet can be found here:&lt;/span&gt;&lt;a href="http://forpiano.com/FILEX/I/s092dhu9sk/diana_ross--if_we_hold_on_together.pdf"&gt; If We Hold On Together.&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: left;"&gt;&lt;object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" height="450" id="FiveminPlayer" width="560"&gt;  &lt;param name='allowfullscreen' value='true'/&gt;&lt;param name='allowScriptAccess' value='always'/&gt;&lt;param name='movie' value='http://embed.5min.com/76179055/'/&gt;&lt;param name='wmode' value='opaque' /&gt;&lt;embed name='FiveminPlayer' src='http://embed.5min.com/76179055/' type='application/x-shockwave-flash' width='460' height='340' allowfullscreen='true' allowScriptAccess='always' wmode='opaque'&gt;  &lt;/embed&gt;  &lt;/object&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;script type="text/javascript"&gt;&lt;!--google_ad_client = "ca-pub-1602461054664536";/* Life-fooder-468x60-20110218 */google_ad_slot = "8557938646";google_ad_width = 468;google_ad_height = 60;//--&gt;&lt;/script&gt;&lt;br /&gt;&lt;script src="http://pagead2.googlesyndication.com/pagead/show_ads.js" type="text/javascript"&gt;&lt;/script&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/22611914-4538986435356829422?l=databobjr.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://databobjr.blogspot.com/feeds/4538986435356829422/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=22611914&amp;postID=4538986435356829422' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/22611914/posts/default/4538986435356829422'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/22611914/posts/default/4538986435356829422'/><link rel='alternate' type='text/html' href='http://databobjr.blogspot.com/2011/04/learn-to-play-piano-if-we-hold-on.html' title='Learn To Play Piano: If We Hold On Together'/><author><name>Data Bob Jr.</name><uri>http://www.blogger.com/profile/11965565939904347208</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-22611914.post-1253288529922069990</id><published>2011-03-10T01:58:00.000-08:00</published><updated>2011-04-06T07:18:45.294-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Video'/><category scheme='http://www.blogger.com/atom/ns#' term='Life'/><title type='text'>Live Crab Vending Machine In The Subway Station</title><content type='html'>&lt;div style="dir: ltr align:left; display: block; float: right; height: 600px; margin: 3px; width: 180px;"&gt;&lt;script type="text/javascript"&gt;&lt;!--google_ad_client = "ca-pub-1602461054664536";/* video-side-ad-160x600-20110311 */google_ad_slot = "0317990982";google_ad_width = 160;google_ad_height = 600;//--&gt;&lt;/script&gt;&lt;br /&gt;&lt;script src="http://pagead2.googlesyndication.com/pagead/show_ads.js" type="text/javascript"&gt;&lt;/script&gt;&lt;/div&gt;&lt;br /&gt;Vending machine sells live crabs.&lt;br /&gt;&lt;br /&gt;"Honey, please pick up a live crab on your way home from the subway station vending machine." &lt;br /&gt;&lt;br /&gt;&lt;iframe allowfullscreen="" frameborder="0" height="390" src="http://www.youtube.com/embed/3iU6aQxjzsg?rel=0" title="YouTube video player" width="480"&gt;&lt;/iframe&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;script type="text/javascript"&gt;&lt;!--google_ad_client = "ca-pub-1602461054664536";/* Life-fooder-468x60-20110218 */google_ad_slot = "8557938646";google_ad_width = 468;google_ad_height = 60;//--&gt;&lt;/script&gt;&lt;br /&gt;&lt;script src="http://pagead2.googlesyndication.com/pagead/show_ads.js" type="text/javascript"&gt;&lt;/script&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/22611914-1253288529922069990?l=databobjr.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://databobjr.blogspot.com/feeds/1253288529922069990/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=22611914&amp;postID=1253288529922069990' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/22611914/posts/default/1253288529922069990'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/22611914/posts/default/1253288529922069990'/><link rel='alternate' type='text/html' href='http://databobjr.blogspot.com/2011/03/live-crab-vending-machine-in-subway.html' title='Live Crab Vending Machine In The Subway Station'/><author><name>Data Bob Jr.</name><uri>http://www.blogger.com/profile/11965565939904347208</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://img.youtube.com/vi/3iU6aQxjzsg/default.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-22611914.post-4350419659372545918</id><published>2011-03-10T00:58:00.000-08:00</published><updated>2011-03-10T07:46:17.034-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='SQL'/><title type='text'>SQL Outer Join Query</title><content type='html'>&lt;b&gt;&lt;span style="font-size: large;"&gt;Outer Join Query&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;SQL OUTER JOIN returns all records from both joined tables even there is no matching record found. There are three types of SQL OUTER JOIN:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;LEFT OUTER JOIN&lt;/li&gt;&lt;li&gt;RIGHT OUTER, &lt;/li&gt;&lt;li&gt;FULL OUTER JOIN&lt;/li&gt;&lt;/ul&gt;In Outer Join, preserved table means that all the rows in the rows in preserved table will be returned from the query results with at least one row. Let's use the following two tables to show the different type of outer joins.&lt;br /&gt;&lt;br /&gt;&lt;div style="dir: ltr align:left; display: block; float: right; height: 260px; margin: 3px; width: 310px;"&gt;&lt;script type="text/javascript"&gt;&lt;!--google_ad_client = "pub-1602461054664536";/* body-ad-300x250-created-4/21/10 */google_ad_slot = "4011047090";google_ad_width = 300;google_ad_height = 250;//--&gt;&lt;/script&gt;&lt;br /&gt;&lt;script src="http://pagead2.googlesyndication.com/pagead/show_ads.js" type="text/javascript"&gt;&lt;/script&gt;&lt;/div&gt;&lt;br /&gt;&lt;strong&gt;Employee table:&lt;/strong&gt; employee id and name&lt;br /&gt;&lt;br /&gt;&lt;table border="1" cellpadding="0" cellspacing="0" style="width: 400px;"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;Emp_id&lt;/td&gt;&lt;td&gt;Name&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;100&lt;/td&gt;&lt;td&gt;John&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;110&lt;/td&gt;&lt;td&gt;Mary&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;111&lt;/td&gt;&lt;td&gt;Smith&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;112&lt;/td&gt;&lt;td&gt;Bob&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;113&lt;/td&gt;&lt;td&gt;Jim&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;114&lt;/td&gt;&lt;td&gt;Joan&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;115&lt;/td&gt;&lt;td&gt;Jill&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;&lt;strong&gt;Employee_hours_worked table:&lt;/strong&gt; daily total hours each employee worked.&lt;br /&gt;&lt;br /&gt;&lt;table border="1" cellpadding="0" cellspacing="0" style="width: 400px;"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;Emp_id&lt;/td&gt;&lt;td&gt;Date&lt;/td&gt;&lt;td&gt;Total_hours_worked&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;1&lt;/td&gt;&lt;td&gt;2009-12-04&lt;/td&gt;&lt;td&gt;1&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;100&lt;/td&gt;&lt;td&gt;2010-01-12&lt;/td&gt;&lt;td&gt;3&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;110&lt;/td&gt;&lt;td&gt;2010-01-12&lt;/td&gt;&lt;td&gt;5&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;113&lt;/td&gt;&lt;td&gt;2010-01-13&lt;/td&gt;&lt;td&gt;2&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;111&lt;/td&gt;&lt;td&gt;2010-01-13&lt;/td&gt;&lt;td&gt;4&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;113&lt;/td&gt;&lt;td&gt;2010-01-13&lt;/td&gt;&lt;td&gt;6&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;110&lt;/td&gt;&lt;td&gt;2010-01-13&lt;/td&gt;&lt;td&gt;2&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;strong&gt;1. Left Outer Join&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Left outer join preserve the table in the left side. Every row in the preserved table is presented in the result set with at least one result row.&lt;br /&gt;&lt;br /&gt;select e.emp_id,e.name, w.date,w.total_hours_worked&lt;br /&gt;from employee e &lt;br /&gt;left join employee_hours_worked w&lt;br /&gt;on e.emp_id = w.emp_id&lt;br /&gt;&lt;br /&gt;&lt;table border="1" cellpadding="0" cellspacing="0" style="width: 400px;"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;emp_id&lt;/td&gt;&lt;td&gt;name&lt;/td&gt;&lt;td&gt;date&lt;/td&gt;&lt;td&gt;total_hours_worked&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;100 &lt;/td&gt;&lt;td&gt;John &lt;/td&gt;&lt;td&gt;1/12/2010&lt;/td&gt;&lt;td&gt;3&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;110&lt;/td&gt;&lt;td&gt;Mary&lt;/td&gt;&lt;td&gt;1/12/2010&lt;/td&gt;&lt;td&gt;5&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;110&lt;/td&gt;&lt;td&gt;Mary&lt;/td&gt;&lt;td&gt;1/13/2010&lt;/td&gt;&lt;td&gt;2&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;111&lt;/td&gt;&lt;td&gt;Smith&lt;/td&gt;&lt;td&gt;1/13/2010&lt;/td&gt;&lt;td&gt;4&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;112&lt;/td&gt;&lt;td&gt;bob&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;113&lt;/td&gt;&lt;td&gt;Jim&lt;/td&gt;&lt;td&gt;1/12/2010&lt;/td&gt;&lt;td&gt;2&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;113&lt;/td&gt;&lt;td&gt;Jim&lt;/td&gt;&lt;td&gt;1/13/2010&lt;/td&gt;&lt;td&gt;6&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;114&lt;/td&gt;&lt;td&gt;Joan&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;114&lt;/td&gt;&lt;td&gt;Jill&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;Put search predicate (filter) in the WHERE clause in a left outer join query will &lt;strong&gt;filter out the result set.&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;select e.emp_id,e.name, w.date,w.total_hours_worked&lt;br /&gt;from employee e &lt;br /&gt;left join employee_hours_worked w&lt;br /&gt;on e.emp_id = w.emp_id&lt;br /&gt;where w.total_hours_worked &amp;lt;=4&lt;br /&gt;&lt;br /&gt;&lt;table border="1" cellpadding="0" cellspacing="0" style="width: 400px;"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;emp_id&lt;/td&gt;&lt;td&gt;name&lt;/td&gt;&lt;td&gt;date&lt;/td&gt;&lt;td&gt;total_hours_worked&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;110&lt;/td&gt;&lt;td&gt;Joan&lt;/td&gt;&lt;td&gt;1/12/2010&lt;/td&gt;&lt;td&gt;3&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;110&lt;/td&gt;&lt;td&gt;Mary&lt;/td&gt;&lt;td&gt;1/13/2010&lt;/td&gt;&lt;td&gt;2&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;111&lt;/td&gt;&lt;td&gt;Smith&lt;/td&gt;&lt;td&gt;1/13/2010&lt;/td&gt;&lt;td&gt;4&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;113&lt;/td&gt;&lt;td&gt;Jim&lt;/td&gt;&lt;td&gt;1/12/2010&lt;/td&gt;&lt;td&gt;2&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;Put search predicate in the ON clause in a left outer join query will &lt;strong&gt;filter out only the matched records in the non preserved table&lt;/strong&gt;. &lt;br /&gt;&lt;br /&gt;select e.emp_id,e.name, w.date,w.total_hours_worked&lt;br /&gt;from pcdb.employee e &lt;br /&gt;left join pcdb.employee_hours_worked w&lt;br /&gt;on e.emp_id = w.emp_id and w.total_hours_worked &amp;lt;=4&lt;br /&gt;emp_id name date total_hours_worked&lt;br /&gt;&lt;br /&gt;&lt;table border="1" cellpadding="0" cellspacing="0" style="width: 400px;"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;emp_id&lt;/td&gt;&lt;td&gt;name&lt;/td&gt;&lt;td&gt;date&lt;/td&gt;&lt;td&gt;total_hours_worked&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;100&lt;/td&gt;&lt;td&gt;john&lt;/td&gt;&lt;td&gt;1/12/2010&lt;/td&gt;&lt;td&gt;3&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;110&lt;/td&gt;&lt;td&gt;Mary&lt;/td&gt;&lt;td&gt;1/13/2010&lt;/td&gt;&lt;td&gt;2&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;111&lt;/td&gt;&lt;td&gt;Smith&lt;/td&gt;&lt;td&gt;1/13/2010&lt;/td&gt;&lt;td&gt;4&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;112&lt;/td&gt;&lt;td&gt;Bob&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;113&lt;/td&gt;&lt;td&gt;Jim&lt;/td&gt;&lt;td&gt;1/12/2010&lt;/td&gt;&lt;td&gt;2&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;114&lt;/td&gt;&lt;td&gt;Joan&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;114&lt;/td&gt;&lt;td&gt;Jill&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;&lt;strong&gt;2 Right Outer Join&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;In Right outer join, the preserved table is on the right with is opposite to Left outer Join.&lt;br /&gt;&lt;br /&gt;select e.emp_id,e.name, w.date,w.total_hours_worked&lt;br /&gt;from pcdb.employee e &lt;br /&gt;right outer join pcdb.employee_hours_worked w&lt;br /&gt;on e.emp_id = w.emp_id&lt;br /&gt;&lt;br /&gt;&lt;table border="1" cellpadding="0" cellspacing="0" style="width: 400px;"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;emp_id&lt;/td&gt;&lt;td&gt;name&lt;/td&gt;&lt;td&gt;date&lt;/td&gt;&lt;td&gt;total_hours_worked&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;100&lt;/td&gt;&lt;td&gt;John&lt;/td&gt;&lt;td&gt;1/12/2010&lt;/td&gt;&lt;td&gt;3&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;110&lt;/td&gt;&lt;td&gt;Mary&lt;/td&gt;&lt;td&gt;1/12/2010&lt;/td&gt;&lt;td&gt;5&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;113&lt;/td&gt;&lt;td&gt;Jim&lt;/td&gt;&lt;td&gt;1/12/2010&lt;/td&gt;&lt;td&gt;2&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;111&lt;/td&gt;&lt;td&gt;Smith&lt;/td&gt;&lt;td&gt;1/13/2010&lt;/td&gt;&lt;td&gt;4&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;113&lt;/td&gt;&lt;td&gt;Jim&lt;/td&gt;&lt;td&gt;1/13/2010&lt;/td&gt;&lt;td&gt;2&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;110&lt;/td&gt;&lt;td&gt;Mary&lt;/td&gt;&lt;td&gt;1/13/2010&lt;/td&gt;&lt;td&gt;2&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;12/4/2009&lt;/td&gt;&lt;td&gt;1&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;Notice that the result set include the record that has not emp_id and name (last record).&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;3. Full Outer Join&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Full Outer Join preserved both tables&lt;br /&gt;&lt;br /&gt;select e.emp_id,e.name, w.date,w.total_hours_worked&lt;br /&gt;from pcdb.employee e &lt;br /&gt;full outer join pcdb.employee_hours_worked w&lt;br /&gt;on e.emp_id = w.emp_id&lt;br /&gt;&lt;br /&gt;&lt;table border="1" cellpadding="0" cellspacing="0" style="width: 400px;"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;emp_id&lt;/td&gt;&lt;td&gt;name&lt;/td&gt;&lt;td&gt;date&lt;/td&gt;&lt;td&gt;total_hours_worded&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;100&lt;/td&gt;&lt;td&gt;John&lt;/td&gt;&lt;td&gt;1/12/2010&lt;/td&gt;&lt;td&gt;3&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;110&lt;/td&gt;&lt;td&gt;Mary&lt;/td&gt;&lt;td&gt;1/12/2010&lt;/td&gt;&lt;td&gt;5&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;110&lt;/td&gt;&lt;td&gt;Mary&lt;/td&gt;&lt;td&gt;1/13/2010&lt;/td&gt;&lt;td&gt;2&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;111&lt;/td&gt;&lt;td&gt;Smith&lt;/td&gt;&lt;td&gt;1/13/2010&lt;/td&gt;&lt;td&gt;4&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;112&lt;/td&gt;&lt;td&gt;Bob&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;113&lt;/td&gt;&lt;td&gt;Jim&lt;/td&gt;&lt;td&gt;1/12/2010&lt;/td&gt;&lt;td&gt;2&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;113&lt;/td&gt;&lt;td&gt;Jim&lt;/td&gt;&lt;td&gt;1/13/2010&lt;/td&gt;&lt;td&gt;6&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;114&lt;/td&gt;&lt;td&gt;Joan&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;115&lt;/td&gt;&lt;td&gt;Jim&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;12/4/2009&lt;/td&gt;&lt;td&gt;1&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;If a database server (like MySQL) dose not support full outer join, the query can be written with an union and a where clasue.&lt;br /&gt;&lt;br /&gt;select e.emp_id,e.name, w.date,w.total_hours_worked&lt;br /&gt;from pcdb.employee e &lt;br /&gt;left outer join pcdb.employee_hours_worked w&lt;br /&gt;on e.emp_id = w.emp_id&lt;br /&gt;union&lt;br /&gt;select e.emp_id,e.name, w.date,w.total_hours_worked&lt;br /&gt;from pcdb.employee e &lt;br /&gt;right outer join pcdb.employee_hours_worked w&lt;br /&gt;on e.emp_id = w.emp_id&lt;br /&gt;where e.emp_id is null&lt;br /&gt;&lt;br /&gt;The where clause in the second query ,'where e.emp_id is null', keep all the the records that only exists in the right table, employee_hours_worked.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Reference&lt;/strong&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://www.amazon.com/Joe-Celkos-SQL-Smarties-Fourth/dp/0123820227?ie=UTF8&amp;amp;tag=dat03-20&amp;amp;link_code=btl&amp;amp;camp=213689&amp;amp;creative=392969" target="_blank"&gt;SQL For Smarties by Joe Celko&lt;/a&gt;&lt;img alt="" border="0" height="1" src="http://www.assoc-amazon.com/e/ir?t=dat03-20&amp;amp;l=btl&amp;amp;camp=213689&amp;amp;creative=392969&amp;amp;o=1&amp;amp;a=0123820227" style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0px; padding-bottom: 0px !important; padding-left: 0px !important; padding-right: 0px !important; padding-top: 0px !important;" width="1" /&gt;&amp;nbsp;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.amazon.com/MySQL-Cookbook-Paul-DuBois/dp/059652708X?ie=UTF8&amp;amp;tag=dat03-20&amp;amp;link_code=btl&amp;amp;camp=213689&amp;amp;creative=392969" target="_blank"&gt;MySQL Cookbook by Paul DuBois&lt;/a&gt;&lt;img alt="" border="0" height="1" src="http://www.assoc-amazon.com/e/ir?t=dat03-20&amp;amp;l=btl&amp;amp;camp=213689&amp;amp;creative=392969&amp;amp;o=1&amp;amp;a=059652708X" style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0px; padding-bottom: 0px !important; padding-left: 0px !important; padding-right: 0px !important; padding-top: 0px !important;" width="1" /&gt;&amp;nbsp;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.amazon.com/Oracle-PL-SQL-Programming-Versions/dp/0596514468?ie=UTF8&amp;amp;tag=dat03-20&amp;amp;link_code=btl&amp;amp;camp=213689&amp;amp;creative=392969" target="_blank"&gt;Oracle Pl/SQL Programming by Steven Feuerstein and Bill Pribyl&lt;/a&gt;&lt;img alt="" border="0" height="1" src="http://www.assoc-amazon.com/e/ir?t=dat03-20&amp;amp;l=btl&amp;amp;camp=213689&amp;amp;creative=392969&amp;amp;o=1&amp;amp;a=0596514468" style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0px; padding-bottom: 0px !important; padding-left: 0px !important; padding-right: 0px !important; padding-top: 0px !important;" width="1" /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;div&gt;&lt;script type="text/javascript"&gt;&lt;!--google_ad_client = "pub-1602461054664536";/* sql-fooder-banner-468x60-20100501 */google_ad_slot = "7590234874";google_ad_width = 468;google_ad_height = 60;//--&gt;&lt;/script&gt;&lt;br /&gt;&lt;script src="http://pagead2.googlesyndication.com/pagead/show_ads.js" type="text/javascript"&gt;&lt;/script&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/22611914-4350419659372545918?l=databobjr.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://databobjr.blogspot.com/feeds/4350419659372545918/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=22611914&amp;postID=4350419659372545918' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/22611914/posts/default/4350419659372545918'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/22611914/posts/default/4350419659372545918'/><link rel='alternate' type='text/html' href='http://databobjr.blogspot.com/2011/03/sql-outer-join-query.html' title='SQL Outer Join Query'/><author><name>Data Bob Jr.</name><uri>http://www.blogger.com/profile/11965565939904347208</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-22611914.post-6715646887174670849</id><published>2011-02-17T05:07:00.000-08:00</published><updated>2011-02-18T09:00:32.085-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Data and Information'/><category scheme='http://www.blogger.com/atom/ns#' term='Video'/><category scheme='http://www.blogger.com/atom/ns#' term='Life'/><category scheme='http://www.blogger.com/atom/ns#' term='Suppercomputer'/><category scheme='http://www.blogger.com/atom/ns#' term='Intelligent'/><title type='text'>Man Vs. Machine  - The  Final Jeopardy!</title><content type='html'>&lt;b&gt;&lt;span style="background-color: white; color: black;"&gt;Man Vs. Machine&amp;nbsp; - The&amp;nbsp; Final Jeopardy!&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;&lt;b&gt;This is amazing! &lt;/b&gt;&lt;br /&gt;&lt;br /&gt;&lt;iframe allowfullscreen="" frameborder="0" height="390" src="http://www.youtube.com/embed/lI-M7O_bRNg?rel=0" title="YouTube video player" width="640"&gt;&lt;/iframe&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www-943.ibm.com/innovation/us/watson/what-is-watson/the-future-of-watson.html"&gt;IBM Watson&lt;/a&gt;&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;script type="text/javascript"&gt;&lt;!--google_ad_client = "ca-pub-1602461054664536";/* Life-fooder-468x60-20110218 */google_ad_slot = "8557938646";google_ad_width = 468;google_ad_height = 60;//--&gt;&lt;/script&gt;&lt;br /&gt;&lt;script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"&gt;&lt;/script&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/22611914-6715646887174670849?l=databobjr.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://databobjr.blogspot.com/feeds/6715646887174670849/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=22611914&amp;postID=6715646887174670849' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/22611914/posts/default/6715646887174670849'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/22611914/posts/default/6715646887174670849'/><link rel='alternate' type='text/html' href='http://databobjr.blogspot.com/2011/02/ibm-final-jeopardy-and-future-of-watson.html' title='Man Vs. Machine  - The  Final Jeopardy!'/><author><name>Data Bob Jr.</name><uri>http://www.blogger.com/profile/11965565939904347208</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://img.youtube.com/vi/lI-M7O_bRNg/default.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-22611914.post-8726209099114895188</id><published>2010-12-02T01:18:00.000-08:00</published><updated>2010-12-02T01:36:47.504-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='MySQL Performance Tuning'/><title type='text'>Performance Tuning Best Practices for MySQL</title><content type='html'>Performance Tuning Best Practices for MySQL by &lt;a href="http://www.joinfu.com/"&gt;Jay Pipes&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;object height="385" width="480"&gt;&lt;param name="movie" value="http://www.youtube.com/v/u70mkgDnDdU?fs=1&amp;amp;hl=en_US&amp;amp;rel=0&amp;amp;color1=0x234900&amp;amp;color2=0x4e9e00"&gt;&lt;/param&gt;&lt;param name="allowFullScreen" value="true"&gt;&lt;/param&gt;&lt;param name="allowscriptaccess" value="always"&gt;&lt;/param&gt;&lt;embed src="http://www.youtube.com/v/u70mkgDnDdU?fs=1&amp;amp;hl=en_US&amp;amp;rel=0&amp;amp;color1=0x234900&amp;amp;color2=0x4e9e00" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="480" height="385"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;/div&gt;References:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://www.amazon.com/High-Performance-MySQL-Optimization-Replication/dp/0596101716?ie=UTF8&amp;amp;tag=dat03-20&amp;amp;link_code=btl&amp;amp;camp=213689&amp;amp;creative=392969" target="_blank"&gt;High Performacnce MySQL&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.amazon.com/Understanding-MySQL-Internals-Sasha-Pachev/dp/0596009577?ie=UTF8&amp;amp;tag=dat03-20&amp;amp;link_code=btl&amp;amp;camp=213689&amp;amp;creative=392969" target="_blank"&gt;Understanding MySQL Internals&lt;/a&gt;&lt;img alt="" border="0" height="1" src="http://www.assoc-amazon.com/e/ir?t=dat03-20&amp;amp;l=btl&amp;amp;camp=213689&amp;amp;creative=392969&amp;amp;o=1&amp;amp;a=0596009577" style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0px; padding-bottom: 0px !important; padding-left: 0px !important; padding-right: 0px !important; padding-top: 0px !important;" width="1" /&gt;&lt;img alt="" border="0" height="1" src="http://www.assoc-amazon.com/e/ir?t=dat03-20&amp;amp;l=btl&amp;amp;camp=213689&amp;amp;creative=392969&amp;amp;o=1&amp;amp;a=0596101716" style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0px; padding-bottom: 0px !important; padding-left: 0px !important; padding-right: 0px !important; padding-top: 0px !important;" width="1" /&gt;&lt;/li&gt;&lt;li&gt;&lt;span&gt;&lt;a href="http://www.amazon.com/MySQL-Experts-Voice-Open-Source/dp/159059505X?ie=UTF8&amp;amp;tag=dat03-20&amp;amp;link_code=btl&amp;amp;camp=213689&amp;amp;creative=392969" target="_blank"&gt;Pro MySQL&lt;/a&gt;&lt;img alt="" border="0" height="1" src="http://www.assoc-amazon.com/e/ir?t=dat03-20&amp;amp;l=btl&amp;amp;camp=213689&amp;amp;creative=392969&amp;amp;o=1&amp;amp;a=159059505X" style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0px; padding-bottom: 0px !important; padding-left: 0px !important; padding-right: 0px !important; padding-top: 0px !important;" width="1" /&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;div&gt;&lt;/div&gt;&lt;script type="text/javascript"&gt;&lt;!--google_ad_client = "ca-pub-1602461054664536";/* MySQL-Performance-tuning-468x60-20101202 */google_ad_slot = "1779596337";google_ad_width = 468;google_ad_height = 60;//--&gt;&lt;/script&gt;&lt;br /&gt;&lt;script src="http://pagead2.googlesyndication.com/pagead/show_ads.js" type="text/javascript"&gt;&lt;/script&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/22611914-8726209099114895188?l=databobjr.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://databobjr.blogspot.com/feeds/8726209099114895188/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=22611914&amp;postID=8726209099114895188' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/22611914/posts/default/8726209099114895188'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/22611914/posts/default/8726209099114895188'/><link rel='alternate' type='text/html' href='http://databobjr.blogspot.com/2010/12/performance-tuning-best-practices-for.html' title='Performance Tuning Best Practices for MySQL'/><author><name>Data Bob Jr.</name><uri>http://www.blogger.com/profile/11965565939904347208</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-22611914.post-8913429962367907610</id><published>2010-12-02T01:01:00.000-08:00</published><updated>2010-12-02T01:24:56.579-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Oracle Data Warehouse'/><category scheme='http://www.blogger.com/atom/ns#' term='Data Warehouse'/><category scheme='http://www.blogger.com/atom/ns#' term='Video'/><category scheme='http://www.blogger.com/atom/ns#' term='Data Modeling'/><title type='text'>OLAP</title><content type='html'>&lt;b&gt;OLAP and Business Intelligence &lt;/b&gt;&lt;br /&gt;&lt;br /&gt;&lt;object height="385" width="480"&gt;&lt;param name="movie" value="http://www.youtube.com/v/KTdJ661013s?fs=1&amp;amp;hl=en_US&amp;amp;rel=0&amp;amp;color1=0x234900&amp;amp;color2=0x4e9e00"&gt;&lt;/param&gt;&lt;param name="allowFullScreen" value="true"&gt;&lt;/param&gt;&lt;param name="allowscriptaccess" value="always"&gt;&lt;/param&gt;&lt;embed src="http://www.youtube.com/v/KTdJ661013s?fs=1&amp;amp;hl=en_US&amp;amp;rel=0&amp;amp;color1=0x234900&amp;amp;color2=0x4e9e00" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="480" height="385"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Reference:&lt;/b&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://www.amazon.com/Multidimensional-Data-Modeling-Toolkit-Intelligence/dp/0981775306?ie=UTF8&amp;amp;tag=dat03-20&amp;amp;link_code=btl&amp;amp;camp=213689&amp;amp;creative=392969" target="_blank"&gt;The Multidimensional Data Modeling Toolkit: Making Your Business Intelligence Applications Smart with Oracle OLAP&lt;/a&gt;&lt;img alt="" border="0" height="1" src="http://www.assoc-amazon.com/e/ir?t=dat03-20&amp;amp;l=btl&amp;amp;camp=213689&amp;amp;creative=392969&amp;amp;o=1&amp;amp;a=0981775306" style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0px; padding-bottom: 0px !important; padding-left: 0px !important; padding-right: 0px !important; padding-top: 0px !important;" width="1" /&gt;.&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.amazon.com/Data-Warehouse-Toolkit-Complete-Dimensional/dp/0471200247?ie=UTF8&amp;amp;tag=dat03-20&amp;amp;link_code=btl&amp;amp;camp=213689&amp;amp;creative=392969" target="_blank"&gt;Data Warehouse Toolkit.&lt;/a&gt;&lt;img alt="" border="0" height="1" src="http://www.assoc-amazon.com/e/ir?t=dat03-20&amp;amp;l=btl&amp;amp;camp=213689&amp;amp;creative=392969&amp;amp;o=1&amp;amp;a=0471200247" style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0px; padding-bottom: 0px !important; padding-left: 0px !important; padding-right: 0px !important; padding-top: 0px !important;" width="1" /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;script type="text/javascript"&gt;&lt;!--google_ad_client = "ca-pub-1602461054664536";/* datawarehouse-468x60-20101202 */google_ad_slot = "6357115194";google_ad_width = 468;google_ad_height = 60;//--&gt;&lt;/script&gt;&lt;br /&gt;&lt;script src="http://pagead2.googlesyndication.com/pagead/show_ads.js" type="text/javascript"&gt;&lt;/script&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/22611914-8913429962367907610?l=databobjr.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://databobjr.blogspot.com/feeds/8913429962367907610/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=22611914&amp;postID=8913429962367907610' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/22611914/posts/default/8913429962367907610'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/22611914/posts/default/8913429962367907610'/><link rel='alternate' type='text/html' href='http://databobjr.blogspot.com/2010/12/olap.html' title='OLAP'/><author><name>Data Bob Jr.</name><uri>http://www.blogger.com/profile/11965565939904347208</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-22611914.post-857333003569898705</id><published>2010-12-02T00:42:00.000-08:00</published><updated>2010-12-02T00:54:59.204-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Data Warehouse'/><category scheme='http://www.blogger.com/atom/ns#' term='Video'/><category scheme='http://www.blogger.com/atom/ns#' term='Data Funny'/><title type='text'>A Song About Failed Data Warehouse</title><content type='html'>&lt;object height="385" width="480"&gt;&lt;param name="movie" value="http://www.youtube.com/v/JpOqwb30Shk?fs=1&amp;amp;hl=en_US&amp;amp;rel=0&amp;amp;color1=0x234900&amp;amp;color2=0x4e9e00"&gt;&lt;/param&gt;&lt;param name="allowFullScreen" value="true"&gt;&lt;/param&gt;&lt;param name="allowscriptaccess" value="always"&gt;&lt;/param&gt;&lt;embed src="http://www.youtube.com/v/JpOqwb30Shk?fs=1&amp;amp;hl=en_US&amp;amp;rel=0&amp;amp;color1=0x234900&amp;amp;color2=0x4e9e00" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="480" height="385"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;br /&gt;&lt;br /&gt;&lt;script type="text/javascript"&gt;&lt;!--google_ad_client = "ca-pub-1602461054664536";/* data-funny-footer */google_ad_slot = "8780070572";google_ad_width = 468;google_ad_height = 60;//--&gt;&lt;/script&gt;&lt;br /&gt;&lt;script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"&gt;&lt;/script&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/22611914-857333003569898705?l=databobjr.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://databobjr.blogspot.com/feeds/857333003569898705/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=22611914&amp;postID=857333003569898705' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/22611914/posts/default/857333003569898705'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/22611914/posts/default/857333003569898705'/><link rel='alternate' type='text/html' href='http://databobjr.blogspot.com/2010/12/ode-to-failed-data-warehouse.html' title='A Song About Failed Data Warehouse'/><author><name>Data Bob Jr.</name><uri>http://www.blogger.com/profile/11965565939904347208</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-22611914.post-8382037780041772058</id><published>2010-11-03T22:24:00.001-07:00</published><updated>2010-11-03T23:17:20.787-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Pictures'/><title type='text'>Halloween 2010</title><content type='html'>&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/_-yHUY3DeIjY/TNJM5fQzVXI/AAAAAAAAADA/S6hmeIcTfO8/s1600/IMG_0029.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="213" px="true" src="http://4.bp.blogspot.com/_-yHUY3DeIjY/TNJM5fQzVXI/AAAAAAAAADA/S6hmeIcTfO8/s320/IMG_0029.JPG" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;strong&gt;"Trick or treat" and Vote.&lt;/strong&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/_-yHUY3DeIjY/TNJGcJTWzAI/AAAAAAAAACc/ig1S7n6sa0I/s1600/IMG_0040.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="213" px="true" src="http://3.bp.blogspot.com/_-yHUY3DeIjY/TNJGcJTWzAI/AAAAAAAAACc/ig1S7n6sa0I/s320/IMG_0040.JPG" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;strong&gt;Dogs in Costumes&lt;/strong&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/_-yHUY3DeIjY/TNJGcXeFVGI/AAAAAAAAACs/IAdrN08Sq1c/s1600/IMG_0063.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="320" px="true" src="http://4.bp.blogspot.com/_-yHUY3DeIjY/TNJGcXeFVGI/AAAAAAAAACs/IAdrN08Sq1c/s320/IMG_0063.JPG" width="213" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;strong&gt;Pimpkin Craving&lt;/strong&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/_-yHUY3DeIjY/TNJGcB4B7_I/AAAAAAAAACk/dUEtCu5KQew/s1600/IMG_0052.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="320" px="true" src="http://2.bp.blogspot.com/_-yHUY3DeIjY/TNJGcB4B7_I/AAAAAAAAACk/dUEtCu5KQew/s320/IMG_0052.JPG" width="213" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;strong&gt;High Tech Costume&lt;/strong&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;script type="text/javascript"&gt;&lt;!--google_ad_client = "pub-1602461054664536";/* picture-footer-banner-468x60-20101103 */google_ad_slot = "6126925307";google_ad_width = 468;google_ad_height = 60;//--&gt;&lt;/script&gt;&lt;br /&gt;&lt;script src="http://pagead2.googlesyndication.com/pagead/show_ads.js" type="text/javascript"&gt;&lt;/script&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/22611914-8382037780041772058?l=databobjr.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://databobjr.blogspot.com/feeds/8382037780041772058/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=22611914&amp;postID=8382037780041772058' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/22611914/posts/default/8382037780041772058'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/22611914/posts/default/8382037780041772058'/><link rel='alternate' type='text/html' href='http://databobjr.blogspot.com/2010/11/halloween-2010.html' title='Halloween 2010'/><author><name>Data Bob Jr.</name><uri>http://www.blogger.com/profile/11965565939904347208</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_-yHUY3DeIjY/TNJM5fQzVXI/AAAAAAAAADA/S6hmeIcTfO8/s72-c/IMG_0029.JPG' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-22611914.post-4053844462532357446</id><published>2010-10-26T00:02:00.000-07:00</published><updated>2011-02-25T08:14:17.479-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='MySQL Data Warehouse'/><category scheme='http://www.blogger.com/atom/ns#' term='MySQL'/><category scheme='http://www.blogger.com/atom/ns#' term='MySQL Performance Tuning: System Variables'/><category scheme='http://www.blogger.com/atom/ns#' term='MySQL Performance Tuning'/><category scheme='http://www.blogger.com/atom/ns#' term='MySQL DBA'/><title type='text'>MYSQL SPEEPUP INSERT INTO A MYISAM TABLE</title><content type='html'>Accordint to the MySQL Manual, there are a few ways to &lt;a href="http://dev.mysql.com/doc/refman/5.1/en/insert-speed.html"&gt;speedup inserts &lt;/a&gt;while adding data to a MyISAM table. Following are the original document from MySQL manual plus the notes I added while I was experiencing with real data loads. &lt;br /&gt;&lt;div style="dir: ltr align:left; display: block; float: right; height: 260px; margin: 3px; width: 310px;"&gt;&lt;script type="text/javascript"&gt;&lt;!--google_ad_client = "pub-1602461054664536";/* boby-image-text-upper-right-300x250-20100427 */google_ad_slot = "1745059421";google_ad_width = 300;google_ad_height = 250;//--&gt;&lt;/script&gt;&lt;br /&gt;&lt;script src="http://pagead2.googlesyndication.com/pagead/show_ads.js" type="text/javascript"&gt;&lt;/script&gt;&lt;/div&gt;&lt;div&gt;&lt;/div&gt;&lt;b&gt;1. Background Information&lt;/b&gt; &lt;br /&gt;&amp;nbsp; &lt;br /&gt;&lt;div&gt;The time required for inserting a row, according to the MySQL manual, is determined by the following factors, where the numbers indicate approximate proportions: &lt;/div&gt;· Cnnecting: (3) &lt;br /&gt;· There are many server variables that can be used to help optimize the user connections as stated in the post: &lt;br /&gt;· Sending query to server: (2) &lt;br /&gt;· Parsing query: (2) &lt;br /&gt;· Inserting row: (1 × size of row) &lt;br /&gt;· Inserting indexes: (1 × number of indexes) &lt;br /&gt;· Closing: (1)&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;/div&gt;&lt;div&gt;&lt;/div&gt;There are two additional things which need to be considered regarding overheard for inserts: &lt;br /&gt;&lt;ul&gt;&lt;li&gt;This does not take into consideration the initial overhead to open tables, which is done once for each concurrently running query. To try to reduce the times need to open table, try to cache them. To cache the table, set the table_cache variable. Please note that the table_cache, max_connections, and max_tmp_tables system variables affect the maximum number of files the server keeps open. If table_cache is set too high, MySQL may run out of file descriptors and refuse connections, fail to perform queries, and be very unreliable. You also have to take into account that the MyISAM storage engine needs two file descriptors for each unique open table. Please refer to this note for &lt;a href="http://databobjr.blogspot.com/2010/03/mysql-performance-tunning-server.html"&gt;connection related variable setting&lt;/a&gt;.&lt;/li&gt;&lt;li&gt;The size of the table slows down the insertion of indexes by log N, assuming B-tree indexes. &lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;div&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;2. Methods Which Can Be Used to speed up Inserts&lt;/b&gt;&amp;nbsp;&lt;/div&gt;&lt;div&gt;&lt;/div&gt;&lt;/b&gt;These are the methods which can be used to speed up inserts. You will notice that most of the methods mentions here are related to MySQL MyISAM tables. &lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;/div&gt;(1.) If you are inserting many rows from the same client at the same time, use INSERT statements with multiple VALUES lists to insert several rows at a time. This is considerably faster (many times faster in some cases) than using separate single-row INSERT statements.&lt;br /&gt;&amp;nbsp;&amp;nbsp; Insert into t1 (a,b,c,d) values (1,2,3,’2010-01-01’), (3,5,6,’2010-02-01’), (7,8,9,’2010-03-01’);&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;/div&gt;Instead of:&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;/div&gt;&amp;nbsp;&amp;nbsp; Insert into t1 (a,b,c,d) values (1,2,3,’2010-01-01’);&lt;br /&gt;&amp;nbsp;&amp;nbsp; Insert into t1 (a,b,c,d) values (3,5,6,’2010-02-01’);&lt;br /&gt;&amp;nbsp;&amp;nbsp; Insert into t1 (a,b,c,d) values (7,8,9,’2010-03-01’);&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;/div&gt;&lt;div&gt;&lt;/div&gt;(2.) If you are adding data to a nonempty table, you can tune the &lt;a href="http://databobjr.blogspot.com/2010/05/mysql-bulkinsertbuffersize-variable.html"&gt;bulk_insert_buffer_size variable&lt;/a&gt; to make data insertion even faster. &lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;/div&gt;(3.) If multiple clients are inserting a lot of rows, you can get higher speed by using the INSERT DELAYED statement. “Insert Delay” hint delays the inserts by storing the insert statements in the memory queue utile the target table is free from reads. Hence, the insert statement will return quickly and all the insert statements that are stored in the queue can be written in one block, which is more optimized that written one statement at a time. &lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;/div&gt;&lt;div style="dir: ltr align:left; display: block; float: left; height: 260px; margin: 3px; width: 310px;"&gt;&lt;script type="text/javascript"&gt;&lt;!--google_ad_client = "pub-1602461054664536";/* body-ad-300x250-created-4/21/10 */google_ad_slot = "4011047090";google_ad_width = 300;google_ad_height = 250;//--&gt;&lt;/script&gt;&lt;br /&gt;&lt;script src="http://pagead2.googlesyndication.com/pagead/show_ads.js" type="text/javascript"&gt;&lt;/script&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;/div&gt;Hear is the syntax for insert delay:&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;/div&gt;Insert delay into t1 (a,b,c,d) values (1,2,3,’2010-01-01’), (3,5,6,’2010-02-01’), (7,8,9,’2010-03-01’);&lt;br /&gt;See Section 12.2.5.2, &lt;a href="http://dev.mysql.com/doc/refman/5.1/en/insert-delayed.html"&gt;INSERT&lt;/a&gt;&lt;br /&gt;Please note that delay insert only works with MyISAM, MEMORY, ARCHIVE and BLACKHOLE(v. 5.1.19) table. And, there is downside of using “Insert Delayed”. There will be negative performance gain if the table is empty or not being used and add overhead to the server to hold additional thread for each table for which there is delayed rows, etc. Please read the manual for details on the negative impacts. &lt;br /&gt;Theses are system status variables can be used to monitor delay insert uses. Here are the Status Variable meaning:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Delayed_insert_threads -- Number of handler threads&lt;/li&gt;&lt;li&gt;Delayed_writes -- Number of rows written with INSERT DELAYED &lt;/li&gt;&lt;li&gt;Not_flushed_delayed_rows -- Number of rows waiting to be written&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&amp;nbsp;(4.) For a MyISAM table, you can use concurrent inserts to add rows at the same time that SELECT statements are running, this works well for tables that have more reads than writes because it just keeps adding data at the end of the data file. &lt;br /&gt;&lt;div&gt;&lt;/div&gt;To enable concurrent inserts, we need to set the concurrent_insert system variable. The values for the variable are:&lt;br /&gt;&lt;br /&gt;· 0 -- Disables concurrent inserts&lt;br /&gt;· 1 -- Enables concurrent insert for MyISAM tables that do not have holes. A hole means that there is free space in the data file, i.e., rows were deleted from the table. This is the default value.&lt;br /&gt;· 2 -- Enables concurrent inserts for all MyISAM tables, even those that have holes. For a table with a hole, &amp;nbsp;new rows are inserted at the end of the table if it is in use by another thread. Otherwise, MySQL acquires a normal write lock and inserts the row into the hole. &lt;br /&gt;&lt;br /&gt;To set the variable with other values (0 or 2) rather than the default value, for example concurrent_insert = 2, enter the parameter in the my.cnf file and restart the server. Or you can also dynamically set it in MySQL, for example:&lt;br /&gt;&amp;nbsp;&amp;nbsp; MySQL&amp;gt; set global concurrent_insert = 2;&lt;br /&gt;&lt;br /&gt;Here are a few things that need to keep in mind. &lt;br /&gt;&lt;br /&gt;1. ) Under circumstances where concurrent inserts can be used, there is seldom any need to use the DELAYED modifier for INSERT statements.&lt;br /&gt;2. ) If you are using the binary log, concurrent inserts are converted to normal inserts for CREATE ... SELECT or INSERT ... SELECT statements. This is done to ensure that you can re-create an exact copy of your tables by applying the log during a backup operation.&lt;br /&gt;3. ) With LOAD DATA INFILE, if you specify CONCURRENT with a MyISAM table that satisfies the condition for concurrent inserts (that is, it contains no free blocks in the middle), other sessions can retrieve data from the table while LOAD DATA is executing. &lt;br /&gt;4)Use of the CONCURRENT option affects the performance of LOAD DATA a bit, even if no other session is using the table at the same time.&lt;br /&gt;MySQL document has more information on using &lt;a href="http://dev.mysql.com/doc/refman/5.1/en/concurrent-inserts.html"&gt;concurrent inserts&lt;/a&gt;. &lt;br /&gt;(5.) Using bulk load command, LOAD DATA INFILE, to load data into a table from a text file can be 20 times faster than using INSERT statements. &lt;br /&gt;&lt;br /&gt;Updating indexes takes time and resources during inserts. When data are loaded into a table that has many indexes, we can follow the steps bellow to speed up the loads.&lt;br /&gt;&lt;br /&gt;1.) Disable the indexes&lt;br /&gt;Non unique indexes of a MyISAM table can be disabled using the following statement:&lt;br /&gt;MySQL&amp;gt; ALTER TABLE t1 DISABLE KEYS;&lt;br /&gt;The alter table disable keys statement also dose a flush table. &lt;br /&gt;2.) Load data into the table using LOAD DATA INFILE statement. This does not update any indexes and therefore is very fast. &lt;br /&gt;3.) Enable the indexes&lt;br /&gt;Indexes can be enabled using the following statement:&lt;br /&gt;&lt;br /&gt;MySQL&amp;gt; ALTER TABLE tbl_name ENABLE KEYS;&lt;br /&gt;&lt;br /&gt;Here is a note on MySQL Disable and Enable Indexes Command. &lt;br /&gt;&lt;br /&gt;http://databobjr.blogspot.com/2010/05/mysql-alter-table-disable-keys.html&lt;br /&gt;&lt;br /&gt;You can also use myisamchk --keys-used=0 -rq /path/to/db/tbl_name to disable index keys and use myisamchk -rq /path/to/db/tbl_name to enable index keys. However, if you used myisamchk to disable or enable index keys, you must issue Flush Tables statement or a mysqladmin flush-tables command. More information can be found here: http://dev.mysql.com/doc/refman/5.0/en/myisamchk.html&lt;br /&gt;. &lt;br /&gt;(6.) To increase performance for MyISAM tables, for both LOAD DATA INFILE and INSERT, enlarge the key cache by increasing the&lt;a href="http://databobjr.blogspot.com/2010/05/mysql-keybuffersize-system-variable.html"&gt; key_buffer_size system variable&lt;/a&gt;. &lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;/div&gt;&lt;strong&gt;2. SUMMARY&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;/div&gt;The methodologies mentioned above were not THE only methods that could speed up inserts nor should they be used exclusively in that orders. It requires a lot of trails and errors to have one that works for a particular environment. &lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;/div&gt;&lt;div&gt;&lt;/div&gt;&lt;strong&gt;References:&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&amp;nbsp;MySQL &lt;a href="http://dev.mysql.com/doc/refman/5.0/en/insert-speed.html"&gt;Manual: Speed of Insert Statement&lt;/a&gt;&lt;/li&gt;&lt;li&gt;Book: &lt;a href="http://www.amazon.com/High-Performance-MySQL-Optimization-Replication/dp/0596101716?ie=UTF8&amp;amp;tag=dat03-20&amp;amp;link_code=btl&amp;amp;camp=213689&amp;amp;creative=392969" target="_blank"&gt;High Performance MySQL&lt;/a&gt;&lt;img alt="" border="0" height="1" src="http://www.assoc-amazon.com/e/ir?t=dat03-20&amp;amp;l=btl&amp;amp;camp=213689&amp;amp;creative=392969&amp;amp;o=1&amp;amp;a=0596101716" style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0px; padding-bottom: 0px !important; padding-left: 0px !important; padding-right: 0px !important; padding-top: 0px !important;" width="1" /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;div&gt;&lt;script type="text/javascript"&gt;&lt;!--google_ad_client = "ca-pub-1602461054664536";/* datawarehouse-468x60-20101202 */google_ad_slot = "6357115194";google_ad_width = 468;google_ad_height = 60;//--&gt;&lt;/script&gt;&lt;br /&gt;&lt;script src="http://pagead2.googlesyndication.com/pagead/show_ads.js" type="text/javascript"&gt;&lt;/script&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/22611914-4053844462532357446?l=databobjr.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://databobjr.blogspot.com/feeds/4053844462532357446/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=22611914&amp;postID=4053844462532357446' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/22611914/posts/default/4053844462532357446'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/22611914/posts/default/4053844462532357446'/><link rel='alternate' type='text/html' href='http://databobjr.blogspot.com/2010/10/mysql-speepup-insert-into-myisam-table.html' title='MYSQL SPEEPUP INSERT INTO A MYISAM TABLE'/><author><name>Data Bob Jr.</name><uri>http://www.blogger.com/profile/11965565939904347208</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-22611914.post-8048334453903763804</id><published>2010-10-21T00:25:00.000-07:00</published><updated>2010-11-06T21:39:02.278-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='MySQL'/><category scheme='http://www.blogger.com/atom/ns#' term='MySQL Performance Tuning: System Variables'/><category scheme='http://www.blogger.com/atom/ns#' term='MySQL Performance Tuning'/><category scheme='http://www.blogger.com/atom/ns#' term='MySQL DBA'/><title type='text'>MySQL Thread States Repair By Sorting Vs. Repair With Key Cache</title><content type='html'>When perform any of the REPAIR, ALTER or LOAD or ENABLE KEYS command on a MyISAM table, it also causes the rebuilding of the indexes. Indexes are rebuilt (repaired) in two modes:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&amp;nbsp;Repair by sorting -- The repair code is using a sort to create indexes. &lt;/li&gt;&lt;li&gt;&amp;nbsp;Repair using keycache -- The repair code is using creating keys one by one through the key cache. This is much slower than Repair by sorting. &lt;/li&gt;&lt;/ul&gt;To start repairing, first it tests if the table can be repaired by sorting provided it meets the following requirements: &lt;br /&gt;&lt;ul&gt;&lt;li&gt;&amp;nbsp;&amp;nbsp;Table at least has one key&amp;nbsp;&lt;/li&gt;&lt;li&gt;&amp;nbsp; Total size needed for individual key is less than myisam_max_sort_file_size &lt;/li&gt;&lt;/ul&gt;&lt;div&gt;If it meets the above requirements, then it uses either regular sorting if myisam_repair_threads = 1 (default) by building each key at a time or in parallel if myisam_repair_threads &amp;gt; 1 by using ‘n’ threads in parallel (n = total keys in the table). &lt;/div&gt;&amp;nbsp; &lt;br /&gt;If it fails to satisfy the above conditions, then it falls to expensive keycache repair mode. &lt;br /&gt;&lt;br /&gt;Therefore, to avoid keycache repair, set the myisam_max_sort_file_size to the max index size.&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;strong&gt;&amp;nbsp;Related Note:&lt;/strong&gt;&lt;/div&gt;&lt;ul&gt;&lt;li&gt;&lt;strong&gt;&amp;nbsp;&lt;a href="http://databobjr.blogspot.com/search/label/MySQL%20Performance%20Tuning%3A%20System%20Variables"&gt;MyISAM_MAX_SORT_FILE_SIZE Variable&lt;/a&gt;&lt;/strong&gt;&lt;/li&gt;&lt;/ul&gt;&lt;strong&gt;References:&lt;/strong&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;MySQL Manual: &lt;a href="http://dev.mysql.com/doc/refman/5.0/en/general-thread-states.html"&gt;&lt;span style="font-size: small;"&gt;General Thread States&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;&lt;li&gt;Book:&lt;a href="http://www.amazon.com/High-Performance-MySQL-Optimization-Replication/dp/0596101716?ie=UTF8&amp;amp;tag=dat03-20&amp;amp;link_code=btl&amp;amp;camp=213689&amp;amp;creative=392969" target="_blank"&gt;High Performance MySQL&lt;/a&gt;&lt;a href="http://www.google.com/cse?cx=partner-pub-1602461054664536%3Aghaimtmraz9&amp;amp;ie=ISO-8859-1&amp;amp;q=MySQL+Index+Creation%3A+Repair+By+Sorting+Vs.+Repair+With+Key+Cache&amp;amp;sa=Search"&gt;&lt;img alt="" border="0" height="1" src="http://www.assoc-amazon.com/e/ir?t=dat03-20&amp;amp;l=btl&amp;amp;camp=213689&amp;amp;creative=392969&amp;amp;o=1&amp;amp;a=0596101716" style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0px; padding-bottom: 0px !important; padding-left: 0px !important; padding-right: 0px !important; padding-top: 0px !important;" width="1" /&gt;&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.google.com/cse?cx=partner-pub-1602461054664536%3Aghaimtmraz9&amp;amp;ie=ISO-8859-1&amp;amp;q=MySQL+Index+Creation%3A+Repair+By+Sorting+Vs.+Repair+With+Key+Cache&amp;amp;sa=Search"&gt;Other reference on the web&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;script type="text/javascript"&gt;&lt;!--amazon_ad_tag = "dat03-20"; amazon_ad_width = "468"; amazon_ad_height = "60";//--&gt;&lt;/script&gt;&lt;br /&gt;&lt;script src="http://www.assoc-amazon.com/s/ads.js" type="text/javascript"&gt;&lt;/script&gt;&lt;br /&gt;&lt;script type="text/javascript"&gt;&lt;!--google_ad_client = "pub-1602461054664536";/* mysqladmin-fooder-banner-468x60-20100503 */google_ad_slot = "9515648953";google_ad_width = 468;google_ad_height = 60;//--&gt;&lt;/script&gt;&lt;br /&gt;&lt;script src="http://pagead2.googlesyndication.com/pagead/show_ads.js" type="text/javascript"&gt;&lt;/script&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/22611914-8048334453903763804?l=databobjr.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://databobjr.blogspot.com/feeds/8048334453903763804/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=22611914&amp;postID=8048334453903763804' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/22611914/posts/default/8048334453903763804'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/22611914/posts/default/8048334453903763804'/><link rel='alternate' type='text/html' href='http://databobjr.blogspot.com/2010/10/mysql-index-creation-repair-by-sorting.html' title='MySQL Thread States Repair By Sorting Vs. Repair With Key Cache'/><author><name>Data Bob Jr.</name><uri>http://www.blogger.com/profile/11965565939904347208</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-22611914.post-3375885130391300367</id><published>2010-09-29T22:47:00.000-07:00</published><updated>2010-10-21T00:36:23.381-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Data and Information'/><category scheme='http://www.blogger.com/atom/ns#' term='Oracle'/><title type='text'>Cloud Computing</title><content type='html'>During Oracle OpenWorld 2010, both Larry Ellison, CEO, Oracle and Marc Benioff, CEO, Salesforce.com gave their views on Cloud Computing. Very interesting indeed.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Here is Larry Ellison:&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;&lt;object width="560" height="340"&gt;&lt;param name="movie" value="http://www.youtube.com/v/tWB0fR-buJ4?fs=1&amp;amp;hl=en_US&amp;amp;rel=0&amp;amp;color1=0x234900&amp;amp;color2=0x4e9e00"&gt;&lt;/param&gt;&lt;param name="allowFullScreen" value="true"&gt;&lt;/param&gt;&lt;param name="allowscriptaccess" value="always"&gt;&lt;/param&gt;&lt;embed src="http://www.youtube.com/v/tWB0fR-buJ4?fs=1&amp;amp;hl=en_US&amp;amp;rel=0&amp;amp;color1=0x234900&amp;amp;color2=0x4e9e00" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="560" height="340"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Here is Marc Benioff:&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;&lt;object width="560" height="340"&gt;&lt;param name="movie" value="http://www.youtube.com/v/k810C1cY4Rc?fs=1&amp;amp;hl=en_US&amp;amp;rel=0&amp;amp;color1=0x234900&amp;amp;color2=0x4e9e00"&gt;&lt;/param&gt;&lt;param name="allowFullScreen" value="true"&gt;&lt;/param&gt;&lt;param name="allowscriptaccess" value="always"&gt;&lt;/param&gt;&lt;embed src="http://www.youtube.com/v/k810C1cY4Rc?fs=1&amp;amp;hl=en_US&amp;amp;rel=0&amp;amp;color1=0x234900&amp;amp;color2=0x4e9e00" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="560" height="340"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;br /&gt;&lt;br /&gt;&lt;script type="text/javascript"&gt;&lt;!--amazon_ad_tag = "dat03-20"; amazon_ad_width = "468"; amazon_ad_height = "60";//--&gt;&lt;/script&gt;&lt;br /&gt;&lt;script type="text/javascript" src="http://www.assoc-amazon.com/s/ads.js"&gt;&lt;/script&gt;&lt;br /&gt;&lt;script type="text/javascript"&gt;&lt;!--google_ad_client = "pub-1602461054664536";/* oracledba-fooder-banner-468x60-20100511 */google_ad_slot = "5574621840";google_ad_width = 468;google_ad_height = 60;//--&gt;&lt;/script&gt;&lt;br /&gt;&lt;script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"&gt;&lt;/script&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/22611914-3375885130391300367?l=databobjr.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://databobjr.blogspot.com/feeds/3375885130391300367/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=22611914&amp;postID=3375885130391300367' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/22611914/posts/default/3375885130391300367'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/22611914/posts/default/3375885130391300367'/><link rel='alternate' type='text/html' href='http://databobjr.blogspot.com/2010/09/cloud-computing.html' title='Cloud Computing'/><author><name>Data Bob Jr.</name><uri>http://www.blogger.com/profile/11965565939904347208</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-22611914.post-1766946575487301261</id><published>2010-09-18T07:28:00.000-07:00</published><updated>2010-10-24T17:20:41.544-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Oracle Data Warehouse'/><category scheme='http://www.blogger.com/atom/ns#' term='Oracle DBA'/><category scheme='http://www.blogger.com/atom/ns#' term='Oracle'/><title type='text'>Setup Oracle Physical Standby Database Using Dataguard On Linux</title><content type='html'>&lt;b&gt;1. INTRODUCTION&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;This document summarizes the steps of creating an Oracle Physical Standby Database on Linux servers using Oracle Data Guard features. Oracle 10g Data Guard supports both Logical and Physical Standby databases. &lt;br /&gt;&lt;br /&gt;The database version that is used here is 10.2.0.3. The Primary database server is pcdb-1.databob.net and Standby database server is pcdb-2.databob.net.The Primary database (db_name) is called PCDB and the Standby database is called PCDBS. &lt;br /&gt;Oracle 10g documentation regarding Data Guard Physical Standby Database can be found here:&lt;br /&gt;http://download.oracle.com/docs/cd/B19306_01/server.102/b14239/create_ps.htm&lt;br /&gt;&lt;br /&gt;&lt;div style="display: block; float: right; height: 260px; margin: 3px; width: 310px;"&gt;&lt;script type="text/javascript"&gt;&lt;!--google_ad_client = "pub-1602461054664536";/* body-ad-300x250-created-4/21/10 */google_ad_slot = "4011047090";google_ad_width = 300;google_ad_height = 250;//--&gt;&lt;/script&gt;&lt;br /&gt;&lt;script src="http://pagead2.googlesyndication.com/pagead/show_ads.js" type="text/javascript"&gt;&lt;/script&gt;&lt;/div&gt;&lt;b&gt;2. CONFIGURATIONS&lt;/b&gt;&lt;br /&gt;&lt;b&gt;2.1 Prerequisites&lt;/b&gt;&lt;br /&gt;Following are the prerequisites need to be met before creating the standby database.&lt;br /&gt;&lt;br /&gt;1. Make sure that the operating system and platform architecture on the primary and standby systems are the same. Oracle user was created in both servers and ssh is configured for Oracle user on both servers&lt;br /&gt;2. Install Oracle database software on the standby server and patch it if necessary. We are using Oracle 10g, release 10.2.0.3. Make sure the same Oracle software release is used on the Primary and Standby databases server, and Oracle home paths are identical on both servers. &lt;br /&gt;3. Test the Standby Database creation and make sure the server was installed properly. Also make sure that all the directories for data and logs are the same on both servers.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;2.2 Planning&lt;/b&gt;&lt;br /&gt;During the configuration processes, it requires restarting the primary database, creating backup copy of data and log files in the primary database, and restoring them in the standby database. Therefore, if the primary database is a production database, proper planning is needed to limit downtime. &lt;br /&gt;&lt;br /&gt;Also, this document separates primary and standby database configuration tasks for clarity reason. In fact, some of these steps can be rearranged to limit database downtime.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;2.3 Configure Primary Database Server, pcdb-1.databob.net &lt;/b&gt;&lt;br /&gt;Before you create a standby database you must first ensure the primary database is properly configured. After the primary database is set up and running, these are additional configuration tasks need to complete:&lt;br /&gt;&lt;br /&gt;1. Enable Forced Logging&lt;br /&gt;2. Create a Password File&lt;br /&gt;3. Configure a Standby Redo Log&lt;br /&gt;4. Enable Archiving&lt;br /&gt;5. Set Additional Primary Database Initialization Parameters&lt;br /&gt;&lt;br /&gt;Please note that during the configuration processes, it requires to restart the primary database. Proper planning is needed to reduce down time if the primary database is already in production.&lt;br /&gt;&lt;br /&gt;You need to be the Oracle sys user to perform most the configuration tasks. To become the sys user, do the following:&lt;br /&gt;&lt;br /&gt;#&amp;gt; sqlplus /nolog&lt;br /&gt;SQL&amp;gt;connect sys/password as sysdba&lt;br /&gt;&lt;br /&gt;Following are steps to configure Primary Database&lt;br /&gt;&lt;br /&gt;&lt;b&gt;1. Enable forced logging on your primary database:&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;SQL&amp;gt; ALTER DATABASE FORCE LOGGING;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;2. Create a password file if it doesn’t exist.&lt;/b&gt;&lt;br /&gt;Create a password file if it dose not exist. Every database in a Data Guard configuration must use a password file, and the password for the SYS user must be identical on every system for redo data transmission to succeed.&lt;br /&gt;&lt;br /&gt;1) To check if a password file already exists, run the following command:&lt;br /&gt;&lt;br /&gt;SQL&amp;gt; select * from v$pwfile_users;&lt;br /&gt;no rows selected&lt;br /&gt;2) Create an Oracle password file in Linux:&lt;br /&gt;Password files are created with the Oracle orapwd tool which is located in $ORACLE_HOME/bin directory. To create the password file, execute the following commands:&lt;br /&gt;#&amp;gt;cd $ORACLE_HOME/bin&lt;br /&gt;#&amp;gt;./orapwd file=/u0/oracle/product/10.2.0/db_1/dbs/orapwPCDB password=&lt;password&gt; force=y&lt;br /&gt;&lt;br /&gt;Replace &lt;password&gt;with the password of the SYS user. The password file needs to be named exactly in orapw&lt;sid&gt; format in Linux. For example, if the sid is ‘PCDB’ then the password file name needs to be named as orapwPCDB.&lt;br /&gt;The password file is located in $ORACLE_HOME/dbs directory.&lt;br /&gt;3) Check again if the password file was created and perform the following query. You should get the same result as show bellow for sys user.&lt;br /&gt;SQL&amp;gt; select * from v$pwfile_users;&lt;br /&gt;&lt;br /&gt;USERNAME SYSDBA SYSOPER&lt;br /&gt;-----------------------------------------&lt;br /&gt;SYS TRUE TRUE&lt;br /&gt;&lt;br /&gt;&lt;b&gt;3. Configure a Standby Redo log.&lt;/b&gt;&lt;br /&gt;1) The size of the standby redo log files should match the size of the current Primary database online redo log files. To find out the size of your online redo log files, run the following query:&lt;br /&gt;&lt;br /&gt;SQL&amp;gt; select bytes from v$log;&lt;br /&gt;BYTES&lt;br /&gt;--------------&lt;br /&gt;10485760&lt;br /&gt;10485760&lt;br /&gt;10485760&lt;br /&gt;2) Use the following command to determine your current log file groups: &lt;br /&gt;SQL&amp;gt; select group#, member from v$logfile:&lt;br /&gt;GROUP# MEMBER&lt;br /&gt;--------------------------------------------------------------------------------&lt;br /&gt;1 /u0/oracle/log/PCDB/redo/PCDB_redo01_01.log&lt;br /&gt;2 /u0/oracle/log/PCDB/redo/PCDB_redo02_01.log&lt;br /&gt;3 /u0/oracle/log/PCDB/redo/PCDB_redo03_01.log&lt;br /&gt;&lt;br /&gt;3) Create standby Redo log groups.&lt;br /&gt;Data Guard can recover and apply more redo data from a standby redo log than from archived redo log files alone. Here, we are going to create same number log groups for standby log as of data redo log group.&lt;br /&gt;Before creating the standby log groups, please make sure that:&lt;br /&gt;• log file sizes are identical on the primary and standby databases.&lt;br /&gt;The size of the current standby redo log files must exactly match the size of the current primary database online redo log files.&lt;br /&gt;• Verify related database parameters and settings.&lt;br /&gt;Verify the values used for the MAXLOGFILES and MAXLOGMEMBERS clauses on the SQL CREATE DATABASE statement will not limit the number of standby redo log file groups and members that you can add. The only way to override the limits specified by the MAXLOGFILES and MAXLOGMEMBERS clauses is to re-create the primary database or control file.&lt;br /&gt;To create the standby log groups, user the following commands:&lt;br /&gt;&lt;br /&gt;SQL&amp;gt;ALTER DATABASE ADD STANDBY LOGFILE GROUP 4 SIZE 10M;&lt;br /&gt;SQL&amp;gt;ALTER DATABASE ADD STANDBY LOGFILE GROUP 5 SIZE 10M;&lt;br /&gt;SQL&amp;gt;ALTER DATABASE ADD STANDBY LOGFILE GROUP 6 SIZE 10M;&lt;br /&gt;4) To verify the results of the standby redo log groups creation, run the following query:&lt;br /&gt;SQL&amp;gt; SELECT GROUP#,THREAD#,SEQUENCE#,ARCHIVED,STATUS FROM V$STANDBY_LOG;&lt;br /&gt;GROUP# THREAD# SEQUENCE# ARCHIVED STATUS&lt;br /&gt;---------- ---------- ---------- --------- ------------------------------&lt;br /&gt;4 0 0 YES UNASSIGNED&lt;br /&gt;5 0 0 YES UNASSIGNED&lt;br /&gt;6 0 0 YES UNASSIGNED&lt;br /&gt;&lt;br /&gt;&lt;b&gt;4. Set Primary Database Initialization Parameters&lt;/b&gt;&lt;br /&gt;Add (or edit) the following parameters to pFile, initPCDB.ora if they are not already in the pFile. If a pFile dose not exist, you can use the following command to create one from the existing spFile:&lt;br /&gt;SQL&amp;gt;create pfile=’&amp;lt;$ORACLE_HOME&amp;gt;/dbs/initPCDB.ora’ from spfile;&lt;br /&gt;(Note: replace oracle home with the full path.).&lt;br /&gt;Add and verify if the following parameters are in the pFile, initPCDB.ora:&lt;br /&gt;db_name=PCDB&lt;br /&gt;db_unique_name=PCDB&lt;br /&gt;LOG_ARCHIVE_CONFIG='DG_CONFIG=(PCDB,PCDBS)'&lt;br /&gt;LOG_ARCHIVE_DEST_1=&lt;br /&gt;'LOCATION=/u0/oracle/log/PCDB/arch VALID_FOR=(ALL_LOGFILES,ALL_ROLES)&lt;br /&gt;DB_UNIQUE_NAME=PCDB'&lt;br /&gt;LOG_ARCHIVE_DEST_2=&lt;br /&gt;'SERVICE=PCDBS LGWR ASYNC&lt;br /&gt;VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE)&lt;br /&gt;DB_UNIQUE_NAME=PCDBS'&lt;br /&gt;LOG_ARCHIVE_DEST_STATE_1=ENABLE&lt;br /&gt;LOG_ARCHIVE_DEST_STATE_2=ENABLE&lt;br /&gt;LOG_ARCHIVE_FORMAT=%t_%s_%r.arc&lt;br /&gt;LOG_ARCHIVE_MAX_PROCESSES=30&lt;br /&gt;remote_login_passwordfile='EXCLUSIVE'&lt;br /&gt;FAL_SERVER=PCDBS&lt;br /&gt;FAL_CLIENT=PCDB&lt;br /&gt;STANDBY_FILE_MANAGEMENT=AUTO&lt;br /&gt;# Specify the location of the standby DB datafiles followed by the primary location;&lt;br /&gt;DB_FILE_NAME_CONVERT=/u0/oracle/data/PCDB/data/datafile','/u0/oracle/data/PCDB/data/datafile'&lt;br /&gt;# Specify the location of the standby DB online redo log files followed by the primary location LOG_FILE_NAME_CONVERT=‘/u0/oracle/data/PCDB/onlinelog’, ‘/u0/oracle/data/PCDB/onlinelog’&lt;/sid&gt;&lt;/password&gt;&lt;/password&gt;&lt;br /&gt;&lt;password&gt;&lt;password&gt;&lt;sid&gt;&lt;br /&gt;&lt;b&gt;5. Create spfile from pfile, and restart primary database using the new spfile and enable archive log.&lt;/b&gt;&lt;br /&gt;Data Guard must use SPFILE. Create the SPFILE and restart database.&lt;br /&gt;SQL&amp;gt; shutdown immediate;&lt;br /&gt;SQL&amp;gt;create spfile from pfile=’/u0/oracle/admin/PCDB/scripts/initPCDB.ora’;&lt;/sid&gt;&lt;/password&gt;&lt;/password&gt;&lt;br /&gt;&lt;password&gt;&lt;password&gt;&lt;sid&gt;&lt;b&gt;&lt;br /&gt;6. Create a Control File for the standby database:&lt;/b&gt;&lt;br /&gt;On Primary DB, create a control file for the standby to use:&lt;br /&gt;SQL&amp;gt;startup mount;&lt;br /&gt;SQL&amp;gt;alter database create standby controlfile as ‘/u0/oracle/log/PCDB/ctl/control-PCDBS-103.ctl’;&lt;br /&gt;Database altered.&lt;/sid&gt;&lt;/password&gt;&lt;/password&gt;&lt;br /&gt;&lt;password&gt;&lt;password&gt;&lt;sid&gt;&lt;br /&gt;&lt;b&gt;7. Make a backup copy of the primary database data file.&lt;/b&gt;&lt;br /&gt;1) If the database is running, shutdown it.&lt;br /&gt;SQL&amp;gt;shutdown immediate;&lt;br /&gt;2) Make a copy of the data files and temp files and online log files and scp them over to the standby database server.&lt;br /&gt;You can copy the file manually or follow the following steps to create scp scripts:&lt;br /&gt;SQL&amp;gt; set pages 50000 lines 300 head off veri off flush off ti off&lt;br /&gt;SQL&amp;gt; spool ‘/tmp/cpfiles_prim.sh’&lt;br /&gt;SQL&amp;gt; select 'scp -p '||file_name||' ${stan_host}:’||file_name from dba_data_files;&lt;br /&gt;SQL&amp;gt; select 'scp -p '||file_name||' ${stan_host}:’||file_name from dba_temp_files;&lt;br /&gt;SQL&amp;gt; select 'scp -p '||member||' ${stan_host}:’||file_name from v$logfile;&lt;br /&gt;SQL&amp;gt; spool off;&lt;br /&gt;Edit the file /tmp/cpfiles_prim.sh to define the ${stan_host} variable. To do so, add these tow lines to the top of the script:&lt;br /&gt;#!/bin/bash&lt;br /&gt;stan_host=&lt;hostname ip="" or=""&gt;&lt;br /&gt;&lt;br /&gt;Replace hostname with the hostname or IP address for the standby server.&lt;br /&gt;#&amp;gt;/tmp/cpfiles_prim.sh&lt;br /&gt;#!/bin/bash&lt;br /&gt;stan_host= pcdb-2.databob.net &lt;br /&gt;scp -p /u0/oracle/data/PCDB/sys/datafile/PCDB_system.dbf ${stan_host}:/u0/oracle/data/PCDB/sys/datafile/PCDB_system.dbf &lt;br /&gt;…..&lt;br /&gt;Execute the script, /tmp/cpfiles_prim.sh, to scp the file over to the standby database server. Note, depend on the files size and the network traffic, it may take some time. Therefore, you may want to change script to copy the files to a temp directory is the primary server, tar and gzip the files and scp the gziped files to the standby server. Then, copy the files to the pproper directories. &lt;br /&gt;&lt;br /&gt;Before copying the files, verify that standby server file system setting are the same as the primary server. This means that all the directories need to be the same.&lt;br /&gt;#&amp;gt;chomd 766 /tmp/cpfiles_prim.sh&lt;br /&gt;#&amp;gt;./tmp/cpfiles_prim.sh&lt;br /&gt;3)Copy the standby control file that was generated in step 6 above to the /tmp directory in the standby server&lt;br /&gt;#&amp;gt;scp ‘/u0/oracle/log/PCDB/ctl/control-PCDBS-103.ctl’ standby_server:/tmp&lt;/hostname&gt;&lt;/sid&gt;&lt;/password&gt;&lt;/password&gt;&lt;br /&gt;&lt;password&gt;&lt;password&gt;&lt;sid&gt;&lt;hostname ip="" or=""&gt;&lt;br /&gt;&lt;b&gt;8. Restart the Primary database using the newly created spfile and enable archive log.&lt;/b&gt;&lt;br /&gt;SQL&amp;gt;Startup mount;&lt;br /&gt;SQL&amp;gt;alter database archivelog;&lt;br /&gt;SQL&amp;gt;alter database open;&lt;br /&gt;SQL&amp;gt;archive log list;&lt;br /&gt;Database log mode Archive Mode&lt;br /&gt;Automatic archival Enabled&lt;br /&gt;Archive destination /u0/oracle/log/PCDB/arch&lt;br /&gt;Oldest online log sequence 343&lt;br /&gt;Next log sequence to archive 345&lt;br /&gt;Current log sequence 345&lt;br /&gt;SQL&amp;gt;&lt;/hostname&gt;&lt;/sid&gt;&lt;/password&gt;&lt;/password&gt;&lt;br /&gt;&lt;password&gt;&lt;password&gt;&lt;sid&gt;&lt;hostname ip="" or=""&gt;&lt;br /&gt;Now the primary database is setup for transmitting data to standby database server. &lt;br /&gt;&lt;b&gt;&lt;br /&gt;2.4 Configure Standby Database Server, pcdb-2.databob.net &lt;/b&gt;&lt;br /&gt;To configure the standby database server, pcdb-2 , db_unique_name PCDBS, these configuration tasks need to complete:&lt;br /&gt;&lt;br /&gt;1. Create a Control File for the Standby Database&lt;br /&gt;2. Backup the Primary Database and transfer a copy to the Standby node.&lt;br /&gt;3. Prepare an Initialization Parameter File for the Standby Database&lt;br /&gt;4. Configure the listener and tnsnames to support the database on both nodes&lt;br /&gt;5. Set Up the Environment to Support the Standby Database on the standby node.&lt;br /&gt;6. Start the Physical Standby Database&lt;br /&gt;7. Verify the Physical Standby Database Is Performing Properly&lt;br /&gt;&lt;br /&gt;Following are steps to configure Standby Database.&lt;br /&gt;&lt;/hostname&gt;&lt;/sid&gt;&lt;/password&gt;&lt;/password&gt;&lt;br /&gt;&lt;div style="display: block; float: right; height: 260px; margin: 3px; width: 310px;"&gt;&lt;script type="text/javascript"&gt;&lt;!--google_ad_client = "pub-1602461054664536";/* oracledba-body-upright-300x250-20100511 */google_ad_slot = "9765500328";google_ad_width = 300;google_ad_height = 250;//--&gt;&lt;/script&gt;&lt;br /&gt;&lt;script src="http://pagead2.googlesyndication.com/pagead/show_ads.js" type="text/javascript"&gt;&lt;/script&gt;&lt;/div&gt;&lt;b&gt;1. Install the Primary database data files on the Standby Server:&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;If you had not copy the data files which you created in section 2.3, step 7, please do so to copy the files to the proper directories from the backup copy.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;2. Copy the Primary DB pfile to Standby server and &lt;/b&gt;rename/edit the file.&lt;br /&gt;1) Copy initPCDB.ora from Primary server to Standby server, &lt;br /&gt;2) Rename it to initPCDBS.ora, and modify the file as follow. &lt;br /&gt;Note that most the parameters here do not need to change since they will be the same as those mentioned in section 2.3, step 4.&lt;br /&gt;*.audit_file_dest=/u0/oracle/admin/PCDB/adump&lt;br /&gt;*.background_dump_dest=/u0/oracle/admin/PCDB/bdump&lt;br /&gt;*.core_dump_dest=/u0/oracle/admin/PCDB/cdump&lt;br /&gt;*.user_dump_dest=/u0/oracle/admin/PCDB/udump&lt;br /&gt;*.compatible='10.2.0.3.0'&lt;br /&gt;control_files = (/u0/oracle/admin/PCDB/pfile/control-PCDB-101.ctl,&lt;br /&gt;/u0/oracle/backup/PCDB/ctl/control-PCDB-102.ctl,&lt;br /&gt;/u0/oracle/log/PCDB/ctl/control-PCDB-103.ctl)&lt;br /&gt;db_name='PCDB'&lt;br /&gt;db_unique_name=PCDBS&lt;br /&gt;LOG_ARCHIVE_CONFIG='DG_CONFIG=(PCDB,PCDBS)'&lt;br /&gt;LOG_ARCHIVE_DEST_1=&lt;br /&gt;'LOCATION=/u0/oracle/log/PCDB/arch VALID_FOR=(ALL_LOGFILES,ALL_ROLES)&lt;br /&gt;DB_UNIQUE_NAME=PCDBS'&lt;br /&gt;LOG_ARCHIVE_DEST_2=&lt;br /&gt;'SERVICE=PCDBS LGWR ASYNC&lt;br /&gt;VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE)&lt;br /&gt;DB_UNIQUE_NAME=PCDB'&lt;br /&gt;LOG_ARCHIVE_DEST_STATE_1=ENABLE&lt;br /&gt;LOG_ARCHIVE_DEST_STATE_2=ENABLE&lt;br /&gt;LOG_ARCHIVE_FORMAT=%t_%s_%r.arc&lt;br /&gt;LOG_ARCHIVE_MAX_PROCESSES=30&lt;br /&gt;remote_login_passwordfile='EXCLUSIVE'&lt;br /&gt;FAL_SERVER=PCDBS&lt;br /&gt;FAL_CLIENT=PCDB&lt;br /&gt;STANDBY_FILE_MANAGEMENT=AUTO&lt;br /&gt;# Specify the location of the standby DB datafiles followed by the primary location;&lt;br /&gt;DB_FILE_NAME_CONVERT=/u0/oracle/data/PCDB/data/datafile','/u0/oracle/data/PCDB/data/datafile'&lt;br /&gt;# Specify the location of the standby DB online redo log files followed by the primary location LOG_FILE_NAME_CONVERT=‘/u0/oracle/data/PCDB/onlinelog’, ‘/u0/oracle/data/PCDB/onlinelog’&lt;br /&gt;&lt;br /&gt;&lt;b&gt;3 Copy the standby control file,which was scp’ed over from the primary server in section 2.3, step 7&lt;/b&gt;&lt;br /&gt;to the following directories and filename ;&lt;br /&gt;/u0/oracle/admin/PCDB/pfile/control-PCDB-101.ctl,&lt;br /&gt;/u0/oracle/backup/PCDB/ctl/control-PCDB-102.ctl,&lt;br /&gt;/u0/oracle/log/PCDB/ctl/control-PCDB-103.ctl&lt;br /&gt;&lt;br /&gt;#&amp;gt;cp /tmp/control-PCDBS-103.ctl /u0/oracle/admin/PCDB/pfile/control-PCDB-101.ctl&lt;br /&gt;#&amp;gt;cp /tmp/control-PCDBS-103.ctl /u0/oracle/backup/PCDB/ctl/control-PCDB-102.ctl&lt;br /&gt;#&amp;gt;cp /tmp/control-PCDBS-103.ctl /u0/oracle/log/PCDB/ctl/control-PCDB-103.ctl&lt;br /&gt;&lt;br /&gt;&lt;b&gt;4. Create the password file for the standby server.&lt;/b&gt;&lt;br /&gt;#&amp;gt;cd $ORACLE_HOME/bin&lt;br /&gt;#&amp;gt;./orapwd file=/u0/oracle/product/10.2.0/db_1/dbs/orapwPCDBS password=&lt;password&gt; force=y&lt;br /&gt;&lt;br /&gt;&lt;b&gt;5. Configure listeners for both the primary and standby databases.&lt;/b&gt;&lt;br /&gt;Create or edit the listener.ora files on both primary and standby server. By default, the listener.ora file is located in the $ORACLE_HOME/network/admin directory.&lt;br /&gt;1) On Primary server, pcdb-1, edit the listener.ora file for PCDB (primary) and PCDBS(standby). &lt;br /&gt;# On primacy server, pcdb-1, PCDB&lt;br /&gt;LISTENER_PCDB =&lt;br /&gt;(DESCRIPTION_LIST =&lt;br /&gt;(DESCRIPTION =&lt;br /&gt;(ADDRESS = (PROTOCOL = TCP)(HOST = pcdb-1)(PORT = 1521)(IP = FIRST))&lt;br /&gt;)&lt;br /&gt;)&lt;br /&gt;SID_LIST_LISTENER_PCDB =&lt;br /&gt;(SID_LIST =&lt;br /&gt;(SID_DESC =&lt;br /&gt;(GLOBAL_DBNAME = PCDB)&lt;br /&gt;(ORACLE_HOME = /u0/oracle/product/10.2.0/db_1)&lt;br /&gt;(SID_NAME = PCDB)&lt;br /&gt;)&lt;br /&gt;)&lt;br /&gt;2) On Standby server, pcdb-2, edit the listener.ora file for PCDBS(standby). &lt;br /&gt;# On primacy server, pcdb-2, PCDBS&lt;br /&gt;LISTENER_PCDBS =&lt;br /&gt;(DESCRIPTION_LIST =&lt;br /&gt;(DESCRIPTION =&lt;br /&gt;(ADDRESS = (PROTOCOL = TCP)(HOST = pcdb-2)(PORT = 1521)(IP = FIRST))&lt;br /&gt;)&lt;br /&gt;)&lt;br /&gt;SID_LIST_LISTENER_PCDBS =&lt;br /&gt;(SID_LIST =&lt;br /&gt;(SID_DESC =&lt;br /&gt;(GLOBAL_DBNAME = PCDBS)&lt;br /&gt;(ORACLE_HOME = /u0/oracle/product/10.2.0/db_1)&lt;br /&gt;(SID_NAME = PCDBS)&lt;br /&gt;)&lt;br /&gt;)&lt;br /&gt;&lt;br /&gt;&lt;b&gt;6. Configure Oracle Net service names for both primary and standby servers.&lt;/b&gt;&lt;br /&gt;&lt;!-- body ad, 300x260 image only --&gt;&lt;br /&gt;&lt;div style="dir: ltr align:left; display: block; float:right; height: 602px; margin: 3px; width: 162px;"&gt;&lt;iframe src="http://rcm.amazon.com/e/cm?t=dat03-20&amp;o=1&amp;p=14&amp;l=bn1&amp;mode=kindle&amp;browse=133140011&amp;fc1=000000&amp;lt1=&amp;lc1=3366FF&amp;bg1=FFFFFF&amp;f=ifr" marginwidth="0" marginheight="0" width="160" height="600" border="0" frameborder="0" style="border:none;" scrolling="no"&gt;&lt;/iframe&gt;&lt;br /&gt;&lt;/div&gt;Configure tnsnames.ora on both servers to hold entries for both databases. By default, the listener.ora file is located in the $ORACLE_HOME/network/admin directory.&lt;br /&gt;1) On Primary database server, pcdb-1, edit the tnsnames.ora &lt;br /&gt;LISTENER_PCDB =&lt;br /&gt;(DESCRIPTION_LIST =&lt;br /&gt;(DESCRIPTION =&lt;br /&gt;(ADDRESS = (PROTOCOL = TCP)(HOST = pcdb-1)(PORT = 1521)(IP = FIRST))&lt;br /&gt;)&lt;br /&gt;)&lt;br /&gt;&lt;br /&gt;PCDB =&lt;br /&gt;(DESCRIPTION =&lt;br /&gt;(ADDRESS = (PROTOCOL = TCP)(HOST = pcdb-1)(PORT = 1521))&lt;br /&gt;(CONNECT_DATA =&lt;br /&gt;(SERVER = DEDICATED)&lt;br /&gt;(SERVICE_NAME = PCDB)&lt;br /&gt;)&lt;br /&gt;)&lt;br /&gt;PCDBS =&lt;br /&gt;(DESCRIPTION =&lt;br /&gt;(ADDRESS = (PROTOCOL = TCP)(HOST =pcdb-2)(PORT = 1521))&lt;br /&gt;(CONNECT_DATA =&lt;br /&gt;(SERVER = DEDICATED)&lt;br /&gt;(SERVICE_NAME = PCDB)&lt;br /&gt;)&lt;br /&gt;)&lt;br /&gt;&lt;br /&gt;EXTPROC_CONNECTION_DATA =&lt;br /&gt;(DESCRIPTION =&lt;br /&gt;(ADDRESS_LIST =&lt;br /&gt;(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))&lt;br /&gt;)&lt;br /&gt;(CONNECT_DATA =&lt;br /&gt;(SID = PLSExtProc)&lt;br /&gt;(PRESENTATION = RO)&lt;br /&gt;)&lt;br /&gt;)&lt;br /&gt;2) On Standby server, pcdb-2, edit the tnsnames.ora &lt;br /&gt;LISTENER_PCDBS=&lt;br /&gt;(DESCRIPTION_LIST =&lt;br /&gt;(DESCRIPTION =&lt;br /&gt;(ADDRESS = (PROTOCOL = TCP)(HOST = pcdb-2)(PORT = 1521)(IP = FIRST))&lt;br /&gt;)&lt;br /&gt;)&lt;br /&gt;&lt;br /&gt;PCDB =&lt;br /&gt;(DESCRIPTION =&lt;br /&gt;(ADDRESS = (PROTOCOL = TCP)(HOST = pcdb-1)(PORT = 1521))&lt;br /&gt;(CONNECT_DATA =&lt;br /&gt;(SERVER = DEDICATED)&lt;br /&gt;(SERVICE_NAME = PCDB)&lt;br /&gt;)&lt;br /&gt;)&lt;br /&gt;&lt;br /&gt;PCDBS =&lt;br /&gt;(DESCRIPTION =&lt;br /&gt;(ADDRESS = (PROTOCOL = TCP)(HOST =pcdb-2)(PORT = 1521))&lt;br /&gt;(CONNECT_DATA =&lt;br /&gt;(SERVER = DEDICATED)&lt;br /&gt;(SERVICE_NAME = PCDB)&lt;br /&gt;)&lt;br /&gt;)&lt;br /&gt;&lt;br /&gt;EXTPROC_CONNECTION_DATA =&lt;br /&gt;(DESCRIPTION =&lt;br /&gt;(ADDRESS_LIST =&lt;br /&gt;(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))&lt;br /&gt;)&lt;br /&gt;(CONNECT_DATA =&lt;br /&gt;(SID = PLSExtProc)&lt;br /&gt;(PRESENTATION = RO)&lt;br /&gt;)&lt;br /&gt;)&lt;b&gt;&lt;br /&gt;7. Start the listener and check tnsping on both nodes to both services&lt;/b&gt;&lt;br /&gt;1) Restart listeners on primary servers&lt;br /&gt;oracle@pcdb-1&amp;gt; lsnrctl stop&lt;br /&gt;lsnrctl stop&lt;br /&gt;&lt;br /&gt;LSNRCTL for Linux: Version 10.2.0.3.0 - Production on 15-SEP-2010 10:26:32&lt;br /&gt;&lt;br /&gt;Copyright (c) 1991, 2006, Oracle. All rights reserved.&lt;br /&gt;&lt;br /&gt;Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))&lt;br /&gt;The command completed successfully&lt;br /&gt;oracle@pcdb-1&amp;gt; lsnrctl start&lt;br /&gt;2)Restart listener on standby server&lt;br /&gt;oracle@pcdb-2&amp;gt; lsnrctl stop&lt;br /&gt;oracle@pcdb-2&amp;gt; lsnrctl start&lt;br /&gt;&lt;br /&gt;3)use tnsping to test both servers, PCDB and PCDBS&lt;br /&gt;&lt;br /&gt;On primary server:&lt;br /&gt;oracle@pcdb-1&amp;gt;tnsping PCDB&lt;br /&gt;oracle@pcdb-1&amp;gt;tnsping PCDBS&lt;br /&gt;&lt;br /&gt;On standby:&lt;br /&gt;oracle@pcdb-2&amp;gt;tnsping PCDB&lt;br /&gt;oracle@pcdb-2&amp;gt;tnsping PCDBS&lt;br /&gt;&lt;b&gt;&lt;br /&gt;8.Verify that the Oracle environment variables are set correctly on the standby server.&lt;/b&gt;&lt;br /&gt;#&amp;gt;sudo – su oracle&lt;br /&gt;#&amp;gt;env &lt;br /&gt;ORACLE_SID=PCDB&lt;br /&gt;ORACLE_BASE=/u0/oracle/product/10.2.0&lt;br /&gt;….&lt;br /&gt;&lt;b&gt;&lt;br /&gt;9. Start up nomount the standby database and generate a spfile.&lt;/b&gt;&lt;br /&gt;SQL&amp;gt; connect sys/password as sysdba;&lt;br /&gt;Connected to an idle instance.&lt;br /&gt;SQL&amp;gt; startup nomount pfile='/u0/oracle/admin/PCDB/scripts/initPCDB.ora';&lt;br /&gt;ORACLE instance started.&lt;br /&gt;&lt;br /&gt;Total System Global Area 1.2583E+10 bytes&lt;br /&gt;Fixed Size 2094096 bytes&lt;br /&gt;Variable Size 1728056304 bytes&lt;br /&gt;Database Buffers 1.0838E+10 bytes&lt;br /&gt;Redo Buffers 14680064 bytes&lt;br /&gt;&lt;br /&gt;SQL&amp;gt; create spfile from pfile='/u0/oracle/admin/PCDB/scripts/initPCDB.ora';&lt;br /&gt;&lt;br /&gt;File created.&lt;br /&gt;&lt;br /&gt;SQL&amp;gt; shutdown immediate;&lt;br /&gt;ORA-01507: database not mounted&lt;br /&gt;ORACLE instance shut down.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;10. Startup mount the standby database and perform recovery&lt;/b&gt;&lt;br /&gt;1) Startup mount the instance&lt;br /&gt;SQL&amp;gt; startup mount&lt;br /&gt;ORACLE instance started.&lt;br /&gt;&lt;br /&gt;Total System Global Area 1.2583E+10 bytes&lt;br /&gt;Fixed Size 2094096 bytes&lt;br /&gt;Variable Size 1728056304 bytes&lt;br /&gt;Database Buffers 1.0838E+10 bytes&lt;br /&gt;Redo Buffers 14680064 bytes&lt;br /&gt;Database mounted. &lt;br /&gt;&lt;br /&gt;2) Start apply the logs&lt;br /&gt;Issue the following command to start apply the logs.&lt;br /&gt;&lt;br /&gt;SQL&amp;gt;alter database recover managed standby database disconnect from session;&lt;br /&gt;Database altered.&lt;br /&gt;&lt;br /&gt;Now, if everything is setup correctly, the standby database should start to apply the logs from the primary database.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;11. Verify the Physical Standby Database Is Performing Properly&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;1) Check alert log of the standby server to see if the operations taking place or there is any error&lt;br /&gt;&lt;br /&gt;#&amp;gt; vi /u0/oracle/admin/PCDB/bdump/alert_PCDBS.log&lt;br /&gt;ALTER DATABASE RECOVER MANAGED STANDBY DATABASE DISCONNECT FROM SESSION&lt;br /&gt;Wed Sep 15 15:03:16 2010&lt;br /&gt;Attempt to start background Managed Standby Recovery process (PCDBS)&lt;br /&gt;MRP0 started with pid=56, OS id=6637&lt;br /&gt;Wed Sep 15 15:03:16 2010&lt;br /&gt;MRP0: Background Managed Standby Recovery process started (PCDBS)&lt;br /&gt;Managed Standby Recovery not using Real Time Apply&lt;br /&gt;parallel recovery started with 3 processes&lt;br /&gt;Media Recovery Waiting for thread 1 sequence 360&lt;br /&gt;Wed Sep 15 15:03:22 2010&lt;br /&gt;Completed: ALTER DATABASE RECOVER MANAGED STANDBY DATABASE DISCONNECT FROM SESSION&lt;br /&gt;&lt;br /&gt;2) Check the alert log of the primary server to see if the operations taking place or there is any error&lt;br /&gt;&lt;br /&gt;The alert log of the primary will show how it recognize the standby and start shipping archived logs&lt;br /&gt;#&amp;gt; vi /u0/oracle/admin/PCDB/bdump/alert_PCDB.log&lt;br /&gt;******************************************************************&lt;br /&gt;LGWR: Setting 'active' archival for destination LOG_ARCHIVE_DEST_2&lt;br /&gt;******************************************************************&lt;br /&gt;LNS: Standby redo logfile selected for thread 1 sequence 364 for destination LOG_ARCHIVE_DEST_2&lt;br /&gt;Wed Sep 15 17:05:24 2010&lt;br /&gt;Thread 1 advanced to log sequence 365&lt;br /&gt;Current log# 2 seq# 365 mem# 0: /u0/oracle/log/PCDB/redo/PCDB_redo02_01.log&lt;br /&gt;Wed Sep 15 17:05:25 2010&lt;br /&gt;LNS: Standby redo logfile selected for thread 1 sequence 365 for destination LOG_ARCHIVE_DEST_2&lt;br /&gt;&lt;br /&gt;3). Check the Standby severer:&lt;br /&gt;3.1). Check database unique_name and database name. &lt;br /&gt;SQL&amp;gt; show parameters db_unique_name;&lt;br /&gt;NAME TYPE VALUE&lt;br /&gt;---------------------------------------------------------------------------&lt;br /&gt;db_unique_name string PCDBS&lt;br /&gt;&lt;br /&gt;SQL&amp;gt; SELECT NAME FROM V$DATABASE&lt;br /&gt;NAME&lt;br /&gt;---------------------------&lt;br /&gt;PCDB&lt;br /&gt;3.2). Check archived redo log on Standby&lt;br /&gt;SQL&amp;gt;SELECT SEQUENCE#, FIRST_TIME, NEXT_TIME FROM V$ARCHIVED_LOG ORDER BY SEQUENCE#;&lt;br /&gt;SEQUENCE# FIRST_TIME NEXT_TIME&lt;br /&gt;---------- --------------- ---------------&lt;br /&gt;367 15-SEP-10 15-SEP-10&lt;br /&gt;368 15-SEP-10 15-SEP-10&lt;br /&gt;369 15-SEP-10 15-SEP-10&lt;br /&gt;370 15-SEP-10 16-SEP-10&lt;br /&gt;371 16-SEP-10 16-SEP-10&lt;br /&gt;372 16-SEP-10 16-SEP-10&lt;br /&gt;3.3)Check archived redo applied on Standby&lt;br /&gt;SQL&amp;gt;select sequence#, applied from v$archived_log order by sequence#;&lt;br /&gt;SEQUENCE# APPLIED&lt;br /&gt;---------- ---------&lt;br /&gt;367 YES&lt;br /&gt;368 YES&lt;br /&gt;369 YES&lt;br /&gt;370 YES&lt;br /&gt;371 YES&lt;br /&gt;372 YES&lt;br /&gt;&lt;br /&gt;3.4) Check standby manager status&lt;br /&gt;SQL&amp;gt; select process, status, sequence# from v$managed_standby;&lt;br /&gt;PROCESS STATUS SEQUENCE#&lt;br /&gt;--------------------------- ------------------------------------ ----------&lt;br /&gt;ARCH CLOSING 363&lt;br /&gt;ARCH CLOSING 364&lt;br /&gt;….&lt;br /&gt;ARCH CONNECTED 0&lt;br /&gt;ARCH CONNECTED 0&lt;br /&gt;MRP0 WAIT_FOR_LOG 373&lt;br /&gt;….&lt;br /&gt;RFS IDLE 0&lt;br /&gt;RFS IDLE 373&lt;br /&gt;The above show MRP0 is waiting for log 372 from the primary server.&lt;br /&gt;3.5) Switch log files on Primary.&lt;br /&gt;Login to primary database and perform the following command to force a log switch.&lt;br /&gt;SQL&amp;gt; alter system switch logfile;&lt;br /&gt;&lt;br /&gt;System altered.&lt;br /&gt;&lt;br /&gt;SQL&amp;gt;archive log list&lt;br /&gt;archive log list;&lt;br /&gt;Database log mode Archive Mode&lt;br /&gt;Automatic archival Enabled&lt;br /&gt;Archive destination /u0/oracle/log/PCDB/arch&lt;br /&gt;Oldest online log sequence 372&lt;br /&gt;Next log sequence to archive 374&lt;br /&gt;Current log sequence 374&lt;br /&gt;&lt;br /&gt;3.6) In Standby Database server, repeat verification steps, 3.2, 3.3 and 3.4. &lt;br /&gt;&lt;br /&gt;You show notice that log 373 had been applied and MRP0/LNS is waiting for log 374 (step 3.4). &lt;br /&gt;12. Errors and Troubleshoot&lt;br /&gt;1) Error: ORA-19527: physical standby redo log must be renamed (in Standby server)&lt;br /&gt;If you have the above error message in the alert log after you issued “alter database recover managed standby database using current logfile disconnect;” statement, it was due to the fact that the standby database file structure is exactly the same as the primary database server. To resolve that, do the following:&lt;br /&gt;&lt;br /&gt;SQL&amp;gt; alter system set log_file_name_convert='dummy','dummy' scope=spfile;&lt;br /&gt;System altered.&lt;br /&gt;&lt;br /&gt;SQL&amp;gt; shutdown immediate;&lt;br /&gt;ORA-01109: database not open&lt;br /&gt;Database dismounted.&lt;br /&gt;ORACLE instance shut down.&lt;br /&gt;&lt;br /&gt;SQL&amp;gt; startup mount;&lt;br /&gt;&lt;br /&gt;Now, you can start the recover again by issue the following statement:&lt;br /&gt;SQL&amp;gt; alter system set log_file_name_convert='dummy','dummy' scope=spfile;&lt;br /&gt;&lt;br /&gt;Check the alert log again and you should not see the same error again. If you see error, “ORA-27037: unable to obtain file status”, try to shutdown the server again one more time and startup mount, you will not see any more error.&lt;br /&gt;&lt;br /&gt;3)ORA-16191: Primary log shipping client not logged on standby&lt;br /&gt;&lt;br /&gt;ORA-16191: Primary log shipping client not logged on standby&lt;br /&gt;&lt;br /&gt;PING[ARCr]: Heartbeat failed to connect to standby 'PCDBS'. Error is 16191.&lt;br /&gt;Wed Sep 15 16:50:49 2010&lt;br /&gt;Errors in file /u0/oracle/admin/PCDB/bdump/PCDB_arcr_29633.trc:&lt;br /&gt;ORA-01017: invalid username/password; logon denied&lt;br /&gt;Wed Sep 15 16:50:49 2010&lt;br /&gt;Error 1017 received logging on to the standby&lt;br /&gt;&lt;br /&gt;The error was caused, most likely, the missing of password file or the password for sys user was not entered correctly in the password file. Run the following query to check if the password file was created in both servers (primary and standby) and the password was correctly. You can always recreate the password files.(see step 2, section 2.3)&lt;br /&gt;&lt;br /&gt;SQL&amp;gt; select * from v$pwfile_users;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;2.5 Useful Commands and Queries&lt;/b&gt;&lt;br /&gt;&lt;/password&gt;&lt;br /&gt;&lt;div style="display: block; float: right; height: 260px; margin: 3px; width: 310px;"&gt;&lt;iframe border="0" frameborder="0" height="250" marginheight="0" marginwidth="0" scrolling="no" src="http://rcm.amazon.com/e/cm?t=dat03-20&amp;amp;o=1&amp;amp;p=12&amp;amp;l=bn1&amp;amp;mode=electronics&amp;amp;browse=172282&amp;amp;fc1=000000&amp;amp;lt1=&amp;amp;lc1=3366FF&amp;amp;bg1=FFFFFF&amp;amp;f=ifr" style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;" width="300"&gt;&lt;/iframe&gt;&lt;/div&gt;• Check archive log status on standby database:&lt;br /&gt;SQL&amp;gt;select sequence#, first_time, next_time,applied from v$archived_log;&lt;br /&gt;• Start archive log recover (log apply service):&lt;br /&gt;SQL&amp;gt;alter database recover managed standby database using current logfile disconnect;&lt;br /&gt;• Start real-time apply on Standby&lt;br /&gt;SQL&amp;gt; alter database recover managed standby database using current logfile disconnect;&lt;br /&gt;• Stop archive log recover:&lt;br /&gt;SQL&amp;gt; alter database recover managed standby database cancel;&lt;br /&gt;• Check dataguard messages&lt;br /&gt;SQL&amp;gt; select error_code, timestamp, message from v$dataguard_status;&lt;br /&gt;• Check standby messages&lt;br /&gt;SQL&amp;gt; select process,status,sequence# from v$managed_standby;&lt;br /&gt;• Enable archivelog&lt;br /&gt;SQL&amp;gt;alter database archivelog;&lt;br /&gt;• Show current archive log list&lt;br /&gt;SQL&amp;gt;archive log list;&lt;br /&gt;• Force a log switch on primary&lt;br /&gt;SQL&amp;gt;alter system switch logfile&lt;br /&gt;• Check log file size&lt;br /&gt;SQL&amp;gt;select bytes from v$log;&lt;br /&gt;• Check current log group&lt;br /&gt;SQL&amp;gt;select group#, member from v$logfile;&lt;br /&gt;• Many more here:&lt;br /&gt;http://download.oracle.com/docs/cd/B19306_01/server.102/b14239/toc.htm&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Related Notes:&lt;/b&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://databobjr.blogspot.com/2007/04/oracleadmin-install-oracle-in-linxu.html"&gt;Install Oracle Using Silent Mode&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://databobjr.blogspot.com/2007/04/oracleadmin-install-oracle-in-linxu.html"&gt;Install Oracle Oracle Patch Using Silent Mode&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;b&gt;REFERENCES&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://download.oracle.com/docs/cd/B19306_01/server.102/b14239/create_ps.htm"&gt;Oracle Documentation: Creating a Physical Standby Database&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://download.oracle.com/docs/cd/B19306_01/server.102/b14239/toc.htm"&gt;Oracle Documentation: Oracle Data Guard Concepts and Administration 10g Release 2 (10.2)&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.amazon.com/Oracle-Guard-Handbook-Osborne-ORACLE/dp/0071621113?ie=UTF8&amp;amp;tag=dat03-20&amp;amp;link_code=btl&amp;amp;camp=213689&amp;amp;creative=392969" target="_blank"&gt;Oracle Data Guard 11g Handbook&lt;/a&gt;&lt;img alt="" border="0" height="1" src="http://www.assoc-amazon.com/e/ir?t=dat03-20&amp;amp;l=btl&amp;amp;camp=213689&amp;amp;creative=392969&amp;amp;o=1&amp;amp;a=0071621113" style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0px; padding-bottom: 0px !important; padding-left: 0px !important; padding-right: 0px !important; padding-top: 0px !important;" width="1" /&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.amazon.com/Oracle-Dataguard-Database-Failover-Focus/dp/0974599387?ie=UTF8&amp;amp;tag=dat03-20&amp;amp;link_code=btl&amp;amp;camp=213689&amp;amp;creative=392969" target="_blank"&gt;Oracle Dataguard: Standby database Failover Handbook&lt;/a&gt;&lt;img alt="" border="0" height="1" src="http://www.assoc-amazon.com/e/ir?t=dat03-20&amp;amp;l=btl&amp;amp;camp=213689&amp;amp;creative=392969&amp;amp;o=1&amp;amp;a=0974599387" style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0px; padding-bottom: 0px !important; padding-left: 0px !important; padding-right: 0px !important; padding-top: 0px !important;" width="1" /&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.google.com/cse?cx=partner-pub-1602461054664536%3Aghaimtmraz9&amp;amp;ie=ISO-8859-1&amp;amp;q=Setup+Oracle+10g+Physical+Standby+Using+Data+Guard+On+Linux&amp;amp;sa=Search"&gt;Other References On the Web&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;&lt;script type="text/javascript"&gt;&lt;!--google_ad_client = "pub-1602461054664536";/* oracledba-fooder-banner-468x60-20100511 */google_ad_slot = "5574621840";google_ad_width = 468;google_ad_height = 60;//--&gt;&lt;/script&gt;&lt;br /&gt;&lt;script src="http://pagead2.googlesyndication.com/pagead/show_ads.js" type="text/javascript"&gt;&lt;/script&gt;&lt;br /&gt;&lt;iframe border="0" frameborder="0" height="60" marginwidth="0" scrolling="no" src="http://rcm.amazon.com/e/cm?t=dat03-20&amp;amp;o=1&amp;amp;p=26&amp;amp;l=ur1&amp;amp;category=kindle&amp;amp;banner=1VW4WBP63FJN3CB2ETG2&amp;amp;f=ifr" style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;" width="468"&gt;&lt;/iframe&gt;&lt;br /&gt;&lt;div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/22611914-1766946575487301261?l=databobjr.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://databobjr.blogspot.com/feeds/1766946575487301261/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=22611914&amp;postID=1766946575487301261' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/22611914/posts/default/1766946575487301261'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/22611914/posts/default/1766946575487301261'/><link rel='alternate' type='text/html' href='http://databobjr.blogspot.com/2010/09/setup-oracle-10g-physical-standby-using.html' title='Setup Oracle Physical Standby Database Using Dataguard On Linux'/><author><name>Data Bob Jr.</name><uri>http://www.blogger.com/profile/11965565939904347208</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-22611914.post-8812068307737298220</id><published>2010-09-18T06:54:00.000-07:00</published><updated>2010-10-06T19:46:27.114-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Oracle DBA'/><category scheme='http://www.blogger.com/atom/ns#' term='Oracle'/><title type='text'>Install Oracle Database Server Patch Using Silent Mode</title><content type='html'>Oracle user patch to do bug fixed and upgade.  Hear is an example of installing Oracle 10g 10.2.0.3 patch using Silent Mode.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;1.Download the Patch&lt;/b&gt;&lt;br /&gt;Download the patch from oracle support site: https://support.oracle.com/CSP/ui/flash.html(aka http://metalink.oracle.com). The patch file is p5337014_10203_LINUX.zip for 32 bit system and p5337014_10203_LINUX-x86-64.zip for 64 bit system/&lt;br /&gt;&lt;br /&gt;To loacate the patch, after login to https://support.oracle.com, click:&lt;br /&gt;&lt;br /&gt;&lt;ol&gt;&lt;li&gt;Patches and Update  (on the top menu)&lt;/li&gt;&lt;li&gt;Latest Patches (Left side bar, under Oracle Server/Tool&lt;/li&gt;&lt;li&gt;Oracle Database (under Latest Oracle Server/Tool Patch Sets)&lt;/li&gt;&lt;/ol&gt;&lt;br /&gt;All the patches are listed there.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;2. Prepare for Patch Installation&lt;/b&gt;&lt;br /&gt;Select a temporary directory to store the installation packages.  For example, the /tmp directory. Use unzip to extract the packages. The packages will store in a directory call Disk1.&lt;br /&gt;&lt;br /&gt;#&amp;gt;unzip p5337014_10203_LINUX x86-64.zip&lt;br /&gt;&lt;br /&gt;&lt;b&gt;3. Update Oracle Time Zone Definitions&lt;/b&gt;&lt;br /&gt;Before installing the patch, check if the the Oracle Time Zone definitions had been installed in the existing installation by running an Oracle script, utltzuv2.sql,  in the $ORACLE_HOME/rdms/admin/  directory.&lt;br /&gt;&lt;br /&gt;SQL&amp;gt; @?/rdbms/admin/utltzuv2.sql;&lt;br /&gt;*&lt;br /&gt;ERROR at line 1:&lt;br /&gt;ORA-00942: table or view does not exist&lt;br /&gt;Table created.&lt;br /&gt;PL/SQL procedure successfully completed.&lt;br /&gt;Commit complete.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;4 Shutdown the Oracle Server and Lisntner&lt;/b&gt;&lt;br /&gt;To begin installing the patch, all the existing Oracle processes need to be shutdowned. First, shutdown the Oracle Server.&lt;br /&gt;&lt;br /&gt;#&amp;gt;sqlplus /nolog&lt;br /&gt;SQL&amp;gt;connect sys/password as sysdba;&lt;br /&gt;SQL&amp;gt; shutdown immediate;&lt;br /&gt;Database closed.&lt;br /&gt;Database dismounted.&lt;br /&gt;ORACLE instance shut down.&lt;br /&gt;SQL&amp;gt; quit&lt;br /&gt;&lt;br /&gt;Secondly, shutdown the listener.&lt;br /&gt;&lt;br /&gt;#&amp;gt;lsnrctl stop&lt;br /&gt;LSNRCTL for Linux: Version 10.2.0.1.0 - Production on 09-SEP-2010 17:59:09&lt;br /&gt;&lt;br /&gt;Copyright (c) 1991, 2005, Oracle.  All rights reserved.&lt;br /&gt;&lt;br /&gt;Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))&lt;br /&gt;The command completed successfully&lt;br /&gt;&lt;br /&gt;If there is any other process running, shutdown it too. To check if all the Oracle processes had been shutdowned, do the following:&lt;br /&gt;&lt;br /&gt;#&amp;gt;ps –ef | grep ora.&lt;br /&gt;&lt;br /&gt;It should show any Oracle process running.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;5.Install the Patch&lt;/b&gt;&lt;br /&gt;Following are steps to install the pach package. It involves installing the binaries by running the installer, runInstaller, and excuting two Oracle sql scripts that are come with the pactch.&lt;br /&gt;&lt;br /&gt;• Remove the existinting inventory directory: /u0/oracle/product/10.2.0/oraInventory&lt;br /&gt;#&amp;gt;mv oraInventory/ oraInventory10201&lt;br /&gt;• Change to the pactch directory:&lt;br /&gt;#&amp;gt;cd /tmp/Disk1&lt;br /&gt;• Run the installation utility:&lt;br /&gt;#&amp;gt; ./runInstaller -silent -responseFile /tmp/enterprise_install.rsp –force&lt;br /&gt;Make sure to check the installation log as show on the screen to check for errors in installation.&lt;br /&gt;• Check Opatch Version &lt;br /&gt;There is a untility script that we can use to checked the binary version. The script is in $ORACLE_HOME/OPatch directory.&lt;br /&gt;#&amp;gt; cd $ORACLE_HOME&lt;br /&gt;#&amp;gt; cd OPatch/&lt;br /&gt;#&amp;gt; opatch version&lt;br /&gt;Invoking OPatch 10.2.0.3.0&lt;br /&gt;OPatch Version: 10.2.0.3.0&lt;br /&gt;OPatch succeeded.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;6.Upgrade the Database&lt;/b&gt;&lt;br /&gt;Startup Oracle in upgrade mode and run the catupgrd.sql script, which is in the $ORACLE_HOME/rdbms/admin/  director, to upgrade the database.  This script will take more than 20 minutes to complete.&lt;br /&gt;#&amp;gt;Sqlplus /nolog&lt;br /&gt;SQL&amp;gt;connect sys/password as sysdba;&lt;br /&gt;SQL&amp;gt; startup upgrade&lt;br /&gt;SQL&amp;gt; spool upgrade.log&lt;br /&gt;SQL&amp;gt; @?/rdbms/admin/catupgrd.sql&lt;br /&gt;SQL&amp;gt; spool off&lt;br /&gt;&lt;br /&gt;Once the upgrade is done. Check any errors in the spooled file. If every thing is OK, proceed to next step to recompile the invalids using utlrp.sql script present in ORACLE_HOME/rdbms/admin directory.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;7. Recompile the Invalids&lt;/b&gt;&lt;br /&gt;SQL&amp;gt; @? /rdbms/admin/utlrp.sql;&lt;br /&gt;&lt;br /&gt;After recompiling, shutdown the database and startup for allowing access to the users which is show in next step.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;7.1 Restart the server.&lt;/b&gt;&lt;br /&gt;If there is no error after upgrading and recompiling, we can now shutdown the database and startup for allowing access to the users. &lt;br /&gt;&lt;br /&gt;&lt;b&gt;7.2 Restart Server&lt;/b&gt;&lt;br /&gt;SQL&amp;gt; shutdown immediate;&lt;br /&gt;SQL&amp;gt;startup mount;&lt;br /&gt;ORACLE instance started.&lt;br /&gt;&lt;br /&gt;Total System Global Area 1.2583E+10 bytes&lt;br /&gt;Fixed Size                  2094096 bytes&lt;br /&gt;Variable Size            1728056304 bytes&lt;br /&gt;Database Buffers         1.0838E+10 bytes&lt;br /&gt;Redo Buffers               14680064 bytes&lt;br /&gt;Database mounted.&lt;br /&gt;&lt;br /&gt;SQL&amp;gt; alter database open;&lt;br /&gt;Database altered.&lt;br /&gt;Check the alert log for error:&lt;br /&gt;#&amp;gt;cd /u0/oracle/admin/OVI/bdump &lt;br /&gt;#&amp;gt;vi alert_ovi.log&lt;br /&gt;If there is no error, the patch upgrade is completed.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;7.3 Start Listner&lt;/b&gt;&lt;br /&gt;#&amp;gt;lsnrctl start&lt;br /&gt;&lt;br /&gt;Now the database is ready for user connections. &lt;br /&gt;&lt;br /&gt;&lt;b&gt;Related Notes:&lt;/b&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://databobjr.blogspot.com/2007/04/oracleadmin-install-oracle-in-linxu.html"&gt;Install Oracle Server Using Silent Mode and Response File&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;script type="text/javascript"&gt;&lt;!--google_ad_client = "pub-1602461054664536";/* oracledba-fooder-banner-468x60-20100511 */google_ad_slot = "5574621840";google_ad_width = 468;google_ad_height = 60;//--&gt;&lt;/script&gt;&lt;br /&gt;&lt;script src="http://pagead2.googlesyndication.com/pagead/show_ads.js" type="text/javascript"&gt;&lt;/script&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/22611914-8812068307737298220?l=databobjr.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://databobjr.blogspot.com/feeds/8812068307737298220/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=22611914&amp;postID=8812068307737298220' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/22611914/posts/default/8812068307737298220'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/22611914/posts/default/8812068307737298220'/><link rel='alternate' type='text/html' href='http://databobjr.blogspot.com/2010/09/install-oracle-database-server-patch.html' title='Install Oracle Database Server Patch Using Silent Mode'/><author><name>Data Bob Jr.</name><uri>http://www.blogger.com/profile/11965565939904347208</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-22611914.post-838209038270024544</id><published>2010-09-11T17:06:00.000-07:00</published><updated>2010-12-02T22:30:59.384-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Video'/><category scheme='http://www.blogger.com/atom/ns#' term='Life'/><title type='text'>Precision</title><content type='html'>&lt;div&gt;&lt;object height="324" width="576"&gt;&lt;param name="movie" value="http://d.yimg.com/m/up/ypp/default/player.swf"&gt;&lt;/param&gt;&lt;param name="flashVars" value="shareUrl=http%3A//comedy.video.yahoo.com/%3Fv%3D8204995&amp;vid=21790744&amp;"&gt;&lt;/param&gt;&lt;param name="allowfullscreen" value="true"&gt;&lt;/param&gt;&lt;param name="wmode" value="transparent"&gt;&lt;/param&gt;&lt;embed width="576" height="324" allowFullScreen="true" src="http://d.yimg.com/m/up/ypp/default/player.swf" type="application/x-shockwave-flash" flashvars="shareUrl=http%3A//comedy.video.yahoo.com/%3Fv%3D8204995&amp;vid=21790744&amp;"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/22611914-838209038270024544?l=databobjr.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://databobjr.blogspot.com/feeds/838209038270024544/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=22611914&amp;postID=838209038270024544' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/22611914/posts/default/838209038270024544'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/22611914/posts/default/838209038270024544'/><link rel='alternate' type='text/html' href='http://databobjr.blogspot.com/2010/09/precision.html' title='Precision'/><author><name>Data Bob Jr.</name><uri>http://www.blogger.com/profile/11965565939904347208</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-22611914.post-4150170209510168227</id><published>2010-09-11T16:31:00.000-07:00</published><updated>2010-12-02T22:31:43.533-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Video'/><category scheme='http://www.blogger.com/atom/ns#' term='Life'/><title type='text'>Stand Up To Cancer</title><content type='html'>&lt;a href="http://www.cancer.org/Cancer/index"&gt;Cancer&lt;/a&gt; dose not discriminate anyone. Let's &lt;a href="http://su2c.standup2cancer.org/"&gt;&lt;b&gt;Stand Up To Cancer&lt;/b&gt;&lt;/a&gt;!&lt;br /&gt;&lt;br /&gt;&lt;object height="340" width="560"&gt;&lt;param name="movie" value="http://www.youtube.com/v/-UbhghhlA7g?fs=1&amp;amp;hl=en_US&amp;amp;hd=1"&gt;&lt;/param&gt;&lt;param name="allowFullScreen" value="true"&gt;&lt;/param&gt;&lt;param name="allowscriptaccess" value="always"&gt;&lt;/param&gt;&lt;embed src="http://www.youtube.com/v/-UbhghhlA7g?fs=1&amp;amp;hl=en_US&amp;amp;hd=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="560" height="340"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/22611914-4150170209510168227?l=databobjr.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://databobjr.blogspot.com/feeds/4150170209510168227/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=22611914&amp;postID=4150170209510168227' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/22611914/posts/default/4150170209510168227'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/22611914/posts/default/4150170209510168227'/><link rel='alternate' type='text/html' href='http://databobjr.blogspot.com/2010/09/stand-up-to-cancer.html' title='Stand Up To Cancer'/><author><name>Data Bob Jr.</name><uri>http://www.blogger.com/profile/11965565939904347208</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-22611914.post-2319873100381430990</id><published>2010-09-04T00:11:00.000-07:00</published><updated>2011-06-30T21:28:24.770-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Video'/><category scheme='http://www.blogger.com/atom/ns#' term='Oracle'/><category scheme='http://www.blogger.com/atom/ns#' term='Data Funny'/><title type='text'>Oracle OpenWorld</title><content type='html'>&lt;a href="http://www.oracle.com/us/openworld/036763.htm?src=6896290&amp;amp;Act=46"&gt;Oracle OpenWorld 2010&lt;/a&gt; will be held at the &lt;a href="http://maps.google.com/maps?f=q&amp;amp;source=s_q&amp;amp;hl=en&amp;amp;geocode=&amp;amp;q=Moscone+Center,+San+Francisco,+CA&amp;amp;sll=37.0625,-95.677068&amp;amp;sspn=38.365962,93.076172&amp;amp;ie=UTF8&amp;amp;hq=Moscone+Center,&amp;amp;hnear=San+Francisco,+California&amp;amp;ll=37.784448,-122.401176&amp;amp;spn=0.00234,0.005681&amp;amp;z=18&amp;amp;iwloc=A"&gt;Moscone Center, San Francisco, CA&lt;/a&gt;; September 19-23. &lt;a href="http://www.oracle.com/us/openworld/keynotes-143370.html"&gt;Keynote speakers&lt;/a&gt; are always one of a kind. If you are there, don't miss them.&lt;br /&gt;&lt;br /&gt;Here a part of the keynote delivered by Arnold Schwarzenegger in Oracle OpenWorld 2009. Very interesting.&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;object height="344" width="425"&gt;&lt;param name="movie" value="http://www.youtube.com/v/-d4QUXxy3O0?fs=1&amp;amp;hl=en_US&amp;amp;rel=0"&gt;&lt;/param&gt;&lt;param name="allowFullScreen" value="true"&gt;&lt;/param&gt;&lt;param name="allowscriptaccess" value="always"&gt;&lt;/param&gt;&lt;embed src="http://www.youtube.com/v/-d4QUXxy3O0?fs=1&amp;amp;hl=en_US&amp;amp;rel=0" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;b&gt;Movies which Gavernor Arnold Schwarzenegger mentioned during his speach.&lt;/b&gt;&lt;br /&gt;&lt;div&gt;&lt;/div&gt;&lt;strong&gt;References:&lt;/strong&gt;&lt;br /&gt;&lt;noscript&gt;&lt;/noscript&gt;&lt;/div&gt;&lt;div&gt;&lt;ul&gt;&lt;li&gt;Map of&amp;nbsp; Moscone Center, San Francisco, California, USA&lt;/li&gt;&lt;/ul&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;iframe frameborder="0" height="350" marginheight="0" marginwidth="0" scrolling="no" src="http://maps.google.com/maps?f=q&amp;amp;source=s_q&amp;amp;hl=en&amp;amp;geocode=&amp;amp;q=Moscone+Center,+San+Francisco,+CA&amp;amp;sll=37.0625,-95.677068&amp;amp;sspn=38.365962,93.076172&amp;amp;ie=UTF8&amp;amp;hq=Moscone+Center,&amp;amp;hnear=San+Francisco,+California&amp;amp;ll=37.784291,-122.399518&amp;amp;spn=0.00234,0.005681&amp;amp;z=14&amp;amp;iwloc=A&amp;amp;cid=13619201068464098152&amp;amp;output=embed" width="425"&gt;&lt;/iframe&gt;&lt;br /&gt;&lt;small&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;a href="http://maps.google.com/maps?f=q&amp;amp;source=embed&amp;amp;hl=en&amp;amp;geocode=&amp;amp;q=Moscone+Center,+San+Francisco,+CA&amp;amp;sll=37.0625,-95.677068&amp;amp;sspn=38.365962,93.076172&amp;amp;ie=UTF8&amp;amp;hq=Moscone+Center,&amp;amp;hnear=San+Francisco,+California&amp;amp;ll=37.784291,-122.399518&amp;amp;spn=0.00234,0.005681&amp;amp;z=14&amp;amp;iwloc=A&amp;amp;cid=13619201068464098152" style="color: blue; text-align: left;"&gt;View Larger Map&lt;/a&gt;&lt;/small&gt;&lt;/div&gt;&lt;script type="text/javascript"&gt;&lt;!--google_ad_client = "pub-1602461054664536";/* datafunny-fodder-468x60-20100603 */google_ad_slot = "6949942203";google_ad_width = 468;google_ad_height = 60;//--&gt;&lt;/script&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://www.google.com/cse?cx=partner-pub-1602461054664536%3Aghaimtmraz9&amp;amp;ie=ISO-8859-1&amp;amp;q=hotels+near+moscone+center%2C+san+francisco%2Cca+usa&amp;amp;sa=Search"&gt;Hotels Near Moscons Center&lt;/a&gt;&amp;nbsp; &lt;/li&gt;&lt;li&gt;&lt;a href="http://www.google.com/cse?cx=partner-pub-1602461054664536%3Aghaimtmraz9&amp;amp;ie=ISO-8859-1&amp;amp;q=restaurants+near+moscone+center%2C+san+francisco%2Cca+usa&amp;amp;sa=Search"&gt;Restaurants Near Moscone Center&lt;/a&gt; &lt;/li&gt;&lt;li&gt;&lt;a href="http://www.oracle.com/us/openworld/index.htm"&gt;Oracle OpenWorld Web Site&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;script src="http://pagead2.googlesyndication.com/pagead/show_ads.js" type="text/javascript"&gt;&lt;/script&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/22611914-2319873100381430990?l=databobjr.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://databobjr.blogspot.com/feeds/2319873100381430990/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=22611914&amp;postID=2319873100381430990' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/22611914/posts/default/2319873100381430990'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/22611914/posts/default/2319873100381430990'/><link rel='alternate' type='text/html' href='http://databobjr.blogspot.com/2010/09/oracle-openworld.html' title='Oracle OpenWorld'/><author><name>Data Bob Jr.</name><uri>http://www.blogger.com/profile/11965565939904347208</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-22611914.post-3141521394830081176</id><published>2010-09-02T23:35:00.000-07:00</published><updated>2010-09-05T23:47:03.935-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Linux For DBA'/><title type='text'>Linux Sed: Print Lines From File Using Sed</title><content type='html'>&lt;b&gt;Print Lines&amp;nbsp;Using Sed&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;This is the third note on Text Manipulations with Linux Sed. &lt;a href="http://databobjr.blogspot.com/2010/09/linux-sed-append-insert-replace-and.html"&gt;The first note covers Append and Insert to a file using sed. It also covers the Option Switches.&lt;/a&gt; &lt;a href="http://databobjr.blogspot.com/2010/09/linux-sed-replace-and-delete-lines-from.html"&gt;The second note covers Replace and Delete from a file using sed&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;To test each of the commands and options, let’s use the following files as an example:&lt;br /&gt;&lt;br /&gt;#&amp;gt; cat sed_edit.txt&lt;br /&gt;New York, Big Apple&lt;br /&gt;Washington DC, The Capital&lt;br /&gt;New Jersey, Garden Stata&lt;br /&gt;Paris, The City of Light&lt;br /&gt;Hong Kong, Pearl of the Orient &lt;br /&gt;&lt;br /&gt;&lt;b&gt;1 Use Sed ‘p’ to print line(s) by address&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;Following is the Syntax to print lines with address:&lt;br /&gt;&lt;br /&gt;#sed -n ‘ADDRESS P’ inputfilename&lt;br /&gt;&lt;br /&gt;Here some examples use print command with address to print line(s) from a input file.&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;/div&gt;• Example 1: print the 3r line from a file&lt;br /&gt;#&amp;gt;sed -n '3p' sed_edit.txt&lt;br /&gt;New Jersey, Garden Stata&lt;br /&gt;&lt;br /&gt;• Example 2: print a range of lines&lt;br /&gt;Print line 2 to to from the input file&lt;br /&gt;&lt;br /&gt;#sed -n '2,4p' sed_edit.txt&lt;br /&gt;Washington DC, The Capital&lt;br /&gt;New Jersey, Garden Stata&lt;br /&gt;Paris, The City of Light&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;/div&gt;• Example 3: Print from line 2 to the end of file.&lt;br /&gt;#&amp;gt;sed -n '2,$p' sed_edit.txt&lt;br /&gt;Washington DC, The Capital&lt;br /&gt;New Jersey, Garden Stata&lt;br /&gt;Paris, The City of Light&lt;br /&gt;Hong Kong, Pearl of the Orient&lt;br /&gt;&lt;br /&gt;&lt;b&gt;2 Use Sed ‘p’ to print line(s) by matches of pattern&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;Following is the Syntax to print lines with address:&lt;br /&gt;&lt;br /&gt;#&amp;gt;sed -n ‘/PATTERN/ P’ inputfilename&lt;br /&gt;&lt;br /&gt;Here are some examples use print command with match of pattern to print line(s) from a input file.&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;/div&gt;• Example 1: print line matches a patter.&lt;br /&gt;Print out the line that matches that pather “Paris”&lt;br /&gt;&lt;br /&gt;$sed -n '/Paris/ p' sed_edit.txt&lt;br /&gt;Paris, The City of Light&lt;br /&gt;&lt;br /&gt;• Example 2: print number of lines from the matched pattern&lt;br /&gt;Print line that matches ‘New Jersey’ and the next two lines&lt;br /&gt;&lt;br /&gt;#sed -n '/New Jersey/,+2p' sed_edit.txt&lt;br /&gt;New Jersey, Garden Stata&lt;br /&gt;Paris, The City of Light&lt;br /&gt;Hong Kong, Pearl of the Orient&lt;br /&gt;&lt;br /&gt;• Example 3: print line starting from a given line to the parttern matched line.&lt;br /&gt;Print from 2nd line to the line that matches “Paris”&lt;br /&gt;&lt;br /&gt;#&amp;gt;sed -n '2,/Paris/p' sed_edit.txt&lt;br /&gt;Washington DC, The Capital&lt;br /&gt;New Jersey, Garden Stata&lt;br /&gt;Paris, The City of Light&lt;br /&gt;&lt;br /&gt;• Example 4: print line between two match patterns&lt;br /&gt;Print lines between match patterns “Washington” and “Paris”&lt;br /&gt;&lt;br /&gt;#&amp;gt; sed -n '/Washington/,/Paris/p' sed_edit.txt&lt;br /&gt;Washington DC, The Capital&lt;br /&gt;New Jersey, Garden Stata&lt;br /&gt;Paris, The City of Light&lt;br /&gt;&lt;br /&gt;• Show all the “Lock wait timeout exceeded” errors from the mysql server error log file&lt;br /&gt;&lt;br /&gt;#&amp;gt;sed -n -e '/Lock wait timeout exceeded/,+1p' mysql-error.log&lt;br /&gt;&lt;br /&gt;&lt;b&gt;“grep”&lt;/b&gt; command can do the similar thing, but the +1 (plus 1 line) option, or change to multiple lines, comes handy sometime when we want to inclue messges after the error message. I found it can be helpful to extract messages that are related to an event from any logs (database server logs, syslogs,etc)&lt;br /&gt;&lt;br /&gt;• Select all the enteries during a period of time from the Oracle alert log&lt;br /&gt;&lt;br /&gt;#sed -n -e '/Thu Jun 4 14:/,/Thu Jun 4 17:/P' alert_ora.log&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;/div&gt;The above example select the log entries from 2:00pm to 5:00pm on Thursday, July 14.&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;/div&gt;&lt;b&gt;References:&lt;/b&gt; &lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;b&gt;&lt;a href="http://www.amazon.com/sed-awk-2nd-Dale-Dougherty/dp/1565922255?ie=UTF8&amp;amp;tag=dat03-20&amp;amp;link_code=btl&amp;amp;camp=213689&amp;amp;creative=392969" target="_blank"&gt;sed &amp;amp; awk&lt;/a&gt;&lt;/b&gt;&lt;/li&gt;&lt;li&gt;&lt;b&gt;&lt;a href="http://databobjr.blogspot.com/2010/09/linux-sed-append-insert-replace-and.html"&gt;Append and Insert to a file using sed&lt;/a&gt;&lt;/b&gt;&lt;/li&gt;&lt;li&gt;&lt;b&gt;&lt;a href="http://databobjr.blogspot.com/2010/09/linux-sed-replace-and-delete-lines-from.html"&gt;Replace and Delete from a file using sed&lt;/a&gt;&lt;/b&gt;&lt;b&gt;&amp;nbsp;&lt;/b&gt;&lt;/li&gt;&lt;li&gt;&lt;b&gt;&lt;a href="http://www.google.com/cse?cx=partner-pub-1602461054664536%3Aghaimtmraz9&amp;amp;ie=ISO-8859-1&amp;amp;q=print+lines+from+text+file+using+linux+sed&amp;amp;sa=Search"&gt;Other reference on the web&lt;/a&gt;&lt;/b&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;&lt;script type="text/javascript"&gt;&lt;!--google_ad_client = "pub-1602461054664536";/* linuxfordba-fooder-banner-468x60-20100504, created 5/4/10 */google_ad_slot = "7828580750";google_ad_width = 468;google_ad_height = 60;//--&gt;&lt;/script&gt;&lt;br /&gt;&lt;script src="http://pagead2.googlesyndication.com/pagead/show_ads.js" type="text/javascript"&gt;&lt;/script&gt;&lt;br /&gt;&lt;iframe border="0" frameborder="0" height="60" marginwidth="0" scrolling="no" src="http://rcm.amazon.com/e/cm?t=dat03-20&amp;amp;o=1&amp;amp;p=26&amp;amp;l=ur1&amp;amp;category=kindle&amp;amp;banner=1VW4WBP63FJN3CB2ETG2&amp;amp;f=ifr" style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;" width="468"&gt;&lt;/iframe&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/22611914-3141521394830081176?l=databobjr.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://databobjr.blogspot.com/feeds/3141521394830081176/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=22611914&amp;postID=3141521394830081176' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/22611914/posts/default/3141521394830081176'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/22611914/posts/default/3141521394830081176'/><link rel='alternate' type='text/html' href='http://databobjr.blogspot.com/2010/09/linux-sed-print-lines-from-file-using.html' title='Linux Sed: Print Lines From File Using Sed'/><author><name>Data Bob Jr.</name><uri>http://www.blogger.com/profile/11965565939904347208</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-22611914.post-1349869001121331689</id><published>2010-09-02T23:18:00.000-07:00</published><updated>2010-09-03T00:05:34.279-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Linux For DBA'/><title type='text'>Linux Sed: REPLACE, AND DELETE LINES FROM A FILE USING SED</title><content type='html'>&lt;b&gt;REPLACE, AND DELETE LINES FROM A FILE USING SED&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;&lt;div&gt;This is the second note on Text Manipulations with Linux Sed.&amp;nbsp; &lt;a href="http://databobjr.blogspot.com/2010/09/linux-sed-append-insert-replace-and.html"&gt;The first note coverts Append and Insert to a file using sed. It also covers the Option Switches.&lt;/a&gt; And, &lt;a href="http://databobjr.blogspot.com/2010/09/linux-sed-print-lines-from-file-using.html"&gt;the third note will covers Print Lines using sed.&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;To test each of the commands and options, let’s use the following files as an example:&lt;br /&gt;&lt;br /&gt;#&amp;gt; cat sed_edit.txt&lt;br /&gt;New York, Big Apple&lt;br /&gt;Washington DC, The Capital&lt;br /&gt;New Jersey, Garden Stata&lt;br /&gt;Paris, The City of Light&lt;br /&gt;Hong Kong, Pearl of the Orient &lt;br /&gt;&lt;div&gt;&lt;/div&gt;&lt;b&gt;&amp;nbsp;1. Use Sed ‘c\’ to replace a line indicate by the address&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;Following is the Syntax to replace a line with address:&lt;br /&gt;&lt;br /&gt;#sed 'ADDRESS a\&lt;br /&gt;&amp;nbsp; Line which you want to replace' filename&lt;br /&gt;&lt;br /&gt;‘ADDRESS’ is a number with represents the line, i.e.,3, represent the 3rd line.&lt;br /&gt;&lt;br /&gt;Here am examples using sed replace with address command:&lt;br /&gt;&lt;br /&gt;• Replace 3rd line with ,” San Francisco, Golden City”&lt;br /&gt;&lt;br /&gt;&amp;nbsp; #&amp;gt; sed '3 c\San Francisco, Golden City' sed_edit.txt&lt;br /&gt;New York, Big Apple&lt;br /&gt;Washington DC, The Capital&lt;br /&gt;San Francisco, Golden City&lt;br /&gt;Paris, The City of Light&lt;br /&gt;Hong Kong, Pearl of the Orient&lt;br /&gt;&lt;br /&gt;&lt;b&gt;2 Use Sed ‘c\’ to replace a line that match with a pathern&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;Following is the Syntax to append a line with a match of a pattern:&lt;br /&gt;&lt;br /&gt;#sed '/PATTERN/ c\&lt;br /&gt;&amp;nbsp;&amp;nbsp; Line which you want to replace' filename&lt;br /&gt;&lt;br /&gt;Here is an example using sed replace to replace a line of match of pattern to a file.&lt;br /&gt;&lt;br /&gt;• There is a typo in line “New Jersey, Garden Stata” with the word “Stata”. Let’s replace it.&lt;br /&gt;&amp;nbsp; #&amp;gt;sed '/New Jersey, Garden Stata/ c\New Jersey, Garden State' sed_edit.txt&lt;br /&gt;New York, Big Apple&lt;br /&gt;Washington DC, The Capital&lt;br /&gt;New Jersey, Garden State&lt;br /&gt;Paris, The City of Light&lt;br /&gt;Hong Kong, Pearl of the Orient&lt;br /&gt;&lt;br /&gt;&lt;b&gt;2.Sed Delete&lt;/b&gt;&lt;br /&gt;&lt;b&gt;2.1 Use Sed ‘d’ to delete line(s) indicate by the address&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;Following is the Syntax to replace a line with address:&lt;br /&gt;#&amp;gt;sed ‘ADDRESS d’ inputfilename&lt;br /&gt;&lt;br /&gt;Please note there is no “backslash”(“\”) after d.&lt;br /&gt;&lt;br /&gt;There are some examples use sed delete command to delete line(s) from a input file.&lt;br /&gt;• Example 1: delete the 3rd line from the file.&lt;br /&gt;&lt;br /&gt;# sed ‘3d’ sed_edit.txt&lt;br /&gt;New York, Big Apple&lt;br /&gt;Washington DC, The Capital&lt;br /&gt;Paris, The City of Light&lt;br /&gt;Hong Kong, Pearl of the Orient&lt;br /&gt;&lt;br /&gt;• Example 2: delete the line 2 to line 4 from the file.&lt;br /&gt;&lt;br /&gt;# sed '2,4d' sed_edit.txt&lt;br /&gt;New York, Big Apple&lt;br /&gt;Hong Kong, Pearl of the Orient&lt;br /&gt;&lt;br /&gt;&lt;b&gt;2.2 Use Sed ‘d’ to delete line(s) indicate by match of pattern&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;Following is the Syntax to replace a line with address:&lt;br /&gt;&lt;br /&gt;#sed ‘/PATTERN/ d’ inputfilename&lt;br /&gt;&lt;br /&gt;Here some examples use sed delete command with match of pattern to delete line(s) from a input file.&lt;br /&gt;&lt;br /&gt;• Example 1: delete line matches a given pattern.&lt;br /&gt;&amp;nbsp; Delete the line “New Jersey, Garden Stata” from the file&lt;br /&gt;&amp;nbsp; #&amp;gt;sed '/New Jersey, Garden Stata/ d' sed_edit.txt&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;New York, Big Apple&lt;br /&gt;&amp;nbsp;&amp;nbsp; Washington DC, The Capital&lt;br /&gt;&amp;nbsp;&amp;nbsp; Paris, The City of Light&lt;br /&gt;&amp;nbsp;&amp;nbsp; Hong Kong, Pearl of the Orient&lt;br /&gt;&lt;br /&gt;• Example 2: delete all the blank link from a file&lt;br /&gt;&amp;nbsp; Let’s change the file to look like this:&lt;br /&gt;&amp;nbsp; #&amp;gt;cat sed_edit.txt&lt;br /&gt;&amp;nbsp; New York, Big Apple&lt;br /&gt;&lt;br /&gt;&amp;nbsp;Washington DC, The Capital&lt;br /&gt;&lt;br /&gt;&amp;nbsp;New Jersey, Garden Stata&lt;br /&gt;&lt;br /&gt;&amp;nbsp; Paris, The City of Light&lt;br /&gt;&amp;nbsp; Hong Kong, Pearl of the Orient&lt;br /&gt;&lt;br /&gt;Now, use delete to remove all blank lines.&lt;br /&gt;&amp;nbsp;#&amp;gt;sed '/^$/d' sed_edit.txt&lt;br /&gt;&amp;nbsp;New York, Big Apple&lt;br /&gt;&amp;nbsp;Washington DC, The Capital&lt;br /&gt;&amp;nbsp;New Jersey, Garden Stata&lt;br /&gt;&amp;nbsp;Paris, The City of Light&lt;br /&gt;&amp;nbsp; Hong Kong, Pearl of the Orient&lt;br /&gt;&lt;br /&gt;• Example 3: delete multiple lines starting from the the line that matches a given pattern&lt;br /&gt;&amp;nbsp;Delete the lines that match “Paris” and all lines that after this lines&lt;br /&gt;&lt;br /&gt;#&amp;gt;sed '/Paris/,$d' sed_edit.txt&lt;br /&gt;New York, Big Apple&lt;br /&gt;Washington DC, The Capital&lt;br /&gt;New Jersey, Garden Stata&lt;br /&gt;&lt;br /&gt;• Example 4: delete 1 addition lines from the match pattern&lt;br /&gt;Delete the line that matches “Paris” and one more line after that&lt;br /&gt;&lt;br /&gt;#sed '/Paris/,+1d' sed_edit.txt&lt;br /&gt;New York, Big Apple&lt;br /&gt;Washington DC, The Capital&lt;br /&gt;New Jersey, Garden Stata&lt;br /&gt;&lt;br /&gt;&lt;b&gt;References:&lt;/b&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://www.amazon.com/sed-awk-2nd-Dale-Dougherty/dp/1565922255?ie=UTF8&amp;amp;tag=dat03-20&amp;amp;link_code=btl&amp;amp;camp=213689&amp;amp;creative=392969" target="_blank"&gt;sed &amp;amp; awk&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://databobjr.blogspot.com/2010/09/linux-sed-append-insert-replace-and.html"&gt;Append and Insert, And Write To  A  File Using Sed&amp;nbsp;&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://databobjr.blogspot.com/2010/09/linux-sed-print-lines-from-file-using.html"&gt;Print Lines Using Sed &lt;img alt="" border="0" height="1" src="http://www.assoc-amazon.com/e/ir?t=dat03-20&amp;amp;l=btl&amp;amp;camp=213689&amp;amp;creative=392969&amp;amp;o=1&amp;amp;a=1565922255" style="border: medium none; margin: 0px; padding: 0px ! important;" width="1" /&gt;&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.google.com/cse?cx=partner-pub-1602461054664536%3Aghaimtmraz9&amp;amp;ie=ISO-8859-1&amp;amp;q=replace+and+delete+text+with+linux+sed&amp;amp;sa=Search"&gt;Other reference on the web&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;&lt;script type="text/javascript"&gt;&lt;!--google_ad_client = "pub-1602461054664536";/* linuxfordba-fooder-banner-468x60-20100504, created 5/4/10 */google_ad_slot = "7828580750";google_ad_width = 468;google_ad_height = 60;//--&gt;&lt;/script&gt;&lt;br /&gt;&lt;script src="http://pagead2.googlesyndication.com/pagead/show_ads.js" type="text/javascript"&gt;&lt;/script&gt;&lt;br /&gt;&lt;iframe border="0" frameborder="0" height="60" marginwidth="0" scrolling="no" src="http://rcm.amazon.com/e/cm?t=dat03-20&amp;amp;o=1&amp;amp;p=26&amp;amp;l=ur1&amp;amp;category=kindle&amp;amp;banner=1VW4WBP63FJN3CB2ETG2&amp;amp;f=ifr" style="border: medium none;" width="468"&gt;&lt;/iframe&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/22611914-1349869001121331689?l=databobjr.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://databobjr.blogspot.com/feeds/1349869001121331689/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=22611914&amp;postID=1349869001121331689' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/22611914/posts/default/1349869001121331689'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/22611914/posts/default/1349869001121331689'/><link rel='alternate' type='text/html' href='http://databobjr.blogspot.com/2010/09/linux-sed-replace-and-delete-lines-from.html' title='Linux Sed: REPLACE, AND DELETE LINES FROM A FILE USING SED'/><author><name>Data Bob Jr.</name><uri>http://www.blogger.com/profile/11965565939904347208</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-22611914.post-4837086540402595453</id><published>2010-09-02T02:23:00.000-07:00</published><updated>2010-10-06T23:51:42.955-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Perl'/><category scheme='http://www.blogger.com/atom/ns#' term='Perl:Regular Expressions'/><title type='text'>PERL REGULAR EXPRESSIONS: MATCHING TEXT WITH REGULAR EXPRESSIOS, ~M</title><content type='html'>In Perl, The “m” means to attempt a regular expression match. The requrlar expressions, or search patterns, are put between to forwardslashes, “/../”. And the string that to be searched is linked by” =~”. Truse, if you want to search any digits from a string, you can do the following:&lt;br /&gt;&lt;br /&gt;my $varString="George Washington was born on February 22, 1732";&lt;br /&gt;print "Search string \"$varString\" for digits\n";&lt;br /&gt;while ( $varString=~ m/(\d+)/g) {&lt;br /&gt;print "Found digits: $1\n";&lt;br /&gt;} &lt;br /&gt;&lt;br /&gt;And the output will be:&lt;br /&gt;&lt;br /&gt;Search string "George Washington was born on February 22, 1732" for digits&lt;br /&gt;Found digits: 22&lt;br /&gt;Found digits: 1732&lt;br /&gt;&lt;br /&gt;Here the search pattern is “/(\d+)/”, “m” means match and ‘=~” tells perl to link to the string “$varString”. Lastly, “g” means do a global search on the string (from left to right). The search resulf, is stored in “$1”.&lt;br /&gt;&lt;br /&gt;If we changed the code a little bit, without using the while loop and without using global search “g”::&lt;br /&gt;&lt;br /&gt;my $varString="George Washington was born on February 22, 1732";&lt;br /&gt;print "Search string \"$varString\" for digits\n";&lt;br /&gt;$varString=~ m/(\d+)/;&lt;br /&gt;print "Found digits: $1\n";&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;/div&gt;The outout will be:&lt;br /&gt;&lt;br /&gt;Search string "George Washington was born on February 22, 1732" for digits&lt;br /&gt;Found digits: 22&lt;br /&gt;&lt;br /&gt;Perl find the first digits and stop and the resulf still store in $1.&lt;br /&gt;&lt;br /&gt;Now, assuming that we forgot to use “~” and have the codes as the following:&lt;br /&gt;&lt;br /&gt;my $varString="George Washington was born on February 22, 1732";&lt;br /&gt;print "Search string \"$varString\" for digits\n";&lt;br /&gt;$varString= m/(\d+)/;&lt;br /&gt;print "Found digits: $1\n";&lt;br /&gt;&lt;br /&gt;The output are:&lt;br /&gt;&lt;br /&gt;Search string "George Washington was born on February 22, 1732" for digits&lt;br /&gt;Use of uninitialized value in pattern match (m//) at ./perl_rex.pl line 8.&lt;br /&gt;Use of uninitialized value in concatenation (.) or string at ./perl_rex.pl line 9.&lt;br /&gt;Found digits:&lt;br /&gt;&lt;br /&gt;The reason is when the “~” is omitted, perl is looking for a match of the regex in $_ and stores the search resulf to $varString.&lt;br /&gt;Lets test it using the following codes:&lt;br /&gt;&lt;br /&gt;my $varString="George Washington was born on February 22, 1732";&lt;br /&gt;print "Search string \"$varString\" for digits\n";&lt;br /&gt;$_="George Washington was born on February 22, 1732";&lt;br /&gt;$varString= m/(\d+)/;&lt;br /&gt;print "Found digits: $1\n";&lt;br /&gt;print "Found digits: $varString\n";&lt;br /&gt;&lt;br /&gt;And the output are:&lt;br /&gt;&lt;br /&gt;Search string "George Washington was born on February 22, 1732" for digits&lt;br /&gt;Found digits: 22&lt;br /&gt;Found digits: 22&lt;br /&gt;&lt;br /&gt;In fact, “m” is not reuested as long as you have used “~”, but using “~m” make the codes a bit easy to read, in my opions.&lt;br /&gt;&lt;br /&gt;my $varString="George Washington was born on February 22, 1732";&lt;br /&gt;print "Search string \"$varString\" for digits\n";&lt;br /&gt;$varString=~ /(\d+)/;&lt;br /&gt;print "Found digits: $1\n";&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;References:&lt;/strong&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://www.amazon.com/Programming-Perl-3rd-Larry-Wall/dp/0596000278?ie=UTF8&amp;amp;tag=dat03-20&amp;amp;link_code=btl&amp;amp;camp=213689&amp;amp;creative=392969" target="_blank"&gt;Programming Perl (3rd Edition)&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.amazon.com/Mastering-Regular-Expressions-Jeffrey-Friedl/dp/0596528124?ie=UTF8&amp;amp;tag=dat03-20&amp;amp;link_code=btl&amp;amp;camp=213689&amp;amp;creative=392969" target="_blank"&gt;Mastering Reqular Expressions&lt;/a&gt;&lt;img alt="" border="0" height="1" src="http://www.assoc-amazon.com/e/ir?t=dat03-20&amp;amp;l=btl&amp;amp;camp=213689&amp;amp;creative=392969&amp;amp;o=1&amp;amp;a=0596528124" style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0px; padding-bottom: 0px !important; padding-left: 0px !important; padding-right: 0px !important; padding-top: 0px !important;" width="1" /&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.google.com/cse?cx=partner-pub-1602461054664536%3Aghaimtmraz9&amp;amp;ie=ISO-8859-1&amp;amp;q=PERL+REGULAR+EXPRESSIONS%3A+MATCHING+TEXT+WITH+REGULAR+EXPRESSIONS%2C+~M&amp;amp;sa=Search"&gt;Other references on the web&lt;img alt="" border="0" height="1" src="http://www.assoc-amazon.com/e/ir?t=dat03-20&amp;amp;l=btl&amp;amp;camp=213689&amp;amp;creative=392969&amp;amp;o=1&amp;amp;a=0596000278" style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0px; padding-bottom: 0px !important; padding-left: 0px !important; padding-right: 0px !important; padding-top: 0px !important;" width="1" /&gt;&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;div&gt;&lt;script type="text/javascript"&gt;&lt;!--google_ad_client = "pub-1602461054664536";/* perlrex-footer-ad-468x60-20100902 */google_ad_slot = "6737697055";google_ad_width = 468;google_ad_height = 60;//--&gt;&lt;/script&gt;&lt;br /&gt;&lt;script src="http://pagead2.googlesyndication.com/pagead/show_ads.js" type="text/javascript"&gt;&lt;/script&gt;&lt;/div&gt;&lt;div&gt;&lt;iframe border="0" frameborder="0" height="60" marginwidth="0" scrolling="no" src="http://rcm.amazon.com/e/cm?t=dat03-20&amp;amp;o=1&amp;amp;p=26&amp;amp;l=ur1&amp;amp;category=kindle&amp;amp;banner=1VW4WBP63FJN3CB2ETG2&amp;amp;f=ifr" style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;" width="468"&gt;&lt;/iframe&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/22611914-4837086540402595453?l=databobjr.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://databobjr.blogspot.com/feeds/4837086540402595453/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=22611914&amp;postID=4837086540402595453' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/22611914/posts/default/4837086540402595453'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/22611914/posts/default/4837086540402595453'/><link rel='alternate' type='text/html' href='http://databobjr.blogspot.com/2010/09/perl-regular-expressions-matching-text.html' title='PERL REGULAR EXPRESSIONS: MATCHING TEXT WITH REGULAR EXPRESSIOS, ~M'/><author><name>Data Bob Jr.</name><uri>http://www.blogger.com/profile/11965565939904347208</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-22611914.post-9095061801122639432</id><published>2010-09-02T01:57:00.000-07:00</published><updated>2010-10-06T19:48:25.807-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Oracle DBA'/><category scheme='http://www.blogger.com/atom/ns#' term='Oracle'/><title type='text'>ORACLE ERROR: ORA-01031: INSUFFICIENT PRIVILEGES</title><content type='html'>&lt;strong&gt;ORA-01031: INSUFFICIENT PRIVILEGES (ORACLE&amp;nbsp; LINUX)&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;When tried to sarted oracle, I got the following error:&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;/div&gt;ERROR: ORA-01031: insufficient privileges&lt;br /&gt;&lt;br /&gt;Following were the steps that I used to start the database instance:&lt;br /&gt;&lt;br /&gt;1) Start sqlplus with nolog&lt;br /&gt;&lt;br /&gt;# &amp;gt; sqlplus /nolog&lt;br /&gt;SQL*Plus: Release 10.2.0.1.0 - Production on Thu Aug 12 14:40:02 2010&lt;br /&gt;(c) 1982, 2005, Oracle. All rights reserved.&lt;br /&gt;SQL&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;/div&gt;2) Connect to oracle as sysdba&lt;br /&gt;&lt;br /&gt;SQL&amp;gt; connect sys/password as sysdba;&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;/div&gt;ERROR:&lt;br /&gt;ORA-01031: insufficient privileges&lt;br /&gt;&lt;br /&gt;I hecked around and it turned out the problem was the parameter setting in the sqlnet.ora file. &lt;br /&gt;In my case, the sqlnet.ora file (stored in the $ORACLE_HOME/network/admin directory) contained the following line:&lt;br /&gt;&lt;br /&gt;SQLNET.AUTHENTICATION_SERVICES= (NTS)&lt;br /&gt;&lt;br /&gt;I changed it to:&lt;br /&gt;&lt;br /&gt;SQLNET.AUTHENTICATION_SERVICES= (ALL)&lt;br /&gt;&lt;br /&gt;And, I was able to connect to oracle using "connect sys/password as sysdba" and stated the database instance and open the database.&lt;br /&gt;&lt;br /&gt;This pointed me to look at the SQLNET.AUTHENTICATION_SERVICES again.&lt;br /&gt;&lt;br /&gt;The parameter can set to :&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;/div&gt;• NONE : cannot connect to database without a password as sysdba (sqlplus /as sysdba)&lt;br /&gt;• NTS: set for using windows NT native authentication&lt;br /&gt;• ALL: ALL for all authentication methods&lt;br /&gt;&lt;br /&gt;Authentication Methods Available with Oracle Advanced Security:&lt;br /&gt;&lt;br /&gt;• kerberos5 for Kerberos authentication&lt;br /&gt;• cybersafe for Cybersafe authentication&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;/div&gt;• radius for RADIUS authentication&lt;br /&gt;• dcegssapi for DCE GSSAPI authentication&lt;br /&gt;&lt;br /&gt;If authentication has been installed, it is recommended that this parameter be set to either none or to one of the authentication methods.&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;/div&gt;&lt;strong&gt;References:&lt;/strong&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://www.amazon.com/Oracle-Database-10g-DBA-Handbook/dp/0072231459?ie=UTF8&amp;amp;tag=dat03-20&amp;amp;link_code=btl&amp;amp;camp=213689&amp;amp;creative=392969" target="_blank"&gt;Oracle Database 10g DBA Handbook&lt;/a&gt;&lt;img alt="" border="0" height="1" src="http://www.assoc-amazon.com/e/ir?t=dat03-20&amp;amp;l=btl&amp;amp;camp=213689&amp;amp;creative=392969&amp;amp;o=1&amp;amp;a=0072231459" style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0px; padding-bottom: 0px !important; padding-left: 0px !important; padding-right: 0px !important; padding-top: 0px !important;" width="1" /&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.amazon.com/Oracle-Database-Handbook-Osborne-ORACLE/dp/0071496637?ie=UTF8&amp;amp;tag=dat03-20&amp;amp;link_code=btl&amp;amp;camp=213689&amp;amp;creative=392969" target="_blank"&gt;Oracle Database 11g DBA Handbook&lt;/a&gt;&lt;img alt="" border="0" height="1" src="http://www.assoc-amazon.com/e/ir?t=dat03-20&amp;amp;l=btl&amp;amp;camp=213689&amp;amp;creative=392969&amp;amp;o=1&amp;amp;a=0071496637" style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0px; padding-bottom: 0px !important; padding-left: 0px !important; padding-right: 0px !important; padding-top: 0px !important;" width="1" /&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.google.com/cse?cx=partner-pub-1602461054664536%3Aghaimtmraz9&amp;amp;ie=ISO-8859-1&amp;amp;q=1.%09ORACLE+ERROR%3A+ORA-01031%3A+INSUFFICIENT+PRIVILEGES+&amp;amp;sa=Search"&gt;Other references on the web&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;div&gt;&lt;script type="text/javascript"&gt;&lt;!--google_ad_client = "pub-1602461054664536";/* oracledba-fooder-banner-468x60-20100511 */google_ad_slot = "5574621840";google_ad_width = 468;google_ad_height = 60;//--&gt;&lt;/script&gt;&lt;br /&gt;&lt;script src="http://pagead2.googlesyndication.com/pagead/show_ads.js" type="text/javascript"&gt;&lt;/script&gt;&lt;/div&gt;&lt;div&gt;&lt;iframe border="0" frameborder="0" height="60" marginwidth="0" scrolling="no" src="http://rcm.amazon.com/e/cm?t=dat03-20&amp;amp;o=1&amp;amp;p=26&amp;amp;l=ur1&amp;amp;category=kindle&amp;amp;banner=1VW4WBP63FJN3CB2ETG2&amp;amp;f=ifr" style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;" width="468"&gt;&lt;/iframe&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/22611914-9095061801122639432?l=databobjr.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://databobjr.blogspot.com/feeds/9095061801122639432/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=22611914&amp;postID=9095061801122639432' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/22611914/posts/default/9095061801122639432'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/22611914/posts/default/9095061801122639432'/><link rel='alternate' type='text/html' href='http://databobjr.blogspot.com/2010/09/oracle-error-ora-01031-insufficient.html' title='ORACLE ERROR: ORA-01031: INSUFFICIENT PRIVILEGES'/><author><name>Data Bob Jr.</name><uri>http://www.blogger.com/profile/11965565939904347208</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-22611914.post-1089179209890981776</id><published>2010-09-02T00:37:00.000-07:00</published><updated>2010-09-02T23:50:01.778-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Linux For DBA'/><title type='text'>LINUX SED: APPEND, INSERT AND  WRITE  TO A FILE FROM A FILE USING SED</title><content type='html'>&lt;b&gt;APPEND, INSERT AND WRITE LINES TO A FILE FROM A FILE USING SED&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;This is the first note on Text Manipulations Using Linux Sed.&lt;br /&gt;&lt;br /&gt;This note covers how to using Linux sed command to do simple append, insert, and write lines to an output file using a text file as input. Sed provides lot of commands to perform number of operations with the lines in a file. This comes handy in situations that we want to use a script to update files.&lt;br /&gt;&lt;br /&gt;1&lt;b&gt; Sed Dose Not Change Input file.&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;"SED" stands for Stream EDitor. Sed reads its input from stdin ("standard input," i.e., the console or pipe), or from files, and writes its results to stdout (“standard output”, i.e., the screen). Therefore, sed doesn't modify any input files. Sed takes any number of user-specified editing operations ("commands") and performed on each line in order on the input data. &lt;br /&gt;&lt;br /&gt;&lt;b&gt;2 Sed command syntax and option switches.&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;Sed commands need to be put inside a pair of sigle quotes ‘’. All text lines that involve append, insert and replace need to be preceded by a “backslash” ( “\”). Make sure that there is no space between the command switch and the “\”. For example, the following command adds a line “add this line after the 3rd line”, to the input file inputfile.txt: &lt;br /&gt;&lt;br /&gt;&lt;pre&gt;#sed ‘3 a\add this line after the 3rd line’ inputfile.txt &lt;/pre&gt;&lt;br /&gt;Following are option switches and commands that use in this note. There is more information on sed can be found in the man page &lt;a href="http://linux.about.com/od/commands/l/blcmdl1_sed.htm"&gt;here&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;&lt;u&gt;Options:&lt;/u&gt;&lt;/b&gt;&lt;br /&gt;• -n, --quiet, --silent suppress automatic printing of pattern space&lt;br /&gt;• -e, script, --expression=script add the script to the commands to be executed&lt;br /&gt;• -f, script-file, --file=script-file add the contents of script-file to the commands to be executed&lt;br /&gt;&lt;div&gt;&lt;/div&gt;&lt;b&gt;&lt;u&gt;Commands:&lt;/u&gt;&lt;/b&gt;&lt;br /&gt;• P – Upper case P. Print up to the first embedded newline of the current pattern space. &lt;br /&gt;• p – Lower case p. Print the current pattern space.&lt;br /&gt;• = -- print current line number.&lt;br /&gt;• W filename – Uper case W. Write the first line of the current pattern space to filename. &lt;br /&gt;• w filename – Lower case w. Write the current pattern space to filename.&lt;br /&gt;• a \text – Append text, which has each embedded newline preceded by a backslash.&lt;br /&gt;• i \text – Insert text, which has each embedded newline preceded by a backslash.&lt;br /&gt;• c\ text -- Replace the selected lines with text, which has each embedded newline preceded by a backslash.&lt;br /&gt;• D – Upper case D. Delete up to the first embedded newline in the pattern space. Start next cycle, but skip reading from the input if there is still data in the pattern space.&lt;br /&gt;• d – Delete pattern space. Start next cycle.&lt;br /&gt;&lt;br /&gt;To test each of the commands and options, let’s use the following files as an example:&lt;br /&gt;&lt;br /&gt;# cat sed_edit.txt&lt;br /&gt;New York, Big Apple&lt;br /&gt;Washington DC, The Capital&lt;br /&gt;New Jersey, Garden Stata&lt;br /&gt;Paris, The City of Light&lt;br /&gt;Hong Kong, Pearl of the Orient&lt;br /&gt;&lt;br /&gt;&lt;b&gt;3 Sed Append&lt;/b&gt;&lt;br /&gt;&lt;b&gt;3.1 Use Sed ‘a\’ to appends a line after every line with the address&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;Following is the Syntax to append a line with address:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;#sed 'ADDRESS a\&lt;br /&gt;  Line which you want to append' filename&lt;br /&gt;‘ADDRESS’ is a number with represents the line, i.e., 3, represent the 3rd line.&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Here are some examples using sed append with address command:&lt;br /&gt;&lt;br /&gt;• Example 1. Add a line after the 3rd line of the file.&lt;br /&gt;Add the line “San Francisco, Golden City” after the 3rd line. &lt;br /&gt;&lt;br /&gt;#sed ‘3 a\San Francisco, Golden City’ sed_edit.txt&lt;br /&gt;New York, Big Apple&lt;br /&gt;Washington DC, The Capital&lt;br /&gt;New Jersey, Garden Stata&lt;br /&gt;San Francisco, Golden City&lt;br /&gt;Paris, The City of Light&lt;br /&gt;Hong Kong, Pearl of the Orient&lt;br /&gt;&lt;br /&gt;• Example 2: Add a line at the end of the file.&lt;br /&gt;Sed also works with regurlar expression. The following command add the line “San Francisco, Golden City” at the end of the file&lt;br /&gt;&lt;br /&gt;#sed ‘$,a\San Francisco, Golden City’ sed_edit.txt &lt;br /&gt;New York, Big Apple&lt;br /&gt;Washington DC, The Capital&lt;br /&gt;New Jersey, Garden Stata&lt;br /&gt;Paris, The City of Light&lt;br /&gt;Hong Kong, Pearl of the Orient&lt;br /&gt;San Francisco, Golden City&lt;br /&gt;&lt;br /&gt;Here, the ‘$’ is the regurlar expression for end of file.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;3.2 Use Sed ‘a\’ to appends a line after every line that match with a pathern&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;Following is the Syntax to append a line with a match of a pattern:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;#sed '/PATTERN/ a\&lt;br /&gt;Line which you want to append' filename&lt;br /&gt;&lt;br /&gt;‘/PATTERN/’ is the pattern that wants match,i.e., /Paris/. Pattern need to be put between two forwardslashes,”/”.&lt;br /&gt;&lt;/pre&gt;Here is an examples using sed append command with a match of pattern:&lt;br /&gt;&lt;br /&gt;• Append a line,” San Francisco, Golden City”, after a match of pattern “Paris”&lt;br /&gt;&lt;br /&gt;#sed '/Paris/ a\San Francisco, Golden City' sed_edit.txt&lt;br /&gt;New York, Big Apple&lt;br /&gt;Washington DC, The Capital&lt;br /&gt;New Jersey, Garden Stata&lt;br /&gt;Paris, The City of Light&lt;br /&gt;San Francisco, Golden City &lt;br /&gt;Hong Kong, Pearl of the Orient&lt;br /&gt;&lt;br /&gt;&lt;b&gt;4 Sed Insert&lt;/b&gt;&lt;br /&gt;The different between sed append and sed insert is that sed append adds the line after the address or match of pattern while sed insert adds the line before the address or match of the parttern.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;4.1 Use Sed ‘i\’ to insert a line before every line with the address&lt;/b&gt;&lt;br /&gt;Following is the Syntax to append a line with address:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;#sed 'ADDRESS a\&lt;br /&gt;Line which you want to append' filename&lt;br /&gt;&lt;br /&gt;‘ADDRESS’ is a number with represents the line, i.e., 3, represent the 3rd line.&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Here are some examples using sed insert to insert a line before an address.&lt;br /&gt;&lt;br /&gt;• Example 1: Insert a line before the 3rd line of the file.&lt;br /&gt;Insert the line “San Francisco, Golden City” before the 3rd line. &lt;br /&gt;&lt;br /&gt;# sed '3 i\San Francisco, Golden City' sed_edit.txt&lt;br /&gt;New York, Big Apple&lt;br /&gt;Washington DC, The Capital&lt;br /&gt;San Francisco, Golden City&lt;br /&gt;New Jersey, Garden Stata&lt;br /&gt;Paris, The City of Light&lt;br /&gt;Hong Kong, Pearl of the Orient&lt;br /&gt;&lt;br /&gt;• Example 2: insert a line at the beginning of the file.&lt;br /&gt;Insert the line “San Francisco, Golden City” at the beginning of the file.&lt;br /&gt;&lt;br /&gt;#sed '1 i\San Francisco, Golden City' sed_edit.txt&lt;br /&gt;San Francisco, Golden City&lt;br /&gt;New York, Big Apple&lt;br /&gt;Washington DC, The Capital&lt;br /&gt;New Jersey, Garden Stata&lt;br /&gt;Paris, The City of Light&lt;br /&gt;Hong Kong, Pearl of the Orient&lt;br /&gt;&lt;br /&gt;Here address “1” represents the first line of the file. &lt;br /&gt;&lt;br /&gt;&lt;b&gt;4.2 Use Sed ‘i\’ to insert a line before every line that match with a pathern&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;Following is the Syntax to append a line with a match of a pattern:&lt;br /&gt;&lt;br /&gt;#sed '/PATTERN/ i\&lt;br /&gt;Line which you want to append' filename&lt;br /&gt;&lt;br /&gt;Here is an example using sed insert to insert a line to a file.&lt;br /&gt;• Insert a line,” San Francisco, Golden City”, before each match of pattern “Paris”&lt;br /&gt;&lt;br /&gt;#sed '/Paris/ i\San Francisco, Golden City' sed_edit.txt&lt;br /&gt;New York, Big Apple&lt;br /&gt;Washington DC, The Capital&lt;br /&gt;New Jersey, Garden Stata&lt;br /&gt;San Francisco, Golden City&lt;br /&gt;Paris, The City of Light&lt;br /&gt;Hong Kong, Pearl of the Orient&lt;br /&gt;&lt;br /&gt;&lt;b&gt;&lt;/b&gt;&lt;br /&gt;&lt;div&gt;&lt;b&gt;5 Sed Write To a File&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp;Following is the Syntax to write to a file with address and pathern:&lt;/div&gt;&lt;br /&gt;&lt;pre&gt;#sed 'ADDERSSw outputfilename' inputfilename&lt;br /&gt;&lt;br /&gt;#sed '/PATTERN/w outputfilename' inputfilename&lt;br /&gt;&lt;/pre&gt;To store output of the above example, we can do the following:&lt;br /&gt;&lt;br /&gt;#sed -n '/Washington/,/Paris/w sed_edit.out' sed_edit.txt&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&amp;nbsp;Sed_edit.out will contain the output of the sed command.&lt;/div&gt;&lt;br /&gt;However, to save a copy of the file that after insert,delete or update(replace) you may find it easier just to use the “&amp;gt;outputfilename” syntax.&lt;br /&gt;&lt;br /&gt;For example, to save the changes make to the input file with the replace command, we can do:&lt;br /&gt;&lt;br /&gt;#sed '/New Jersey, Garden Stata/ c\New Jersey, Garden State' sed_edit.txt &amp;gt; sed_edit.out&lt;br /&gt;&lt;br /&gt;&lt;b&gt;References:&lt;/b&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://www.amazon.com/sed-awk-2nd-Dale-Dougherty/dp/1565922255?ie=UTF8&amp;amp;tag=dat03-20&amp;amp;link_code=btl&amp;amp;camp=213689&amp;amp;creative=392969" target="_blank"&gt;sed &amp;amp; awk&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://databobjr.blogspot.com/2010/09/linux-sed-replace-and-delete-lines-from.html"&gt;Replace and Delete Using Sed &lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://databobjr.blogspot.com/2010/09/linux-sed-print-lines-from-file-using.html"&gt;Print Line Using Sed&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.google.com/cse?cx=partner-pub-1602461054664536%3Aghaimtmraz9&amp;amp;ie=ISO-8859-1&amp;amp;q=text+manipulation+with+sed&amp;amp;sa=Search"&gt;Other reference on the web&lt;img alt="" border="0" height="1" src="http://www.assoc-amazon.com/e/ir?t=dat03-20&amp;amp;l=btl&amp;amp;camp=213689&amp;amp;creative=392969&amp;amp;o=1&amp;amp;a=1565922255" style="border: medium none; margin: 0px; padding: 0px ! important;" width="1" /&gt;&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;&lt;script type="text/javascript"&gt;&lt;!--google_ad_client = "pub-1602461054664536";/* linuxfordba-fooder-banner-468x60-20100504, created 5/4/10 */google_ad_slot = "7828580750";google_ad_width = 468;google_ad_height = 60;//--&gt;&lt;/script&gt;&lt;br /&gt;&lt;script src="http://pagead2.googlesyndication.com/pagead/show_ads.js" type="text/javascript"&gt;&lt;/script&gt;&lt;br /&gt;&lt;iframe border="0" frameborder="0" height="60" marginwidth="0" scrolling="no" src="http://rcm.amazon.com/e/cm?t=dat03-20&amp;amp;o=1&amp;amp;p=26&amp;amp;l=ur1&amp;amp;category=kindle&amp;amp;banner=1VW4WBP63FJN3CB2ETG2&amp;amp;f=ifr" style="border: medium none;" width="468"&gt;&lt;/iframe&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/22611914-1089179209890981776?l=databobjr.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://databobjr.blogspot.com/feeds/1089179209890981776/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=22611914&amp;postID=1089179209890981776' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/22611914/posts/default/1089179209890981776'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/22611914/posts/default/1089179209890981776'/><link rel='alternate' type='text/html' href='http://databobjr.blogspot.com/2010/09/linux-sed-append-insert-replace-and.html' title='LINUX SED: APPEND, INSERT AND  WRITE  TO A FILE FROM A FILE USING SED'/><author><name>Data Bob Jr.</name><uri>http://www.blogger.com/profile/11965565939904347208</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total><georss:featurename>Bay Area</georss:featurename><georss:point>37.7141454 -122.25</georss:point><georss:box>36.627736399999996 -124.117676 38.8005544 -120.382324</georss:box></entry><entry><id>tag:blogger.com,1999:blog-22611914.post-3606875563823492739</id><published>2010-08-07T03:40:00.000-07:00</published><updated>2011-04-08T22:07:24.065-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Data Warehouse'/><title type='text'>DATA WAREHOUSE CONCEPTS</title><content type='html'>&lt;b&gt;Data Warehouse Concepts&lt;br /&gt;&lt;br /&gt;&lt;/b&gt;&lt;strong&gt;1. Introduction:&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Over the years, I had done a few data warehouse projects and read a few data warehouse and business intelligence books and white pages. However, I had never really summarized the concepts, terminologies, and techniques that I had learned. Here, I will start to put together the basic concepts, and terminologies that are frequently referred to and mythologies and techniques that are frequently used and talked about. &lt;br /&gt;&lt;br /&gt;I am going to organize the topic base on the following data warehouse concepts. In this note, I will provide summarize version of the concepts. In the future note, I will provide more explanation and example of the each concept.&lt;br /&gt;&lt;br /&gt;&lt;div style="dir: ltr align:left; display: block; float: right; height: 260px; margin: 3px; width: 310px;"&gt;&lt;script type="text/javascript"&gt;&lt;!--google_ad_client = "pub-1602461054664536";/* body-ad-300x250-created-4/21/10 */google_ad_slot = "4011047090";google_ad_width = 300;google_ad_height = 250;//--&gt;&lt;/script&gt;&lt;br /&gt;&lt;script src="http://pagead2.googlesyndication.com/pagead/show_ads.js" type="text/javascript"&gt;&lt;/script&gt;&lt;/div&gt;&lt;ul&gt;&lt;li&gt;&amp;nbsp; Data warehouse and data mart&lt;/li&gt;&lt;li&gt;&amp;nbsp;Fact and Dimension&lt;/li&gt;&lt;li&gt;&amp;nbsp;Star Schema and Snowflake Schema&lt;/li&gt;&lt;li&gt;&amp;nbsp;Extract, Transform and Load (ETL)&lt;/li&gt;&lt;li&gt;&amp;nbsp;Meta Data&lt;/li&gt;&lt;li&gt;&amp;nbsp;Cube&lt;/li&gt;&lt;/ul&gt;&lt;strong&gt;2. Data Warehouse and Data Mart&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;2.1 Data Warehouse&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;A data warehouse is a central repository for all or significant parts of the data that an enterprise's various business systems collect. The goal of the data warehouse is make enterprise data easily accessible for strategic decision making.&lt;br /&gt;&lt;br /&gt;There are two well-known authors on data warehousing: Bill Inmon and Ralph Kimball. Following are definitions from each of them:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;li&gt;&lt;strong&gt;Bill Inmon:&lt;/strong&gt; A data warehouse is a subject-oriented, integrated, nonvolatile, and time-variant collection of&amp;nbsp; data in support of management’s decisions.&amp;nbsp;&lt;/li&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/o2&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Subject-oriented - Data that gives information about a particular subject instead of about a company's&amp;nbsp;&amp;nbsp; on-going operations. &lt;/li&gt;&lt;li&gt;&amp;nbsp;Integrated - Data that is gathered into the data warehouse from a variety of sources and merged into a coherent whole.&lt;/li&gt;&lt;li&gt;Time-variant - All data in the data warehouse is identified with a particular time period.&lt;/li&gt;&lt;li&gt;&amp;nbsp;Non-volatile - Data is stable in a data warehouse. More data is added, but data is never removed. This enables management to gain a consistent picture of the business.&amp;nbsp;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;br /&gt;&lt;li&gt;&lt;strong&gt;Ralph Kimball:&lt;/strong&gt; The conglomeration of an organization’s data warehouse staging and presentation areas, where operational data is specifically structured for query and analysis performance and ease-of-use.&lt;/li&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/o2&gt;&lt;br /&gt;&lt;div&gt;&lt;strong&gt;2.2 Data Mart&lt;/strong&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp;A data mart is a repository of data gathered from operational data and other sources that is designed to serve a particular community of knowledge workers. In scope, the data may derive from an enterprise-wide database or data warehouse or be more specialized. The emphasis of a data mart is on meeting the specific demands of a particular group of knowledge users in terms of analysis, content, presentation, and ease-of-use. Users of a data mart can expect to have data presented in terms that are familiar. &lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;/div&gt;&lt;strong&gt;2.3 Data Warehouse vs. Data Mart:&lt;/strong&gt; &lt;br /&gt;&lt;ul&gt;&lt;li&gt;&amp;nbsp;A data warehouse tends to be a strategic but somewhat unfinished concept. The design of a data warehouse tends to start from an analysis of what data already exists and how it can be collected in such a way that the data can later be used. A data warehouse is a central aggregation of data (which can be distributed physically);&amp;nbsp;&lt;/li&gt;&lt;li&gt;A data mart tends to be tactical and aimed at meeting an immediate need. The design of a data mart tends to start from an analysis of user needs. A data mart is a data repository that may derive from a data warehouse or not and that emphasizes ease of access and usability for a particular designed purpose.&amp;nbsp;&lt;/li&gt;&lt;/ul&gt;&lt;strong&gt;3.&amp;nbsp;Fcts and Dimensions&lt;/strong&gt;&lt;br /&gt;&lt;div&gt;&lt;/div&gt;&lt;strong&gt;3.1 Facts&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;/div&gt;A fact table is the central table in a star join schema characterized by a composite key, each of whose elements is a foreign key drawn from a dimension table.&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Represent a business process, i.e., models the business process as an artifact in the data model&amp;nbsp;&lt;/li&gt;&lt;li&gt;Contain the measurements or metrics or facts of business processes.&amp;nbsp;&lt;/li&gt;&lt;li&gt;Most are additive (sales this month), some are semi-additive (balance as of), some are not additive (unit price).&amp;nbsp;&lt;/li&gt;&lt;li&gt;The level of detail is called the “grain” of the table.&amp;nbsp;&lt;/li&gt;&lt;li&gt;Contain foreign keys for the dimension tables include time dimension.&amp;nbsp;&lt;/li&gt;&lt;li&gt;Reolve many-to-many relationships&lt;/li&gt;&lt;/ul&gt;&lt;strong&gt;3.2 Dimensions&lt;/strong&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Represent the who, what, where, when and how of a measurement/artifact.&amp;nbsp;&lt;/li&gt;&lt;li&gt;Represent real-world entities not business processes.&amp;nbsp;&lt;/li&gt;&lt;li&gt;Give the context of a measurement (subject).&amp;nbsp;&lt;/li&gt;&lt;li&gt;For example for the Sales fact table, the characteristics of the 'monthly sales number' measurement can be a Location (Where), Time (When), Product Sold (What).&amp;nbsp;&amp;nbsp;&lt;/li&gt;&lt;li&gt;The Dimension Attributes are the various columns in a dimension table. In the Location dimension, the attributes can be Location Code, State, Country, Zip code. Generally the Dimension Attributes are used in report labels, and query constraints such as where Country='USA'. The dimension attributes also contain one or more hierarchical relationships.&amp;nbsp;&amp;nbsp;&lt;/li&gt;&lt;li&gt;&amp;nbsp;Hierarchical relationships.&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;&lt;strong&gt;4. Star Schemas and Snowflake Schemas&lt;/strong&gt;&lt;/div&gt;&lt;div&gt;&lt;/div&gt;&lt;strong&gt;4.1 Star Schemas&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;/div&gt;&lt;div&gt;&lt;/div&gt;A start Schema (Dimensional Model) consists a single fact table of metrics surrounded by multiple descriptive dimension tables. A start schema will consist at less on fact table and a few dimensions tables.&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;/div&gt;&lt;div&gt;&lt;/div&gt;&lt;div&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/_-yHUY3DeIjY/TF00RMv4KoI/AAAAAAAAACA/v-LQ4MFy_Ao/s1600/star_schema.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" bx="true" height="257" src="http://4.bp.blogspot.com/_-yHUY3DeIjY/TF00RMv4KoI/AAAAAAAAACA/v-LQ4MFy_Ao/s320/star_schema.jpg" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp;&amp;nbsp;&lt;/div&gt;&lt;strong&gt;4.2 Snowflake Schema&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;/div&gt;A snowflake schema is a set of tables comprised of a single, central fact table surrounded by normalized dimensions. The main different between a star schema and a snowflake schema is that star schema tends to have demoralize dimensions while a snowflake schema prefers normalized dimensions.&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;/div&gt;&lt;div&gt;&lt;/div&gt;&lt;div&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/_-yHUY3DeIjY/TF00fHPMMvI/AAAAAAAAACE/VZHMCWo0S_A/s1600/snowflake_schema.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" bx="true" src="http://1.bp.blogspot.com/_-yHUY3DeIjY/TF00fHPMMvI/AAAAAAAAACE/VZHMCWo0S_A/s1600/snowflake_schema.jpg" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;/div&gt;&lt;div&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;/div&gt;&lt;div&gt;&lt;/div&gt;&lt;div&gt;&lt;strong&gt;5.&amp;nbsp;Extract, Transform and Load (ETL)&lt;/strong&gt;&lt;/div&gt;&lt;div&gt;&lt;/div&gt;Extract, Transform and Load (ETL) is the name for a process or a group of processes that transport data from source system into the data warehouse or data mart.&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&amp;nbsp;Extract is the fist part of an ETL process. It involves extracting the data from different source systems and different data formats.&amp;nbsp;&amp;nbsp;&lt;/li&gt;&lt;li&gt;Transform refers to Appling business rules and logics to the data that was extracted from the source system before loading them into the data warehouse. Data quality assurance can also be performed here.&amp;nbsp;&lt;/li&gt;&lt;li&gt;Load processes load data, after the transform processes, to the data warehouse and data mart which some time also refer to as targets.&amp;nbsp;&amp;nbsp;&lt;/li&gt;&lt;/ul&gt;&lt;strong&gt;6.&amp;nbsp;Meta Data&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;/div&gt;Meta data literally means "data about data.". It describes the characteristics of a resource. describes how and when and by whom a particular set of data was collected, and how the data is formatted. Metadata is essential for understanding information stored in data warehouses.&lt;br /&gt;&lt;ul&gt;&lt;li&gt;A data dictionary is a "centralized repository of information about data such as meaning, relationships to other data, origin, usage, and format. &lt;/li&gt;&lt;/ul&gt;&lt;strong&gt;7.&amp;nbsp;Cube&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;/div&gt;A cube contains dimensions, hierarchies, levels, and measures. Each individual point in a cube is referred to as a cell.&lt;br /&gt;&lt;br /&gt;&lt;div&gt;Cubes are OLAP objects consisting of related measures and dimensions that you configure within an Analysis Services database. You can define and configure multiple cubes within a single database and each cube can use some or all of the same dimensions. You can also define a single cube that contains multiple measure groups in the same database rather than defining separate cubes. When you define a cube with multiple measure groups, you need to define how dimensions relate to each measure group and customize, as appropriate, dimension objects within each cube and measure group. When defining a cube, you also define advance cube properties, including calculations, KPIs, actions, partitions and aggregations, perspectives and translations. &lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;/div&gt;&lt;div&gt;&lt;strong&gt;8. Smmary&lt;/strong&gt;&lt;/div&gt;&lt;div&gt;&lt;/div&gt;The concepts which described above were the basic concepts would start with any data were house project. Understand those concepts provide a starting point in any data warehouse development. Each of the concepts mentioned above represent an important part in the data warehouse development life cycle. These concepts are fundamental to design and implement a data warehouse. Following diagram show each of the concepts tied into in each data warehouse layers.&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;/div&gt;&lt;div class="separator" style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; clear: both; text-align: center;"&gt;&lt;img border="0" bx="true" height="380" src="http://1.bp.blogspot.com/_-yHUY3DeIjY/TF01D7C2tOI/AAAAAAAAACI/UxHXn1cViLU/s640/dw_dm.jpg" width="640" /&gt;&lt;/div&gt;&lt;div class="separator" style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; clear: both; text-align: center;"&gt;&lt;/div&gt;&lt;div&gt;&lt;/div&gt;&lt;div class="separator" style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; clear: both; text-align: center;"&gt;&lt;/div&gt;&lt;div&gt;&lt;/div&gt;&lt;div class="separator" style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; clear: both; text-align: left;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; clear: both; text-align: left;"&gt;&lt;strong&gt;References:&lt;/strong&gt;&lt;/div&gt;&lt;ul&gt;&lt;li&gt;&lt;br /&gt;&lt;div class="separator" style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; clear: both; text-align: left;"&gt;W. H. Inmon: &lt;a href="http://www.amazon.com/Building-Data-Warehouse-W-Inmon/dp/0764599445?ie=UTF8&amp;amp;tag=dat03-20&amp;amp;link_code=btl&amp;amp;camp=213689&amp;amp;creative=392969" target="_blank"&gt;Building The Data Warehouse &lt;/a&gt;&lt;img alt="" border="0" height="1" src="http://www.assoc-amazon.com/e/ir?t=dat03-20&amp;amp;l=btl&amp;amp;camp=213689&amp;amp;creative=392969&amp;amp;o=1&amp;amp;a=0764599445" style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0px; padding-bottom: 0px !important; padding-left: 0px !important; padding-right: 0px !important; padding-top: 0px !important;" width="1" /&gt;( 2005) &lt;/div&gt;&lt;/li&gt;&lt;li&gt;&lt;br /&gt;&lt;div class="separator" style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; clear: both; text-align: left;"&gt;Rallph Kimball and Margy Ross: &lt;a href="http://www.amazon.com/Data-Warehouse-Toolkit-Complete-Dimensional/dp/0471200247?ie=UTF8&amp;amp;tag=dat03-20&amp;amp;link_code=btl&amp;amp;camp=213689&amp;amp;creative=392969" target="_blank"&gt;The Data Warehouse Toolkit (Second Edition)&lt;/a&gt;&lt;img alt="" border="0" height="1" src="http://www.assoc-amazon.com/e/ir?t=dat03-20&amp;amp;l=btl&amp;amp;camp=213689&amp;amp;creative=392969&amp;amp;o=1&amp;amp;a=0471200247" style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0px; padding-bottom: 0px !important; padding-left: 0px !important; padding-right: 0px !important; padding-top: 0px !important;" width="1" /&gt;&lt;/div&gt;&lt;/li&gt;&lt;li&gt;&lt;br /&gt;&lt;div class="separator" style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; clear: both; text-align: left;"&gt;&lt;a href="http://www.google.com/cse?cx=partner-pub-1602461054664536%3Aghaimtmraz9&amp;amp;ie=ISO-8859-1&amp;amp;q=data+warehouse+concepts&amp;amp;sa=Search"&gt;Othere Reference On the Web&lt;/a&gt;&lt;/div&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;&lt;script type="text/javascript"&gt;&lt;!--google_ad_client = "pub-1602461054664536";/* date-model-footer-468x60-20100807 */google_ad_slot = "7109162042";google_ad_width = 468;google_ad_height = 60;//--&gt;&lt;/script&gt;&lt;br /&gt;&lt;script src="http://pagead2.googlesyndication.com/pagead/show_ads.js" type="text/javascript"&gt;&lt;/script&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/22611914-3606875563823492739?l=databobjr.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://databobjr.blogspot.com/feeds/3606875563823492739/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=22611914&amp;postID=3606875563823492739' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/22611914/posts/default/3606875563823492739'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/22611914/posts/default/3606875563823492739'/><link rel='alternate' type='text/html' href='http://databobjr.blogspot.com/2010/08/data-warehouse-concepts.html' title='DATA WAREHOUSE CONCEPTS'/><author><name>Data Bob Jr.</name><uri>http://www.blogger.com/profile/11965565939904347208</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_-yHUY3DeIjY/TF00RMv4KoI/AAAAAAAAACA/v-LQ4MFy_Ao/s72-c/star_schema.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-22611914.post-7211838859293404462</id><published>2010-07-30T06:38:00.000-07:00</published><updated>2010-10-06T20:06:49.101-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='MySQL Data Warehouse'/><category scheme='http://www.blogger.com/atom/ns#' term='MySQL'/><category scheme='http://www.blogger.com/atom/ns#' term='MySQL Performance Tuning'/><category scheme='http://www.blogger.com/atom/ns#' term='MySQL DBA'/><title type='text'>IP To Country Lookup Table Using MySQL Spatial Index</title><content type='html'>I have an IP to Country lookup table that is used by various applications. The table is very simple: &lt;br /&gt;&lt;br /&gt;CREATE TABLE `lu_ip_to_country` (&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; id INT UNSIGNED NOT NULL auto_increment,&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; start_ip_num int(10) UNSIGNED NOT NULL,&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;end_ip_num int(10) UNSIGNED NOT NULL,&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; country_id char(2) NOT NULL,&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; iso_country_code varchar(3) DEFAULT NULL,&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; country_name varchar(100) DEFAULT NULL,&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; PRIMARY KEY (id),&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; key start_end_ip (start_ip_num,end_ip_num)&lt;br /&gt;);&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&amp;nbsp;Start_ip_num: Beginning IP Number&lt;/li&gt;&lt;li&gt;&amp;nbsp;End_ip_num: Ending IP Number&lt;/li&gt;&lt;li&gt;&amp;nbsp;Country_id: two character country abbreviations (US, BG, FR, etc.) similar to ISO code &lt;/li&gt;&lt;li&gt;&amp;nbsp;ISO_country_code: ISO 3166 Country Code&lt;/li&gt;&lt;li&gt;&amp;nbsp;Country_name: Country Name&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;div&gt;Beginning IP Number and Ending IP Number are the number version of the IPs which are calculated as follows:&lt;/div&gt;&lt;div&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Ip number = 16777216*w + 65536*x + 256*y + z &lt;/div&gt;Where w, x, y, z represent the IP address (w, x,y,z). For example: if ip is 61.94.7.255,then w=61,x=94,y=7 and z=255.&lt;br /&gt;&lt;br /&gt;&amp;nbsp;The queries that use to lookup country information are simple as well:&lt;br /&gt;&lt;div&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;Select country_id from lu_ip_to_country&lt;/div&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Where v_ip_num_lookup between start_ip_num and end_ip_num &lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;/div&gt;In this query, the v_ip_num_lookup is a variable used to store the calculated ip number. For example, '61.94.7.255’=1029572607.&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;/div&gt;The other query utilized the MySQL INET_ATON() function, which convert the ip to ip number. i.e. INET_ATON('61.94.7.255') = 1029572607. The query is the following:&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;/div&gt;&amp;nbsp;&amp;nbsp; Select country_id from lu_ip_to_country&lt;br /&gt;&amp;nbsp;&amp;nbsp; Where INET_ATON('61.94.7.255') between start_ip_num and end_ip_num&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;/div&gt;These tow queries worked fine but slow. It will take up-to 1.5 second to return the result. And they were even slower when there were concurrent requests to this table. I had tried different indexes, and even tried to use memory table, but the improvements were not notable.&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;/div&gt;The other week, while I was searching the web, I came across an &lt;a href="http://jcole.us/blog/archives/2007/11/24/on-efficiently-geo-referencing-ips-with-maxmind-geoip-and-mysql-gis/"&gt;article,&lt;/a&gt; which was written by &lt;a href="http://jcole.us/blog/"&gt;Jeremy Cole&lt;/a&gt;, described how to use MySQL GIS with spatial R-tree indexes for similar ip-to-country lookup in MySQL.I decided to give it a try. And, it turn out that the result was excellence. &lt;br /&gt;&lt;br /&gt;Jeremy Cole’s article gave a vary detail explanation on how &lt;a href="http://dev.mysql.com/doc/refman/5.0/en/gis-class-polygon.html"&gt;GIS&lt;/a&gt; with &lt;a href="http://dev.mysql.com/doc/refman/5.0/en/creating-spatial-indexes.html"&gt;spatial R-tree indexes&lt;/a&gt; work in this case. Here are the steps on how I implemented and tested it (following what were described in the article).&lt;br /&gt;&lt;br /&gt;1. Reconstruct the table to using POLYGON type and spatial index&lt;br /&gt;&lt;br /&gt;CREATE TABLE lu_ip_to_country_geoip (&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; id INT UNSIGNED NOT NULL auto_increment,&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ip_poly POLYGON NOT NULL,&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; start_ip_num int(10) UNSIGNED NOT NULL,&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; end_ip_num int(10) UNSIGNED NOT NULL,&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; country_id varchar(3) NOT NULL,&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; iso_country_code varchchar(3) DEFAULT NULL,&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; country_name varchar(100) DEFAULT NULL,&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; PRIMARY KEY (id),&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; SPATIAL INDEX (ip_poly)&lt;br /&gt;);&lt;br /&gt;&lt;br /&gt;2. Export the data from the existing table&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Select start_ip_num, &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; end_ip_num, &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;country_id,&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; iso_country_code,&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; country_name&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Into outfile ‘/tmp/ip-country-data.dat’&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;FIELDS&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; TERMINATED BY ","&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ENCLOSED BY "\""&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; LINES&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; TERMINATED BY "\n"&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; FROM lu_ip_to_country;&lt;br /&gt;&lt;br /&gt;If you don’t have the data in the first place, you can download them from &lt;a href="http://www.maxmind.com/app/country"&gt;MaxMind&lt;/a&gt; web site (http://www.maxmind.com/app/country) as mentioned in the article. &lt;br /&gt;&lt;br /&gt;3. Load the data into the new table with the MySQL GIS function to build the POLYGON for ip_poly field from the start_ip_num and end_ip_num fields.&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; LOAD DATA LOCAL INFILE "/tmp/ip-country-data.dat"&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; INTO TABLE lu_ip_to_country_geoip&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; FIELDS&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; TERMINATED BY ","&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ENCLOSED BY "\""&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;LINES&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; TERMINATED BY "\n"&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; @start_ip_num, @end_ip_num,&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; @country_id,@iso_country_code, @country_name&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; )&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SET&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; id := NULL,&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;start_ip_num := @start_ip_num,&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; end_ip_num := @end_ip_num,&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ip_poly := GEOMFROMWKB(POLYGON(LINESTRING(&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* clockwise, 4 points and back to 0 */&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; POINT(@start_ip_num, -1), /* 0, top left */&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;POINT(@end_ip_num, -1), /* 1, top right */&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; POINT(@end_ip_num, 1), /* 2, bottom right */&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; POINT(@start_ip_num, 1), /* 3, bottom left */&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;POINT(@start_ip_num, -1) /* 0, back to start */))),&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; country_id := @country_code,&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; iso_country_code := @iso-country_code,&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; country_name := @country_string;&lt;br /&gt;&lt;br /&gt;4. Test queries&lt;br /&gt;&lt;br /&gt;mysql&amp;gt; SELECT country_id,iso_country_code,country_name FROM lu_ip_to_country WHERE INET_ATON('61.94.7.255') BETWEEN start_ip_address AND end_ip_address; &lt;br /&gt;+------------+------------------+--------------+&lt;br /&gt;| country_id | iso_country_code | country_name |&lt;br /&gt;+------------+------------------+--------------+&lt;br /&gt;| ID | IDN | Indonesia |&lt;br /&gt;+------------+------------------+--------------+&lt;br /&gt;1 row in set (1.57 sec)&lt;br /&gt;&lt;br /&gt;mysql&amp;gt; SELECT country_id,iso_country_code,country_name FROM lu_ip_to_country_geoip WHERE MBRCONTAINS(ip_poly, POINTFROMWKB(POINT(INET_ATON('61.94.7.255'), 0)));&lt;br /&gt;+------------+------------------+--------------+&lt;br /&gt;| country_id | iso_country_code | country_name |&lt;br /&gt;+------------+------------------+--------------+&lt;br /&gt;| ID | IDN | Indonesia |&lt;br /&gt;+------------+------------------+--------------+&lt;br /&gt;1 row in set (0.35 sec)&lt;br /&gt;&lt;br /&gt;5. Perform A/B Test on ETL process.&lt;br /&gt;&lt;br /&gt;I also selected a reasonable data file and ran through the process using old ip-to-country table for process A and new ip-to-country table for process B and QA’edfor the following:&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&amp;nbsp;Check to make sure all Country IDs/Codes match exactly on both out put&lt;/li&gt;&lt;li&gt;Compare times&lt;/li&gt;&lt;/ul&gt;&amp;nbsp;Both processes produced the same country code lookups except the new table made the same process run much faster. &lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;/div&gt;&lt;div&gt;&lt;strong&gt;References:&lt;/strong&gt;&lt;/div&gt;&lt;ul&gt;&lt;li&gt;Jcole’s Weblog: &lt;a href="http://jcole.us/blog/archives/2007/11/24/on-efficiently-geo-referencing-ips-with-maxmind-geoip-and-mysql-gis/"&gt;On efficiently geo-referencing IPs with MaxMind GeoIP and MySQL GIS&lt;/a&gt; &lt;/li&gt;&lt;li&gt;MySQL Forum: &lt;a href="http://forums.mysql.com/read.php?23,184702,184702"&gt;MySQL and GIS, GeoIP: FAQs, How-To, Articles, Blogs&lt;/a&gt;&lt;/li&gt;&lt;li&gt;MySQL Manual: &lt;a href="http://dev.mysql.com/doc/refman/5.0/en/spatial-extensions.html"&gt;Spatial Extensions&lt;/a&gt; &lt;/li&gt;&lt;li&gt;MySQL Manual: &lt;a href="http://dev.mysql.com/doc/refman/5.0/en/creating-spatial-indexes.html"&gt;Creating Spatial Indexes&lt;/a&gt; &lt;/li&gt;&lt;li&gt;MySQL Manual: &lt;a href="http://dev.mysql.com/doc/refman/5.0/en/gis-class-polygon.html"&gt;Class Polygon&lt;/a&gt;&lt;/li&gt;&lt;li&gt;MySQL Manual: &lt;a href="http://dev.mysql.com/doc/refman/5.0/en/relations-on-geometry-mbr.html"&gt;Relations on Geometry Minimal Bounding Rectangles (MBRs) &lt;/a&gt;&lt;/li&gt;&lt;li&gt;MySQL Manual: &lt;a href="http://dev.mysql.com/doc/refman/5.0/en/gis-class-point.html"&gt;Class Point &lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.google.com/cse?cx=partner-pub-1602461054664536%3Aghaimtmraz9&amp;amp;ie=ISO-8859-1&amp;amp;q=ip+to+country+lookup%2CGIS%2C+GeoIP%2C+Spatial+&amp;amp;sa=Search"&gt;Other References on the web&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;script type="text/javascript"&gt;&lt;!--google_ad_client = "pub-1602461054664536";/* mysql-data-warehouse-fooder-banner-468x60-20100520 */google_ad_slot = "3636414118";google_ad_width = 468;google_ad_height = 60;//--&gt;&lt;/script&gt;&lt;br /&gt;&lt;script src="http://pagead2.googlesyndication.com/pagead/show_ads.js" type="text/javascript"&gt;&lt;/script&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/22611914-7211838859293404462?l=databobjr.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://databobjr.blogspot.com/feeds/7211838859293404462/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=22611914&amp;postID=7211838859293404462' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/22611914/posts/default/7211838859293404462'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/22611914/posts/default/7211838859293404462'/><link rel='alternate' type='text/html' href='http://databobjr.blogspot.com/2010/07/ip-to-country-lookup-table-using-mysql.html' title='IP To Country Lookup Table Using MySQL Spatial Index'/><author><name>Data Bob Jr.</name><uri>http://www.blogger.com/profile/11965565939904347208</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-22611914.post-1566246590742355980</id><published>2010-06-03T19:59:00.000-07:00</published><updated>2010-12-03T22:09:11.506-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Video'/><category scheme='http://www.blogger.com/atom/ns#' term='Data Funny'/><title type='text'>Mouse Tricks - Point and Click</title><content type='html'>&lt;b&gt;What would have happened if he had used a touch screen instead a mouse at work ?&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="background: #000000; height: 348px; width: 400px;"&gt;&lt;embed allowfullscreen="true" allowscriptaccess="always" flashvars="playerVars=showStats=no|autoPlay=no|" height="348" name="Metacafe_4680462" pluginspage="http://www.macromedia.com/go/getflashplayer" src="http://www.metacafe.com/fplayer/4680462/funny_ad_over_work.swf" type="application/x-shockwave-flash" width="400" wmode="transparent"&gt;&lt;/embed&gt;&lt;br /&gt;&lt;div style="font-size: 12px;"&gt;&lt;a href="http://www.metacafe.com/watch/4680462/funny_ad_over_work/"&gt;Funny Ad over Work&lt;/a&gt; - &lt;a href="http://www.metacafe.com/"&gt;For more funny movies, click here&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;&lt;script type="text/javascript"&gt;&lt;!--google_ad_client = "pub-1602461054664536";/* datafunny-fodder-468x60-20100603 */google_ad_slot = "6949942203";google_ad_width = 468;google_ad_height = 60;//--&gt;&lt;/script&gt;&lt;br /&gt;&lt;script src="http://pagead2.googlesyndication.com/pagead/show_ads.js" type="text/javascript"&gt;&lt;/script&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/22611914-1566246590742355980?l=databobjr.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://databobjr.blogspot.com/feeds/1566246590742355980/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=22611914&amp;postID=1566246590742355980' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/22611914/posts/default/1566246590742355980'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/22611914/posts/default/1566246590742355980'/><link rel='alternate' type='text/html' href='http://databobjr.blogspot.com/2010/06/mouse-tricks-point-and-click.html' title='Mouse Tricks - Point and Click'/><author><name>Data Bob Jr.</name><uri>http://www.blogger.com/profile/11965565939904347208</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-22611914.post-7486286062494515049</id><published>2010-06-03T06:17:00.000-07:00</published><updated>2010-10-06T23:43:12.206-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='MySQL'/><category scheme='http://www.blogger.com/atom/ns#' term='MySQL DBA'/><title type='text'>MYSQL UPGRADE 5.0 TO  5.1</title><content type='html'>&lt;strong&gt;UPGRADE MYSQL 5.0.45 TO ENTERPRISE 5.1.40&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;I did a MySQL upgrade from 5.0.45 to 5.1.40 on two&amp;nbsp; servers. Before starting the actual upgrade, I spent some time reading manuals and web postings. It turned out that the times were well spent. The upgraded version was Enterprise 5.1.40. However, the upgrade processes should be the same if it was upgraded to the same Community version.&lt;br /&gt;&lt;br /&gt;These are some information on existing software:&lt;br /&gt;&lt;br /&gt;· Server version: 5.0.45-log Source distribution&lt;br /&gt;· OS: Redhat Linux 4. (2.6.18-92.el5), 64 bits.&lt;br /&gt;&lt;br /&gt;Note that the existing installation was from the packages that were bundled with Redhat Linux packages.&lt;br /&gt;&lt;br /&gt;Following were the steps I took to do the upgrade. I also included here all the issues that I had encountered in each step.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;1. Obtain a full database dump (backup) and made a backup copy of the my.cnf file.&lt;/strong&gt; &lt;br /&gt;&lt;br /&gt;These two things are, no matter it was involving an upgrade or other major server works, important to do and should not skip.&lt;br /&gt;&lt;br /&gt;#&amp;gt;mysqldump –u root –p dbs &amp;gt;dbs-dump.sql&lt;br /&gt;#&amp;gt;cp /etc/my.cnf /tmp/my.cnf&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;2. Stop MySQL&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;#&amp;gt;./etc/init.d/mysqld stop&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;3.&amp;nbsp;Upgrade (Install)&amp;nbsp;MySQL Server&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;#&amp;gt; rpm -Uvh MySQL-server-advanced-gpl-5.1.40sp1-0.rhel4.x86_64.rpm&lt;br /&gt;&lt;br /&gt;Here I got my first error:&lt;br /&gt;&lt;br /&gt;&lt;em&gt;&amp;nbsp;&amp;nbsp; error: Failed dependencies:&lt;/em&gt;&lt;br /&gt;&lt;em&gt;&amp;nbsp;&amp;nbsp; libmysqlclient.so.15()(64bit) is needed by (installed) perl-DBD-MySQL-3.0007-1.fc6.x86_64&lt;/em&gt;&lt;br /&gt;&lt;em&gt;&amp;nbsp; libmysqlclient.so.15(libmysqlclient_15)(64bit) is needed by (installed) perl-DBD-MySQL-3.0007- 1.fc6.x86_64&lt;/em&gt;&lt;br /&gt;&lt;br /&gt;Initially, I thought this error was due to some compatibility issues, so I decided to go ahead and to install the shared libraries (shared-compat package) first:&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&amp;nbsp;#&amp;gt; rpm -Uvh MySQL-shared-compat-advanced-gpl-5.1.40sp1-0.rhel4.x86_64.rpm&lt;/div&gt;&lt;br /&gt;The package was installed without any error. I then tried to install the server package again.&lt;br /&gt;&lt;br /&gt;#&amp;gt; rpm -Uvh MySQL-server-advanced-gpl-5.1.40sp1-0.rhel4.x86_64.rpm&lt;br /&gt;&lt;br /&gt;This time, the server installation started without the dependency problems, but it gave me more warning and error messages:&lt;br /&gt;&lt;br /&gt;&lt;em&gt;Preparing... ########################################### [100%]&lt;/em&gt;&lt;br /&gt;&lt;em&gt;******************************************************************&lt;/em&gt;&lt;br /&gt;&lt;em&gt;A MySQL server package (mysql-server-5.0.45-7.el5) is installed.&lt;/em&gt;&lt;br /&gt;&lt;br /&gt;&lt;em&gt;The current MySQL server package is provided by a different vendor (Red Hat, Inc.) than MySQL AB or Sun Microsystems, Inc..&lt;/em&gt;&lt;br /&gt;&lt;br /&gt;&lt;em&gt;Some files may be installed to different locations, including log files and the service startup script in /etc/init.d/.&lt;/em&gt;&lt;br /&gt;&lt;em&gt;Upgrading directly from MySQL 5.0 to MySQL 5.1 may notbe safe in all cases. A manual dump and restore using mysqldump is recommended. It is important to review the MySQL manual's Upgrading&lt;/em&gt;&lt;br /&gt;&lt;em&gt;section for version-specific incompatibilities.&lt;/em&gt;&lt;br /&gt;&lt;br /&gt;&lt;em&gt;A manual upgrade is required.&lt;/em&gt;&lt;br /&gt;&lt;br /&gt;&lt;em&gt;- Ensure that you have a complete, working backup of your data and my.cnf files&lt;/em&gt;&lt;br /&gt;&lt;em&gt;- Shut down the MySQL server cleanly&lt;/em&gt;&lt;br /&gt;&lt;em&gt;- Remove the existing MySQL packages. Usually this command will list the packages you should remove:&lt;/em&gt;&lt;br /&gt;&lt;em&gt;rpm -qa grep -i '^mysql-'&lt;/em&gt;&lt;br /&gt;&lt;br /&gt;&lt;em&gt;You may choose to use 'rpm --nodeps -ev &lt;package-name&gt;' to remove the package which contains the mysqlclient shared library. The library will be reinstalled by the MySQL-shared-compat package.&lt;/em&gt;&lt;br /&gt;&lt;br /&gt;&lt;em&gt;- Install the new MySQL packages supplied by Sun Microsystems, Inc.&lt;/em&gt;&lt;br /&gt;&lt;em&gt;- Ensure that the MySQL server is started&lt;/em&gt;&lt;br /&gt;&lt;em&gt;- Run the 'mysql_upgrade' program&lt;/em&gt;&lt;br /&gt;&lt;br /&gt;&lt;em&gt;This is a brief description of the upgrade process. Important details can be found in the MySQL manual, in the Upgrading section.&lt;/em&gt;&lt;br /&gt;&lt;em&gt;******************************************************************&lt;/em&gt;&lt;br /&gt;&lt;em&gt;error: %pre(MySQL-server-advanced-gpl-5.1.40sp1-0.rhel4.x86_64) scriptlet failed, exit status 1&lt;/em&gt;&lt;br /&gt;&lt;em&gt;error: install: %pre scriptlet failed (2), skipping MySQL-server-advanced-gpl-5.1.40sp1-0.rhel4&lt;/em&gt;&lt;br /&gt;&lt;br /&gt;Well, it turned out, there was no such thing as “Upgrade”. It required that we removed the existing packages, installed all the new packages, and then, run the upgrade script to upgrade the existing databases.&lt;br /&gt;&lt;br /&gt;Following the instructions, I checked what was installed in the server:&lt;br /&gt;&lt;br /&gt;#&amp;gt; rpm -qa grep -i '^mysql-'&lt;br /&gt;&lt;br /&gt;mysql-5.0.45-7.el5&lt;br /&gt;MySQL-shared-compat-advanced-gpl-5.1.40sp1-0.rhel4&lt;br /&gt;mysql-server-5.0.45-7.el5&lt;br /&gt;&lt;br /&gt;Since I just installed the MySQL-shared-compat-advanced-gpl-5.1.40sp1-0.rhel4 package, all I needed to remove were the following packages:&lt;br /&gt;&lt;br /&gt;· mysql-5.0.45-7.el5&lt;br /&gt;· mysql-server-5.0.45-7.el5&lt;br /&gt;&lt;br /&gt;#&amp;gt; rpm -e mysql-server-5.0.45-7.el5.x86_64&lt;br /&gt;warning: /var/log/mysqld.log saved as /var/log/mysqld.log.rpmsave&lt;br /&gt;&lt;br /&gt;# &amp;gt; rpm -e mysql-5.0.45-7.el5&lt;br /&gt;warning: /etc/my.cnf saved as /etc/my.cnf.rpmsave&lt;br /&gt;&lt;br /&gt;Now, I was ready to install the new packages again:&lt;br /&gt;&lt;br /&gt;# &amp;gt; rpm -Uvh MySQL-server-advanced-gpl-5.1.40sp1-0.rhel4.x86_64.rpm&lt;br /&gt;&lt;br /&gt;The installation was successful with the following messages:&lt;br /&gt;&lt;br /&gt;&lt;em&gt;Preparing... ########################################### [100%]&lt;/em&gt;&lt;br /&gt;&lt;em&gt;1:MySQL-server-advanced-g########################################### [100%]&lt;/em&gt;&lt;br /&gt;&lt;br /&gt;&lt;em&gt;PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !&lt;/em&gt;&lt;br /&gt;&lt;em&gt;To do so, start the server, then issue the following commands:&lt;/em&gt;&lt;br /&gt;&lt;em&gt;/usr/bin/mysqladmin -u root password 'new-password'&lt;/em&gt;&lt;br /&gt;&lt;em&gt;/usr/bin/mysqladmin -u root -h mysql.domain.com password 'new-password'&lt;/em&gt;&lt;br /&gt;&lt;br /&gt;&lt;em&gt;Alternatively you can run:&lt;/em&gt;&lt;br /&gt;&lt;em&gt;/usr/bin/mysql_secure_installation&lt;/em&gt;&lt;br /&gt;&lt;em&gt;which will also give you the option of removing the test databases and anonymous user created by default. This is strongly recommended for production servers.&lt;/em&gt;&lt;br /&gt;&lt;br /&gt;&lt;em&gt;See the manual for more instructions.&lt;/em&gt;&lt;br /&gt;&lt;em&gt;Please report any problems with the /usr/bin/mysqlbug script!&lt;/em&gt;&lt;br /&gt;&lt;em&gt;he latest information about MySQL is available at http://www.mysql.com/&lt;/em&gt;&lt;br /&gt;&lt;em&gt;Support MySQL by buying support/licenses from &lt;/em&gt;&lt;a href="http://shop.mysql.com/"&gt;&lt;em&gt;http://shop.mysql.com/&lt;/em&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;em&gt;Starting MySQL.[ OK ]&lt;/em&gt;&lt;br /&gt;&lt;em&gt;Giving mysqld 2 seconds to start&lt;/em&gt;&lt;br /&gt;&lt;br /&gt;By checking the log and using ps –ef | grep mysql, I confirmed that the server was started.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;4. Installed the client package.&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Since the server was running, I wanted to install the client package so I could connect to the server.&lt;br /&gt;&lt;br /&gt;#&amp;gt;&amp;nbsp;rpm -Uvh MySQL-client-advanced-gpl-5.1.40sp1-0.rhel4.x86_64.rpm&lt;br /&gt;&lt;br /&gt;No problem installing the client. So, I tried to connect to the server and it worked.&lt;br /&gt;&lt;br /&gt;#&amp;gt;mysql -u root&lt;br /&gt;&lt;br /&gt;&lt;em&gt;Welcome to the MySQL monitor. Commands end with ; or \g.&lt;/em&gt;&lt;br /&gt;&lt;em&gt;Your MySQL connection id is 1&lt;/em&gt;&lt;br /&gt;&lt;em&gt;Server version: 5.1.40sp1-enterprise-gpl-advanced MySQL Enterprise Server - Advanced Edition (GPL)&lt;/em&gt;&lt;br /&gt;&lt;em&gt;Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.&lt;/em&gt;&lt;br /&gt;&lt;em&gt;mysql&amp;gt; show databases;&lt;/em&gt;&lt;br /&gt;&lt;br /&gt;&lt;em&gt;+--------------------+&lt;/em&gt;&lt;br /&gt;&lt;em&gt;Database &lt;/em&gt;&lt;br /&gt;&lt;em&gt;+--------------------+&lt;/em&gt;&lt;br /&gt;&lt;em&gt;information_schema &lt;/em&gt;&lt;br /&gt;&lt;em&gt;ysql &lt;/em&gt;&lt;br /&gt;&lt;em&gt;test &lt;/em&gt;&lt;br /&gt;&lt;em&gt;+--------------------+&lt;/em&gt;&lt;br /&gt;&lt;em&gt;3 rows in set (0.00 sec)&lt;/em&gt;&lt;br /&gt;&lt;br /&gt;So far so good. &lt;br /&gt;&lt;br /&gt;&lt;strong&gt;5. Installed other packages.&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;There were other packages, such as share libraries, embedded MySQL server library and devel libraries and include files (MySQL-devel package),etc, that needed to install in my case . I installed all of them without any problem.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;6. Restarted the server with my.cnf file.&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Since the server were started without the my.cnf file, I needed to stop the server, copy the my.cnf back to the /etc/ directory (see step 1) and restarted the server. While executing the rpm –e command to remove the old packages, the my.cnf file was renamed to my.cnf.rpmsave (see step 3)&lt;br /&gt;&lt;br /&gt;#&amp;gt;./etc/init.d/mysql stop&lt;br /&gt;#&amp;gt;cp /tmp/my.cnf /etc/my.cnf&lt;br /&gt;#&amp;gt;./etc/init.d/mysql start&lt;br /&gt;&lt;br /&gt;Checked the error log, I noticed the following error messages:&lt;br /&gt;&lt;br /&gt;&lt;em&gt;100602 13:05:34 [ERROR] Column count of mysql.db is wrong. Expected 22, found 20. The table is probably corrupted&lt;/em&gt;&lt;br /&gt;&lt;em&gt;100602 13:05:34 [ERROR] mysql.user has no `Event_priv` column at position 29&lt;/em&gt;&lt;br /&gt;&lt;em&gt;100602 13:05:34 [ERROR] Event Scheduler: An error occurred when initializing system tables. Disabling the Event Scheduler.&lt;/em&gt;&lt;br /&gt;&lt;em&gt;100602 13:05:34 [Note] /usr/sbin/mysqld: ready for connections.&lt;/em&gt;&lt;br /&gt;&lt;em&gt;Version: '5.1.40sp1-enterprise-gpl-advanced-log' socket: '/var/lib/mysql/mysql.sock' port: 3306 MySQL Enterprise Server - Advanced Edition (GPL)&lt;/em&gt;&lt;br /&gt;&lt;em&gt;100602 13:44:57 [Warning] Statement may not be safe to log in statement format. Statement: ALTER TABLE general_log MODIFY COLUMN server_id INTEGER UNSIGNED NOT NULL&lt;/em&gt;&lt;br /&gt;&lt;em&gt;100602 13:44:57 [Warning] Statement may not be safe to log in statement format. Statement: ALTER TABLE slow_log MODIFY COLUMN server_id INTEGER UNSIGNED NOT NULL&lt;/em&gt;&lt;br /&gt;&lt;br /&gt;These messages were expected because I had not run the mysql_upgrade script.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;7. Executed the mysql_upgrade script&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;The script, in my case, was located in /usr/bin.&lt;br /&gt;&lt;br /&gt;#&amp;gt;./usr/bin/mysql_upgrade&lt;br /&gt;&lt;br /&gt;Again, it was a smooth run.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;8. Loaded the database dump file&lt;/strong&gt; &lt;br /&gt;&lt;br /&gt;At this point, I could load the database back to the server. &lt;br /&gt;&lt;br /&gt;#&amp;gt;mysql –u root –p &amp;lt; dbs-dump.sql&lt;br /&gt;&lt;br /&gt;There was no error or warning message.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;9. Restarted the server&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Here, just to restart the server one more time to make sure there was no error message.&lt;br /&gt;&lt;br /&gt;#&amp;gt;/etc/init.d/mysql stop&lt;br /&gt;#&amp;gt;/etc/init.d/mysql start&lt;br /&gt;&lt;br /&gt;Checked the error log and there was not error. I also ran some queries and connected an application to the database server.&amp;nbsp; No error as well.&amp;nbsp; So, Server was upgraded.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Summary:&lt;/strong&gt; It is very important to read the MySQL manual, other articles such as those that listed under &lt;strong&gt;References&lt;/strong&gt;, and search the web for any new information before doing the actual upgrade. Also, if it is possible, try it out in a development server first before doing it in a production environment. There are more than one way to do the upgrade, but each has its own upside and downside. I did the above upgrade on two QA servers and there was very little time pressure. One thing to keep in mind is that doing mysql dump and load takes time depends on the size of the database; therefore, a detail plan is need for large production system upgrade. There is other method, such as replication, that can be used to reduce times. It is also recommended that we should check for performance issues and query consistent issues after the upgrade. In some cases, mysql_upgrade may not run as smoothly as it was in my case. The MySQL manual also states some known bugs and issues which are worth to check out against the existing installation to make sure if or not they apply to the existing installation and there is a plan to due with them if they do. &lt;br /&gt;&lt;br /&gt;Following are the summary of steps for the upgrade:&lt;br /&gt;&lt;br /&gt;1. Backup databases and my.cnf file&lt;br /&gt;2. Stop MySQL server&lt;br /&gt;3. Remove existing MySQL packages&lt;br /&gt;4. Install MySQL 5.1 server package&lt;br /&gt;5. Install MySQL 5.1 client and other MySQL 5.1 packages&lt;br /&gt;6. Restart MySQL with my.cnf file&lt;br /&gt;7. Execute mysql_upgrade script&lt;br /&gt;8. Load database backup to MySQL server (v.5.1)&lt;br /&gt;9. Restart server and check error log.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;References:&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&amp;nbsp;&lt;a href="http://dev.mysql.com/doc/refman/5.1/en/installing.html"&gt;MySQL Manual: Installing and Upgrade &lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.mysqlperformanceblog.com/2010/01/05/upgradin%20g-mysql/"&gt;MySQL Performance Blog: Upgrading MySQL&lt;/a&gt; &lt;/li&gt;&lt;li&gt;&lt;a href="http://www.mysqlperformanceblog.com/2010/01/05/upgrading-mysql/#comment-711116"&gt;MySQL Performance Blog: Upgrading MySQL Reader’s command:&lt;/a&gt; &lt;/li&gt;&lt;li&gt;&lt;a href="http://www.amazon.com/High-Performance-MySQL-Optimization-Replication/dp/0596101716?ie=UTF8&amp;amp;tag=dat03-20&amp;amp;link_code=btl&amp;amp;camp=213689&amp;amp;creative=392969" target="_blank"&gt;High performance MySQL: Chapter 4 and 8&lt;/a&gt;&lt;img alt="" border="0" height="1" src="http://www.assoc-amazon.com/e/ir?t=dat03-20&amp;amp;l=btl&amp;amp;camp=213689&amp;amp;creative=392969&amp;amp;o=1&amp;amp;a=0596101716" style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0px; padding-bottom: 0px !important; padding-left: 0px !important; padding-right: 0px !important; padding-top: 0px !important;" width="1" /&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.google.com/cse?cx=partner-pub-1602461054664536%3Aghaimtmraz9&amp;amp;ie=ISO-8859-1&amp;amp;q=mysql+upgrade+5.0+to+5.1&amp;amp;sa=Search"&gt;Other Reference On the Web&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;strong&gt;Related Posts:&lt;/strong&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://databobjr.blogspot.com/2010/05/mysql-failed-to-create-procedure-error.html"&gt;ERROR 1307 (HY000): Failed to CREATE PROCEDURE&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://databobjr.blogspot.com/2010/05/mysql-startup-mysql-server-failed.html"&gt;Startup MySQL Server Failed&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;div&gt;&lt;script type="text/javascript"&gt;&lt;!--google_ad_client = "pub-1602461054664536";/* mysqladmin-fooder-banner-468x60-20100503 */google_ad_slot = "9515648953";google_ad_width = 468;google_ad_height = 60;//--&gt;&lt;/script&gt;&lt;br /&gt;&lt;script src="http://pagead2.googlesyndication.com/pagead/show_ads.js" type="text/javascript"&gt;&lt;/script&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/22611914-7486286062494515049?l=databobjr.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://databobjr.blogspot.com/feeds/7486286062494515049/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=22611914&amp;postID=7486286062494515049' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/22611914/posts/default/7486286062494515049'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/22611914/posts/default/7486286062494515049'/><link rel='alternate' type='text/html' href='http://databobjr.blogspot.com/2010/06/mysql-upgrade-50-to-51.html' title='MYSQL UPGRADE 5.0 TO  5.1'/><author><name>Data Bob Jr.</name><uri>http://www.blogger.com/profile/11965565939904347208</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-22611914.post-8421137878001568120</id><published>2010-05-27T00:44:00.000-07:00</published><updated>2010-10-06T23:44:09.219-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='MySQL'/><category scheme='http://www.blogger.com/atom/ns#' term='MySQL Performance Tuning'/><category scheme='http://www.blogger.com/atom/ns#' term='MySQL DBA'/><title type='text'>MYSQL MYISAM_RECOVER OPTIONS</title><content type='html'>&lt;strong&gt;MYSQL MYISAM_RECOVER OPTIONS&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;This variable sets the mode for automatic recovery when a MyISAM table crashed. The option value is any combination of the following values:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&amp;nbsp;&amp;nbsp;DEFAULT --Recovery without backup, forcing, or quick checking. It is the same as not giving any option.&lt;/li&gt;&lt;li&gt;&amp;nbsp;BACKUP --If the data file was changed during recovery, save a backup of the tbl_name.MYD file as tbl_name-datetime.BAK.&lt;/li&gt;&lt;li&gt;&amp;nbsp;FORCE --Run recovery even if we would lose more than one row from the .MYD file.&lt;/li&gt;&lt;li&gt;&amp;nbsp;QUICK --Don't check the rows in the table if there aren't any delete blocks.&lt;/li&gt;&lt;/ul&gt;&amp;nbsp;Multiple values can be set at the same tiem. To use multiple values, separate them by commas. &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; myisam_recover=backup,force&lt;br /&gt;&lt;br /&gt;To disable this option, set it to “”. &lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; myisam-recover=””&lt;br /&gt;&amp;nbsp;&amp;nbsp; &lt;br /&gt;If one or more myisam-recover option is used, each time mysqld opens a MyISAM table, it checks if or not the table is marked as crashed or wasn’t closed properly. If it is the case, mysqld runs a check on the table and attempts to repair it if the table was corrupted. Following are the steps which mysqld will perform according to the MySQL Manual:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&amp;nbsp;The server checks the table for errors. &lt;/li&gt;&lt;li&gt;&amp;nbsp;If the server finds an error, it tries to do a fast table repair (with sorting and without re-creating the data file). &lt;/li&gt;&lt;li&gt;&amp;nbsp;If the repair fails because of an error in the data file (for example, a duplicate-key error), the server tries again, this time re-creating the data file. &lt;/li&gt;&lt;li&gt;&amp;nbsp;If the repair still fails, the server tries once more with the old repair option method (write row by row without sorting). This method should be able to repair any type of error and has low disk space requirements. &lt;/li&gt;&lt;/ul&gt;&amp;nbsp;If the recovery wouldn't be able to recover all rows from previously completed statements and you didn't specify FORCE in the value of the --myisam-recover option, automatic repair aborts with an error message in the error log: &lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Error: Couldn't repair table: test.g00pages&lt;br /&gt;&lt;br /&gt;If FORCE&amp;nbsp;was&amp;nbsp;specified, a warning like this is written instead: &lt;br /&gt;&lt;br /&gt;&lt;div&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Warning: Found 344 of 354 rows when repairing ./test/g00pages&lt;/div&gt;&lt;br /&gt;Note that if the automatic recovery value includes BACKUP, the recovery process creates files with names of the form tbl_name-datetime.BAK. You should have a cron script that automatically moves these files from the database directories to backup media. &lt;br /&gt;&lt;br /&gt;Myisam-recover is not a dynamic variable; hence, it requires a server restart to reset the variable.&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;strong&gt;References:&lt;/strong&gt;&lt;/div&gt;&lt;ul&gt;&lt;li&gt;&lt;strong&gt;&lt;a href="http://dev.mysql.com/doc/refman/5.0/en/server-options.html"&gt;MySQL Manual: Server Command Options&lt;/a&gt;&lt;/strong&gt;&lt;/li&gt;&lt;li&gt;&lt;strong&gt;&lt;a href="http://www.amazon.com/Understanding-MySQL-Internals-Sasha-Pachev/dp/0596009577?ie=UTF8&amp;amp;tag=widgetsamazon-20&amp;amp;link_code=btl&amp;amp;camp=213689&amp;amp;creative=392969" target="_blank"&gt;Understanding MySQL Internals: Chapter 5: Configuration Variables&lt;/a&gt;&lt;img alt="" border="0" height="1" src="http://www.assoc-amazon.com/e/ir?t=widgetsamazon-20&amp;amp;l=btl&amp;amp;camp=213689&amp;amp;creative=392969&amp;amp;o=1&amp;amp;a=0596009577" style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0px; padding-bottom: 0px !important; padding-left: 0px !important; padding-right: 0px !important; padding-top: 0px !important;" width="1" /&gt;&lt;/strong&gt;&lt;/li&gt;&lt;li&gt;&lt;strong&gt;&lt;a href="http://www.amazon.com/High-Performance-MySQL-Optimization-Replication/dp/0596101716?ie=UTF8&amp;amp;tag=widgetsamazon-20&amp;amp;link_code=btl&amp;amp;camp=213689&amp;amp;creative=392969" target="_blank"&gt;High Performance MySQL: Chapter 6: Optimizing Server Settings&lt;/a&gt;&lt;img alt="" border="0" height="1" src="http://www.assoc-amazon.com/e/ir?t=widgetsamazon-20&amp;amp;l=btl&amp;amp;camp=213689&amp;amp;creative=392969&amp;amp;o=1&amp;amp;a=0596101716" style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0px; padding-bottom: 0px !important; padding-left: 0px !important; padding-right: 0px !important; padding-top: 0px !important;" width="1" /&gt;&lt;/strong&gt;&lt;/li&gt;&lt;li&gt;&lt;strong&gt;&lt;a href="http://www.google.com/cse?cx=partner-pub-1602461054664536%3Aghaimtmraz9&amp;amp;ie=ISO-8859-1&amp;amp;q=MYSQL+MYISAM+RECOVER+OPTIONS&amp;amp;sa=Search"&gt;Other Reference On the Web&lt;/a&gt;&lt;/strong&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;&lt;strong&gt;&lt;/strong&gt;&amp;nbsp;&lt;strong&gt;Related Posts:&lt;/strong&gt;&lt;/div&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://databobjr.blogspot.com/2010/05/mysq-delaykeywrite.html"&gt;MySQL Delay Key Write Option&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;&lt;/div&gt;&lt;br /&gt;&lt;script type="text/javascript"&gt;&lt;!--google_ad_client = "pub-1602461054664536";/* mysqladmin-fooder-banner-468x60-20100503 */google_ad_slot = "9515648953";google_ad_width = 468;google_ad_height = 60;//--&gt;&lt;/script&gt;&lt;br /&gt;&lt;script src="http://pagead2.googlesyndication.com/pagead/show_ads.js" type="text/javascript"&gt;&lt;/script&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/22611914-8421137878001568120?l=databobjr.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://databobjr.blogspot.com/feeds/8421137878001568120/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=22611914&amp;postID=8421137878001568120' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/22611914/posts/default/8421137878001568120'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/22611914/posts/default/8421137878001568120'/><link rel='alternate' type='text/html' href='http://databobjr.blogspot.com/2010/05/mysql-myisamrecover-options.html' title='MYSQL MYISAM_RECOVER OPTIONS'/><author><name>Data Bob Jr.</name><uri>http://www.blogger.com/profile/11965565939904347208</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-22611914.post-8717336228878474741</id><published>2010-05-27T00:11:00.000-07:00</published><updated>2010-10-06T23:27:25.893-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='MySQL'/><category scheme='http://www.blogger.com/atom/ns#' term='MySQL Performance Tuning: System Variables'/><category scheme='http://www.blogger.com/atom/ns#' term='MySQL Performance Tuning'/><category scheme='http://www.blogger.com/atom/ns#' term='MySQL DBA'/><title type='text'>MYSQL MYISAM_MAX_SORT_FILE_SIZE Variable</title><content type='html'>&lt;strong&gt;MYSQL&amp;nbsp;MYISAM_MAX_SORT_FILE_SIZE Variable&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;MYISAM_MAX_SORT_FILE_SIZE sets the maximum size of the temporary file that MySQL is allowed to use while re-creating a MyISAM index (during REPAIR TABLE, ALTER TABLE, or LOAD DATA INFILE). If the file size would be larger than this value, the index is created using the key cache instead, which is slower. The value is given in bytes and the default value is 2GB. &lt;br /&gt;&lt;br /&gt;Set this values a bit larger thatn the largest index file if there is disk space is available to ensure that REPAIR TABLE is be done by sort rather than repair by key cache. Sorting is much faster than repair by key cache.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;References:&lt;/strong&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://dev.mysql.com/doc/refman/5.0/en/server-system-variables.html#sysvar_myisam_max_sort_file_size"&gt;MySQL Manual: MYISAM_MAX_SORT_FILE_SIZE Variable&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.google.com/cse?cx=partner-pub-1602461054664536%3Aghaimtmraz9&amp;amp;ie=ISO-8859-1&amp;amp;q=mysql+MYISAM_MAX_SORT_FILE_SIZE&amp;amp;sa=Search"&gt;Other References On The Web&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&amp;nbsp;&lt;strong&gt;Related Posts:&lt;/strong&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://databobjr.blogspot.com/2010/05/mysql-myisamsortbuffersize-variable.html"&gt;MySQL MYISAM_SORT_BUFFER_SIZE Variable&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://databobjr.blogspot.com/2010/05/mysql-keybuffersize-system-variable.html"&gt;MySQL KEY_BUFFER_SIZE Variable&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;script type="text/javascript"&gt;&lt;!--google_ad_client = "pub-1602461054664536";/* mysqlsystemvariable-fooder-baner-468x60-20100506 */google_ad_slot = "1957650245";google_ad_width = 468;google_ad_height = 60;//--&gt;&lt;/script&gt;&lt;br /&gt;&lt;script src="http://pagead2.googlesyndication.com/pagead/show_ads.js" type="text/javascript"&gt;&lt;/script&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/22611914-8717336228878474741?l=databobjr.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://databobjr.blogspot.com/feeds/8717336228878474741/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=22611914&amp;postID=8717336228878474741' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/22611914/posts/default/8717336228878474741'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/22611914/posts/default/8717336228878474741'/><link rel='alternate' type='text/html' href='http://databobjr.blogspot.com/2010/05/mysql-myisammaxsortfilesize-variable.html' title='MYSQL MYISAM_MAX_SORT_FILE_SIZE Variable'/><author><name>Data Bob Jr.</name><uri>http://www.blogger.com/profile/11965565939904347208</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-22611914.post-6811131262052546593</id><published>2010-05-26T22:05:00.000-07:00</published><updated>2010-10-06T23:29:16.910-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='MySQL'/><category scheme='http://www.blogger.com/atom/ns#' term='MySQL Performance Tuning: System Variables'/><category scheme='http://www.blogger.com/atom/ns#' term='MySQL Performance Tuning'/><category scheme='http://www.blogger.com/atom/ns#' term='MySQL DBA'/><title type='text'>MYSQL BULK_INSERT_BUFFER_SIZE Variable</title><content type='html'>&lt;b&gt;MYSQL BULK_INSERT_BUFFER_SIZE SYSTEM VARIABLE&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;MyISAM uses a special tree-like cache to make bulk inserts faster for INSERT ... SELECT, INSERT ... VALUES (...), (...), ..., and LOAD DATA INFILE when adding data to nonempty tables. The BULK_INSERT_BUFFER_SIZE variable limits the size of the cache tree in bytes per thread. Setting it to 0 disables this optimization. The default value is 8MB. The maximum value is 4GB. The bulk_insert_buffer_size can be set both on system and session levels.&lt;br /&gt;&lt;br /&gt;If data is being added to a non-empty table, tuning the bulk_insert_buffer_size variable can make data insertion faster. Normaily, it shows the improvement when the data to be inserted is more than 10k rows. But it is hard to say what is the right value, so, trail and try with incremental buffer size values.&lt;br /&gt;&lt;br /&gt;Also, performance improvement will be more obvisoue if the following variables are also set:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;MYISAM_SORT_BUFFER_SIZE&lt;/li&gt;&lt;li&gt;KEY_BUFFER_SIZE&lt;/li&gt;&lt;/ul&gt;&amp;nbsp;In addition, when doing bulk inset, consider disable the indexes before loading the data using the following alter table command:&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; alter table&amp;nbsp;t disable keys;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;References:&lt;/b&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://dev.mysql.com/doc/refman/5.0/en/server-system-variables.html#sysvar_bulk_insert_buffer_size"&gt;MySQL Manual: Bulk_Insert_buffer_Size variable.&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.google.com/cse?cx=partner-pub-1602461054664536%3Aghaimtmraz9&amp;amp;ie=ISO-8859-1&amp;amp;q=15.%09MYSQL+BULK_INSERT_BUFFER_SIZE+SYSTEM+VARIABLE&amp;amp;sa=Search"&gt;Other References On The Web&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&amp;nbsp;&lt;b&gt;Related Posts:&lt;/b&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://databobjr.blogspot.com/2010/05/mysql-myisamsortbuffersize-variable.html"&gt;MySQL MYISAM_SORT_BUFFER_SIZE Variable&lt;/a&gt; &lt;/li&gt;&lt;li&gt;&lt;a href="http://databobjr.blogspot.com/2010/05/mysql-keybuffersize-system-variable.html"&gt;MySQL KEY_BUFFER_SIZE variable&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://databobjr.blogspot.com/2010/05/mysql-alter-table-disable-keys.html"&gt;MySQL Alter Table t Disable Keys Statement&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://databobjr.blogspot.com/2010/05/mysql-optimize-table.html"&gt;MySQL Optimize Table Command&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;div&gt;&lt;script type="text/javascript"&gt;&lt;!--google_ad_client = "pub-1602461054664536";/* mysqlsystemvariable-fooder-baner-468x60-20100506 */google_ad_slot = "1957650245";google_ad_width = 468;google_ad_height = 60;//--&gt;&lt;/script&gt;&lt;br /&gt;&lt;script src="http://pagead2.googlesyndication.com/pagead/show_ads.js" type="text/javascript"&gt;&lt;/script&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/22611914-6811131262052546593?l=databobjr.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://databobjr.blogspot.com/feeds/6811131262052546593/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=22611914&amp;postID=6811131262052546593' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/22611914/posts/default/6811131262052546593'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/22611914/posts/default/6811131262052546593'/><link rel='alternate' type='text/html' href='http://databobjr.blogspot.com/2010/05/mysql-bulkinsertbuffersize-variable.html' title='MYSQL BULK_INSERT_BUFFER_SIZE Variable'/><author><name>Data Bob Jr.</name><uri>http://www.blogger.com/profile/11965565939904347208</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-22611914.post-8943745585955251111</id><published>2010-05-26T19:11:00.000-07:00</published><updated>2010-10-06T23:32:07.413-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='MySQL'/><category scheme='http://www.blogger.com/atom/ns#' term='MySQL Performance Tuning: System Variables'/><category scheme='http://www.blogger.com/atom/ns#' term='MySQL Performance Tuning'/><category scheme='http://www.blogger.com/atom/ns#' term='MySQL DBA'/><title type='text'>MYSQL MYISAM_SORT_BUFFER_SIZE Variable</title><content type='html'>&lt;strong&gt;MYSQL MYISAM_SORT_BUFFER_SIZE Variable&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&amp;nbsp;This is the The size of the buffer that is allocated when sorting MyISAM indexes during a REPAIR TABLE or when creating indexes with CREATE INDEX or ALTER TABLE. The maximum size is 4 GB. &lt;/div&gt;&lt;br /&gt;This variable should be set as large as the largest index in the table for index builds if there is sufficient RAM and it is not over 4 GB.&lt;br /&gt;&lt;br /&gt;This variable can be set as global variable or session variable. &lt;br /&gt;&amp;nbsp; &lt;br /&gt;MYSQL&amp;gt;set session MYISAM_SORT_BUFFER_SIZE=1073741824; &lt;br /&gt;or &lt;br /&gt;MYSQL&amp;gt;set&amp;nbsp;global MYISAM_SORT_BUFFER_SIZE=1073741824; &lt;br /&gt;&lt;br /&gt;Or, to set it in my.cnf file:&lt;br /&gt;MYISAM_SORT_BUFFER_SIZE=1073741824&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;References:&lt;/strong&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://dev.mysql.com/doc/refman/5.0/en/server-system-variables.html#sysvar_myisam_sort_buffer_size"&gt;MySQL Manual: MyISAM_Sort_Buffer_Size&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.google.com/cse?cx=partner-pub-1602461054664536%3Aghaimtmraz9&amp;amp;ie=ISO-8859-1&amp;amp;q=mysql+MYISAM_SORT_BUFFER_SIZE+variable&amp;amp;sa=Search"&gt;Other References On The Web&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;div&gt;&lt;/div&gt;&lt;script type="text/javascript"&gt;&lt;!--google_ad_client = "pub-1602461054664536";/* mysqlsystemvariable-fooder-baner-468x60-20100506 */google_ad_slot = "1957650245";google_ad_width = 468;google_ad_height = 60;//--&gt;&lt;/script&gt;&lt;br /&gt;&lt;script src="http://pagead2.googlesyndication.com/pagead/show_ads.js" type="text/javascript"&gt;&lt;/script&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/22611914-8943745585955251111?l=databobjr.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://databobjr.blogspot.com/feeds/8943745585955251111/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=22611914&amp;postID=8943745585955251111' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/22611914/posts/default/8943745585955251111'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/22611914/posts/default/8943745585955251111'/><link rel='alternate' type='text/html' href='http://databobjr.blogspot.com/2010/05/mysql-myisamsortbuffersize-variable.html' title='MYSQL MYISAM_SORT_BUFFER_SIZE Variable'/><author><name>Data Bob Jr.</name><uri>http://www.blogger.com/profile/11965565939904347208</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-22611914.post-1515698446353117169</id><published>2010-05-21T07:07:00.000-07:00</published><updated>2011-06-30T21:27:14.938-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Video'/><category scheme='http://www.blogger.com/atom/ns#' term='Life'/><title type='text'>World Expo 2010 Shanghai China</title><content type='html'>&lt;a href="http://en.expo2010.cn/"&gt;&lt;strong&gt;World Expo 2010&lt;/strong&gt;&lt;/a&gt; (aka World Fair) is under way in Shanghai China. &lt;br /&gt;&lt;br /&gt;&lt;div style="dir: ltr align:left; display: block; float: right; height: 260px; margin: 3px; width: 310px;"&gt;&lt;script type="text/javascript"&gt;&lt;!--google_ad_client = "pub-1602461054664536";/* life-expo-upright-300x250-20100521 */google_ad_slot = "7673227261";google_ad_width = 300;google_ad_height = 250;//--&gt;&lt;/script&gt;&lt;br /&gt;&lt;script src="http://pagead2.googlesyndication.com/pagead/show_ads.js" type="text/javascript"&gt;&lt;/script&gt;&lt;/div&gt;Ever since the&lt;a href="http://en.wikipedia.org/wiki/The_Great_Exhibition"&gt; first World Fair&lt;/a&gt;, which held in &lt;a href="http://en.wikipedia.org/wiki/The_Crystal_Palace"&gt;The Crystal Palace&lt;/a&gt; in &lt;a href="http://en.wikipedia.org/wiki/Hyde_Park,_London"&gt;Hyde Park, London&lt;/a&gt;, United Kingdom in 1851, there have been total 54 World Exhibition taking places in different countries according to &lt;a href="http://en.wikipedia.org/wiki/List_of_world_expositions"&gt;Wikipedia&lt;/a&gt;. However, officially, Expo 2010 is the 41st World Expo. &lt;a href="http://www.bie-paris.org/"&gt;The Bureau International des Expositions (BIE)&lt;/a&gt;, which governs the World Expo, provides information on organizations and history of the Word Expo. Following are some facts I had found which were related to &lt;a href="http://en.expo2010.cn/"&gt;World Expo 2010&lt;/a&gt;,Shanghai China.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;The Participants:&lt;/strong&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;189 countries and 57 international organizations are participating in &lt;a href="http://en.expo2010.cn/"&gt;the Shanghai World Expo&lt;/a&gt;. 18 corporations including &lt;a href="http://en.expo2010.cn/c/en_qy_tpl_58.htm"&gt;Cisco&lt;/a&gt; and &lt;a href="http://en.expo2010.cn/c/en_qy_tpl_108.htm"&gt;Coca-Cola&lt;/a&gt;. &lt;/li&gt;&lt;/ul&gt;&lt;strong&gt;The Site:&lt;/strong&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://en.expo2010.cn/pavilions/hqzg.htm"&gt;The Shanghai World Expo&lt;/a&gt; is the largest World's Fair &lt;a href="http://en.expo.cn/index.html#&amp;amp;c=home"&gt;site&lt;/a&gt; ever at 5.28 square km (2.5 square miles ). It costs $46 billion USD to build. The official cost of $4.2 billion covers just the Expo site and its operations. &lt;/li&gt;&lt;/ul&gt;&lt;strong&gt;The Pavilions:&lt;/strong&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;The site itself is made up of a series of &lt;a href="http://en.expo2010.cn/pavilions/hqzg.htm"&gt;100 pavilions&lt;/a&gt;. &lt;a href="http://en.expo.cn/indexn.html?id=11100001"&gt;The China Pavilion&lt;/a&gt;, an inverted, imperial-red pyramid known as the Oriental Crown, built at an estimated cost of 1.5 billion &lt;a href="http://www.xe.com/ucc/convert.cgi?Amount=1&amp;amp;From=USD&amp;amp;To=CNY&amp;amp;image.x=46&amp;amp;image.y=17&amp;amp;image=Submit"&gt;RMB&lt;/a&gt;. Five permanent structures: &lt;a href="http://en.expo.cn/indexn.html?id=11100001"&gt;China Pavilion&lt;/a&gt;, &lt;a href="http://en.expo.cn/indexn.html?id=12400001"&gt;Expo Center&lt;/a&gt;, &lt;a href="http://en.expo.cn/indexn.html?id=12200001"&gt;Expo Culture Center&lt;/a&gt;, &lt;a href="http://en.expo.cn/indexn.html?id=12100001"&gt;Theme Pavilions&lt;/a&gt;, and &lt;a href="http://en.expo.cn/indexn.html?id=12200001"&gt;Expo Boulevard&lt;/a&gt; designed for continual use after the Expo.&lt;/li&gt;&lt;/ul&gt;&lt;strong&gt;The Staff:&lt;/strong&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;There are 50,000 Expo Bureau staff and other service staffs during the Expo, There are 72,000 &lt;a href="http://en.expo2010.cn/volunteer/hqzyz.htm"&gt;volunteers&lt;/a&gt;, age from 16 to 99, working inside the Expo site, and 4,000 Expo-exclusive taxis dedicate for the Expo. There are another 100,000 volunteers will staff more than 1,000 service centers around the city during the event. &lt;/li&gt;&lt;/ul&gt;&lt;strong&gt;Visits:&lt;/strong&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;The &lt;a href="http://en.expo2010.cn/"&gt;Expo&lt;/a&gt; will open for 184 days, from May 1st to October 3oth, 2010. It is expected to attract 70 million visitors, including an estimated 5 million foreign tourists. It also expects to receive almost 100 foreign leaders.&lt;/li&gt;&lt;/ul&gt;&lt;strong&gt;Tickes:&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&amp;nbsp;The &lt;a href="http://en.expo2010.cn/expotickets/indexn.htm"&gt;ticket prices&lt;/a&gt; ranging from 90 to 200 &lt;a href="http://www.xe.com/ucc/convert.cgi?Amount=1&amp;amp;From=USD&amp;amp;To=CNY&amp;amp;image.x=46&amp;amp;image.y=17&amp;amp;image=Submit"&gt;yuan&lt;/a&gt; (or approximately $13 to $30 USD) depending on whether you visit on a standard day, peak day, or only during evening hours. All tickets are good for either 3 or 7 days, depending on which type of ticket you choose.&lt;/li&gt;&lt;/ul&gt;&lt;strong&gt;The Theme:&lt;/strong&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&amp;nbsp;The World Expo 2010 theme is “&lt;a href="http://www.bie-paris.org/site/en/Shanghai%202010/theme.html"&gt;Better City, Better Life&lt;/a&gt;”. There are five sub-themes:&lt;/li&gt;&lt;/ul&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; * Blending of Diverse Cultures in the City&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; * Economic Prosperity in the City&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;* Innovation of Science and Technology in the City &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; * Remodeling of Communities in the City&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; *&amp;nbsp;Interactions Between Urban and Rural Areas&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Here is the Officer Video of the World Expo 2010&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;object height="344" width="425"&gt;&lt;param name="movie" value="http://www.youtube.com/v/DnVO2R9SWZQ&amp;hl=en_US&amp;fs=1&amp;rel=0"&gt;&lt;/param&gt;&lt;param name="allowFullScreen" value="true"&gt;&lt;/param&gt;&lt;param name="allowscriptaccess" value="always"&gt;&lt;/param&gt;&lt;embed src="http://www.youtube.com/v/DnVO2R9SWZQ&amp;hl=en_US&amp;fs=1&amp;rel=0" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;strong&gt;&amp;nbsp;The Theme Song:&lt;/strong&gt;&lt;/div&gt;&lt;ul&gt;&lt;li&gt;&amp;nbsp;The theme song is&amp;nbsp;called "City" (成市) which was sung by movie star and&amp;nbsp; Expo Ambassador Jackie Chan. This MTV video also features NBA star Yao Ming and pianist Lang Lang. Both are Expo Ambassadors as well.&lt;/li&gt;&lt;/ul&gt;&lt;object height="344" width="425"&gt;&lt;param name="movie" value="http://www.youtube.com/v/XfMdfXUduMA&amp;hl=en_US&amp;fs=1&amp;rel=0"&gt;&lt;/param&gt;&lt;param name="allowFullScreen" value="true"&gt;&lt;/param&gt;&lt;param name="allowscriptaccess" value="always"&gt;&lt;/param&gt;&lt;embed src="http://www.youtube.com/v/XfMdfXUduMA&amp;hl=en_US&amp;fs=1&amp;rel=0" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;References:&lt;/strong&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://en.expo2010.cn/"&gt;Expo 2010 Shanghai China&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.bie-paris.org/site/index.php"&gt;The Bureau&amp;nbsp;International des Expoisitions (BIE)&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://en.expo.cn/index.html#lang=t&amp;amp;c=home"&gt;Expo Shanghai Online&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://en.wikipedia.org/wiki/World%27s_fair"&gt;Wikipedia&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.amazon.com/World-Fairs-Century-Progress-Expositions/dp/0226732371?ie=UTF8&amp;amp;tag=dat03-20&amp;amp;link_code=btl&amp;amp;camp=213689&amp;amp;creative=392969" target="_blank"&gt;World of Fairs: The Century-of-progress Expositions&lt;/a&gt;&lt;img alt="" border="0" height="1px" src="http://www.assoc-amazon.com/e/ir?t=dat03-20&amp;amp;l=btl&amp;amp;camp=213689&amp;amp;creative=392969&amp;amp;o=1&amp;amp;a=0226732371" style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0px; padding-bottom: 0px !important; padding-left: 0px !important; padding-right: 0px !important; padding-top: 0px !important;" width="1px" /&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.amazon.com/Encyclopedia-Worlds-Fairs-Expositions-Findling/dp/0786434163?ie=UTF8&amp;amp;tag=dat03-20&amp;amp;link_code=btl&amp;amp;camp=213689&amp;amp;creative=392969" target="_blank"&gt;Encyclopedia of World's Fairs and Expositions&lt;/a&gt;&lt;img alt="" border="0" height="1px" src="http://www.assoc-amazon.com/e/ir?t=dat03-20&amp;amp;l=btl&amp;amp;camp=213689&amp;amp;creative=392969&amp;amp;o=1&amp;amp;a=0786434163" style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0px; padding-bottom: 0px !important; padding-left: 0px !important; padding-right: 0px !important; padding-top: 0px !important;" width="1px" /&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.google.com/cse?cx=partner-pub-1602461054664536%3Aghaimtmraz9&amp;amp;ie=ISO-8859-1&amp;amp;q=World+Expo+2010+Shanghai+China&amp;amp;sa=Search"&gt;Other References On The Web&lt;/a&gt;&lt;/li&gt;&lt;li&gt;Jack Chan's Movies&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;&lt;script type="text/javascript"&gt;&lt;!--google_ad_client = "pub-1602461054664536";/* life-wordexpo-468x60-20100521 */google_ad_slot = "6610524701";google_ad_width = 468;google_ad_height = 60;//--&gt;&lt;/script&gt;&lt;br /&gt;&lt;script src="http://pagead2.googlesyndication.com/pagead/show_ads.js" type="text/javascript"&gt;&lt;/script&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/22611914-1515698446353117169?l=databobjr.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://databobjr.blogspot.com/feeds/1515698446353117169/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=22611914&amp;postID=1515698446353117169' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/22611914/posts/default/1515698446353117169'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/22611914/posts/default/1515698446353117169'/><link rel='alternate' type='text/html' href='http://databobjr.blogspot.com/2010/05/world-expo-2010-shanghai-china.html' title='World Expo 2010 Shanghai China'/><author><name>Data Bob Jr.</name><uri>http://www.blogger.com/profile/11965565939904347208</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-22611914.post-1102837294336117827</id><published>2010-05-21T01:20:00.000-07:00</published><updated>2010-10-06T23:21:27.025-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='MySQL Data Warehouse'/><category scheme='http://www.blogger.com/atom/ns#' term='MySQL'/><category scheme='http://www.blogger.com/atom/ns#' term='MySQL Performance Tuning'/><title type='text'>MySQL: Optimize Table</title><content type='html'>&lt;b&gt;MySQL Optimize Table Command&lt;br /&gt;&lt;/b&gt;&lt;br /&gt;The Optimize table command defragments, reclaims free space and makes concurrent inserts wrk again. For MyISAM table, optimize table command performs the following tasks:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Repaire the table if the table has deleted or split rows. This, in trun, help defragment and reclaim free spaces.&lt;/li&gt;&lt;li&gt;Sort index pages if it is needed.&lt;/li&gt;&lt;li&gt;Update the table’s statistics.&lt;/li&gt;&lt;/ul&gt;&amp;nbsp;One way to find out if one should run optimize table on a table is to compare the data length and data free values from the show table status command.&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&amp;nbsp; Data_length is the length of the data file. &lt;/li&gt;&lt;li&gt;&amp;nbsp; Data_free is the the number of allocated but unused byte. These included those deleted records.&lt;/li&gt;&lt;/ul&gt;&amp;nbsp;When a data_free value is relative large in comparing to date_length, optimize table should be performed agaist the table. Please see the following example:&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; mysql&amp;gt; show table status like '%table_name%' \G;&lt;br /&gt;&lt;br /&gt;*************************** 1. row ***************************&lt;br /&gt;&lt;div style="dir: ltr align:left; display: block; float:right; height: 610px; margin: 3px; width: 170px;"&gt;&lt;script type="text/javascript"&gt;&lt;!--amazon_ad_tag = "dat03-20"; amazon_ad_width = "160"; amazon_ad_height = "600";//--&gt;&lt;/script&gt;&lt;br /&gt;&lt;script type="text/javascript" src="http://www.assoc-amazon.com/s/ads.js"&gt;&lt;/script&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp;Name: table_name&lt;/div&gt;&amp;nbsp;Engine: MyISAM&lt;br /&gt;&amp;nbsp;Version: 10&lt;br /&gt;&amp;nbsp;Row_format: Dynamic&lt;br /&gt;Rows: 1473839&lt;br /&gt;Avg_row_length: 186&lt;br /&gt;Data_length: 420392440&lt;br /&gt;Max_data_length: 281474976710655&lt;br /&gt;Index_length: 52712448&lt;br /&gt;Data_free: 145156624&lt;br /&gt;Auto_increment: NULL&lt;br /&gt;&amp;nbsp;Create_time: 2010-05-18 18:35:16&lt;br /&gt;&amp;nbsp;Update_time: 2010-05-20 13:44:47&lt;br /&gt;&amp;nbsp;Check_time: 2010-05-20 02:21:54&lt;br /&gt;&amp;nbsp;Collation: latin1_swedish_ci&lt;br /&gt;&amp;nbsp;Checksum: NULL&lt;br /&gt;&amp;nbsp;Create_options: delay_key_write=1&lt;br /&gt;&amp;nbsp;Comment:&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp; mysql&amp;gt; optimize table table_name;&lt;br /&gt;&lt;br /&gt;+--------------------------------+----------+----------+----------+&lt;br /&gt;Table&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Op&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Msg_type&amp;nbsp; Msg_text &lt;br /&gt;&amp;nbsp;+--------------------------------+----------+----------+----------+&lt;br /&gt;&amp;nbsp;dwstgdb.table_name&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; optimize&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; status&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; OK &lt;br /&gt;&amp;nbsp;+--------------------------------+----------+----------+----------+&lt;br /&gt;&amp;nbsp;1 row in set (50.08 sec)&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp; mysql&amp;gt; show table status like '%table_name%' \G;&lt;br /&gt;&lt;br /&gt;*************************** 1. row ***************************&lt;br /&gt;&amp;nbsp;Name: table_name&lt;br /&gt;&amp;nbsp;Engine: MyISAM&lt;br /&gt;&amp;nbsp;Version: 10&lt;br /&gt;&amp;nbsp;Row_format: Dynamic&lt;br /&gt;&amp;nbsp;Rows: 1473839&lt;br /&gt;&amp;nbsp;Avg_row_length: 186&lt;br /&gt;&amp;nbsp;Data_length: 275235816&lt;br /&gt;&amp;nbsp;Max_data_length: 281474976710655&lt;br /&gt;&amp;nbsp;Index_length: 30075904&lt;br /&gt;&amp;nbsp;Data_free: 0&lt;br /&gt;&amp;nbsp;Auto_increment: NULL&lt;br /&gt;&amp;nbsp;Create_time: 2010-05-18 18:35:16&lt;br /&gt;&amp;nbsp;Update_time: 2010-05-21 00:33:58&lt;br /&gt;&amp;nbsp;Check_time: 2010-05-21 00:34:14&lt;br /&gt;&amp;nbsp;Collation: latin1_swedish_ci&lt;br /&gt;&amp;nbsp;Checksum: NULL&lt;br /&gt;&amp;nbsp;Create_options: delay_key_write=1&lt;br /&gt;&amp;nbsp;Comment:&lt;br /&gt;&lt;br /&gt;Now we can see that the data_free value down to 0 from 145156624 after performing optimize table. This will indeed deframent the table and speep up the queries. In general, optimize table command should be performed on a reqular basis.&lt;br /&gt;&lt;br /&gt;&lt;div&gt;Referemces:&lt;/div&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://dev.mysql.com/doc/refman/5.1/en/optimize-table.html"&gt;MySQL Manual: OPTIMIZE TABLE Syntax&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.google.com/cse?cx=partner-pub-1602461054664536%3Aghaimtmraz9&amp;amp;ie=ISO-8859-1&amp;amp;q=mysql%3A+optimize+table&amp;amp;sa=Search"&gt;Other References On The Web&lt;/a&gt;&amp;nbsp;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;br /&gt;&lt;script type="text/javascript"&gt;&lt;!--google_ad_client = "pub-1602461054664536";/* mysql-data-warehouse-fooder-banner-468x60-20100520 */google_ad_slot = "3636414118";google_ad_width = 468;google_ad_height = 60;//--&gt;&lt;/script&gt;&lt;br /&gt;&lt;script src="http://pagead2.googlesyndication.com/pagead/show_ads.js" type="text/javascript"&gt;&lt;/script&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/22611914-1102837294336117827?l=databobjr.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://databobjr.blogspot.com/feeds/1102837294336117827/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=22611914&amp;postID=1102837294336117827' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/22611914/posts/default/1102837294336117827'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/22611914/posts/default/1102837294336117827'/><link rel='alternate' type='text/html' href='http://databobjr.blogspot.com/2010/05/mysql-optimize-table.html' title='MySQL: Optimize Table'/><author><name>Data Bob Jr.</name><uri>http://www.blogger.com/profile/11965565939904347208</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-22611914.post-8095357368098122983</id><published>2010-05-21T01:09:00.000-07:00</published><updated>2010-10-06T23:24:31.777-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='MySQL Data Warehouse'/><category scheme='http://www.blogger.com/atom/ns#' term='MySQL Performance Tuning'/><category scheme='http://www.blogger.com/atom/ns#' term='MySQL DBA'/><title type='text'>MySQL: Alter Table  Disable Keys</title><content type='html'>&lt;strong&gt;MySQL Disable Indexes Command&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;When inserting,updating or deleting a high percenblege of the data from a table, it is a best pratce to disable indexes. Especaily, when doing a bulk load into a empty table.&amp;nbsp; To disable indexes, one can drop all the index keys and recreate them later. Or, we can use Alter Table table name Disable Keys to deactivate&amp;nbsp; indexes&amp;nbsp; on a MyISAM table.&lt;br /&gt;&lt;br /&gt;To do that, before performing the sql statements that involve with insert, update or delete, issue the following command:&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; mysql&amp;gt; alter table tablename disable keys;&lt;br /&gt;&lt;br /&gt;Now perform the tasks; for example:&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;mysql&amp;gt; insert into&amp;nbsp;tablename(...) values( ...);&lt;br /&gt;&lt;br /&gt;After the task has been completed, issue the following command to reactivate the indexes:&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; mysql&amp;gt;alter table tablename enable keys;&lt;br /&gt;&lt;br /&gt;ALTER TABLE tablename DISABLE KEYS tells MySQL to stop updating nonunique indexes. ALTER TABLE tablename ENABLE KEYS tells MySQL to re-create missing indexes. MySQL does this with a special algorithm that is much faster than inserting keys one by one, so disabling keys before performing bulk insert operations should give a considerable speedup. When using ALTER TABLE tablename DISABLE KEYS, please keep in mind the following:&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&amp;nbsp;ALTER TABLE tablename DISABLE KEYS will keep UNIQUE keys active.&lt;/li&gt;&lt;li&gt;Using ALTER TABLE tablename DISABLE KEYS requires ALTER, INSERT, CREATE and the INDEX privilege for that table. &lt;/li&gt;&lt;li&gt;While the nonunique indexes are disabled, they are ignored for statements such as SELECT and EXPLAIN that otherwise would use them. &lt;/li&gt;&lt;li&gt;ENABLE KEYS and DISABLE KEYS were not supported for partitioned tables prior to MySQL 5.1.11. &lt;/li&gt;&lt;/ul&gt;&lt;strong&gt;&amp;nbsp;References:&lt;/strong&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://dev.mysql.com/doc/refman/5.1/en/alter-table.html"&gt;MySQL Manual: ALTER TABLE Syntax.&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.google.com/cse?cx=partner-pub-1602461054664536:ghaimtmraz9&amp;amp;ie=ISO-8859-1&amp;amp;q=mysql:+alter+table+..+disable+keys&amp;amp;sa=Search"&gt;Other References On The Web.&lt;/a&gt;&amp;nbsp;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;script type="text/javascript"&gt;&lt;!--google_ad_client = "pub-1602461054664536";/* mysql-data-warehouse-fooder-banner-468x60-20100520 */google_ad_slot = "3636414118";google_ad_width = 468;google_ad_height = 60;//--&gt;&lt;/script&gt;&lt;br /&gt;&lt;script src="http://pagead2.googlesyndication.com/pagead/show_ads.js" type="text/javascript"&gt;&lt;/script&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/22611914-8095357368098122983?l=databobjr.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://databobjr.blogspot.com/feeds/8095357368098122983/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=22611914&amp;postID=8095357368098122983' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/22611914/posts/default/8095357368098122983'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/22611914/posts/default/8095357368098122983'/><link rel='alternate' type='text/html' href='http://databobjr.blogspot.com/2010/05/mysql-alter-table-disable-keys.html' title='MySQL: Alter Table  Disable Keys'/><author><name>Data Bob Jr.</name><uri>http://www.blogger.com/profile/11965565939904347208</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-22611914.post-1702947439851210460</id><published>2010-05-21T00:43:00.000-07:00</published><updated>2010-10-06T23:25:35.188-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='MySQL Data Warehouse'/><category scheme='http://www.blogger.com/atom/ns#' term='MySQL'/><category scheme='http://www.blogger.com/atom/ns#' term='MySQL Performance Tuning'/><category scheme='http://www.blogger.com/atom/ns#' term='MySQL DBA'/><title type='text'>MySQ: Delay_Key_Write</title><content type='html'>&lt;strong&gt;MySQL Alter Table t Delay_ Key_ Write Command&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;The delay_key_write option works with MyISAM tables. Delayed key writing tells storage engine not to wtire change index data to disk at the end of any query that changes the data. Instead, the changes are kept in the key buffer until the server prunes the buffer or close the table. This option can boots performance if the MyISAM table is changing frequenry, for example, has a lot of inserts and updates. &lt;br /&gt;&lt;br /&gt;To turn on delay_key_write option for a table, you can include the following statement in to create table script:&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Delay_key_write =1&lt;br /&gt;&lt;br /&gt;Or for existing table, use the alter table statement:&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; MySQL&amp;gt; ALTER TABLE table name DELAY_KEY_WRITE = 1;&lt;br /&gt;&lt;br /&gt;Please note that,in MySQL, Alter Table statement takes time to excute and locks the table. Therefore, for large tables, so do this with care.&lt;br /&gt;&lt;br /&gt;There are a few thing need to keep in mind when using delay_key_write option as well. First, the changes, mainly, the index changes, will be kep in memory until the buffer cache prunes or the table is closed. A table is closed when:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&amp;nbsp;&amp;nbsp;When the cache is full and a thread tries to open a table that is not in the cache.&lt;/li&gt;&lt;li&gt;&amp;nbsp;When the cache contains more than table_cache entries and a thread is no longer using a table.&lt;/li&gt;&lt;li&gt;&amp;nbsp;When FLUSH TABLES command is issued. &lt;/li&gt;&lt;/ul&gt;&amp;nbsp;This means that if the server or table is crashed, there will be indexes cruptions since the indexes on the index file (tablename.MYI) was not updated while the data file (tablename.MYD) was. Therefore, it is recomanded that the myisam-recover variable to be turned on during server startup. For example, set &lt;br /&gt;&amp;nbsp;--myisam-recover=BACKUP,FORCE in my.cnf file or start the server with –myisam-recover option. Secondly, if the table has many write delays, it will table longer for the table to close since it needs time to flush all the caches to the disk, and it will take longer to run FLUSH TABLES statements(flush table, flush table with read lock) Hence, flush tables should be used a bit frequely if you use delay_key_write option. Lastly, queries may need to wait for the MyISAM engine to free up space in the key buffer cache because the unflushed dirty blocks in the key buffer cache take up space. &lt;br /&gt;&lt;br /&gt;Delay_Key_write option can also be enable globally for all MyISAM tables. To do so, set the delay_key_write option to ‘all’:&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&amp;nbsp;&amp;nbsp; delay_key_write = all&lt;/div&gt;&lt;br /&gt;However, it is not a commend pratics to most systems because for infrequently written tables, delay_key_write may increase the chance of index corruption.&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;strong&gt;&amp;nbsp;References:&lt;/strong&gt;&lt;/div&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://dev.mysql.com/doc/refman/5.1/en/table-cache.html"&gt;MySQL Manual: How MySQL Opens and Closes Tables&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.amazon.com/High-Performance-MySQL-Optimization-Replication/dp/0596101716?ie=UTF8&amp;amp;tag=dat03-20&amp;amp;link_code=btl&amp;amp;camp=213689&amp;amp;creative=392969" target="_blank"&gt;High Performance MySQL: Chapter 1, MySQL Architecture. Chapter 6, Optimizing Server Settings &lt;/a&gt;&lt;img alt="" border="0" height="1" src="http://www.assoc-amazon.com/e/ir?t=dat03-20&amp;amp;l=btl&amp;amp;camp=213689&amp;amp;creative=392969&amp;amp;o=1&amp;amp;a=0596101716" style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0px; padding-bottom: 0px !important; padding-left: 0px !important; padding-right: 0px !important; padding-top: 0px !important;" width="1" /&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.google.com/cse?cx=partner-pub-1602461054664536:ghaimtmraz9&amp;amp;ie=ISO-8859-1&amp;amp;q=mysql:+delay_key_write&amp;amp;sa=Search"&gt;Other References On The Web&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;div&gt;&lt;script type="text/javascript"&gt;&lt;!--google_ad_client = "pub-1602461054664536";/* mysql-data-warehouse-fooder-banner-468x60-20100520 */google_ad_slot = "3636414118";google_ad_width = 468;google_ad_height = 60;//--&gt;&lt;/script&gt;&lt;br /&gt;&lt;script src="http://pagead2.googlesyndication.com/pagead/show_ads.js" type="text/javascript"&gt;&lt;/script&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/22611914-1702947439851210460?l=databobjr.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://databobjr.blogspot.com/feeds/1702947439851210460/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=22611914&amp;postID=1702947439851210460' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/22611914/posts/default/1702947439851210460'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/22611914/posts/default/1702947439851210460'/><link rel='alternate' type='text/html' href='http://databobjr.blogspot.com/2010/05/mysq-delaykeywrite.html' title='MySQ: Delay_Key_Write'/><author><name>Data Bob Jr.</name><uri>http://www.blogger.com/profile/11965565939904347208</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-22611914.post-1528376225822113804</id><published>2010-05-21T00:28:00.000-07:00</published><updated>2010-10-06T23:44:48.364-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='MySQL'/><category scheme='http://www.blogger.com/atom/ns#' term='MySQL DBA'/><title type='text'>MySQL: Failed to CREATE PROCEDURE ERROR 1307 (HY000)</title><content type='html'>&lt;strong&gt;ERROR 1307 (HY000): Failed to CREATE PROCEDURE …&lt;/strong&gt; &lt;br /&gt;&lt;br /&gt;When tried to create a procedure, I got the above error message. The user had the needed create routine privileges and the procedure syntax was corrected. Used the following command to check the version and found out that it was v.5.1.30. &lt;br /&gt;&lt;br /&gt;mysql&amp;gt; select version();&lt;br /&gt;+----------------------+&lt;br /&gt;| version() |&lt;br /&gt;+----------------------+&lt;br /&gt;| 5.1.30-community-log |&lt;br /&gt;+----------------------+&lt;br /&gt;1 row in set (0.00 sec)&lt;br /&gt;&lt;br /&gt;After some researches, it turned out that the database was a copy from an earlier version. So to resolve the problem, I need to apply the mysql_upgrade script. For Redhat Linux installation, it was located in /usr/bin. But it is easy to find out where it is by using the Linux ‘which’ command:&lt;br /&gt;&lt;br /&gt;#&amp;gt; which mysql_upgrade&lt;br /&gt;/usr/bin/mysql_upgrade&lt;br /&gt;&lt;br /&gt;To excute the script, from the command line run the script using mysql root user and password: &lt;br /&gt;&lt;br /&gt;#&amp;gt;/usr./bin/mysql_upgrade -u root –p&lt;br /&gt;&lt;br /&gt;Now it should be fine. The script also printed out messages on the screen on what got updated during the execution.&lt;br /&gt;&lt;strong&gt;References:&lt;/strong&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://dev.mysql.com/doc/refman/5.1/en/upgrading-from-previous-series.html"&gt;MySQL Manual: Upgrading from MySQL 5.0 to 5.1&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.google.com/cse?cx=partner-pub-1602461054664536%3Aghaimtmraz9&amp;amp;ie=ISO-8859-1&amp;amp;q=mysql+upgrade+5.0+to+5.1&amp;amp;sa=Search"&gt;Other References On The Web&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;script type="text/javascript"&gt;&lt;!--google_ad_client = "pub-1602461054664536";/* mysqladmin-fooder-banner-468x60-20100503 */google_ad_slot = "9515648953";google_ad_width = 468;google_ad_height = 60;//--&gt;&lt;/script&gt;&lt;br /&gt;&lt;script src="http://pagead2.googlesyndication.com/pagead/show_ads.js" type="text/javascript"&gt;&lt;/script&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/22611914-1528376225822113804?l=databobjr.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://databobjr.blogspot.com/feeds/1528376225822113804/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=22611914&amp;postID=1528376225822113804' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/22611914/posts/default/1528376225822113804'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/22611914/posts/default/1528376225822113804'/><link rel='alternate' type='text/html' href='http://databobjr.blogspot.com/2010/05/mysql-failed-to-create-procedure-error.html' title='MySQL: Failed to CREATE PROCEDURE ERROR 1307 (HY000)'/><author><name>Data Bob Jr.</name><uri>http://www.blogger.com/profile/11965565939904347208</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-22611914.post-9174718801454642240</id><published>2010-05-11T07:19:00.000-07:00</published><updated>2010-10-06T19:49:17.890-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Oracle DBA'/><category scheme='http://www.blogger.com/atom/ns#' term='Oracle'/><title type='text'>Download Oracle Softwares Using Wget and Browser</title><content type='html'>&lt;div style="dir: ltr align:left; display: block; float:right; height: 260px; margin: 3px; width: 310px;"&gt;&lt;script type="text/javascript"&gt;&lt;!--google_ad_client = "pub-1602461054664536";/* oracledba-body-upright-300x250-20100511 */google_ad_slot = "9765500328";google_ad_width = 300;google_ad_height = 250;//--&gt;&lt;/script&gt;&lt;br /&gt;&lt;script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"&gt;&lt;/script&gt;&lt;br /&gt;&lt;/div&gt;Oracle softwares can be&amp;nbsp;downloaded for free for developing and prototyping your applications (or for strictly self-educational purposes) from its download &lt;a href="http://www.oracle.com/technology/software/index.html"&gt;site&lt;/a&gt;. Please read the Development License term for more details. (&lt;a href="http://www.oracle.com/technology/software/index.html"&gt;http://www.oracle.com/technology/software/index.html&lt;/a&gt;)&lt;br /&gt;&lt;div&gt;&amp;nbsp;To download the software, you first need to create an Orcale (some time call Oracle Technology Network) user account &lt;a href="https://login.oracle.com/mysso/signon.jsp"&gt;here&lt;/a&gt;.(&lt;a href="https://login.oracle.com/mysso/signon.jsp"&gt;https://login.oracle.com/mysso/signon.jsp&lt;/a&gt;). Please note, it is different from a MetaLink Support account and&amp;nbsp;MetaLink account can be used as well.&amp;nbsp; Following show two different ways of downloading the softwares.&lt;/div&gt;&lt;br /&gt;&lt;strong&gt;1. Download Using Web Browser&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;It is easy to download using Web Browser. Just select the software from the download list, accept the license agreement, and download and save the software from the browser.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;2. Download Using Linux Wget&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;If you are installing the software in a Linux box or don’t not have access to a browser, you can use wget &lt;br /&gt;(&lt;a href="http://www.gnu.org/software/wget/"&gt;http://www.gnu.org/software/wget/&lt;/a&gt;) to donwload the software. The syntax to download using wget is:&lt;br /&gt;&lt;br /&gt;wget -vv --post -data="remoteIp=&lt;remote ip=""&gt;&lt;your address="" ip=""&gt;globalId=&amp;amp;redirectUrl=&lt;download and="" file="" pathe=""&gt;&lt;download and="" file="" name="" path=""&gt;&lt;download and="" directory="" file="" name=""&gt;username=&lt;login&gt;&lt;loginid&gt;&amp;amp;password=&lt;password&gt;&lt;password&gt;&amp;amp;submit=Continue" https://profile.oracle.com/jsp/reg/loginHandler.jsp -o &lt;log file=""&gt;&lt;br /&gt;&lt;br /&gt;Where:&lt;br /&gt;remote IP&amp;nbsp;= ip address of the server where&amp;nbsp;wget is issued&lt;br /&gt;login id =&amp;nbsp;oracle account login id&lt;br /&gt;password=oracle account password.&lt;br /&gt;Log file = log file which&amp;nbsp;can use to log information for the download. Just pick a file name.&lt;br /&gt;download path and file name = the directory and file name of the file you want to download. &lt;br /&gt;&amp;nbsp; &lt;br /&gt;To get the download path and file name information, try to download the file from a browser. After&amp;nbsp;starting the download, copy the url from the browser and past it on&amp;nbsp;the notepad. For example, assuming your want to download&amp;nbsp;database 10g, the url you copy will look like this: &lt;br /&gt;&lt;br /&gt;&lt;a href="https://profile.oracle.com/jsp/realms/otnLogin.jsp?remoteIp=192.168.1.1&amp;amp;globalId=&amp;amp;redirectUrl=http%3a%2f%2fdownload-llnw.oracle.com%3a80%2fotn%2flinux%2foracle10g%2f10201%2f10201_database_linux32.zip"&gt;https://profile.oracle.com/jsp/realms/otnLogin.jsp?remoteIp=192.168.1.1&amp;amp;globalId=&amp;amp;redirectUrl=http%3a%2f%2fdownload-llnw.oracle.com%3a80%2fotn%2flinux%2foracle10g%2f10201%2f10201_database_linux32.zip&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;And the&amp;nbsp;download path and file is: &lt;br /&gt;http%3a%2f%2fdownload-llnw.oracle.com%3a80%2fotn%2flinux%2foracle10g%2f10201%2f10201_database_linux32.zip&lt;br /&gt;&lt;br /&gt;For example, to download the&amp;nbsp; database 10g (10.0.2.1); and, remote&amp;nbsp;IP = 192.168.1.1, oracle account id = bobsmith, password = password and log file = ora.log. The wget command is:&lt;br /&gt;&lt;br /&gt;wget -vv --post-data="remoteIp=192.168.1.1&amp;amp;globalId=&amp;amp;redirectUrl=http:%2F%2Fdownload-llnw.oracle.com:80%2fotn%2flinux%2foracle10g%2f10201%2f10201_database_linux32.zip&amp;amp;username=bobsmith&amp;amp;password=password&amp;amp;submit=Continue" https://profile.oracle.com/jsp/reg/loginHandler.jsp -o ora.log&lt;br /&gt;&lt;br /&gt;Please note, --post-data is one parameter.&lt;br /&gt;Check the log file for error after the download to make sure a completed file was downloaded.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;References:&lt;/strong&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://www.oracle.com/technetwork/index.html"&gt;Oracle Technology Network&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.google.com/cse?cx=partner-pub-1602461054664536%3Aghaimtmraz9&amp;amp;ie=ISO-8859-1&amp;amp;q=oracle+installation&amp;amp;sa=Search"&gt;Other References On the Web&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;strong&gt;Related Post:&lt;/strong&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://databobjr.blogspot.com/2007/04/oracleadmin-install-oracle-in-linxu.html"&gt;Install Oracle&amp;nbsp;On Linxu Using A Response File&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;script type="text/javascript"&gt;&lt;!--google_ad_client = "pub-1602461054664536";/* oracledba-fooder-banner-468x60-20100511 */google_ad_slot = "5574621840";google_ad_width = 468;google_ad_height = 60;//--&gt;&lt;/script&gt;&lt;br /&gt;&lt;script src="http://pagead2.googlesyndication.com/pagead/show_ads.js" type="text/javascript"&gt;&lt;/script&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/22611914-9174718801454642240?l=databobjr.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://databobjr.blogspot.com/feeds/9174718801454642240/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=22611914&amp;postID=9174718801454642240' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/22611914/posts/default/9174718801454642240'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/22611914/posts/default/9174718801454642240'/><link rel='alternate' type='text/html' href='http://databobjr.blogspot.com/2010/05/download-oracle-softwares-using-wget.html' title='Download Oracle Softwares Using Wget and Browser'/><author><name>Data Bob Jr.</name><uri>http://www.blogger.com/profile/11965565939904347208</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-22611914.post-515084754527204182</id><published>2010-05-11T06:57:00.000-07:00</published><updated>2010-10-06T23:45:31.701-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='MySQL'/><category scheme='http://www.blogger.com/atom/ns#' term='MySQL DBA'/><title type='text'>MySQL: Startup MySQL Server Failed</title><content type='html'>&lt;strong&gt;Starting MySQL/etc/init.d/mysql: line 159: kill: (9193) - No such process [FAILED]&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;When tried to start the MySQL server ( v. 5.0.51a, in RedHat Linux 4) using /etc/init.d/mysql start, I got the following error message and the server failed to start. &lt;br /&gt;&lt;br /&gt;#&amp;gt;/etc/init.d/start&lt;br /&gt;Starting MySQL/etc/init.d/mysql: line 159: kill: (9193) - No such process [FAILED]&lt;br /&gt;&lt;br /&gt;Unforturalely, there was not error in the error log to tell what caused the problem. After some debugging, it turned out, it was because there was one of the server variable, which was added to the my.cnf file after the last successfull server start, was not supported. The server variable was: &lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; open_file_limit&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;After command out this variable in the my.cnf file, there server started without problem, &lt;br /&gt;&lt;br /&gt;In general, if there is any variable which was wrongly entered (misspelled, for example) in the my.cnf file, the server will fail to start. However, there will not be any error message in the error log to inform the user what cause the error.&lt;br /&gt;&lt;strong&gt;References:&lt;/strong&gt; &lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://dev.mysql.com/doc/refman/5.0/en/server-system-variables.html"&gt;MySQL Manual: Server System Variables&lt;/a&gt;. &lt;/li&gt;&lt;li&gt;&lt;a href="http://dev.mysql.com/doc/refman/5.0/en/using-system-variables.html"&gt;MySQL Manual: Using System Variables.&lt;/a&gt; &lt;/li&gt;&lt;li&gt;&lt;a href="http://www.amazon.com/High-Performance-MySQL-Optimization-Replication/dp/0596101716?ie=UTF8&amp;amp;tag=dat03-20&amp;amp;link_code=btl&amp;amp;camp=213689&amp;amp;creative=392969" target="_blank"&gt;High Performance MySQL: Chapter 6, Optimizing Server Settings&lt;/a&gt;&lt;img alt="" border="0" height="1" src="http://www.assoc-amazon.com/e/ir?t=dat03-20&amp;amp;l=btl&amp;amp;camp=213689&amp;amp;creative=392969&amp;amp;o=1&amp;amp;a=0596101716" style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0px; padding-bottom: 0px !important; padding-left: 0px !important; padding-right: 0px !important; padding-top: 0px !important;" width="1" /&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.google.com/cse?cx=partner-pub-1602461054664536%3Aghaimtmraz9&amp;amp;ie=ISO-8859-1&amp;amp;q=Starting+MySql+Sever+Failed&amp;amp;sa=Search"&gt;Other Reference On The Web.&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;strong&gt;Related Post:&lt;/strong&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://databobjr.blogspot.com/2010/02/mysqladmin-start-up-error-mysqlmanager.html"&gt;Mysql Start Up Error: MySQL..Manager of pid-file quit without updating file.[FAILED]&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/22611914-515084754527204182?l=databobjr.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://databobjr.blogspot.com/feeds/515084754527204182/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=22611914&amp;postID=515084754527204182' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/22611914/posts/default/515084754527204182'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/22611914/posts/default/515084754527204182'/><link rel='alternate' type='text/html' href='http://databobjr.blogspot.com/2010/05/mysql-startup-mysql-server-failed.html' title='MySQL: Startup MySQL Server Failed'/><author><name>Data Bob Jr.</name><uri>http://www.blogger.com/profile/11965565939904347208</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-22611914.post-7127401146544986541</id><published>2010-05-11T06:36:00.000-07:00</published><updated>2010-10-06T23:33:12.723-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='MySQL'/><category scheme='http://www.blogger.com/atom/ns#' term='MySQL Performance Tuning: System Variables'/><category scheme='http://www.blogger.com/atom/ns#' term='MySQL Performance Tuning'/><category scheme='http://www.blogger.com/atom/ns#' term='MySQL DBA'/><title type='text'>MySQL: query_cache_size</title><content type='html'>&lt;b&gt;MySQL Query Cache Variable: query_cache_size&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;The query cache in MySQL stores the text of SELECT statement as well as its result set. If an identical query is sent to the server later, the server retrieves the result set from the query cache instead parsing and exciting the query again. Therefore, it reduces time and resource that need to execute the query. However, please note that Query Cache only works for identical queries (exactly the same). For example, the following two queries are not considered identical:&lt;br /&gt;&lt;div style="dir: ltr align:left; display: block; float: right; height: 260px; margin: 3px; width: 310px;"&gt;&lt;script type="text/javascript"&gt;&lt;!--google_ad_client = "pub-1602461054664536";/* body-ad-300x250-created-4/21/10 */google_ad_slot = "4011047090";google_ad_width = 300;google_ad_height = 250;//--&gt;&lt;/script&gt;&lt;br /&gt;&lt;script src="http://pagead2.googlesyndication.com/pagead/show_ads.js" type="text/javascript"&gt;&lt;/script&gt;&lt;/div&gt;&lt;br /&gt;Select city, state, zip from address where city = ‘new york’&lt;br /&gt;Vs.&lt;br /&gt;Select city, state, zip from address where city = ‘NEW YORK’&lt;br /&gt;&lt;br /&gt;These two queries are also not considered identical:&lt;br /&gt;&lt;br /&gt;Select city, state, zip from address where city = ‘NEW YORK’&lt;br /&gt;Vs.&lt;br /&gt;SELECT city, state, zip from address WHERE city= NEW YORK’&lt;br /&gt;&lt;br /&gt;Because one use lower case clause word (select and where) and the other use upper case clause (SELECT and WHERE). Also, the cache is not used for queries of the following types: &lt;br /&gt;· Queries that are a subquery of an outer query &lt;br /&gt;· Queries executed within the body of a stored function, trigger, or event &lt;br /&gt;&lt;br /&gt;&lt;strong&gt;(1.) Query Cache Variables&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;The following are server variables need to be set to make use of the query cache.&lt;br /&gt;&lt;br /&gt;1. Have_query_cache: this variable indicates where or not query cache is available. The default is ‘Yes’ for standard installation.&lt;br /&gt;2. Query_cahce_type: this variable sets the query cache type. It can be set in global and session level. The values for this variable can be 0,1 or 2:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&amp;nbsp;0 - tells the server not to cache results or retrieve results from the query cache. However, this setting dose not deallocate the query cache buffer. Refer to query_cache_size section for how to allocate the query cache buffer.&lt;/li&gt;&lt;li&gt;&amp;nbsp;1 – tells the server to cache all queries except for those that begin with select sql_no_cache. The default for Query_cahce_type is 1.&lt;/li&gt;&lt;li&gt;&amp;nbsp;2 – tells the server to cache query results only for queries that begin with select sql_cache. &lt;/li&gt;&lt;/ul&gt;3. Query_cache_size: this variable sets the amount of memory allocated for caching query result sets. To disable or deallocate the query cache, set this variable value to 0, which is also the default. Please note that memory are allocated for query cache regardless if Query_cahce_type is set to 0 or not if query_cache_size variable is set to 40960 bytes or more. If the value is set to less than 40960, the server will reset the query_cache_size variable to 0 and place a warning message in the error log.&lt;br /&gt;&lt;br /&gt;4. query_cache_min_res_unit: this variable sets the minimum size (in bytes) for) blocks allocated by the query cache. The default value is 4KB. According to the MySQL Manual, this should be adequate for most case. The query cache allocates blocks for storing query results by allocating memory blocks set by the query_cache_min_res_unit variable. If there are many queries with small result sets, the default block size may lead to memory fragmentation; moreover, it can force the query cache to prune (delete) queries from the cache due to lack of memory. In this case, you should decrease the value of the query_cache_min_res_unit variable.&lt;br /&gt;&lt;br /&gt;5. Query_cache_limit: this variable sets the maximum size result set that the query cache will store. The default is 1MB.&lt;br /&gt;&lt;br /&gt;(2.) &lt;strong&gt;Query Cache Status Variables and Monitoring&lt;/strong&gt;&lt;br /&gt;&lt;ol&gt;&lt;li&gt;&lt;strong&gt;Qcache_free_memory&lt;/strong&gt;: this status variable shows that amount of free memory for query cache. If the amount is low in comparing to the amount of the Query_cache_size, memory may be added to the Query_cache_size.&lt;/li&gt;&lt;li&gt;&lt;strong&gt;Qcache_not_cached&lt;/strong&gt;: this status displays the number of queries that were not cached. Not all the queries are cacheable such as a non-select query.&lt;/li&gt;&lt;li&gt;&lt;strong&gt;Qchache_queries_in_cache&lt;/strong&gt;: this status display the number of queries registered in the query cache.&lt;/li&gt;&lt;li&gt;&lt;strong&gt;Qcache_total_blocks&lt;/strong&gt;: this status displays the total number of blocks in the query cache. &lt;/li&gt;&lt;li&gt;&lt;strong&gt;Qcache_hits:&lt;/strong&gt; this status variable displays the number of query cache hits&lt;/li&gt;&lt;li&gt;&lt;strong&gt;Qcache_inserts&lt;/strong&gt;: this status variable displays the number of queries added to the query cache. &lt;/li&gt;&lt;li&gt;&lt;strong&gt;Com_select:&lt;/strong&gt; this status display number of times a select statement has been executed. If a query result is returned from query cache, the server increments the Qcache_hits status variable, not Com_select.&lt;/li&gt;&lt;/ol&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;strong&gt;Com_select&lt;/strong&gt; = (Qcache_inserts + Qcache_not_cached + queries with errors found during the&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; column-privileges check)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;strong&gt;The total number of SELECT queries&lt;/strong&gt; = ( Com_select + Qcache_hits + queries with &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; errors&amp;nbsp;found&amp;nbsp; by parser)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;strong&gt;The total number of successfully executed SELECT queries&lt;/strong&gt; = ( Com_select + Qcache_hits )&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;strong&gt;Query cache utilization&lt;/strong&gt; = (Qcache_hits/ total number of successfully executed SELECT queries) &lt;/div&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Or&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;strong&gt;Query cache utilization&lt;/strong&gt; = (Qcache_hits/( Com_select + Qcache_hits ))&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Please note that it all depends on the kind of applications, the % Query cache utilization will be&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; different. &lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 8. &lt;strong&gt;Qcache_free_blocks&lt;/strong&gt;: this variable display the number of free memory blocks in the query cache.&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 9.&amp;nbsp;&lt;strong&gt;Qcache_lowmem_prunes&lt;/strong&gt;: this status displays the number of queries that were deleted from the query &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; cache because of low memory. This status variable value also increases if the cache is not big enough to&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;hold the query statements. Also, this variable increase if there were many small query results sets which&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; indicates memory fragmentation. If the qcache_lowmem_prunes status variable is greater than 0,&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;consider increasing the query_cache_size dynamically and monitor the Qcache_lowmem_prunes status&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;variable to make sure that it stop increase.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&amp;nbsp;(3.) MySQL Commands&lt;/strong&gt;&lt;br /&gt;&lt;div&gt;&lt;/div&gt;To determine if or not the query cache has become fragmented, you can execute the FLUSH QUERY CACHE statement to defragment the cache... After issuing the statement, only a single free block remains. This command dose not removes queries from the cache. &lt;br /&gt;&lt;br /&gt;To remove all the queries from the cache, use the RESET QUERY CACHE command.&lt;br /&gt;&lt;br /&gt;Some other considerations need to be given when setting up Query Cache. As the size of the query cache grows, it will take longer to scan for matching queries, take longer to retrieve the result sets, and increase mutex contention. &lt;br /&gt;&lt;br /&gt;&lt;strong&gt;References:&lt;/strong&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://dev.mysql.com/doc/refman/5.1/en/query-cache.html"&gt;MySQL Manual: The MySQL Query Cache&lt;/a&gt;. &lt;/li&gt;&lt;li&gt;&lt;a href="http://dev.mysql.com/tech-resources/articles/mysql-query-cache.html"&gt;MySQL Articles: The Query Cache. (by Robin Schumacher)&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.amazon.com/High-Performance-MySQL-Optimization-Replication/dp/0596101716?ie=UTF8&amp;amp;tag=dat03-20&amp;amp;link_code=btl&amp;amp;camp=213689&amp;amp;creative=392969" target="_blank"&gt;High Performance MySQL: Chapter 5 and Chapter 6.&lt;/a&gt;&lt;img alt="" border="0" height="1" src="http://www.assoc-amazon.com/e/ir?t=dat03-20&amp;amp;l=btl&amp;amp;camp=213689&amp;amp;creative=392969&amp;amp;o=1&amp;amp;a=0596101716" style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0px; padding-bottom: 0px !important; padding-left: 0px !important; padding-right: 0px !important; padding-top: 0px !important;" width="1" /&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.amazon.com/Understanding-MySQL-Internals-Sasha-Pachev/dp/0596009577?ie=UTF8&amp;amp;tag=dat03-20&amp;amp;link_code=btl&amp;amp;camp=213689&amp;amp;creative=392969" target="_blank"&gt;Understanding MySQL Internal: Chapter 5, Configuration Variables&lt;/a&gt;&lt;img alt="" border="0" height="1" src="http://www.assoc-amazon.com/e/ir?t=dat03-20&amp;amp;l=btl&amp;amp;camp=213689&amp;amp;creative=392969&amp;amp;o=1&amp;amp;a=0596009577" style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0px; padding-bottom: 0px !important; padding-left: 0px !important; padding-right: 0px !important; padding-top: 0px !important;" width="1" /&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.google.com/cse?cx=partner-pub-1602461054664536%3Aghaimtmraz9&amp;amp;ie=ISO-8859-1&amp;amp;q=MySQL+Query+Cache+Variable%3A+query_cache_size&amp;amp;sa=Search"&gt;Other Reference On The Web&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;strong&gt;Related Posts:&lt;/strong&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://databobjr.blogspot.com/2010/04/mysql-performance-tunning-individual.html"&gt;MySQL Individual Thread Variables Setting And Tunning&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://databobjr.blogspot.com/2010/03/mysql-performance-tunning-server.html"&gt;MySQL Server Connection System Variables&lt;/a&gt; &lt;/li&gt;&lt;li&gt;&lt;a href="http://databobjr.blogspot.com/2010/05/mysql-keybuffersize-system-variable.html"&gt;MySQL MyISAM Key Cache&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;div&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;/div&gt;&lt;script type="text/javascript"&gt;&lt;!--google_ad_client = "pub-1602461054664536";/* mysqlsystemvariable-fooder-baner-468x60-20100506 */google_ad_slot = "1957650245";google_ad_width = 468;google_ad_height = 60;//--&gt;&lt;/script&gt;&lt;br /&gt;&lt;script src="http://pagead2.googlesyndication.com/pagead/show_ads.js" type="text/javascript"&gt;&lt;/script&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/22611914-7127401146544986541?l=databobjr.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://databobjr.blogspot.com/feeds/7127401146544986541/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=22611914&amp;postID=7127401146544986541' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/22611914/posts/default/7127401146544986541'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/22611914/posts/default/7127401146544986541'/><link rel='alternate' type='text/html' href='http://databobjr.blogspot.com/2010/05/mysql-querycachesize.html' title='MySQL: query_cache_size'/><author><name>Data Bob Jr.</name><uri>http://www.blogger.com/profile/11965565939904347208</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-22611914.post-3171121085551711445</id><published>2010-05-04T21:45:00.000-07:00</published><updated>2010-10-06T23:35:49.477-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='MySQL'/><category scheme='http://www.blogger.com/atom/ns#' term='MySQL Performance Tuning: System Variables'/><category scheme='http://www.blogger.com/atom/ns#' term='MySQL Performance Tuning'/><category scheme='http://www.blogger.com/atom/ns#' term='MySQL DBA'/><title type='text'>MySQL Key_Buffer_Size System Variable</title><content type='html'>&lt;b&gt;MySQL MyISAM Key Cache: Key_Buffer_Size System Variable&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;Index blocks for MyISAM tables are buffered and are shared by all threads. key_buffer_size is the size of the buffer used for index blocks. The key buffer is also known as the key cache. For 32-bit system, the maximum allow amount is 4 GB. As of MySQL 5.0.52, values larger than 4GB are allowed for 64-bit platforms (except 64-bit Windows, for which large values are truncated to 4GB with a warning).&lt;br /&gt;&lt;div style="dir: ltr align:left; display: block; float: right; height: 260px; margin: 3px; width: 310px;"&gt;&lt;script type="text/javascript"&gt;&lt;!--google_ad_client = "pub-1602461054664536";/* body-ad-300x250-created-4/21/10 */google_ad_slot = "4011047090";google_ad_width = 300;google_ad_height = 250;//--&gt;&lt;/script&gt;&lt;br /&gt;&lt;script src="http://pagead2.googlesyndication.com/pagead/show_ads.js" type="text/javascript"&gt;&lt;/script&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;You can increase the value to get better index handling for all reads and multiple writes; on a system whose primary function is to run MySQL using the MyISAM storage engine, 25% of the machine's total memory is an acceptable value for this variable. However, you should be aware that, if you make the value too large (for example, more than 50% of the machine's total memory), your system might start to page and become extremely slow. This is because MySQL relies on the operating system to perform file system caching for data reads,so you must leave some room for the file system cache. You should also consider the memory requirements of any other storage engines that you may be usingin addition to MyISAM.&lt;/div&gt;&lt;br /&gt;Please note that the key cache is not used if the &lt;strong&gt;key_buffer_size&lt;/strong&gt; value is too small to allocate the minimal number of block buffers (8). &lt;br /&gt;&lt;br /&gt;&lt;strong&gt;1.&amp;nbsp; Key_Buffer_Size&amp;nbsp;Status Varaiables and Monitoring:&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;The following global status variables should be checked periodically:&lt;br /&gt;&amp;nbsp; &lt;br /&gt;&lt;strong&gt;Key_read_requests&lt;/strong&gt;: the number of requests that have been executed to read a key block from the cache.&lt;br /&gt;&lt;strong&gt;Key_reads:&lt;/strong&gt; the number of physical reads of a key block from disk. &lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Key cache hit (read miss) ratio = (1-(Key_reads/Key_read_requests)) * 100. &lt;br /&gt;&lt;br /&gt;The &lt;strong&gt;key cache hit ratio&lt;/strong&gt; represents the proportion of keys that are being read from the key cache in memory instead of from disk. This should normally be greater than 99% for optimum efficiency. &lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Key_write_requests&lt;/strong&gt;: the number of requests to write a key block to the cache.&lt;br /&gt;&lt;strong&gt;Key_writes&lt;/strong&gt;: the number of actual writes, logical and physical key block, to disk.&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Kewrite miss ratio = (1-(Key_writes/Key_write_requests)) * 100&lt;br /&gt;&lt;br /&gt;The &lt;strong&gt;key write ratio&lt;/strong&gt; is usually near 100% if you are using mostly updates and deletes, but might be much smaller if you tend to do updates that affect many rows at the same time or if you are using the DELAY_KEY_WRITE table option.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Key_blocks_unused&lt;/strong&gt;: the number of used blocks in the key cache. This value is a high-water mark that indicates the maximum number of blocks that have ever been in use at one time. The more blocks in the key cache, the less the server is using disk-based I/O to examine the index data, therefore, the value&lt;br /&gt;of this variable should be high.&lt;br /&gt;&lt;strong&gt;key_cache_block_size&lt;/strong&gt;: the number of requests that have been executed to read key block from the cache.&lt;br /&gt;The fraction of the key buffer in use can be determined using key_buffer_size in conjunction with the Key_blocks_unused status variable and the buffer block size, which is available from the key_cache_block_size system variable: &lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; 1- ((Key_blocks_unused × key_cache_block_size) / key_buffer_size)&lt;br /&gt;&lt;br /&gt;This value is an approximation because some space in the key buffer is being allocated internally for administrative structures.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Key_block_not_flushed:&lt;/strong&gt; the number of key blocks in the key caches that have changed but have not yet been flushed to disk. These can be considered ‘dirty” key blocks in the key cache. The index will be corrupted during a crash and will need to be repaired before it can be used again. Therefore, this value should be near zero (0).&lt;br /&gt;&lt;br /&gt;Adjust the &lt;strong&gt;key_buffer_size&lt;/strong&gt; variable and monitor the key cache hit ratio. Please don’t forget to put the corresponding value of key_buffer_size in your my.cnf; hence, the variable is set properly when the server is restarted.&lt;br /&gt;&lt;br /&gt;&lt;script type="text/javascript"&gt;&lt;!--google_ad_client = "pub-1602461054664536";/* post-header-banner-468x60-20100421 */google_ad_slot = "6025652737";google_ad_width = 468;google_ad_height = 60;//--&gt;&lt;/script&gt;&lt;br /&gt;&lt;strong&gt;References:&lt;/strong&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;strong&gt;&lt;a href="http://dev.mysql.com/doc/refman/5.1/en/myisam-key-cache.html"&gt;MySQL Manual: The MyISAM Key Cache&lt;/a&gt; &lt;/strong&gt;&lt;/li&gt;&lt;li&gt;&lt;strong&gt;&lt;a href="http://www.amazon.com/High-Performance-MySQL-Optimization-Replication/dp/0596101716?ie=UTF8&amp;amp;tag=dat03-20&amp;amp;link_code=btl&amp;amp;camp=213689&amp;amp;creative=392969" target="_blank"&gt;High Performance MySQL: Chapter 6, Optimzing Server Settings&lt;/a&gt;&lt;img alt="" border="0" height="1" src="http://www.assoc-amazon.com/e/ir?t=dat03-20&amp;amp;l=btl&amp;amp;camp=213689&amp;amp;creative=392969&amp;amp;o=1&amp;amp;a=0596101716" style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0px; padding-bottom: 0px !important; padding-left: 0px !important; padding-right: 0px !important; padding-top: 0px !important;" width="1" /&gt;&lt;/strong&gt;&lt;/li&gt;&lt;li&gt;&lt;strong&gt;&lt;a href="http://www.google.com/cse?cx=partner-pub-1602461054664536%3Aghaimtmraz9&amp;amp;ie=ISO-8859-1&amp;amp;q=MySQL+myisam+key+cache&amp;amp;sa=Search"&gt;Other Reference On The Web&lt;/a&gt;&lt;/strong&gt;&lt;/li&gt;&lt;/ul&gt;&lt;strong&gt;Related Post: &lt;/strong&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;strong&gt;&lt;a href="http://databobjr.blogspot.com/"&gt;MySQL Query Cache&lt;/a&gt;&lt;/strong&gt;&lt;strong&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/strong&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://databobjr.blogspot.com/2010/04/mysql-performance-tunning-individual.html"&gt;&lt;strong&gt;MySQL Individual Thread Variables Setting And Tunning&lt;/strong&gt;&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://databobjr.blogspot.com/2010/03/mysql-performance-tunning-server.html"&gt;&lt;strong&gt;MySQL Server Connection System Variables&lt;/strong&gt;&lt;/a&gt;&amp;nbsp;&lt;/li&gt;&lt;/ul&gt;&lt;script type="text/javascript"&gt;&lt;!--google_ad_client = "pub-1602461054664536";/* mysqlsystemvariable-fooder-baner-468x60-20100506 */google_ad_slot = "1957650245";google_ad_width = 468;google_ad_height = 60;//--&gt;&lt;/script&gt;&lt;br /&gt;&lt;script src="http://pagead2.googlesyndication.com/pagead/show_ads.js" type="text/javascript"&gt;&lt;/script&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/22611914-3171121085551711445?l=databobjr.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://databobjr.blogspot.com/feeds/3171121085551711445/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=22611914&amp;postID=3171121085551711445' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/22611914/posts/default/3171121085551711445'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/22611914/posts/default/3171121085551711445'/><link rel='alternate' type='text/html' href='http://databobjr.blogspot.com/2010/05/mysql-keybuffersize-system-variable.html' title='MySQL Key_Buffer_Size System Variable'/><author><name>Data Bob Jr.</name><uri>http://www.blogger.com/profile/11965565939904347208</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-22611914.post-4508248208383813895</id><published>2010-04-30T23:53:00.000-07:00</published><updated>2010-05-03T21:55:15.445-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='SQL'/><title type='text'>SQL: SELECT THE FIRST N RECORDS</title><content type='html'>Assuming that we want to select the first 8 registrations from the following sample User table&lt;br /&gt;&lt;div class="Section1"&gt;&lt;br /&gt;&lt;div&gt;&lt;table border="1" cellpadding="0" cellspacing="0" style="width: 400px;"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td width="29"&gt;Id&lt;/td&gt;&lt;td width="76"&gt;First_Name&lt;/td&gt;&lt;td width="79"&gt;Last_Name&lt;/td&gt;&lt;td width="74"&gt;City&lt;/td&gt;&lt;td width="130"&gt;Registration_Date&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;1&lt;/td&gt;&lt;td&gt;John&lt;/td&gt;&lt;td&gt;Smith&lt;/td&gt;&lt;td&gt;New York&lt;/td&gt;&lt;td&gt;2009-01-01&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;2&lt;/td&gt;&lt;td&gt;Adam&lt;/td&gt;&lt;td&gt;King&lt;/td&gt;&lt;td&gt;London&lt;/td&gt;&lt;td&gt;2008-12-01&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;3&lt;/td&gt;&lt;td&gt;Lin&lt;/td&gt;&lt;td&gt;Lin&lt;/td&gt;&lt;td&gt;Beijing&lt;/td&gt;&lt;td&gt;2009-12-01&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;&lt;br /&gt;Let's start with a MySQL query, which will use the LIMIT clause:&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Select * from user order by registration_date limit 8;&lt;br /&gt;&lt;br /&gt;&lt;div class="MsoNormal"&gt;&lt;span style="mso-spacerun: yes;"&gt;&lt;/span&gt;The above query will give the first 8 users by registration date.&lt;br /&gt;&lt;br /&gt;Now, if we want to have the first 8 users from New York, you can change the query to this:&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Select * from user WHERE city=’New York’ ORDER BY registration_date limit 8;&lt;br /&gt;&lt;br /&gt;Now let’s try the following query:&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; SELECT * FROM&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ( SELECT * FROM user ORDER BY registration_date LIMIT 8 ) As &amp;nbsp;first_8&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; WHERE city='New York';&lt;br /&gt;&lt;br /&gt;This above query result actually returns the users from New York from the first 8 registrations. The number of records return will be between 0 and 8 in reality because the WHERE clause filter the records from the sub query result set.&lt;br /&gt;&lt;br /&gt;Since each database venders use different non-standard result limit syntax, the above query needs to rewrite to accommodate the particular syntax . For example, in Oracle, the query can be rewritten in follow form:&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp; Select * from user order by registration_date where rownum &amp;gt;= 8;&lt;br /&gt;&lt;br /&gt;And in SQL Server, it can be written like this:&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp; Select TOP 8 * from user order by registration_date;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;strong&gt;&amp;nbsp;Reference:&lt;/strong&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;ul&gt;&lt;li&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-size: large;"&gt;&amp;nbsp;&lt;/span&gt;&lt;a href="http://www.blogger.com/goog_1512940513"&gt;MySQ&lt;/a&gt;&lt;/span&gt;&lt;a href="http://www.amazon.com/MySQL-Cookbook-Paul-DuBois/dp/059652708X?ie=UTF8&amp;amp;tag=dat03-20&amp;amp;link_code=btl&amp;amp;camp=213689&amp;amp;creative=392969"&gt;MySQL Cookboook: Chapter 3, Selecting Data FromTables&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/li&gt;&lt;li&gt;&amp;nbsp;&lt;a href="http://www.amazon.com/MySQL-Cookbook-Paul-DuBois/dp/059652708X?ie=UTF8&amp;amp;tag=dat03-20&amp;amp;link_code=btl&amp;amp;camp=213689&amp;amp;creative=392969" target="_blank"&gt;MySQL Cookbook: Chapter 13,Statistical Techniques.&lt;/a&gt;&lt;img alt="" border="0" height="1" src="http://www.assoc-amazon.com/e/ir?t=dat03-20&amp;amp;l=btl&amp;amp;camp=213689&amp;amp;creative=392969&amp;amp;o=1&amp;amp;a=059652708X" style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0px; padding-bottom: 0px !important; padding-left: 0px !important; padding-right: 0px !important; padding-top: 0px !important;" width="1" /&gt;&lt;/li&gt;&lt;li&gt;&amp;nbsp;&lt;a href="http://www.iso.org/iso/search.htm?qt=!SO+2008+SQL&amp;amp;searchSubmit=Search&amp;amp;sort=rel&amp;amp;type=simple&amp;amp;published=on"&gt;ISO 2008-SQL&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.google.com/custom?hl=en&amp;amp;safe=active&amp;amp;client=pub-1602461054664536&amp;amp;cof=FORID%3A13%3BAH%3Aleft%3BCX%3AData%2520Bob%2520Jr%252E%3BL%3Ahttp%3A%2F%2Fwww.google.com%2Fintl%2Fen%2Fimages%2Flogos%2Fcustom_search_logo_sm.gif%3BLH%3A30%3BLP%3A1%3BLC%3A%23000033%3BVLC%3A%23ff6fcf%3BGALT%3A%230066cc%3BDIV%3A%23cccccc%3B&amp;amp;adkw=AELymgUb1JZAfbjc1K1HsyvkBF037WG9cCF8zLvkzVySv_dM3Tfct07jEZKeQDqtghXo3R1EK1NlxBCeYQdF4h30XhIa5T4WZR7YMtV3akzQ9pCIOTXcjrU&amp;amp;channel=1119855433&amp;amp;ie=ISO-8859-1&amp;amp;oe=ISO-8859-1&amp;amp;q=select+the+first+n+records%2C+top+n+query&amp;amp;btnG=Search&amp;amp;cx=partner-pub-1602461054664536%3Aghaimtmraz9"&gt;Other Reference On the Web&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;script type="text/javascript"&gt;&lt;!--google_ad_client = "pub-1602461054664536";/* sql-fooder-banner-468x60-20100501 */google_ad_slot = "7590234874";google_ad_width = 468;google_ad_height = 60;//--&gt;&lt;/script&gt;&lt;br /&gt;&lt;script src="http://pagead2.googlesyndication.com/pagead/show_ads.js" type="text/javascript"&gt;&lt;/script&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/22611914-4508248208383813895?l=databobjr.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://databobjr.blogspot.com/feeds/4508248208383813895/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=22611914&amp;postID=4508248208383813895' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/22611914/posts/default/4508248208383813895'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/22611914/posts/default/4508248208383813895'/><link rel='alternate' type='text/html' href='http://databobjr.blogspot.com/2010/04/sql-select-first-n-records.html' title='SQL: SELECT THE FIRST N RECORDS'/><author><name>Data Bob Jr.</name><uri>http://www.blogger.com/profile/11965565939904347208</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-22611914.post-2215863963687115825</id><published>2010-04-27T02:01:00.000-07:00</published><updated>2010-10-06T19:52:09.626-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='MySQL'/><category scheme='http://www.blogger.com/atom/ns#' term='MySQL Replication'/><category scheme='http://www.blogger.com/atom/ns#' term='MySQL DBA'/><title type='text'>Mysql Replication Slave Stopped Due to  “Lock Wait Timeout Exceeded” Error</title><content type='html'>&lt;div style="dir: ltr align:left; display: block; float: right; height: 260px; margin: 3px; width: 310px;"&gt;&lt;script type="text/javascript"&gt;&lt;!--google_ad_client = "pub-1602461054664536";/* boby-image-text-upper-right-300x250-20100427 */google_ad_slot = "1745059421";google_ad_width = 310;google_ad_height = 250;//--&gt;&lt;/script&gt;&lt;br /&gt;&lt;script src="http://pagead2.googlesyndication.com/pagead/show_ads.js" type="text/javascript"&gt;&lt;/script&gt;&lt;/div&gt;&lt;strong&gt;MySQL Replication: [ERROR] Slave: : Error 'Lock wait timeout exceeded; try restarting transaction' on query.&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;In a deadlock situation, the Mysql Replication server slave would let the transaction to retry up to the number of time which was set for the &lt;b&gt;slave_transaction_retries &lt;/b&gt;system variable before stopping the slave and logging a message like the one bellow in the error log:&lt;br /&gt;&lt;br /&gt;&lt;em&gt;100419 0:03:47 [ERROR] Slave: : Error 'Lock wait timeout exceeded; try restarting transaction' on query.&amp;nbsp;&amp;nbsp; Default database: 'mysqldb'. Query: 'UPDATE a_table SET colum_1 =a_value_colum + 1000,…,… WHERE id='12345'', Error_code: 1205&lt;/em&gt;&lt;br /&gt;&lt;em&gt;100419 0:03:47 [Note] Slave SQL thread exiting, replication stopped in log 'slave-1-log-bin.006034' at position 10470968&lt;/em&gt;&lt;br /&gt;&lt;br /&gt;Refering to the MySQL manual; the 1205 error has the following description:&lt;br /&gt;&lt;br /&gt;&lt;em&gt;Error: 1205 SQLSTATE: HY000 (ER_LOCK_WAIT_TIMEOUT) &lt;/em&gt;&lt;br /&gt;&lt;em&gt;Message: Lock wait timeout exceeded; try restarting transaction.&lt;/em&gt;&lt;br /&gt;&lt;br /&gt;Since the tables involved in the locks were InnoDB tables, we could check the InnoDB status by issuing the following command:&lt;br /&gt;Mysql&amp;gt; show engine innodb status\G;&lt;br /&gt;&lt;em&gt;---------------------------------------------&lt;/em&gt;&lt;br /&gt;&lt;em&gt;LATEST DETECTED DEADLOCK&lt;/em&gt;&lt;br /&gt;&lt;em&gt;---------------------------------------------&lt;/em&gt;&lt;br /&gt;&lt;em&gt;*** (1) TRANSACTION:&lt;/em&gt;&lt;br /&gt;&lt;em&gt;TRANSACTION 0 2513168731, ACTIVE 0 sec, process no 17876, OS thread id 685890464 starting index read&lt;/em&gt;&lt;br /&gt;&lt;em&gt;mysql tables in use 2, locked 2&lt;/em&gt;&lt;br /&gt;&lt;em&gt;LOCK WAIT 5 lock struct(s), heap size 320, undo log entries 1&lt;/em&gt;&lt;br /&gt;&lt;em&gt;MySQL thread id 8018, query id 317267495 &lt;hostname.domain.com ip=""&gt;user_id Updating&lt;/em&gt;&lt;br /&gt;&lt;em&gt;...&lt;/em&gt;&lt;br /&gt;There were some useful information regarding the lock from the above output under the LATEST DETECTED DEADLOCK section which details the causes of the deadlock such as what kind of locks were used, and the query statements that involved in the lock.&lt;br /&gt;&lt;br /&gt;To resolve the deadlock issues, we may need to debug the query statements and make code changes. In the mean time, we can check &lt;strong&gt;innodb_lock_wait_timeout&lt;/strong&gt; and &lt;strong&gt;slave_transaction_retries&lt;/strong&gt; to see if we can increase it a bit to avoid stopping the slave. To do so, issue the following statement from the mysql client:&lt;br /&gt;&lt;br /&gt;Mysql&amp;gt; show variables;&lt;br /&gt;innodb_lock_wait_timeout | 150&lt;br /&gt;…&lt;br /&gt;slave_transaction_retries | 10&lt;br /&gt;&lt;br /&gt;The &lt;strong&gt;innodb_lock_wait_timeout&lt;/strong&gt; variable set the length of time a transaction will wait for a row lock resource before “giving up”. The default value is 50 seconds. Please note that this variable applies to InnoDB row locks only. A MySQL table lock does not happen inside InnoDB and this timeout does not apply to waits for table locks. InnoDB does detect transaction deadlocks in its own lock table immediately and rolls back one transaction. The lock wait timeout value does not apply to such a wait. &lt;br /&gt;&lt;br /&gt;The &lt;strong&gt;slave_transaction_retries&lt;/strong&gt; set the number of time the replication slave thread to retry before stopping with an error due to any of the following situation (the default for this variable is 10):&lt;br /&gt;&lt;br /&gt;· an InnoDB deadlock &lt;br /&gt;· the transaction's execution time exceeded InnoDB's innodb_lock_wait_timeout &lt;br /&gt;· the transaction’s execution time exceeded NDBCLUSTER’s TransactionDeadlockDetectionTimeout&lt;br /&gt;· the transaction’s execution time exceeded NDBCLUSTER's TransactionInactiveTimeout, &lt;br /&gt;&lt;br /&gt;Please also notice that, if the &lt;strong&gt;slave_transaction_retries&lt;/strong&gt; server variable is set, the transaction will hold the lock for (&lt;strong&gt;slave_transaction_retries * innodb_lock_wait_timeout&lt;/strong&gt;) seconds before giving up. In the example above, it means that a lock will be held for proximately 1,500 seconds (10*150). Therefore, try to find out what is causing this lock and fix it maybe a better solution. &lt;br /&gt;&lt;br /&gt;In any case, please remember to restart the slave because deadlock error stopped the slave as it had indicated in the error log. &lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Reference:&lt;/strong&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://dev.mysql.com/doc/refman/5.1/en/error-messages-server.html"&gt;MySQL server Error Codes and Messages:&lt;/a&gt; &lt;/li&gt;&lt;li&gt;&lt;a href="http://dev.mysql.com/doc/refman/5.1/en/innodb-parameters.html#sysvar_innodb_lock_wait_timeout"&gt;innodb_lock_wait_timeout:&lt;/a&gt; &lt;/li&gt;&lt;li&gt;&lt;a href="http://dev.mysql.com/doc/refman/5.1/en/replication-options-slave.html#sysvar_slave_transaction_retries"&gt;slave_transaction_retries:&lt;/a&gt; &lt;/li&gt;&lt;li&gt;&lt;a href="http://www.amazon.com/High-Performance-MySQL-Optimization-Replication/dp/0596101716?ie=UTF8&amp;amp;tag=dat03-20&amp;amp;link_code=btl&amp;amp;camp=213689&amp;amp;creative=392969" target="_blank"&gt;High Performance MySQL (Second Edition), Appendix D, Debugging Locks&lt;/a&gt;&lt;img alt="" border="0" height="1" src="http://www.assoc-amazon.com/e/ir?t=dat03-20&amp;amp;l=btl&amp;amp;camp=213689&amp;amp;creative=392969&amp;amp;o=1&amp;amp;a=0596101716" style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0px; padding-bottom: 0px !important; padding-left: 0px !important; padding-right: 0px !important; padding-top: 0px !important;" width="1" /&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.amazon.com/High-Performance-MySQL-Optimization-Replication/dp/0596101716?ie=UTF8&amp;amp;tag=dat03-20&amp;amp;link_code=btl&amp;amp;camp=213689&amp;amp;creative=392969" target="_blank"&gt;High Performance MySQL (Second Edition), Chapter 8: Replication&lt;/a&gt;&lt;img alt="" border="0" height="1" src="http://www.assoc-amazon.com/e/ir?t=dat03-20&amp;amp;l=btl&amp;amp;camp=213689&amp;amp;creative=392969&amp;amp;o=1&amp;amp;a=0596101716" style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0px; padding-bottom: 0px !important; padding-left: 0px !important; padding-right: 0px !important; padding-top: 0px !important;" width="1" /&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.google.com/cse?cx=partner-pub-1602461054664536%3Aghaimtmraz9&amp;amp;ie=ISO-8859-1&amp;amp;q=MySQL+Replication%3A+%5BERROR%5D+Slave%3A+Error+%27Lock+wait+timeout+exceeded%3B+try+restarting+transaction%27+on+query&amp;amp;sa=Search"&gt;Other Reference On The Web&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;script type="text/javascript"&gt;&lt;!--google_ad_client = "pub-1602461054664536";/* mysqlreplication-fooder-banner-468x60-20100504 */google_ad_slot = "0388465201";google_ad_width = 468;google_ad_height = 60;//--&gt;&lt;/script&gt;&lt;br /&gt;&lt;script src="http://pagead2.googlesyndication.com/pagead/show_ads.js" type="text/javascript"&gt;&lt;/script&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/22611914-2215863963687115825?l=databobjr.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://databobjr.blogspot.com/feeds/2215863963687115825/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=22611914&amp;postID=2215863963687115825' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/22611914/posts/default/2215863963687115825'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/22611914/posts/default/2215863963687115825'/><link rel='alternate' type='text/html' href='http://databobjr.blogspot.com/2010/04/mysql-replication-stopped-due-to-lock.html' title='Mysql Replication Slave Stopped Due to  “Lock Wait Timeout Exceeded” Error'/><author><name>Data Bob Jr.</name><uri>http://www.blogger.com/profile/11965565939904347208</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-22611914.post-5541706838642154197</id><published>2010-04-20T22:41:00.000-07:00</published><updated>2010-05-04T19:02:58.462-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Linux For DBA'/><title type='text'>Linux Command: cp -f, --force,  Not Working</title><content type='html'>Today, when I tried to copy some files from one dirctory to the other in my &lt;a target="_blank"  href="http://www.amazon.com/s/?ie=UTF8&amp;tag=dat03-20&amp;link_code=btl&amp;camp=213689&amp;creative=392969&amp;search-alias=aps&amp;field-keywords=Linux server"&gt;Linux server&lt;/a&gt;&lt;img src="http://www.assoc-amazon.com/e/ir?t=dat03-20&amp;l=btl&amp;camp=213689&amp;creative=392969&amp;o=1&amp;a=" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important; padding: 0px !important" /&gt;, I issued the following Linux command:&lt;br /&gt;&lt;br /&gt;#&gt;cp -rf /dir1/* /dir2&lt;br /&gt;&lt;div style="dir: ltr align:left; display: block; float:right; height: 260px; margin: 3px; width: 310px;"&gt;&lt;script type="text/javascript"&gt;&lt;!--google_ad_client = "pub-1602461054664536";/* body-ad-300x250-created-4/21/10 */google_ad_slot = "4011047090";google_ad_width = 300;google_ad_height = 250;//--&gt;&lt;/script&gt;&lt;br /&gt;&lt;script src="http://pagead2.googlesyndication.com/pagead/show_ads.js" type="text/javascript"&gt;&lt;/script&gt;&lt;/div&gt;However, the -f, --force switch, which was to tell cp command to overwrite the existing files (it meas if an existing destination file cannot be opened, remove it and try again),  did not seen to work.  I kept getting  the following message:&lt;br /&gt;&lt;br /&gt;cp: overwrite ‘/dir1/subdir1/file.dat with /dir2/subdir1/file.dat’ &lt;br /&gt;&lt;br /&gt;Since I had about 300 files to copy,  it was not  easy for me to keep typing ‘y’.  So, I did some searches and  found the following solution.&lt;br /&gt;&lt;br /&gt;1. Run the alias command to check if cp was set to alias with a different command.&lt;br /&gt;&lt;br /&gt;#&gt; alias&lt;br /&gt;&lt;br /&gt;alias cp='cp -i' &lt;br /&gt;alias mv='mv -i' &lt;br /&gt;alias rm='rm -i' &lt;br /&gt;&lt;br /&gt;Which you can see, cp was acturaly alias as 'cp –i'.  -i, --interactive, which means prompt before overwrite. Therefore, -f was ignored. &lt;br /&gt;&lt;br /&gt;I want to remove the alias so I could copy the files. To do so, I needed to issue the following command:&lt;br /&gt;&lt;br /&gt;#&gt;unalias cp &lt;br /&gt;&lt;br /&gt;However, in normally situation, we do want to use cp –i to prevent accidentally override files.  Therefore, I issued the following command after done with copying the files:&lt;br /&gt;&lt;br /&gt;#&gt;alias ‘cp=cp –I’ &lt;br /&gt;&lt;br /&gt;One more detail, to perform the above steps, it required root access. So, what happen if we don’t have root access?  Well, the following command works: &lt;br /&gt;&lt;br /&gt;Command:&lt;br /&gt;#&gt; /bin/cp -rf /dir1/* /dir2&lt;br /&gt;&lt;br /&gt;It is because that the /bin/cp copy is not alias to any other command switch.&lt;br /&gt;&lt;br /&gt;&lt;script type="text/javascript"&gt;&lt;!--google_ad_client = "pub-1602461054664536";/* post-header-banner-468x60-20100421 */google_ad_slot = "6025652737";google_ad_width = 468;google_ad_height = 60;//--&gt;&lt;/script&gt;&lt;br /&gt;&lt;script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"&gt;&lt;/script&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/22611914-5541706838642154197?l=databobjr.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://databobjr.blogspot.com/feeds/5541706838642154197/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=22611914&amp;postID=5541706838642154197' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/22611914/posts/default/5541706838642154197'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/22611914/posts/default/5541706838642154197'/><link rel='alternate' type='text/html' href='http://databobjr.blogspot.com/2010/04/linux-copy-command-cp-f-force-not.html' title='Linux Command: cp -f, --force,  Not Working'/><author><name>Data Bob Jr.</name><uri>http://www.blogger.com/profile/11965565939904347208</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-22611914.post-8174372199056812675</id><published>2010-04-17T11:22:00.000-07:00</published><updated>2010-12-03T22:09:32.574-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='MySQL'/><category scheme='http://www.blogger.com/atom/ns#' term='Video'/><category scheme='http://www.blogger.com/atom/ns#' term='Data Funny'/><title type='text'>Guide to NoSQL, redux</title><content type='html'>I really like this presentation in MySQL Conference 2010. The speeker was Mark Atwood.&lt;br /&gt;&lt;br /&gt;&lt;object height="269" width="448"&gt;&lt;param name="movie" value="http://www.youtube.com/v/zAbFRiyT3LU&amp;hl=en_US&amp;fs=1&amp;rel=0"&gt;&lt;/param&gt;&lt;param name="allowFullScreen" value="true"&gt;&lt;/param&gt;&lt;param name="allowscriptaccess" value="always"&gt;&lt;/param&gt;&lt;embed src="http://www.youtube.com/v/zAbFRiyT3LU&amp;hl=en_US&amp;fs=1&amp;rel=0" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="448" height="269"&gt; &lt;/embed&gt;&lt;/object&gt;&lt;br /&gt;&lt;br /&gt;&lt;script type="text/javascript"&gt;&lt;!--google_ad_client = "pub-1602461054664536";/* datafunny-fodder-468x60-20100603 */google_ad_slot = "6949942203";google_ad_width = 468;google_ad_height = 60;//--&gt;&lt;/script&gt;&lt;br /&gt;&lt;script src="http://pagead2.googlesyndication.com/pagead/show_ads.js" type="text/javascript"&gt;&lt;/script&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/22611914-8174372199056812675?l=databobjr.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://databobjr.blogspot.com/feeds/8174372199056812675/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=22611914&amp;postID=8174372199056812675' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/22611914/posts/default/8174372199056812675'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/22611914/posts/default/8174372199056812675'/><link rel='alternate' type='text/html' href='http://databobjr.blogspot.com/2010/04/guide-to-nosql-redux.html' title='Guide to NoSQL, redux'/><author><name>Data Bob Jr.</name><uri>http://www.blogger.com/profile/11965565939904347208</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-22611914.post-947053324977538024</id><published>2010-04-15T05:41:00.000-07:00</published><updated>2010-09-29T23:15:21.624-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Data and Information'/><title type='text'>What Does $1 Trillion Look Like?</title><content type='html'>&lt;script type="text/javascript"&gt;&lt;!--google_ad_client = "pub-1602461054664536";/* post-header-banner-468x60-20100421 */google_ad_slot = "6025652737";google_ad_width = 468;google_ad_height = 60;//--&gt;&lt;/script&gt;&lt;br /&gt;&lt;script src="http://pagead2.googlesyndication.com/pagead/show_ads.js" type="text/javascript"&gt;&lt;/script&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.cnbc.com/id/30108264/What_Does_1_Trillion_Look_Like"&gt;&lt;span style="font-size: large;"&gt;CNBC&lt;/span&gt;&lt;/a&gt;&lt;span style="font-size: large;"&gt; shows an interesting way to look at &lt;/span&gt;&lt;a href="http://www.amazon.com/s/?ie=UTF8&amp;amp;tag=dat03-20&amp;amp;link_code=btl&amp;amp;camp=213689&amp;amp;creative=392969&amp;amp;search-alias=stripbooks&amp;amp;field-keywords=money" target="_blank"&gt;&lt;span style="font-size: large;"&gt;money&lt;/span&gt;&lt;/a&gt;&lt;span style="font-size: large;"&gt;&lt;img alt="" border="0" height="1" src="http://www.assoc-amazon.com/e/ir?t=dat03-20&amp;amp;l=btl&amp;amp;camp=213689&amp;amp;creative=392969&amp;amp;o=1&amp;amp;a=" style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0px; padding-bottom: 0px !important; padding-left: 0px !important; padding-right: 0px !important; padding-top: 0px !important;" width="1" /&gt;.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://www.cnbc.com/id/30108264/What_Does_1_Trillion_Look_Like?slide=10"&gt;&lt;img border="0" height="427" src="http://4.bp.blogspot.com/_-yHUY3DeIjY/S8muwpy-91I/AAAAAAAAABM/7Pvb0sNEzvc/s640/SS_visualizing_10.jpg" width="640" wt="true" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/22611914-947053324977538024?l=databobjr.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://databobjr.blogspot.com/feeds/947053324977538024/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=22611914&amp;postID=947053324977538024' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/22611914/posts/default/947053324977538024'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/22611914/posts/default/947053324977538024'/><link rel='alternate' type='text/html' href='http://databobjr.blogspot.com/2010/04/what-does-1-trillion-look-like-cnbc.html' title='What Does $1 Trillion Look Like?'/><author><name>Data Bob Jr.</name><uri>http://www.blogger.com/profile/11965565939904347208</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_-yHUY3DeIjY/S8muwpy-91I/AAAAAAAAABM/7Pvb0sNEzvc/s72-c/SS_visualizing_10.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-22611914.post-4593046424678321719</id><published>2010-04-11T01:10:00.000-07:00</published><updated>2010-10-06T23:37:37.514-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='MySQL'/><category scheme='http://www.blogger.com/atom/ns#' term='MySQL Performance Tuning: System Variables'/><category scheme='http://www.blogger.com/atom/ns#' term='MySQL Performance Tuning'/><category scheme='http://www.blogger.com/atom/ns#' term='MySQL DBA'/><title type='text'>MySQL Individual Thread System Variables Setting And Tunning</title><content type='html'>&lt;strong&gt;MySQL Performance Tunning: Individual Thread Variables Setting And Tunning&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;MySQL use many factors to determine the amount of memory assigned to each&lt;br /&gt;&lt;div style="dir: ltr align:left; display: block; float: right; height: 260px; margin: 3px; width: 310px;"&gt;&lt;script type="text/javascript"&gt;&lt;!--google_ad_client = "pub-1602461054664536";/* body-ad-300x250-created-4/21/10 */google_ad_slot = "4011047090";google_ad_width = 300;google_ad_height = 250;//--&gt;&lt;/script&gt;&lt;br /&gt;&lt;script src="http://pagead2.googlesyndication.com/pagead/show_ads.js" type="text/javascript"&gt;&lt;/script&gt;&lt;/div&gt;individual thread that is running. Following is a list of variables that can be applied to an individual thread:&lt;br /&gt;&lt;br /&gt;· Sort_buffer_size&lt;br /&gt;· Join_buffer_size&lt;br /&gt;· Read_buffer_size&lt;br /&gt;· Tmp_table_size&lt;br /&gt;· Max_heap_table_size&lt;br /&gt;&lt;br /&gt;&lt;b&gt;1. The System Variables&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;Sort_buffer_size: this variable determines the amount of memory to allocate for sourt operations. Each thread that needs to do a sort will allocates a buffer from the variable value. If there is too many records to be sorted in the memory, then a disk based sort takes place instead, Which take longer to perform. To ensure the ORDER BY and GROUP BY operation performance, the sort_buffer_size can be increase.&lt;br /&gt;&lt;br /&gt;Join_buffer_size: this variable determines the buffer size for joins that don’t use indexes (use full table scan). Normally, the best way to get fast joins is to add indexes; however, if this is not possible, increase the values of this variable to get a faster full join.&lt;br /&gt;&lt;br /&gt;Read_buffer_size: this variable determines the size of the buffer used for catching row data during full table scans. Each thread that does a sequential scn allocates a buffer tof this size(in bytes) fro each table it scans. The default is set to 131072. &lt;br /&gt;&lt;br /&gt;Tmp_table_size: this system variable determines the maximum size allowed for a temporary table staored in memory tables before it is convertrd to an on-dis MyISAM table. This variable should be increased if GROUP BY queries involving many rows are performed and the is enough memory to support them.&lt;br /&gt;&lt;br /&gt;Max_heap_table_size: This variable sets the maximum size to which MEMORY tables are allowed to grow. The value of the variable is used to calculate MEMORY table MAX_ROWS values. Setting this variable has no effect on any existing MEMORY table, unless the table is re-created with a statement such as CREATE TABLE or altered with ALTER TABLE or TRUNCATE TABLE. A server restart also sets the maximum size of existing MEMORY tables to the global max_heap_table_size value.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;2. Getting Server Status and Setting the variable values&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;Each of the status variables below should be monitored to determine the size of the sort_buffer_size variabl:&lt;br /&gt;· Sort_merge_passes: this status variable displays the number of merge passes that the sort alforithm has had to perform. Increase the sort_buffer_size values if the status value is large.&lt;br /&gt;· Sort_range: this status variable show the number of sorts that were done using ranges&lt;br /&gt;· Sort_rows: this status show the numberof sourted rows&lt;br /&gt;· Sort_scan: this status show number of sourts that were done table scan.&lt;br /&gt;&lt;br /&gt;The following stauts measure the number of joins that did not using indexes:&lt;br /&gt;· Select_full_join &lt;br /&gt;· Select_full_range_join &lt;br /&gt;· Select_range &lt;br /&gt;· Select_range_check &lt;br /&gt;· Select_scan &lt;br /&gt;Please note that one join buffer is allocated for each full join between two tables; and, complex joins between several tables for which indexes are not used should be avoided at all costs.&lt;br /&gt;&lt;br /&gt;If many sequential scans rae carried out, it is best to increase the read_buffer_size values. According to MySQL documentation, the normal size for this variable should set to ! MB to 2 MB, but can be set up to 8 MB. &lt;br /&gt;&lt;br /&gt;The following status need to be taken into account when setting tmp_table_size variable value:&lt;br /&gt;&lt;br /&gt;· Created_tmp_disk_tables: this status shows the number of temporary tables on disk cread automatically by the serv while queries were executed. If BLOB/TEXT fields are requested in the queries, MySQL will use disk based temporary tables automatically. We need to determine how many BLOB/TEXT fields reuested statements were ran on the server before deciding change the tmp_table_size variable value.&lt;br /&gt;· Created_ tmp_files: this status shows then number of temporary files has created.&lt;br /&gt;· Created_tmp_tables: this status shows the number of in-memory temporary tables created automatically by the server while excuting queries. If the ratio of created_tmp_disk_tables to created_tmp_tables is hight, consider increasing the tmp_table_size variable value. One or two creates per second is reasonable.&lt;br /&gt;&lt;br /&gt;Please note that the max_heap_table_size variable places a maximum limit on tmp_table_size because memory storageengine is used for implicit in-memory temporary tables. For example, if tmp_table_size is 32M and max_heap_table_size is 16M, then the implicit MEMORY temporary tables will convert to on-disk MyISAM tables where they grow past 15M. Therefore, both these variable need to be considered when dealing with implicit temporary tables.&lt;br /&gt;&lt;br /&gt;Also, it is best to have the individual session to set the values of the variables if only some queries need lare values and to avoid larger than necessary allocations for the queries which don't need large size.&lt;br /&gt;&lt;br /&gt;&lt;script type="text/javascript"&gt;&lt;!--google_ad_client = "pub-1602461054664536";/* mysqlsystemvariable-fooder-baner-468x60-20100506 */google_ad_slot = "1957650245";google_ad_width = 468;google_ad_height = 60;//--&gt;&lt;/script&gt;&lt;br /&gt;&lt;strong&gt;References:&lt;/strong&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&amp;nbsp;&lt;a href="http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html"&gt;MySQL Manual: MySQL Server System Variables&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&amp;nbsp;&lt;a href="http://www.amazon.com/Understanding-MySQL-Internals-Sasha-Pachev/dp/0596009577?ie=UTF8&amp;amp;tag=dat03-20&amp;amp;link_code=btl&amp;amp;camp=213689&amp;amp;creative=392969" target="_blank"&gt;Understanding MySQL Internals: Chapter 5, Configuration Variables&lt;/a&gt;&lt;img alt="" border="0" height="1" src="http://www.assoc-amazon.com/e/ir?t=dat03-20&amp;amp;l=btl&amp;amp;camp=213689&amp;amp;creative=392969&amp;amp;o=1&amp;amp;a=0596009577" style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0px; padding-bottom: 0px !important; padding-left: 0px !important; padding-right: 0px !important; padding-top: 0px !important;" width="1" /&gt;&lt;/li&gt;&lt;li&gt;&amp;nbsp;&lt;a href="http://www.amazon.com/High-Performance-MySQL-Optimization-Replication/dp/0596101716?ie=UTF8&amp;amp;tag=dat03-20&amp;amp;link_code=btl&amp;amp;camp=213689&amp;amp;creative=392969" target="_blank"&gt;High Performance MySQL: Chapter 6, Optomizing Server Settings&lt;/a&gt;&lt;img alt="" border="0" height="1" src="http://www.assoc-amazon.com/e/ir?t=dat03-20&amp;amp;l=btl&amp;amp;camp=213689&amp;amp;creative=392969&amp;amp;o=1&amp;amp;a=0596101716" style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0px; padding-bottom: 0px !important; padding-left: 0px !important; padding-right: 0px !important; padding-top: 0px !important;" width="1" /&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.google.com/cse?cx=partner-pub-1602461054664536%3Aghaimtmraz9&amp;amp;ie=ISO-8859-1&amp;amp;q=MySQL+Individual+Thread+System+Variables&amp;amp;sa=Search"&gt;Other Reference On the Web&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;strong&gt;Related Posts:&lt;/strong&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://databobjr.blogspot.com/2010/03/mysql-performance-tunning-server.html"&gt;MySQL Server Connection System Variables&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://databobjr.blogspot.com/"&gt;MySQL Query Cache Variable&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;div&gt;&lt;/div&gt;&lt;script type="text/javascript"&gt;&lt;!--google_ad_client = "pub-1602461054664536";/* mysqlsystemvariable-fooder-baner-468x60-20100506 */google_ad_slot = "1957650245";google_ad_width = 468;google_ad_height = 60;//--&gt;&lt;/script&gt;&lt;br /&gt;&lt;script src="http://pagead2.googlesyndication.com/pagead/show_ads.js" type="text/javascript"&gt;&lt;/script&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/22611914-4593046424678321719?l=databobjr.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://databobjr.blogspot.com/feeds/4593046424678321719/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=22611914&amp;postID=4593046424678321719' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/22611914/posts/default/4593046424678321719'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/22611914/posts/default/4593046424678321719'/><link rel='alternate' type='text/html' href='http://databobjr.blogspot.com/2010/04/mysql-performance-tunning-individual.html' title='MySQL Individual Thread System Variables Setting And Tunning'/><author><name>Data Bob Jr.</name><uri>http://www.blogger.com/profile/11965565939904347208</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-22611914.post-5595594735302206508</id><published>2010-04-10T10:45:00.000-07:00</published><updated>2010-04-21T21:15:34.804-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Life'/><title type='text'>Life Trapped in Amber from Age of Dinosaurs</title><content type='html'>According to &lt;a href="http://www.livescience.com/"&gt;LiveScience&lt;/a&gt;, a host of&lt;a href="http://www.livescience.com/php/multimedia/album.php?gid=1879"&gt; bugs, fungus and other life forms&lt;/a&gt; have been found trapped in&amp;nbsp;a 95-million-year-old amber.&lt;br /&gt;&lt;br /&gt;&lt;script type="text/javascript"&gt;&lt;!--google_ad_client = "pub-1602461054664536";/* body-ad-300x250-created-4/21/10 */google_ad_slot = "4011047090";google_ad_width = 300;google_ad_height = 250;//--&gt;&lt;/script&gt;&lt;br /&gt;&lt;script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"&gt;&lt;/script&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/22611914-5595594735302206508?l=databobjr.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://databobjr.blogspot.com/feeds/5595594735302206508/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=22611914&amp;postID=5595594735302206508' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/22611914/posts/default/5595594735302206508'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/22611914/posts/default/5595594735302206508'/><link rel='alternate' type='text/html' href='http://databobjr.blogspot.com/2010/04/life-trapped-in-amber-from-age-of.html' title='Life Trapped in Amber from Age of Dinosaurs'/><author><name>Data Bob Jr.</name><uri>http://www.blogger.com/profile/11965565939904347208</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-22611914.post-1663007896793930613</id><published>2010-04-01T06:04:00.001-07:00</published><updated>2010-05-06T03:56:15.515-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Data Funny'/><title type='text'>Topeka Search</title><content type='html'>&lt;div id="Layer1" style="height: 200px; position: absolute; width: 448px; z-index: 1;"&gt;&lt;a href="http://googleblog.blogspot.com/2010/04/different-kind-of-company-name.html"&gt;&lt;img border="0" src="http://2.bp.blogspot.com/_-yHUY3DeIjY/S9EX9bbNQRI/AAAAAAAAABU/lGhJ_CszVnk/s320/topeka_photo_02.jpg" tt="true" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div id="Layer2" style="float: none; height: 200px; left: 449px; padding-bottom: 2px; padding-top: 0px; position: relative; width: 120px; z-index: 1;"&gt;&lt;/div&gt;&lt;span style="font-size: large;"&gt;Have a&amp;nbsp;question on setting MySQL server variables? &lt;/span&gt;&lt;a href="http://googleblog.blogspot.com/2010/04/different-kind-of-company-name.html"&gt;&lt;span style="font-size: large;"&gt;Topeka&lt;/span&gt;&lt;/a&gt;&lt;span style="font-size: large;"&gt; it.&lt;/span&gt;&lt;br /&gt;&lt;script type="text/javascript"&gt;&lt;!--google_ad_client = "pub-1602461054664536";/* post-header-banner-468x60-20100421 */google_ad_slot = "6025652737";google_ad_width = 468;google_ad_height = 60;//--&gt;&lt;/script&gt;&lt;br /&gt;&lt;script src="http://pagead2.googlesyndication.com/pagead/show_ads.js" type="text/javascript"&gt;&lt;/script&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/22611914-1663007896793930613?l=databobjr.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://databobjr.blogspot.com/feeds/1663007896793930613/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=22611914&amp;postID=1663007896793930613' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/22611914/posts/default/1663007896793930613'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/22611914/posts/default/1663007896793930613'/><link rel='alternate' type='text/html' href='http://databobjr.blogspot.com/2010/04/data-funny-topeka-search.html' title='Topeka Search'/><author><name>Data Bob Jr.</name><uri>http://www.blogger.com/profile/11965565939904347208</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_-yHUY3DeIjY/S9EX9bbNQRI/AAAAAAAAABU/lGhJ_CszVnk/s72-c/topeka_photo_02.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-22611914.post-5077263437043963673</id><published>2010-03-29T22:11:00.000-07:00</published><updated>2010-10-06T23:46:31.574-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='MySQL'/><category scheme='http://www.blogger.com/atom/ns#' term='MySQL DBA'/><title type='text'>MySQL Error: Too Many Connections, Error: 1040 SQLSTATE: 08004</title><content type='html'>&lt;div style="dir: ltr align:left; display: block; float: right; height: 260px; margin: 3px; width: 310px;"&gt;&lt;script type="text/javascript"&gt;&lt;!--google_ad_client = "pub-1602461054664536";/* body-ad-300x250-created-4/21/10 */google_ad_slot = "4011047090";google_ad_width = 300;google_ad_height = 250;//--&gt;&lt;/script&gt;&lt;br /&gt;&lt;script src="http://pagead2.googlesyndication.com/pagead/show_ads.js" type="text/javascript"&gt;&lt;/script&gt;&lt;/div&gt;If you get a too many connections error,Error: 1040 SQLSTATE: 08004 (ER_CON_COUNT_ERROR), when you try to connect to the mysqld server, this means that all available connections are in use by other clients.&lt;br /&gt;&lt;br /&gt;To increase the concurrent connections what are allowed to connect to the server, change the max_connections system variable value. The default value was 100 prior to MySQL 5.1.15. The default value is 151. If you need to support more connections, you should set a larger value for this variable. &lt;br /&gt;&lt;br /&gt;To check what were the max concurrent number of connections to the database server so far, check the Max_used_connections status. If the max_used_connections number is closed to max_connections variable value, the max_connections number should be increased.&lt;br /&gt;&lt;br /&gt;Please check &lt;a href="http://databobjr.blogspot.com/2009/06/mysql-set-server-variables.html"&gt;post Setting System Variables&lt;/a&gt;&amp;nbsp;to see how to check status and set variables. There are other server connection related variables also need to be considered when setting max_connections variables. Those variables were covered in this post: &lt;a href="http://databobjr.blogspot.com/2010/03/mysql-performance-tunning-server.html"&gt;Server Connection Variables Setting and Tuning&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/22611914-5077263437043963673?l=databobjr.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://databobjr.blogspot.com/feeds/5077263437043963673/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=22611914&amp;postID=5077263437043963673' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/22611914/posts/default/5077263437043963673'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/22611914/posts/default/5077263437043963673'/><link rel='alternate' type='text/html' href='http://databobjr.blogspot.com/2010/03/mysql-error-too-many-connections-error.html' title='MySQL Error: Too Many Connections, Error: 1040 SQLSTATE: 08004'/><author><name>Data Bob Jr.</name><uri>http://www.blogger.com/profile/11965565939904347208</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-22611914.post-6630551954300354441</id><published>2010-03-28T14:59:00.000-07:00</published><updated>2010-10-06T23:40:44.843-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='MySQL'/><category scheme='http://www.blogger.com/atom/ns#' term='MySQL Performance Tuning: System Variables'/><category scheme='http://www.blogger.com/atom/ns#' term='MySQL Performance Tuning'/><category scheme='http://www.blogger.com/atom/ns#' term='MySQL DBA'/><title type='text'>MySQL Server Connection System Variables Setting and Tuning</title><content type='html'>&lt;strong&gt;MySQL Performance Tunning: Server Connection&amp;nbsp;Variables Setting and Tunning&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;/div&gt;The max_connections MySQL server configuration variables sets the maximum concurrent connections allow to the database server. If there is not enough connections for all the clients to connect, an error message, “too many connects”, is sent back the client and connection is refused. While the max_connections variable dictiated how many connections are allowed to connect to the server, all the variables list bellow should be configured and tuned to maximize the server connection performance. &lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&amp;nbsp;Max_Connections&lt;/li&gt;&lt;li&gt;&amp;nbsp;Max_user_connections&lt;/li&gt;&lt;li&gt;&amp;nbsp;Table_open_caches (table_cache)&lt;/li&gt;&lt;li&gt;&amp;nbsp;Open_files_limit&lt;/li&gt;&lt;li&gt;&amp;nbsp;thread_cache_size&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;div&gt;&lt;/div&gt;&lt;div style="dir: ltr align:right; display: block; float: right; height: 260px; margin: 3px; width: 310px;"&gt;&lt;script type="text/javascript"&gt;&lt;!--google_ad_client = "pub-1602461054664536";/* Upper-Right-Body-ad-300x250-image-text-20100423 */google_ad_slot = "2279305361";google_ad_width = 300;google_ad_height = 250;//--&gt;&lt;/script&gt;&lt;br /&gt;&lt;script src="http://pagead2.googlesyndication.com/pagead/show_ads.js" type="text/javascript"&gt;&lt;/script&gt;&lt;/div&gt;First, as mentioned above, the connections variable sets the number of concurrent connections to the MySQL server at one time. The default value is 100 which is low for most systems Hower, The value should not be set to too hight because each connection require memory and file descriptor. On the other hand, setting a large number of connections benefit persistent connection because large number of connections allow persistent connection to remain opened rather than being close and reopen frequently. For linux system, the number is range from 500 to 1000. If there is no enough connections, the client will receive a “Too many connections” error message and will be refused to connected to the database server. &lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;/div&gt;&lt;div&gt;&lt;/div&gt;The max_user_connections variable sets the maximum number of simultaneous connections allowed to any given MySQL user account. The default is set to 0 which means “no limit.” This variable has a global value that can be set at server startup or runtime. It also has a read-only session value that indicates the effective simultaneous-connection limit that applies to the account associated with the current session. The session value is initialized as follows: &lt;br /&gt;· If the user account has a nonzero MAX_USER_CONNECTIONS resource limit, the session max_user_connections value is set to that limit. &lt;br /&gt;· Otherwise, the session max_user_connections value is set to the global value. &lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;/div&gt;&lt;div&gt;&lt;/div&gt;The table_open_cache (table_cache for MySql version before 5.1.3) sets the vaules for the number of open table for all threads that the server allows. The default values is 64. Increase this values will increase the number of file descriptors that MySql requires. It is important to make sure that the OS can handle the open file desriter set by the table_opne_cache variable. If the values of table_open_cache is set to too high a value, the MySql server may run out of file descriptots and refuse connections, fail to excute queries, and has unreliable behavior.&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;/div&gt;&lt;div&gt;&lt;/div&gt;The open_file_limit variable sets the number of open file descriptors the operating system allows to open. &lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;/div&gt;&lt;div&gt;&lt;/div&gt;The thread_cache_size variable sets the amount of threads will be cached after a connection disconeects for the purpose of maintaining memory for new connection. When a client disconnects, the client's threads are put in the cache if there are fewer than thread_cache_size threads there. Requests for threads are satisfied by reusing threads taken from the cache if possible, and only when the cache is empty is a new thread created.&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;/div&gt;&lt;div&gt;&lt;/div&gt;&lt;strong&gt;&lt;span style="font-size: large;"&gt;1.Setting Variables&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;/div&gt;&lt;div&gt;&lt;/div&gt;To determind what value to be set for each variable, we should start by getting some statistics from the current system. If it is going to be a newly deploy system, we should do some scientifit extimation for each values and mornitoring the system for a few days and correct the statistics from the running system, then, change the configuration values as needed.&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;/div&gt;&lt;div&gt;&lt;/div&gt;To check server status from mysql prompt do the following:&lt;br /&gt;mysql&amp;gt;show status \G;&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;/div&gt;&lt;div&gt;&lt;/div&gt;The about commond will display all the status variables. You can also choose to display a sub set of the status variable by using the ‘Like’ clause.&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;/div&gt;&lt;div&gt;&lt;/div&gt;mysql&amp;gt; show global status like '%connection%';&lt;br /&gt;+----------------------+-------+&lt;br /&gt;| Variable_name | Value |&lt;br /&gt;+----------------------+-------+&lt;br /&gt;| Connections | 76 |&lt;br /&gt;| Max_used_connections | 5 |&lt;br /&gt;+----------------------+-------+&lt;br /&gt;2 rows in set (0.00 sec)&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;/div&gt;&lt;div&gt;&lt;/div&gt;mysql&amp;gt; show global status like 'open%table%';&lt;br /&gt;+--------------------------+-------+&lt;br /&gt;| Variable_name | Value |&lt;br /&gt;+--------------------------+-------+&lt;br /&gt;| Open_table_definitions | 77 |&lt;br /&gt;| Open_tables | 4 |&lt;br /&gt;| Opened_table_definitions | 73 |&lt;br /&gt;| Opened_tables | 11531 |&lt;br /&gt;+--------------------------+-------+&lt;br /&gt;4 rows in set (0.02 sec)&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;/div&gt;&lt;div&gt;&lt;/div&gt;To set server variables, use the SET GLOBAL variable_name=value command in the mysql prompt:&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;/div&gt;&lt;div&gt;&lt;/div&gt;mysql&amp;gt; set global max_connections=300;&lt;br /&gt;Query OK, 0 rows affected (0.00 sec)&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;/div&gt;&lt;div&gt;&lt;/div&gt;Please remember to update the my.cnf file with the updated variable values so the server will start with the new variables in the next restart.&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;/div&gt;&lt;div&gt;&lt;/div&gt;&lt;strong&gt;1.1 Getting Server Status&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;/div&gt;&lt;div&gt;&lt;/div&gt;First, check the following server status variables are related to server connections.&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;/div&gt;&lt;div&gt;&lt;/div&gt;· Connections&lt;br /&gt;· Max_used_connections&lt;br /&gt;· Open_tables&lt;br /&gt;· Opened_tables&lt;br /&gt;· Opened_table_definitions&lt;br /&gt;· Open_files&lt;br /&gt;· Threads_cached&lt;br /&gt;· Threads_connected&lt;br /&gt;· Threads_created&lt;br /&gt;· Threads_running&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;/div&gt;&lt;div&gt;&lt;/div&gt;Connections status show the number of connections attemts (successful or fail) to the MySql server since the server started.&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;/div&gt;&lt;div&gt;&lt;/div&gt;Max_used_connections status show the maximum number of connections that have been used simultaneously since the server started. This maximum number this status variable will show is connections + 1. Therefore the connections system variable should be set to above this status number and increased when this status number increased. It is a good idead to set up an alert to monitor the Max_used_connections status variable and proactively change the connections system variable value when the status variable value is close to the connections value.&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;/div&gt;&lt;div&gt;&lt;/div&gt;Open_tables status show the number of currently open tables. A single table open 10 times will add 10 to open_table status. Since mysql is a multi-threaded system, each running quering will open one or more tables, same or different. Truce, open_tables status values will much larger that the total physical number of table a database has. If the open_tables status return a large number, it is a sign that table_cache is not big enough. &lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;/div&gt;&lt;div&gt;&lt;/div&gt;Opened_ta
