<?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>Laurent Schneider</title>
	<atom:link href="http://laurentschneider.com/feed" rel="self" type="application/rss+xml" />
	<link>http://laurentschneider.com</link>
	<description>Oracle Certified Master</description>
	<lastBuildDate>Mon, 21 May 2012 11:00:03 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>[Windows] Email of current user</title>
		<link>http://laurentschneider.com/wordpress/2012/05/windows-email-of-current-user.html</link>
		<comments>http://laurentschneider.com/wordpress/2012/05/windows-email-of-current-user.html#comments</comments>
		<pubDate>Mon, 21 May 2012 11:00:03 +0000</pubDate>
		<dc:creator>Laurent Schneider</dc:creator>
				<category><![CDATA[powershell]]></category>
		<category><![CDATA[windows]]></category>
		<category><![CDATA[email]]></category>

		<guid isPermaLink="false">http://laurentschneider.com/?p=1329</guid>
		<description><![CDATA[I hate having to type my email address, so I created a long one-liner to do the trick of getting my email from Exchange and copying it in my clipboard powershell -noprofile -command &#34;$o=New-Object DirectoryServices.DirectorySearcher; $o.SearchRoot=New-Object DirectoryServices.DirectoryEntry;$o.Filter=&#039;samaccountname=&#039;+$ENV:USERNAME;write-host ($o.FindOne().Properties.mail)&#34; &#124; clip save this as &#8220;C:\WINDOWS\E.BAT&#8221; Then, when you have to enter your email in a form [...]]]></description>
			<content:encoded><![CDATA[<p>I hate having to type my email address, so I created a long one-liner to do the trick of getting my email from Exchange and copying it in my clipboard</p>
<p><pre><code>
powershell -noprofile -command &quot;$o=New-Object DirectoryServices.DirectorySearcher; $o.SearchRoot=New-Object DirectoryServices.DirectoryEntry;$o.Filter=&#039;samaccountname=&#039;+$ENV:USERNAME;write-host ($o.FindOne().Properties.mail)&quot; | clip
</code></pre></p>
<p>save this as &#8220;C:\WINDOWS\E.BAT&#8221; </p>
<p>Then, when you have to enter your email in a form or document or login screen,<br />
[⊞+R] [e] [enter] [CTRL+V]<br />
4 keystrokes (+ 2 mod)</p>
<p>Explanation :<br />
<pre><code>
C:\&gt;powershell -noprofile
Windows PowerShell
Copyright (C) 2009 Microsoft Corporation. All rights reserved.

PS C:\&gt; $o=New-Object DirectoryServices.DirectorySearcher;
### new object to browse Microsoft AD
PS C:\&gt; $o.SearchRoot=New-Object DirectoryServices.DirectoryEntry;
### the base dn
PS C:\&gt; $o.Filter=&#039;samaccountname=&#039;+$ENV:USERNAME;
### the search filter, your Username
PS C:\&gt; $o.FindOne().Properties.mail
### find one (not necessarly 100% safe) and print the mail property
laurentschneider@example.com
</code></pre></p>
]]></content:encoded>
			<wfw:commentRss>http://laurentschneider.com/wordpress/2012/05/windows-email-of-current-user.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>My first .NET gui in Powershell</title>
		<link>http://laurentschneider.com/wordpress/2012/05/my-first-net-gui-in-powershell.html</link>
		<comments>http://laurentschneider.com/wordpress/2012/05/my-first-net-gui-in-powershell.html#comments</comments>
		<pubDate>Fri, 11 May 2012 14:33:10 +0000</pubDate>
		<dc:creator>Laurent Schneider</dc:creator>
				<category><![CDATA[sql]]></category>
		<category><![CDATA[windows]]></category>
		<category><![CDATA[dot net]]></category>

		<guid isPermaLink="false">http://laurentschneider.com/?p=1320</guid>
		<description><![CDATA[I managed to interface Oracle and a GUI via powershell. First, load the Oracle and the .NET assemblies [void] [Reflection.Assembly]::LoadFile(&#34;C:\oracle\product\11.2.0\client_1\ODP.NET\bin\2.x\Oracle.DataAccess.dll&#34;) [void] [Reflection.Assembly]::LoadWithPartialName(&#34;Drawing&#34;) [void] [Reflection.Assembly]::LoadWithPartialName(&#34;Windows.Forms&#34;) Now, let&#8217;s retrieve EMP in a powershell array. I hope one of my reader will advise me on a better way $connection=New-Object Oracle.DataAccess.Client.OracleConnection(&#34;Data Source=DB01; User Id=scott; password=tiger&#34;) $connection.open() $command=new-object Oracle.DataAccess.Client.OracleCommand(&#34;select ename [...]]]></description>
			<content:encoded><![CDATA[<p>I managed to interface Oracle and a GUI via powershell.</p>
<p>First, load the Oracle and the .NET assemblies</p>
<p><pre><code>
[void] [Reflection.Assembly]::LoadFile(&quot;C:\oracle\product\11.2.0\client_1\ODP.NET\bin\2.x\Oracle.DataAccess.dll&quot;)
[void] [Reflection.Assembly]::LoadWithPartialName(&quot;Drawing&quot;)
[void] [Reflection.Assembly]::LoadWithPartialName(&quot;Windows.Forms&quot;)
</code></pre></p>
<p>Now, let&#8217;s retrieve EMP in a powershell array. I hope one of my reader will advise me on a better way <img src='http://laurentschneider.com/wordpress/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p><pre><code>
$connection=New-Object Oracle.DataAccess.Client.OracleConnection(&quot;Data Source=DB01; User Id=scott; password=tiger&quot;)
$connection.open()
$command=new-object Oracle.DataAccess.Client.OracleCommand(&quot;select ename from emp&quot;,$connection)
$reader = $command.ExecuteReader()
$a = @()
while ($reader.Read()) {
&nbsp;&nbsp;$a = $a + $reader.GetString(0)
}
$connection.close()
</code></pre></p>
<p>last, let&#8217;s create a simple window (a Form) with a list (a List box) where you can select an item with a doubleclick.</p>
<p>Initialize the list with the array from EMP</p>
<p><pre><code>

$form = New-Object Windows.Forms.Form
$form.Text = &quot;Select employee !&quot;
$form.Size = New-Object Drawing.Size(640,480)
$form.StartPosition = &quot;CenterScreen&quot;
$listbox = New-Object Windows.Forms.ListBox
$listbox.Location = New-Object Drawing.Point(10,10)
$listbox.Size = New-Object Drawing.Size(620,460)
$listbox.Items.AddRange($a)
$listbox.Add_DoubleClick({$form.Close();})
$form.Controls.Add($listbox)
$form.Topmost = $True
$form.Add_Shown({$form.Activate()})
[void] $form.ShowDialog()
</code></pre></p>
<p><img src="http://laurentschneider.com/wordpress/wp-content/uploads/2012/05/scott_net.jpg"/></p>
<p>Show the result (or use it in your powershell scripts)<br />
<pre><code>
PS&gt; $listbox.SelectedItems[0]
SCOTT
</code></pre></p>
<p>Pretty cool! No compiler needed, directly run from the powershell prompt</p>
]]></content:encoded>
			<wfw:commentRss>http://laurentschneider.com/wordpress/2012/05/my-first-net-gui-in-powershell.html/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>EURO symbol, sqlplus, cmd.exe and various issues</title>
		<link>http://laurentschneider.com/wordpress/2012/05/euro-symbol-sqlplus-cmd-exe-and-various-issues.html</link>
		<comments>http://laurentschneider.com/wordpress/2012/05/euro-symbol-sqlplus-cmd-exe-and-various-issues.html#comments</comments>
		<pubDate>Thu, 10 May 2012 11:15:09 +0000</pubDate>
		<dc:creator>Laurent Schneider</dc:creator>
				<category><![CDATA[sqlplus]]></category>
		<category><![CDATA[windows]]></category>
		<category><![CDATA[Lucida]]></category>

		<guid isPermaLink="false">http://laurentschneider.com/?p=1315</guid>
		<description><![CDATA[One customer reported a not-correctly displayed Euro Symbol (€) in the database from sqlplus (msdos). Why? First, the character set did not support it. select * from v$nls_parameters where PARAMETER like &#039;%CHARACTERSET%&#039;; PARAMETER&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;VALUE ------------------------------ --------------- NLS_CHARACTERSET&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; WE8ISO8859P1 NLS_NCHAR_CHARACTERSET&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; AL16UTF16 If you are still using WE8ISO8859P1, consider migrating to WE8MSWIN1252 using csalter sqlplus &#34;/ as sysdba&#34; [...]]]></description>
			<content:encoded><![CDATA[<p>One customer reported a not-correctly displayed Euro Symbol (€) in the database from sqlplus (msdos).</p>
<p>Why?</p>
<p>First, the character set did not support it.<br />
<pre><code>
select * from v$nls_parameters where PARAMETER like &#039;%CHARACTERSET%&#039;;

PARAMETER&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;VALUE
------------------------------ ---------------
NLS_CHARACTERSET&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; WE8ISO8859P1
NLS_NCHAR_CHARACTERSET&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; AL16UTF16
</code></pre></p>
<p>If you are still using WE8ISO8859P1, consider migrating to WE8MSWIN1252 using csalter<br />
<pre><code>
sqlplus &quot;/ as sysdba&quot; @?/rdbms/admin/csminst
csscan &quot;&#039;sys/sys as sysdba&#039;&quot; full=y tochar=we8mswin1252 array=1024000 process=5
sqlplus &quot;/ as sysdba&quot; @?/rdbms/admin/csalter.plb
</code></pre></p>
<p>It is not always that straight forward, check output from csscan (scan.*) carefully before running csalter.</p>
<p>Ok, now retry<br />
<pre><code>
H:\&gt;set NLS_LANG=american_america.we8pc850

H:\&gt;sqlplus.exe scott/tiger

SQL*Plus: Release 11.1.0.6.0 - Production on Thu May 10 11:28:01 2012

Copyright (c) 1982, 2007, Oracle.&nbsp;&nbsp;All rights reserved.

Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL&gt; select chr(128) from dual;

C
-
■
</code></pre></p>
<p>Not good!</p>
<p>Obviously, the PC850 client character is not good enough. Let&#8217;s switch to mswin1252 on the client.</p>
<p><pre><code>
H:\&gt;chcp 1252
Active code page: 1252

H:\&gt;set NLS_LANG=american_america.we8mswin1252

H:\&gt;sqlplus.exe scott/tiger

Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL&gt; select chr(128) from dual;

C
-
Ç
</code></pre></p>
<p>Well, what&#8217;s missing now? The font ! Let&#8217;s change it from &#8220;Raster Fonts&#8221; to &#8220;Lucida Console&#8221;. Either by clicking on the command com properties, or even dynamically with <a href="http://www.pinvoke.net/default.aspx/kernel32/SetConsoleFont.html">that gem</a> (tested on XP) !</p>
<p><pre><code>
H:\&gt;type Lucida.cs
using System;
using System.Runtime.InteropServices;

public class Lucida
{
&nbsp;&nbsp;const int STD_OUT_HANDLE = -11;

&nbsp;&nbsp;[DllImport(&quot;kernel32.dll&quot;, SetLastError = true)]
&nbsp;&nbsp;static extern int SetConsoleFont(IntPtr hOut, uint dwFontSize);

&nbsp;&nbsp;[DllImport(&quot;kernel32.dll&quot;, SetLastError = true)]
&nbsp;&nbsp;static extern IntPtr GetStdHandle(int dwType);

&nbsp;&nbsp;public static void Main()
&nbsp;&nbsp;{
&nbsp;&nbsp;&nbsp;&nbsp;SetConsoleFont(GetStdHandle(STD_OUT_HANDLE), 6);
&nbsp;&nbsp;}
}

H:\&gt;csc Lucida.cs
Microsoft (R) Visual C# 2010 Compiler version 4.0.30319.1
Copyright (C) Microsoft Corporation. All rights reserved.
H:\&gt;Lucida

H:\&gt;sqlplus.exe scott/tiger

Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL&gt; select chr(128) from dual;

C
-
€
</code></pre></p>
]]></content:encoded>
			<wfw:commentRss>http://laurentschneider.com/wordpress/2012/05/euro-symbol-sqlplus-cmd-exe-and-various-issues.html/feed</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Create helloworld.exe file in powershell</title>
		<link>http://laurentschneider.com/wordpress/2012/05/create-helloworld-exe-file-in-powershell.html</link>
		<comments>http://laurentschneider.com/wordpress/2012/05/create-helloworld-exe-file-in-powershell.html#comments</comments>
		<pubDate>Wed, 09 May 2012 14:03:20 +0000</pubDate>
		<dc:creator>Laurent Schneider</dc:creator>
				<category><![CDATA[powershell]]></category>
		<category><![CDATA[Hello World]]></category>

		<guid isPermaLink="false">http://laurentschneider.com/?p=1313</guid>
		<description><![CDATA[PS&#62; Add-Type -outputtype consoleapplication -outputassembly helloworld.exe &#039;public class helloworld{public static void Main(){System.Console.WriteLine(&#34;hello world&#34;);}}&#039; PS&#62; .\helloworld.exe hello world Probably my first .exe this century]]></description>
			<content:encoded><![CDATA[<p><pre><code>
PS&gt; Add-Type -outputtype consoleapplication -outputassembly helloworld.exe &#039;public class helloworld{public static void Main(){System.Console.WriteLine(&quot;hello world&quot;);}}&#039;
PS&gt; .\helloworld.exe
hello world
</code></pre></p>
<p>Probably my first .exe this century <img src='http://laurentschneider.com/wordpress/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />  </p>
]]></content:encoded>
			<wfw:commentRss>http://laurentschneider.com/wordpress/2012/05/create-helloworld-exe-file-in-powershell.html/feed</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Toad 11.5 is out</title>
		<link>http://laurentschneider.com/wordpress/2012/05/toad-11-5-is-out.html</link>
		<comments>http://laurentschneider.com/wordpress/2012/05/toad-11-5-is-out.html#comments</comments>
		<pubDate>Tue, 08 May 2012 15:08:03 +0000</pubDate>
		<dc:creator>Laurent Schneider</dc:creator>
				<category><![CDATA[news]]></category>
		<category><![CDATA[toad]]></category>

		<guid isPermaLink="false">http://laurentschneider.com/?p=1310</guid>
		<description><![CDATA[The latest Toad is now in production, 11.5, get it from http://toadfororacle.com. If you have an old license key, 9.6 or older, it may complain at installation time, just ignore. It will be fine at run time. Enhanced TAB browsing experience, nicer and more visible colors for your connection (production=red&#8230;), read-only connections. Currently it still [...]]]></description>
			<content:encoded><![CDATA[<p>The latest Toad is now in production, 11.5, get it from <a href="http://toadfororacle.com">http://toadfororacle.com</a>.</p>
<p>If you have an old license key, 9.6 or older, it may complain at installation time, just ignore. It will be fine at run time.</p>
<p>Enhanced TAB browsing experience, nicer and more visible colors for your connection (production=red&#8230;), read-only connections.</p>
<p>Currently it still requires a 32bit clients, even when running on a 64bit Operating System.</p>
]]></content:encoded>
			<wfw:commentRss>http://laurentschneider.com/wordpress/2012/05/toad-11-5-is-out.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to get rid of corrupted blocks without a backup</title>
		<link>http://laurentschneider.com/wordpress/2012/04/how-to-get-rid-of-corrupted-blocks-without-a-backup.html</link>
		<comments>http://laurentschneider.com/wordpress/2012/04/how-to-get-rid-of-corrupted-blocks-without-a-backup.html#comments</comments>
		<pubDate>Thu, 12 Apr 2012 14:07:57 +0000</pubDate>
		<dc:creator>Laurent Schneider</dc:creator>
				<category><![CDATA[dba]]></category>
		<category><![CDATA[sql]]></category>
		<category><![CDATA[ORA-01110]]></category>
		<category><![CDATA[ORA-01578]]></category>
		<category><![CDATA[ORA-26040]]></category>

		<guid isPermaLink="false">http://laurentschneider.com/?p=1307</guid>
		<description><![CDATA[First, you identify the blocks in alert log or with db verify $ dbv BLOCKSIZE=8192 file=sysaux01.dbf DBV-00201: Block, DBA 12629823, marked corrupt for invalid redo application ... DBVERIFY - Verification complete Total Pages Examined&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; : 131072 Total Pages Processed (Data) : 69691 Total Pages Failing&#160;&#160; (Data) : 0 Total Pages Processed (Index): 28669 Total Pages [...]]]></description>
			<content:encoded><![CDATA[<p>First, you identify the blocks in alert log or with db verify</p>
<p><pre><code>
$ dbv BLOCKSIZE=8192 file=sysaux01.dbf
DBV-00201: Block, DBA 12629823, marked corrupt for invalid redo application
...
DBVERIFY - Verification complete

Total Pages Examined&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : 131072
Total Pages Processed (Data) : 69691
Total Pages Failing&nbsp;&nbsp; (Data) : 0
Total Pages Processed (Index): 28669
Total Pages Failing&nbsp;&nbsp; (Index): 0
Total Pages Processed (Other): 15755
Total Pages Processed (Seg)&nbsp;&nbsp;: 0
Total Pages Failing&nbsp;&nbsp; (Seg)&nbsp;&nbsp;: 0
Total Pages Empty&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;: 16957
Total Pages Marked Corrupt&nbsp;&nbsp; : 9
Total Pages Influx&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : 0
Total Pages Encrypted&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;: 0
Highest block SCN&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;: 3220271881 (11.3220271881)
</code></pre></p>
<p>For the dba number, identify the block<br />
<pre><code>
def dba=12585405
col block_id new_v block_id
col file_id new_v file_id
select dbms_utility.data_block_address_block(&amp;dba) block_id, 
dbms_utility.data_block_address_file(&amp;dba) file_id from dual;

&nbsp;&nbsp;BLOCK_ID&nbsp;&nbsp;&nbsp;&nbsp;FILE_ID
---------- ----------
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;2493&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;3
</code></pre></p>
<p>From the block_id/file_id, identify the segment<br />
<pre><code>
col owner new_v table_owner 
col segment_name new_v segment_name
select owner,segment_name,segment_type from dba_extents where file_id=&amp;file_id and &amp;BLOCK_ID between block_id and block_id + blocks - 1;
OWNER
------------------------------
SEGMENT_NAME
-----------------------------------
SEGMENT_TYPE
------------------
SYS
SYS_IL0000008786C00008$$
LOBINDEX
</code></pre></p>
<p>If it is a lob, identify the column and data_type<br />
<pre><code>
select tablespace_name,owner, table_name, column_name, data_type from dba_lobs join
dba_tab_columns using (owner, table_name, column_name) where segment_name =
&#039;&amp;segment_name&#039; and owner=&#039;&amp;table_owner&#039;;
TABLESPACE_NAME&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;OWNER
------------------------------ ------------------------------
TABLE_NAME&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; COLUMN_NAME
------------------------------ ------------------------------
DATA_TYPE
--------------------------------------------------------------------------------
SYSAUX&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SYS
WRI$_DBU_FEATURE_USAGE&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; FEATURE_INFO
CLOB
</code></pre></p>
<p>If you are lucky, you will find a useless segment that you will just drop. Or maybe you will be able to move all segments in another tablespace and drop the tablespace with the corrupt blocks.</p>
<p>If you are pretty unlucky like me today, you will find sys segments in system or sysaux. </p>
<p>Either you export all users data and import them again in a new database (but this means downtime), or you start moving the segments in another tablespace. Or dropping and recreating them.<br />
Check <a href="http://laurentschneider.com/wordpress/2006/08/tablespace-maintenance-tasks.html">Tablespace maintenance tasks</a></p>
<p>Once dropped or moved or emptied, you may still see the corrupted blocks. Do not forget to purge the recyclebin, either with PURGE DBA_RECYCLEBIN or PURGE TABLESPACE tbs1 USER usr1</p>
<p>Even then the corruption may belong to no more segment but still appear in dbverify. One workaround is to fill the tablespace (check it does not extend) with a dummy table</p>
<p><pre><code>create table t(x number, y varchar2(4000) default lpad(&#039;x&#039;,4000,&#039;x&#039;)) tablespace tbs1;

exec while true loop insert into t(x) select rownum r from dual connect by level&lt;10000;commit;end loop

exec while true loop insert into t(x) select rownum r from dual connect by level&lt;100;commit;end loop

exec while true loop insert into t(x,y) select rownum r,&#039;x&#039; from dual;commit;end loop

exec while true loop insert into t(x,y) values (null,null);commit;end loop

drop table t;
</code></pre></p>
<p>Run dbv again and again until you get completly rid of errors. If you drop and recreate sys objects, or even if you simply move them out of the sys tablespace, dictionary corruption and ora-600 is possible. But well, you had corruption anyway &#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://laurentschneider.com/wordpress/2012/04/how-to-get-rid-of-corrupted-blocks-without-a-backup.html/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>weekinmonth in powershell starts on Sunday&#8230;</title>
		<link>http://laurentschneider.com/wordpress/2012/04/weekinmonth-in-powershell-starts-on-sunday.html</link>
		<comments>http://laurentschneider.com/wordpress/2012/04/weekinmonth-in-powershell-starts-on-sunday.html#comments</comments>
		<pubDate>Wed, 11 Apr 2012 18:25:34 +0000</pubDate>
		<dc:creator>Laurent Schneider</dc:creator>
				<category><![CDATA[powershell]]></category>
		<category><![CDATA[weekinmonth]]></category>

		<guid isPermaLink="false">http://laurentschneider.com/?p=1299</guid>
		<description><![CDATA[This April month is full of surprises! Not only I did not have the opportunity to trick my colleagues on Sunday April first, but I had some bug of my code due to the start of the week. [int](get-date).dayofweek and (Get-WmiObject Win32_LocalTime).dayofweek both refer Sunday as day 0. PS&#62; get-date Wednesday, 11. April 2012 18:31:52 [...]]]></description>
			<content:encoded><![CDATA[<p>This April month is full of surprises! Not only I did not have the opportunity to trick my colleagues on Sunday April first, but I had some bug of my code due to the start of the week.</p>
<p>[int](get-date).dayofweek and  (Get-WmiObject Win32_LocalTime).dayofweek both refer Sunday as day 0. </p>
<p><pre><code>
PS&gt; get-date
Wednesday, 11. April 2012 18:31:52
PS C:\svn&gt; [int](get-date).dayofweek
3
PS C:\svn&gt; (Get-WmiObject Win32_LocalTime).dayofweek
3
</code></pre></p>
<p>Consistently and unfortunately for me, the week does start on Sunday. And not on Monday.</p>
<p>To get week ending on Sunday, lets add 6 for Monday (5 for Tuesday, and so on) to dayofweek and get the 7-modulo<br />
<pre><code>
PS&gt; (6+(get-date).dayofweek)%7
2
</code></pre><br />
Ok, now Mon=0, Tue=1, Wed=2, etc&#8230;</p>
<p>Substract it from day of month to truncate to Monday<br />
<pre><code>
PS&gt; (get-date).day - (6+(get-date).dayofweek)%7
9
</code></pre></p>
<p>First day of current week is Monday 9th</p>
<p>Now add 5 to get the first Day of month between 0 and 6<br />
Divide by 7&#8230;<br />
add 1 to get first week=1 (and not 0).</p>
<p>Truncate<br />
<pre><code>
PS&gt; [math]::floor(((get-date).day - (6+(get-date).dayofweek)%7 + 5)/7)+1
3
</code></pre></p>
<p>Which slicely differs from weekinmonth when 1st of month is Sunday !<br />
<pre><code>
PS&gt; (Get-WmiObject Win32_LocalTime).weekinmonth
2
</code></pre></p>
<p>Pfeww&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://laurentschneider.com/wordpress/2012/04/weekinmonth-in-powershell-starts-on-sunday.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How much is + &#8216;x&#8217; ?</title>
		<link>http://laurentschneider.com/wordpress/2012/04/how-much-is-x.html</link>
		<comments>http://laurentschneider.com/wordpress/2012/04/how-much-is-x.html#comments</comments>
		<pubDate>Wed, 11 Apr 2012 15:41:25 +0000</pubDate>
		<dc:creator>Laurent Schneider</dc:creator>
				<category><![CDATA[fun]]></category>
		<category><![CDATA[sql]]></category>
		<category><![CDATA[to_number]]></category>

		<guid isPermaLink="false">http://laurentschneider.com/?p=1295</guid>
		<description><![CDATA[Sounds like an april fool, but I wonder what is + &#8216;x&#8217; supposed to do SQL&#62; select + &#039;x&#039; from dual; + - x it does not convert to number as 0 + &#8217;1&#8242; would do]]></description>
			<content:encoded><![CDATA[<p>Sounds like an april fool, but I wonder what is + &#8216;x&#8217; supposed to do <img src='http://laurentschneider.com/wordpress/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p><pre><code>SQL&gt; select + &#039;x&#039; from dual;

+
-
x</code></pre></p>
<p>it does not convert to number as <b>0 + &#8217;1&#8242;</b> would do </p>
]]></content:encoded>
			<wfw:commentRss>http://laurentschneider.com/wordpress/2012/04/how-much-is-x.html/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>[alert] AIX Posix Timezone issue</title>
		<link>http://laurentschneider.com/wordpress/2012/03/alert-aix-posix-timezone-issue.html</link>
		<comments>http://laurentschneider.com/wordpress/2012/03/alert-aix-posix-timezone-issue.html#comments</comments>
		<pubDate>Fri, 16 Mar 2012 11:24:17 +0000</pubDate>
		<dc:creator>Laurent Schneider</dc:creator>
				<category><![CDATA[news]]></category>
		<category><![CDATA[unix]]></category>
		<category><![CDATA[aix]]></category>
		<category><![CDATA[tz]]></category>

		<guid isPermaLink="false">http://laurentschneider.com/?p=1284</guid>
		<description><![CDATA[Maybe you did get or you will get an issue with the date command in AIX. expected behavior, Linux $ TZ=NZST-12NZDT,M10.1.0/2,M3.3.0/3 date Sat Mar 17 00:14:54 NZDT 2012 $ TZ=Pacific/Auckland date Sat Mar 17 00:14:58 NZDT 2012 unexpected behavior, AIX $ TZ=Pacific/Auckland date Sat Mar 17 00:15:50 GMT+13:00 2012 $ TZ=NZST-12NZDT,M10.1.0/2,M3.3.0/3 date Fri Mar 16 [...]]]></description>
			<content:encoded><![CDATA[<p>Maybe you did get or you will get an issue with the date command in AIX. </p>
<p>expected behavior, Linux<br />
<pre><code>
$ TZ=NZST-12NZDT,M10.1.0/2,M3.3.0/3 date
Sat Mar 17 00:14:54 NZDT 2012
$ TZ=Pacific/Auckland date
Sat Mar 17 00:14:58 NZDT 2012
</code></pre></p>
<p>unexpected behavior, AIX<br />
<pre><code>
$ TZ=Pacific/Auckland date
Sat Mar 17 00:15:50 GMT+13:00 2012
$ TZ=NZST-12NZDT,M10.1.0/2,M3.3.0/3 date
Fri Mar 16 23:15:52 NZST 2012
</code></pre></p>
<p>The consequence : <b>date</b>, and all other unix commands like ls, who, ps that display the date in human readable format, and all programs that use ctime are affected<br />
<pre><code>
$ TZ=NZST-12NZDT,M10.1.0/2,M3.3.0/3 perl -e &#039;use POSIX;print ctime(time)&#039;
Fri Mar 16 23:19:51 2012
</code></pre></p>
<p>Reference and link to the fixes : <a href="http://www-01.ibm.com/support/docview.wss?uid=isg3T1013017">www-01.ibm.com/support/docview.wss?uid=isg3T1013017</a></p>
]]></content:encoded>
			<wfw:commentRss>http://laurentschneider.com/wordpress/2012/03/alert-aix-posix-timezone-issue.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Close tabs in Toad</title>
		<link>http://laurentschneider.com/wordpress/2012/03/close-tabs-in-toad.html</link>
		<comments>http://laurentschneider.com/wordpress/2012/03/close-tabs-in-toad.html#comments</comments>
		<pubDate>Mon, 12 Mar 2012 09:55:58 +0000</pubDate>
		<dc:creator>Laurent Schneider</dc:creator>
				<category><![CDATA[toad]]></category>
		<category><![CDATA[tabs]]></category>

		<guid isPermaLink="false">http://laurentschneider.com/?p=1280</guid>
		<description><![CDATA[Sometimes you wait a feature for so long that even if it is small and common, you feel greatly happy In Toad 11.5.0.38. Greatly replace the &#8220;right-click&#8221; + &#8220;close tab&#8221;]]></description>
			<content:encoded><![CDATA[<p>Sometimes you wait a feature for so long that even if it is small and common, you feel greatly happy </p>
<p><img src="http://laurentschneider.com/wordpress/wp-content/uploads/2012/03/closetab.png"/></p>
<p>In Toad 11.5.0.38. Greatly replace the &#8220;right-click&#8221; + &#8220;close tab&#8221;</p>
]]></content:encoded>
			<wfw:commentRss>http://laurentschneider.com/wordpress/2012/03/close-tabs-in-toad.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

