<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Tanel Poder's blog: Core IT for Geeks and Pros &#187; Windows</title>
	<atom:link href="http://blog.tanelpoder.com/category/windows/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.tanelpoder.com</link>
	<description>Oracle troubleshooting, internals and performance tuning</description>
	<lastBuildDate>Sat, 31 Jul 2010 05:44:10 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Sqlplus is my second home, part 3: Colored selections in Windows XP command prompt</title>
		<link>http://blog.tanelpoder.com/2007/09/01/sqlplus-is-my-second-home-part-3-colored-selections-in-windows-xp-command-prompt/</link>
		<comments>http://blog.tanelpoder.com/2007/09/01/sqlplus-is-my-second-home-part-3-colored-selections-in-windows-xp-command-prompt/#comments</comments>
		<pubDate>Sat, 01 Sep 2007 05:55:23 +0000</pubDate>
		<dc:creator>Tanel Poder</dc:creator>
				<category><![CDATA[Cool stuff]]></category>
		<category><![CDATA[Tools]]></category>
		<category><![CDATA[Windows]]></category>

		<guid isPermaLink="false">http://tanelpoder.wordpress.com/2007/09/01/sqlplus-is-my-second-home-part-3-colored-selections-in-windows-xp-command-prompt/</guid>
		<description><![CDATA[Whenever delivering some Oracle training or running a demo at a conference, I&#8217;ve always liked to use the Windows command prompt version of sqlplus. One reason of course is its easy command line history navigation capability ( press F7 in cmd.exe after entering few commands to see why ). Another reason is that whenever I [...]]]></description>
			<content:encoded><![CDATA[<p>Whenever delivering some Oracle training or running a demo at a conference, I&#8217;ve always liked to use the Windows command prompt version of sqlplus.</p>
<p>One reason of course is its easy command line history navigation capability ( press F7 in cmd.exe after entering few commands to see why ).</p>
<p>Another reason is that whenever I want to highlight some part of sqlplus output, I can just drag a selection rectangle around that text. In other words I can &#8220;mark&#8221; the text &#8211; drawing the attention there. Of course as the selection rectangle is really meant for copy &amp; paste operations only, it has several limitations. It&#8217;s not persistent, whenever I continue typing, the text &#8220;marking&#8221; will disappear.</p>
<p>Windows XP has introduced a really cool feature to cmd.exe, which anyone doing presentations involving some command line tool output will appreciate!</p>
<p>Basically XP allows you to <em>persistently</em> select and <em>color</em> command prompt output!</p>
<p>An example of what I&#8217;m talking about is here:</p>
<p><span id="more-39"></span></p>
<p><img border="0" src="http://tanelpoder.files.wordpress.com/2007/09/color_cmd.png" /></p>
<p>How can this be done?</p>
<p>First, you need to create a DWORD value in Windows registry <strong>HKEY_CURRENT_USER\Console\EnableColorSelection</strong> and set it to <strong>1</strong></p>
<p>Now launch CMD.exe, select something and press CTRL+6. The backround of text of the selection should turn red. If you press ALT+6, the foreground text should turn red.<br />
You have 10 different colors available for your use, using key-combinations ALT+0..9 and CTRL+0..9</p>
<p>Also, this coloring is persistent. If you generate more output during your demos, you can always scroll back and easily spot the highlighted part quickly if need to revisit some previous result.</p>
<p>Nice huh? I will sure use it in my future demos and presentations!</p>
<p>If you want my whole CMD.exe registry key settings, copy and paste the these lines below into a .reg file and import into your registry ( after backing up your current key of course! ).</p>
<pre><code>Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Console]
"ColorTable00"=dword:00000000
"ColorTable01"=dword:00800000
"ColorTable02"=dword:00008000
"ColorTable03"=dword:00808000
"ColorTable04"=dword:00000080
"ColorTable05"=dword:00800080
"ColorTable06"=dword:00008080
"ColorTable07"=dword:00c0c0c0
"ColorTable08"=dword:00808080
"ColorTable09"=dword:00ff0000
"ColorTable10"=dword:0000ff00
"ColorTable11"=dword:00ffff00
"ColorTable12"=dword:000000ff
"ColorTable13"=dword:00ff00ff
"ColorTable14"=dword:0000ffff
"ColorTable15"=dword:00ffffff
"CursorSize"=dword:00000019
"FaceName"="Lucida Console"
"FontFamily"=dword:00000036
"FontSize"=dword:000e0000
"FontWeight"=dword:00000190
"FullScreen"=dword:00000000
"HistoryBufferSize"=dword:000001f4
"InsertMode"=dword:00000001
"LoadConIme"=dword:00000001
"NumberOfHistoryBuffers"=dword:00000004
"PopupColors"=dword:00000007
"QuickEdit"=dword:00000001
"ScreenBufferSize"=dword:270f03e8
"ScreenColors"=dword:00000070
"WindowSize"=dword:0032009c
"CurrentPage"=dword:00000002
"HistoryNoDup"=dword:00000001
"WordDelimiters"=";:,.[]{}()/\|^&amp;*-=+"
"EnableColorSelection"=dword:00000001

</code></pre>
<p>I&#8217;ve configured multiple CMD.exe things from defaults for my convenience. Most of the stuff is accessible from the CMD.exe Properties menu, however the EnableColorSelection and WordDelimiters need to be set in registry.</p>
<p>The <strong>WordDelimiters</strong> is another handy setting. It allows you to specify where in the typed line cursor stops should you navigate left or right word-by-word using CTRL+Left/Right arrows. Normally only the space char was recognized as a word delimiter, but I&#8217;ve added many other characters as well &#8211; it&#8217;s much faster to navigate on command line that way.</p>
<div class="facebook_like_button"><iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fblog.tanelpoder.com%2F2007%2F09%2F01%2Fsqlplus-is-my-second-home-part-3-colored-selections-in-windows-xp-command-prompt%2F&amp;layout=standard&amp;show-faces=true&amp;width=450&amp;action=like&amp;font=arial&amp;colorscheme=light" scrolling="no" frameborder="0" allowTransparency="true" style="padding: 0px 0px; border:none; overflow:hidden; width:450px; height:70px;"></iframe></div> <img src="http://blog.tanelpoder.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=39" width="1" height="1" style="display: none;" /><p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save"><img src="http://blog.tanelpoder.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://blog.tanelpoder.com/2007/09/01/sqlplus-is-my-second-home-part-3-colored-selections-in-windows-xp-command-prompt/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Operating systems are lazy allocating memory</title>
		<link>http://blog.tanelpoder.com/2007/08/28/operating-systems-are-lazy-allocating-memory/</link>
		<comments>http://blog.tanelpoder.com/2007/08/28/operating-systems-are-lazy-allocating-memory/#comments</comments>
		<pubDate>Tue, 28 Aug 2007 15:02:24 +0000</pubDate>
		<dc:creator>Tanel Poder</dc:creator>
				<category><![CDATA[Internals]]></category>
		<category><![CDATA[Oracle]]></category>
		<category><![CDATA[Unix/Linux]]></category>
		<category><![CDATA[Windows]]></category>

		<guid isPermaLink="false">http://tanelpoder.wordpress.com/2007/08/28/operating-systems-are-lazy-allocating-memory/</guid>
		<description><![CDATA[There was a discussion about whether Oracle really allocates all memory for SGA immediately on instance startup or not. And further, whether Oracle allocates memory beyond the SGA_TARET if SGA_MAX_SIZE is larger than it. It&#8217;s worth reading this thread first: http://forums.oracle.com/forums/thread.jspa?threadID=535400&#38;tstart=0 I will paste an edited version of my reply to here as well: Don&#8217;t [...]]]></description>
			<content:encoded><![CDATA[<p>There was a discussion about whether Oracle really <strong>allocates</strong> all memory for SGA immediately on instance startup or not. And further, whether Oracle allocates memory beyond the SGA_TARET if SGA_MAX_SIZE is larger than it.<br />
It&#8217;s worth reading this thread first: <a href="http://blog.tanelpoder.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL2ZvcnVtcy5vcmFjbGUuY29tL2ZvcnVtcy90aHJlYWQuanNwYT90aHJlYWRJRD01MzU0MDAmYW1wO3RzdGFydD0w">http://forums.oracle.com/forums/thread.jspa?threadID=535400&amp;tstart=0</a></p>
<p>I will paste an edited version of my reply to here as well:</p>
<p><span id="more-36"></span></p>
<p>Don&#8217;t confuse address space set-up with allocating physical memory pages from RAM!</p>
<p>Even if ipcs -m shows x GB as the SGA shm segment length, it doesn&#8217;t mean this memory has actually been initialized and taken from RAM.</p>
<p>Decent OS&#8217;es do only initialize the pageable meory pages when they&#8217;re touched the first time, so a shm segment showing 10GB in ipcs -m output may be only 10% &#8220;used&#8221; really as some pages have never been touched.There are many things which affect when and if the memory is actually *allocated*, the ones I remember right now are:</p>
<blockquote><p>1) using solaris ISM &#8211; means Oracle will be usng non-pageable large pages &#8211; the shm seg size you see in ipcs is fully allocated from RAM and locked in RAM.</p>
<p>2) using Solaris DISM, the SGA shm segment is pageable (small pages in Solaris 8, large pages from Solaris 9) and may not necessarily be allocated from RAM</p>
<p>3) using lock_sga=true -&gt; the SGA shm segment is allocated from RAM and locked in RAM</p>
<p>4) using _lock_sga_areas -&gt; some ranges of pages in SGA shm segment are locked to memory, some pages of SGA shm segment may still be uninitialized</p>
<p>5) using _pre_page_sga=true -&gt; all pages of SGA shm segment are touched on startup</p>
<p>6) few others like _db_cache_pre_warm which affect memory page touching on startup&#8230;</p>
<p>7) using memory_target on Oracle 11g</p></blockquote>
<p>So, there are *many* things which affect physical memory allocation, but generally, unless you&#8217;re using non-pageable pages, not all SGA-size worth of memory is allocated from OS during instance startup.</p>
<p>Normally these artificial instance startup errors after setting sga_max_size to xxxGB come from hitting max shm segment size or max RAM + swap size (on Unixes). On linux on the other hand you can overallocate memory as Linux doesn&#8217;t back anonymous memory mappings with swap space (linux starts killing &#8220;random&#8221; processes instead when running out-of-memory. nice, huh?)</p>
<p>This means that if your SGA_TARGET is lower than SGA_MAX_SIZE during startup then the pages &#8220;above&#8221; SGA_TARGET will never be touched, thus not allocated!</p>
<p>And if you ramp down SGA_TARGET during your instance lifetime, then the pages &#8220;above&#8221; the new SGA_TARGET won&#8217;t be touched anymore (after MMAN completes the downsizing), which means these pages will be paged out from physical memory if there&#8217;s shortage of free physical memory.</p>
<p>Note that this &#8220;lazy&#8221; allocation behaviour comes from how modern operating systems work, it&#8217;s not a feature of Oracle. Oracle just has an option to request some specific behaviour from OS on some platforms (like requesting ISM using SHARE_MMU flag on Solaris when setting up the SGA SHM segment).</p>
<p>Thanks to this heavy &#8220;virtualization&#8221; of virtual memory pages and short codepath requirements for VM handling, its often hard to get a complete and accurate picture of individual processes &amp; SHM segments physical memory usage.</p>
<div class="facebook_like_button"><iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fblog.tanelpoder.com%2F2007%2F08%2F28%2Foperating-systems-are-lazy-allocating-memory%2F&amp;layout=standard&amp;show-faces=true&amp;width=450&amp;action=like&amp;font=arial&amp;colorscheme=light" scrolling="no" frameborder="0" allowTransparency="true" style="padding: 0px 0px; border:none; overflow:hidden; width:450px; height:70px;"></iframe></div> <img src="http://blog.tanelpoder.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=36" width="1" height="1" style="display: none;" /><p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save"><img src="http://blog.tanelpoder.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://blog.tanelpoder.com/2007/08/28/operating-systems-are-lazy-allocating-memory/feed/</wfw:commentRss>
		<slash:comments>13</slash:comments>
		</item>
	</channel>
</rss>
