<?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>Point41</title>
	<atom:link href="http://www.point41.com/index.php/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.point41.com</link>
	<description>IT Tips &#38; Tricks</description>
	<lastBuildDate>Thu, 13 Aug 2009 21:24:22 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Reseeding Identity Columns for Replication</title>
		<link>http://www.point41.com/index.php/2009/08/13/reseeding-identity-columns-for-replication/</link>
		<comments>http://www.point41.com/index.php/2009/08/13/reseeding-identity-columns-for-replication/#comments</comments>
		<pubDate>Thu, 13 Aug 2009 21:24:22 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[DBCC CHECKIDENT]]></category>

		<guid isPermaLink="false">http://www.point41.com/?p=100</guid>
		<description><![CDATA[As a software developer/architect in this era of downsizing and people becoming Jacks of all Trades, I frequently find myself in a situation where I have to do DBA stuff. In one particular case, I am maintaining two databases which are peer-to-peer replicated. The databases support a web application for a primary site and a [...]]]></description>
			<content:encoded><![CDATA[<p>As a software developer/architect in this era of downsizing and people becoming Jacks of all Trades, I frequently find myself in a situation where I have to do DBA stuff. In one particular case, I am maintaining two databases which are peer-to-peer replicated. The databases support a web application for a primary site and a disaster recovery (DR) site.</p>
<p>Though already running in production mode, the web application is still changing because new features are being added on a daily basis. As a result of this, schema changes are pushed to the database almost weekly and I just don&#8217;t have the time to maintain the SQL scripts required to keep replication in sync with the schema changes. It is much easier to just: 1) take down replication and delete the DR database, 2) update the schema on the primary database, 3) restore a new copy of the second DR from a backup of the primary, 4) reseed identity columns on the DR database, 5) set up replication from scratch.</p>
<p>It may sound stupid, but whatever. Setting up replication from scratch through the UI works out to be easier than maintaining the change scripts required to keep several hundred tables properly replicated while new tables are columns are being constantly added. The only pain-in-the-ass part of this method is that the identity columns of hundreds of tables in the DR database need to be reseeded each time. Fortunately this can be done quickly.</p>
<p>Our rule is that indentity columns of type <strong>int</strong> should have values in the range of 1 &#8211; 1073741823 on the main database, and on the second database the range should be 1073741824 and up. For <strong>bigint</strong> it should be 1 &#8211; 10737418239 on the main database and 10737418240 and up on the second database.</p>
<p>So for a table tbl_abc which has an identity column of type <strong>int</strong> to run the following 2 SQL statements on the DR database:</p>
<div style="background-color: #dfdfdf; padding-bottom: 16px;"><code><br />
dbcc checkident('tbl_abc', RESEED, 1073741824)<br />
dbcc checkident('tbl_abc', RESEED)<br />
 </code></div>
<p>The first sets the seed value to 1073741824. However, the application might have previously failed over to the DR database and there may already be rows with identity columns having a value of 1073741824 and up. The second statement above correcly sets the seed to the next available value, if 1073741824 is already used.</p>
<p>The output of following SQL script will generate the pair DBCC statements for all tables in the database named &#8216;tbl_%&#8217;.</p>
<div style="background-color: #dfdfdf; padding-bottom: 16px;"><code><br />
select<br />
'dbcc checkident(''' + st.name + ''',RESEED,' + case when sc.system_type_id = 56 then '1073741824)' else '10737418240)' end<br />
from sys.tables st<br />
inner join sys.columns sc on sc.object_id = st.object_id<br />
where st.name like 'tbl_%'<br />
and sc.is_identity = 1</p>
<p>select<br />
'dbcc checkident(''' + st.name + ''',RESEED)'<br />
from sys.tables st<br />
inner join sys.columns sc on sc.object_id = st.object_id<br />
where st.name like 'tbl_%'<br />
and sc.is_identity = 1</p>
<p></code></div>
<p>
The output needs to be captured as text and cleaned up a little (remove headers, etc.), before being resumbitted as a SQL command. Note that if the table has many rows (over several hundred thousand), it could take a while for DBCC CHECKIDENT to complete.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.point41.com/index.php/2009/08/13/reseeding-identity-columns-for-replication/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>4GB Virtual Address Space Under WoW64</title>
		<link>http://www.point41.com/index.php/2009/08/11/4gb-virtual-address-space-under-wow64/</link>
		<comments>http://www.point41.com/index.php/2009/08/11/4gb-virtual-address-space-under-wow64/#comments</comments>
		<pubDate>Tue, 11 Aug 2009 23:07:28 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Windows x64]]></category>
		<category><![CDATA[/LARGEADDRESSAWARE]]></category>
		<category><![CDATA[EDITBIN]]></category>

		<guid isPermaLink="false">http://www.point41.com/?p=79</guid>
		<description><![CDATA[In Windows x86 your 32-bit application can only address 2GB of virtual address space. The other 2GB has been reserved for kernel operations. Under Windows x64, with the 32-bit application running under WoW64, you can give the access to the full 4GB virtual address space by changing a flag in the PE header. This is [...]]]></description>
			<content:encoded><![CDATA[<p>In Windows x86 your 32-bit application can only address 2GB of virtual address space. The other 2GB has been reserved for kernel operations. Under Windows x64, with the 32-bit application running under WoW64, you can give the access to the full 4GB virtual address space by changing a flag in the PE header. This is accomplished by using the <b>EDITBIN.EXE</b> utility which comes with Visual Studio.
</p>
<div style="background-color: #dfdfdf; padding: 16px 16px 16px 16px; font-family: courier; font-size:10px;">
editbin /LARGEADDRESSAWARE xxx.exe
</div>
<p>Why not just simply compile and link xxx.exe as a native 64-bit application and get much more than 4GB? Well, the application may be using libraries and components which are only available as 32-bit binaries. In this case, building a 64-bit app is not an option. Also, if you have been following Rico Mariani&#8217;s (of Visual Studio fame) blog, you would know that there are some <a href="http://blogs.msdn.com/ricom/archive/2009/06/10/visual-studio-why-is-there-no-64-bit-version.aspx">disadvantages</a> of running native 64-bit applications vs. 32-bit applications under WoW64 &#8211; the main thing being that all address pointers would be twice the size, meaning a larger memory footprint and slower memory access.
</p>
<p>
You can use the <b>DUMPBIN.EXE</b> utility (also part of Visual Studio tools), to find out the setting of the /LARGEADDRESSAWARE flag in the header.
</p>
<div style="background-color: #dfdfdf; padding: 16px 16px 16px 16px; font-family: courier; font-size:10px;">
dumpbin /HEADERS xxx.exe
</div>
<p><img src="http://www.point41.com/wp-content/uploads/2009/08/dumpbin.gif"/></p>
<p>
In the output of DUMPBIN look out for <i>Application can handle large (>2GB) addresses</i>. This means that your 32-bit app will be able to address the full 4GB address space when running under Windows x64. Note that when running the app in 32-bit Windows configured with the /3GB option, the app will be able to address 3GB.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.point41.com/index.php/2009/08/11/4gb-virtual-address-space-under-wow64/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Script to Re-index SQL Server Database</title>
		<link>http://www.point41.com/index.php/2009/08/09/script-to-re-index-sql-server-database/</link>
		<comments>http://www.point41.com/index.php/2009/08/09/script-to-re-index-sql-server-database/#comments</comments>
		<pubDate>Sun, 09 Aug 2009 22:31:16 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[SQL Server]]></category>

		<guid isPermaLink="false">http://www.point41.com/?p=66</guid>
		<description><![CDATA[The following SQL Server script enumerates the tables in a database and calls DBBC REINDEX on each one (with a fill factor of 80%). It then calls sp_updatestats too update the index statistics.



USE &#60;database_name&#62;
DECLARE @TableName varchar(255) 
DECLARE TableCursor CURSOR FOR
SELECT table_name FROM information_schema.tables
WHERE table_type = &#8216;base table&#8217; 
OPEN TableCursor 
FETCH NEXT FROM TableCursor INTO @TableName
WHILE [...]]]></description>
			<content:encoded><![CDATA[<p>The following SQL Server script enumerates the tables in a database and calls DBBC REINDEX on each one (with a fill factor of 80%). It then calls sp_updatestats too update the index statistics.
</p>
<div style="background-color: #dfdfdf; padding: 1px 16px 1px 16px; font-family: courier; font-size:10px;">
<p>
USE <i>&lt;database_name&gt;</i></p>
<p>DECLARE @TableName varchar(255) </p>
<p>DECLARE TableCursor CURSOR FOR<br />
SELECT table_name FROM information_schema.tables<br />
WHERE table_type = &#8216;base table&#8217; </p>
<p>OPEN TableCursor </p>
<p>FETCH NEXT FROM TableCursor INTO @TableName<br />
WHILE @@FETCH_STATUS = 0<br />
BEGIN<br />
Print @TableName<br />
DBCC DBREINDEX(@TableName,&#8217; &#8216;,80)<br />
FETCH NEXT FROM TableCursor INTO @TableName<br />
END </p>
<p>CLOSE TableCursor </p>
<p>EXEC sp_updatestats
</p>
</div>
<p>To avoid your queries from running under non-optimal execution plans, the script should be run periodically, typically weekly or nightly, when the the database is not in use.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.point41.com/index.php/2009/08/09/script-to-re-index-sql-server-database/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Replicating large text / ntext fields in SQL Server 2005, 2008</title>
		<link>http://www.point41.com/index.php/2009/08/09/replicating-large-text-ntext-fields-in-sql-server-2005-2008/</link>
		<comments>http://www.point41.com/index.php/2009/08/09/replicating-large-text-ntext-fields-in-sql-server-2005-2008/#comments</comments>
		<pubDate>Sun, 09 Aug 2009 15:24:40 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[replication]]></category>

		<guid isPermaLink="false">http://www.point41.com/?p=37</guid>
		<description><![CDATA[Scenario &#8211; You have successfully setup replicated SQL Server databases with ntext fields and things were going fine initially. One day you get this error in the Event Log:

Server: Msg 7139, Level 16, State 1, Line 1
Length of text, ntext, or image data ([some number larger than 65536]) to be replicated exceeds configured maximum 65536.
The [...]]]></description>
			<content:encoded><![CDATA[<p><b>Scenario</b> &#8211; You have successfully setup replicated SQL Server databases with ntext fields and things were going fine initially. One day you get this error in the Event Log:</p>
<div style="background-color: #dfdfdf; padding: 1px 16px 1px 16px;">
<p style="font-family: Courier;font-size: 10pt;">Server: Msg 7139, Level 16, State 1, Line 1<br />
Length of text, ntext, or image data ([some number larger than 65536]) to be replicated exceeds configured maximum 65536.<br />
The statement has been terminated.</p>
</div>
<p>This is happeming because <b>Max Text Replication Size</b> by default is set to 65536 and SQL Server has attempted to replicate a row where the data in a column is greater than this size. From the SQL Server Management Studio you can view and change this setting under Server Properties | Advanced dialog.
</p>
<p><img src="http://www.point41.com/wp-content/uploads/2009/08/MaxTextReplSize.gif" alt="max text repl size" /></p>
<p>Increase this number to a higher value &#8211; up to <b>2147483647</b>. Make this change on all SQL Servers involved in the replication. If you don&#8217;t like UI stuff, you can also make this change via a SQL Query.</p>
<div style="background-color: #dfdfdf; padding: 1px 16px 1px 16px;font-family: Courier;font-size: 10pt;">
<p>
EXEC sp_configure &#8216;max text repl size&#8217;, 2147483647<br />
GO</p>
<p>RECONFIGURE<br />
GO </p>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.point41.com/index.php/2009/08/09/replicating-large-text-ntext-fields-in-sql-server-2005-2008/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Disabling SSL 2.0 on IIS 6</title>
		<link>http://www.point41.com/index.php/2009/08/07/disabling-ssl-2-0-on-iis-6/</link>
		<comments>http://www.point41.com/index.php/2009/08/07/disabling-ssl-2-0-on-iis-6/#comments</comments>
		<pubDate>Fri, 07 Aug 2009 22:25:03 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Security]]></category>

		<guid isPermaLink="false">http://www.point41.com/?p=18</guid>
		<description><![CDATA[If you run a secure site on IIS 6, note that the legacy SSL 2.0 protocol is enabled by default. SSL 2.0 has been superseded by SSL 3.0 and you&#8217;d want to disable it for the following reasons.
The Downgrade Attack: SSL v2 has no notion of integrity checking for handshake packets. Thus, an attacker could [...]]]></description>
			<content:encoded><![CDATA[<p>If you run a secure site on IIS 6, note that the legacy SSL 2.0 protocol is enabled by default. SSL 2.0 has been superseded by SSL 3.0 and you&#8217;d want to disable it for the following reasons.</p>
<p><b>The Downgrade Attack</b>: SSL v2 has no notion of integrity checking for handshake packets. Thus, an attacker could change the algorithms and key lengths chosen by the client while the appropriate handshake message was on the wire. This can result in a weak SSL connection being setup between the client and the server even though this is not what the two intended. Armed with this weak connection, the attacker could log all the traffic going by during the data exchange and could then use a brute force application to attack the weak encryption.</p>
<p><b>The Truncation Attack</b>: SSL v2 does not allow the parties involved to distinguish when the connection is ended by one of them or by a malicious third party. Thus an attacker can freely interrupt secure client-server connections. If the attacker additionally understands the application, the semantics and ordering of messages being exchanged, then he/she can potentially alter the meaning of a message by interrupting the connection at precisely the correct instant.</p>
<p><b>Instructions for disabling SSL 2.0</b></p>
<ul style="text-align: left">
<li>Open the registry editor and navigate to the following key:
<p>HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\ SecurityProviders\SCHANNEL\Protocols\SSL 2.0</li>
<li>Under the Client key set <strong>Enabled</strong> DWORD value to 0&#215;0</li>
<li>Under the Server key set <strong>Enabled</strong> DWORD value to 0&#215;0</li>
</ul>
<p><img src="http://www.point41.com/wp-content/uploads/2009/08/disable_ssl2.gif" /><br />
</p>
<p>If you hire someone to run a penetration test on your server/web site, this is one of the things they look out for. Eliminating it right from the start would prevent this blemish on your pen test report.</p>
<p>
<b>References</b><br />
<a href="http://support.microsoft.com/?kbid=245030">http://support.microsoft.com/?kbid=245030</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.point41.com/index.php/2009/08/07/disabling-ssl-2-0-on-iis-6/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Windows Server 2003 Automatic Logon On Startup</title>
		<link>http://www.point41.com/index.php/2009/08/06/windows-server-2003-automatic-logon-on-startup/</link>
		<comments>http://www.point41.com/index.php/2009/08/06/windows-server-2003-automatic-logon-on-startup/#comments</comments>
		<pubDate>Fri, 07 Aug 2009 00:24:09 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Other]]></category>

		<guid isPermaLink="false">http://www.point41.com/?p=3</guid>
		<description><![CDATA[After system startup, there is sometimes a need to have Windows Server login automatically as a particular user. The following changes to the registry accomplishes this.


Using RegEdit, open the following key: 
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon
Set the account name in the DefaultUserName entry. If DefaultUserName does not exist, create a new entry as a string value (REG_SZ).
Set the [...]]]></description>
			<content:encoded><![CDATA[<p>After system startup, there is sometimes a need to have Windows Server login automatically as a particular user. The following changes to the registry accomplishes this.
</p>
<ul style="text-align: left">
<li>Using RegEdit, open the following key: <br />
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon</li>
<li>Set the account name in the <strong>DefaultUserName</strong> entry. If <strong>DefaultUserName</strong> does not exist, create a new entry as a string value (REG_SZ).</li>
<li>Set the password in the <strong>DefaultPassword</strong> entry. If <strong>DefaultPassword</strong> does not exist, create a new entry as a string value (REG_SZ).</li>
<li>Set the <strong>AutoAdminLogon</strong> entry to <strong>1</strong>. If <strong>AutoAdminLogon</strong> does not exist, create a new entry as a string value (REG_SZ).</li>
</ul>
<div style="text-align: center">
<br />
<i>Click on the picture for larger image.</i><br />
<a href="/wp-content/uploads/2009/08/autostart.gif" target="_blank"><img src="/wp-content/uploads/2009/08/autostart.gif" style="width:450px" /></a>
</div>
<p>The next time the computer restarts it will automatically login as the specified user.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.point41.com/index.php/2009/08/06/windows-server-2003-automatic-logon-on-startup/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
