<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Mostly SQL Things</title>
	<atom:link href="http://paulwinans.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://paulwinans.wordpress.com</link>
	<description>I want a place to hold good sql things for future reference.</description>
	<lastBuildDate>Tue, 07 Jul 2009 23:47:15 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='paulwinans.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>Mostly SQL Things</title>
		<link>http://paulwinans.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://paulwinans.wordpress.com/osd.xml" title="Mostly SQL Things" />
	<atom:link rel='hub' href='http://paulwinans.wordpress.com/?pushpress=hub'/>
		<item>
		<title>Changing The Port Used By SQL Server</title>
		<link>http://paulwinans.wordpress.com/2009/07/07/changing-the-port-used-by-sql-server/</link>
		<comments>http://paulwinans.wordpress.com/2009/07/07/changing-the-port-used-by-sql-server/#comments</comments>
		<pubDate>Tue, 07 Jul 2009 23:45:25 +0000</pubDate>
		<dc:creator>paulwinans</dc:creator>
				<category><![CDATA[DBA]]></category>

		<guid isPermaLink="false">http://paulwinans.wordpress.com/?p=82</guid>
		<description><![CDATA[We need to change the port sql server uses from the default to&#8230; something else. Towards that end I want to make aliases on all the end user computers and other sql servers so they can still connect without problems. Thank you to microsoft&#8217;s scripting guy and this article. First I made a file with [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=paulwinans.wordpress.com&amp;blog=7901670&amp;post=82&amp;subd=paulwinans&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>We need to change the port sql server uses from the default to&#8230; something else. Towards that end I want to make aliases on all the end user computers and other sql servers so they can still connect without problems.</p>
<p>Thank you to <a href="http://technet.microsoft.com/en-us/scriptcenter/default.aspx">microsoft&#8217;s scripting guy</a> and <a href="http://www.databasejournal.com/features/mssql/article.php/3709441/Microsoft-Windows-PowerShell-and-SQL-Server-2005-WMI-Providers--Part-1.htm">this article</a>.</p>
<p>First I made a file with all the computers in the domain. Save this as getadcomputers.ps1 and then run it within powershell like this: .\getadcomputers.ps1 &gt; .\computer.txt</p>
<p># run as the following to save all the AD registered computers<br />
# .\getadcomputers.ps1 &gt; .\computer.txt</p>
<p>$strCategory = &#8220;computer&#8221;</p>
<p>$objDomain = New-Object System.DirectoryServices.DirectoryEntry</p>
<p>$objSearcher = New-Object System.DirectoryServices.DirectorySearcher<br />
$objSearcher.SearchRoot = $objDomain<br />
$objSearcher.Filter = (&#8220;(objectCategory=$strCategory)&#8221;)</p>
<p>$colProplist = &#8220;name&#8221;<br />
foreach ($i in $colPropList){$objSearcher.PropertiesToLoad.Add($i)}</p>
<p>$colResults = $objSearcher.FindAll()</p>
<p>foreach ($objResult in $colResults)<br />
    {$objComputer = $objResult.Properties; $objComputer.name}</p>
<p>Then I added that to a friendly Access table, decided what computers to exclude, and made a routine to loop through and create the aliases.</p>
<p>Sub AddRegKey()</p>
<p>  &#8216; Loops through the table sfhpComputers and<br />
  &#8216;   1. checks if the keypath &amp; value exists<br />
  &#8216;   2. if yes then logs a message and continues<br />
  &#8216;   3. if not then adds the key and checks the add worked and logs a message</p>
<p>  Dim strKeyRoot, strKeyPath, strValueName, strData, strValue, strType<br />
  Const HKEY_LOCAL_MACHINE = &amp;H80000002<br />
  strKeyRoot = &#8220;HKEY_LOCAL_MACHINE&#8221;<br />
  strKeyPath = &#8220;SOFTWARE\Microsoft\MSSQLServer\Client\ConnectTo&#8221;<br />
  strValueName = &#8220;newAliasName&#8221;<br />
  strData = &#8220;DBMSSOCN,fullSQLServerName,NewPortNumber&#8221;<br />
  strType = &#8220;REG_SZ&#8221;<br />
  Dim rs As DAO.Recordset</p>
<p>  Set rs = CurrentDb.OpenRecordset(&#8220;select name, Note1, Note2 from Computers&#8221;)</p>
<p>  With rs<br />
    Do While Not .BOF And Not .EOF<br />
      strComputer = !Name</p>
<p>      &#8216; Check if the key exists<br />
      Set objregistry = GetObject(&#8220;winmgmts:\\&#8221; &amp; _<br />
          strComputer &amp; &#8220;\root\default:StdRegProv&#8221;)<br />
      objregistry.GetStringValue HKEY_LOCAL_MACHINE, strKeyPath, strValueName, strValue</p>
<p>      If Not IsNull(strValue) Then<br />
        .Edit<br />
        !Note1 = &#8220;The registry key &#8221; &amp; strValueName &amp; &#8221; &#8211; &#8221; &amp; strData &amp; &#8221; already exists.&#8221;<br />
        !Note2 = Null<br />
        .Update<br />
        GoTo nextComputer<br />
      End If<br />
      &#8216; End check if the key exists</p>
<p>      &#8216; Begin code to add registry key<br />
      shellcmd = &#8220;reg.exe add \\&#8221; &amp; strComputer &amp; &#8220;\&#8221; &amp; strKeyRoot &amp; &#8220;\&#8221; &amp; strKeyPath &amp; &#8221; /v &#8221; &amp; strValueName &amp; _<br />
        &#8221; /t &#8221; &amp; strType &amp; &#8221; /d &#8221; &amp; strData</p>
<p>      output = Shell(shellcmd)<br />
      &#8216; End code to add registry key</p>
<p>      &#8216; Now check the key was added<br />
      Set objregistry = GetObject(&#8220;winmgmts:\\&#8221; &amp; _<br />
          strComputer &amp; &#8220;\root\default:StdRegProv&#8221;)</p>
<p>      .Edit</p>
<p>      If Err = 462 Then<br />
        !Note1 = &#8220;Computer &#8221; &amp; strComputer &amp; &#8221; does not exist.&#8221;<br />
        !Note2 = output<br />
        GoTo nextComputer<br />
      End If</p>
<p>      objregistry.GetStringValue HKEY_LOCAL_MACHINE, strKeyPath, strValueName, strValue</p>
<p>      If IsNull(strValue) Then<br />
        !Note1 = &#8220;ERROR: The registry key &#8221; &amp; strValueName &amp; &#8221; &#8211; &#8221; &amp; strData &amp; &#8221; not added successfully.&#8221;<br />
        !Note2 = output<br />
      Else<br />
        !Note1 = &#8220;The registry key &#8221; &amp; strValueName &amp; &#8221; &#8211; &#8221; &amp; strValue &amp; &#8221; added successfully.&#8221;<br />
        !Note2 = output<br />
      End If</p>
<p>      .Update</p>
<p>nextComputer:<br />
      .MoveNext<br />
    Loop<br />
  End With<br />
End Sub</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/paulwinans.wordpress.com/82/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/paulwinans.wordpress.com/82/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/paulwinans.wordpress.com/82/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/paulwinans.wordpress.com/82/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/paulwinans.wordpress.com/82/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/paulwinans.wordpress.com/82/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/paulwinans.wordpress.com/82/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/paulwinans.wordpress.com/82/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/paulwinans.wordpress.com/82/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/paulwinans.wordpress.com/82/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/paulwinans.wordpress.com/82/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/paulwinans.wordpress.com/82/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/paulwinans.wordpress.com/82/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/paulwinans.wordpress.com/82/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=paulwinans.wordpress.com&amp;blog=7901670&amp;post=82&amp;subd=paulwinans&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://paulwinans.wordpress.com/2009/07/07/changing-the-port-used-by-sql-server/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/04ab7881a385155654629d3b7d3d239a?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">paulwinans</media:title>
		</media:content>
	</item>
		<item>
		<title>database mail problem</title>
		<link>http://paulwinans.wordpress.com/2009/07/07/database-mail-problem/</link>
		<comments>http://paulwinans.wordpress.com/2009/07/07/database-mail-problem/#comments</comments>
		<pubDate>Tue, 07 Jul 2009 23:35:04 +0000</pubDate>
		<dc:creator>paulwinans</dc:creator>
				<category><![CDATA[DBA]]></category>

		<guid isPermaLink="false">http://paulwinans.wordpress.com/?p=79</guid>
		<description><![CDATA[What to do if database mail is not working. Mail was not being sent. First I queried SELECT * FROM msdb.dbo.sysmail_event_log and saw in the description field &#8220;The mail could not be sent to the recipients because of the mail server failure. (Sending Mail using Account 1 (2009-03-31T12:24:10). Exception Message: Could not connect to mail [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=paulwinans.wordpress.com&amp;blog=7901670&amp;post=79&amp;subd=paulwinans&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>What to do if database mail is not working.</p>
<p>Mail was not being sent. First I queried </p>
<p>SELECT * FROM msdb.dbo.sysmail_event_log</p>
<p>and saw in the description field </p>
<p>&#8220;The mail could not be sent to the recipients because of the mail server failure. (Sending Mail using Account 1 (2009-03-31T12:24:10). Exception Message: Could not connect to mail server. (A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond [ip address]:[port number]). )&#8221;</p>
<p>Running</p>
<p>EXEC msdb.dbo.sysmail_help_status_sp ;</p>
<p>returned &#8220;inactive&#8221;</p>
<p>Some websites suggested that the people trying to send mail need to be in the msdb role DatabaseMailUserRole, so I checked that</p>
<p>EXEC msdb.sys.sp_helprolemember &#8216;DatabaseMailUserRole&#8217; ;</p>
<p>but then I remembered I am a sysadmin and am not able to send mail.</p>
<p>Then I practically ran this </p>
<p>select name , is_broker_enabled from sys.databases</p>
<p>and this and then could send mail:</p>
<p>alter database msdb set single_user with rollback immediate<br />
alter database msdb set enable_broker<br />
alter database msdb set MULTI_USER </p>
<p>These procedures may be helpful too:</p>
<p>exec msdb..sysmail_help_principalprofile_sp<br />
EXEC msdb.dbo.sysmail_help_queue_sp @queue_type = &#8216;mail&#8217; ;<br />
exec msdb..sysmail_stop_sp<br />
exec msdb..sysmail_start_sp</p>
<p>Except the jobs still could not send mail. For some reason sql server agent did not have database mail set up. After pointing and clicking to get that together I thought I was done, except now I got this error:</p>
<p>The mail could not be sent to the recipients because of the mail server failure. (Sending Mail using Account 1 (2009-07-06T14:10:00). Exception Message: Cannot send mails to mail server. (The specified string is not in the form required for an e-mail address.). )</p>
<p>This error was because the operators were defined with mapi names and not full email addresses.</p>
<p>Whew done!</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/paulwinans.wordpress.com/79/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/paulwinans.wordpress.com/79/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/paulwinans.wordpress.com/79/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/paulwinans.wordpress.com/79/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/paulwinans.wordpress.com/79/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/paulwinans.wordpress.com/79/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/paulwinans.wordpress.com/79/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/paulwinans.wordpress.com/79/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/paulwinans.wordpress.com/79/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/paulwinans.wordpress.com/79/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/paulwinans.wordpress.com/79/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/paulwinans.wordpress.com/79/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/paulwinans.wordpress.com/79/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/paulwinans.wordpress.com/79/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=paulwinans.wordpress.com&amp;blog=7901670&amp;post=79&amp;subd=paulwinans&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://paulwinans.wordpress.com/2009/07/07/database-mail-problem/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/04ab7881a385155654629d3b7d3d239a?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">paulwinans</media:title>
		</media:content>
	</item>
		<item>
		<title>sql traces</title>
		<link>http://paulwinans.wordpress.com/2009/06/30/sql-traces/</link>
		<comments>http://paulwinans.wordpress.com/2009/06/30/sql-traces/#comments</comments>
		<pubDate>Tue, 30 Jun 2009 18:38:54 +0000</pubDate>
		<dc:creator>paulwinans</dc:creator>
				<category><![CDATA[DBA]]></category>

		<guid isPermaLink="false">http://paulwinans.wordpress.com/?p=69</guid>
		<description><![CDATA[I was asked to trace department&#8217;s access to a certain sql server here. To create a trace that is run by sql server, open profiler and define your trace. Then, while it is not running, you can script it by going to the File-Script Trace menu and save the sql. Either make a stored procedure [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=paulwinans.wordpress.com&amp;blog=7901670&amp;post=69&amp;subd=paulwinans&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I was asked to trace department&#8217;s access to a certain sql server here.</p>
<p>To create a trace that is run by sql server, open profiler and define your trace. Then, while it is not running, you can script it by going to the File-Script Trace menu and save the sql. </p>
<p>Either make a stored procedure which contains the sql or just paste in into a job step. Have your job run when sql server agent starts or set your procedure as a startup procedure with sp_procoption. </p>
<p>Once the trace is running you can check on it with:<br />
SELECT * FROM ::fn_trace_getinfo ([the trace id])</p>
<p>Stop it with:<br />
exec msdb..sp_trace_setstatus [the trace id] , 0 &#8212; stop the trace<br />
exec msdb..sp_trace_setstatus [the trace id] , 2 &#8212; close and delete the trace defination</p>
<p>I also added the following so if there was an existing output file it would be renamed.<br />
exec master..xp_cmdshell &#8216;ren [path to your trace output] &#8220;%date:~10,4%%date:~4,2%%date:~7,2%_%time:~0,2%%time:~3,2%%time:~6,2%-[some common name]&#8220;&#8216;</p>
<p>Also, I increased sp_trace_create&#8217;s parameters @options to rollover to a new file and @maxfilesize to a much larger file size just in case.</p>
<p>Later I will import the results into sql server and total the cpu, duration, and reads and writes by workstation.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/paulwinans.wordpress.com/69/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/paulwinans.wordpress.com/69/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/paulwinans.wordpress.com/69/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/paulwinans.wordpress.com/69/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/paulwinans.wordpress.com/69/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/paulwinans.wordpress.com/69/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/paulwinans.wordpress.com/69/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/paulwinans.wordpress.com/69/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/paulwinans.wordpress.com/69/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/paulwinans.wordpress.com/69/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/paulwinans.wordpress.com/69/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/paulwinans.wordpress.com/69/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/paulwinans.wordpress.com/69/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/paulwinans.wordpress.com/69/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=paulwinans.wordpress.com&amp;blog=7901670&amp;post=69&amp;subd=paulwinans&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://paulwinans.wordpress.com/2009/06/30/sql-traces/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/04ab7881a385155654629d3b7d3d239a?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">paulwinans</media:title>
		</media:content>
	</item>
		<item>
		<title>Using SQL DMO to read DTS Packages</title>
		<link>http://paulwinans.wordpress.com/2009/06/26/using-sql-dmo-to-read-dts-packages/</link>
		<comments>http://paulwinans.wordpress.com/2009/06/26/using-sql-dmo-to-read-dts-packages/#comments</comments>
		<pubDate>Fri, 26 Jun 2009 18:26:31 +0000</pubDate>
		<dc:creator>paulwinans</dc:creator>
				<category><![CDATA[SQL DMO]]></category>

		<guid isPermaLink="false">http://paulwinans.wordpress.com/?p=65</guid>
		<description><![CDATA[There is a column name and defination change and lots of code has to be examined. The developers were worried about looking through the many DTS packages. Happily the contents can be queried using sql-dmo. The short of it is looping through all the DTS packages, one at a time setting a reference to is [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=paulwinans.wordpress.com&amp;blog=7901670&amp;post=65&amp;subd=paulwinans&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>There is a column name and defination change and lots of code has to be examined. The developers were worried about looking through the many DTS packages. Happily the contents can be queried using sql-dmo. </p>
<p>The short of it is looping through all the DTS packages, one at a time setting a reference to is with the DTS.Package2 object, and then looping through the tasks and the task&#8217;s properties. </p>
<p>I made a table to insert each package&#8217;s, task&#8217;s, and property&#8217;s values, including the server too and then was able to query for the column in questio. Woo-hoo!</p>
<p>This came in handy for looking for code within view, procedures, etc:<br />
exec sp_msforeachdb &#8216;use [?] ; select distinct db_name(), name from sysobjects so join syscomments sc on so.id = sc.id where sc.text like &#8221;%&lt;&gt;%&#8221;&#8217;</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/paulwinans.wordpress.com/65/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/paulwinans.wordpress.com/65/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/paulwinans.wordpress.com/65/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/paulwinans.wordpress.com/65/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/paulwinans.wordpress.com/65/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/paulwinans.wordpress.com/65/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/paulwinans.wordpress.com/65/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/paulwinans.wordpress.com/65/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/paulwinans.wordpress.com/65/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/paulwinans.wordpress.com/65/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/paulwinans.wordpress.com/65/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/paulwinans.wordpress.com/65/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/paulwinans.wordpress.com/65/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/paulwinans.wordpress.com/65/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=paulwinans.wordpress.com&amp;blog=7901670&amp;post=65&amp;subd=paulwinans&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://paulwinans.wordpress.com/2009/06/26/using-sql-dmo-to-read-dts-packages/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/04ab7881a385155654629d3b7d3d239a?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">paulwinans</media:title>
		</media:content>
	</item>
		<item>
		<title>Finding a job</title>
		<link>http://paulwinans.wordpress.com/2009/06/17/finding-a-job/</link>
		<comments>http://paulwinans.wordpress.com/2009/06/17/finding-a-job/#comments</comments>
		<pubDate>Wed, 17 Jun 2009 18:37:58 +0000</pubDate>
		<dc:creator>paulwinans</dc:creator>
				<category><![CDATA[DBA]]></category>
		<category><![CDATA[Employment]]></category>

		<guid isPermaLink="false">http://paulwinans.wordpress.com/?p=53</guid>
		<description><![CDATA[One of my friends asked me how I found a job so fast after such a long vacation. Here is what I wrote to her: Does your resume shout out that you meet the job poster&#8217;s qualifications requirements? Here is my resume; do a search for &#8221;sql server dba&#8221; at dice.com or some other site and see how [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=paulwinans.wordpress.com&amp;blog=7901670&amp;post=53&amp;subd=paulwinans&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>One of my friends asked me how I found a job so fast after such a long vacation. Here is what I wrote to her:</p>
<ul>
<li>Does your resume shout out that you meet the job poster&#8217;s qualifications requirements? <br /><a href="http://paulwinans.files.wordpress.com/2009/06/resume1.doc">Here is my resume</a>; do a search for &#8221;sql server dba&#8221; at dice.com or some other site and see how I basically show how I&#8217;ve done what they&#8217;re asking for. Of course I am not a 100% match for every post&#8230;. but you get the picture.</li>
<li>Are you doing the &#8220;linked in&#8221; thing and looking there too? <br /><a href="http://blog.guykawasaki.com/2007/01/ten_ways_to_use.html">Read this</a> for some ideas.</li>
<li>Are you really taking honest time every day to do EVERYTHING you can to get a job? This is a serious question that you have to answer by taking some time and being sincere with yourself. <br />For example, here is one thing you can do: volunteer at a place where you&#8217;d like to work for a day or two a week. Or offering to work for cheap for a week so they can see how much they need you if the interview doesn&#8217;t go well.</li>
<li>Do a search on &#8220;interview questions&#8221; and be an expert at interviewing. This REALLY REALLY helped me when I got a call back (I also searched for interview questions for my field and studied hard; people dig small facts).</li>
</ul>
<p>Good luck to everyone with their search.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/paulwinans.wordpress.com/53/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/paulwinans.wordpress.com/53/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/paulwinans.wordpress.com/53/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/paulwinans.wordpress.com/53/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/paulwinans.wordpress.com/53/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/paulwinans.wordpress.com/53/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/paulwinans.wordpress.com/53/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/paulwinans.wordpress.com/53/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/paulwinans.wordpress.com/53/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/paulwinans.wordpress.com/53/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/paulwinans.wordpress.com/53/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/paulwinans.wordpress.com/53/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/paulwinans.wordpress.com/53/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/paulwinans.wordpress.com/53/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=paulwinans.wordpress.com&amp;blog=7901670&amp;post=53&amp;subd=paulwinans&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://paulwinans.wordpress.com/2009/06/17/finding-a-job/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/04ab7881a385155654629d3b7d3d239a?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">paulwinans</media:title>
		</media:content>
	</item>
		<item>
		<title>using sp_msforeachdb</title>
		<link>http://paulwinans.wordpress.com/2009/06/11/using-sp_msforeachdb/</link>
		<comments>http://paulwinans.wordpress.com/2009/06/11/using-sp_msforeachdb/#comments</comments>
		<pubDate>Thu, 11 Jun 2009 16:53:23 +0000</pubDate>
		<dc:creator>paulwinans</dc:creator>
				<category><![CDATA[Day to day]]></category>
		<category><![CDATA[DBA]]></category>

		<guid isPermaLink="false">http://paulwinans.wordpress.com/?p=45</guid>
		<description><![CDATA[I really like sp_msforeachdb. For example, here is the sql to my regular maintenance jobs: exec sp_MSforeachdb &#8216;DBCC CHECKDB(?) with NO_INFOMSGS, ALL_ERRORMSGS&#8217; exec sp_msforeachdb &#8216;if db_id(&#8221;?&#8221;) &#60;&#62; db_id(&#8221;master&#8221;) and db_id(&#8221;?&#8221;) &#60;&#62; db_id(&#8221;tempdb&#8221;) begin use [?];exec sp_dbreindex_or_indexdefrag;end&#8217; exec sp_msforeachdb &#8216;if db_id(&#8221;?&#8221;) &#60;&#62; db_id(&#8221;master&#8221;) and db_id(&#8221;?&#8221;) &#60;&#62; db_id(&#8221;tempdb&#8221;) begin use [?];exec sp_updatestats;end&#8217; Yesterday I was reducing the [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=paulwinans.wordpress.com&amp;blog=7901670&amp;post=45&amp;subd=paulwinans&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I really like sp_msforeachdb. For example, here is the sql to my regular maintenance jobs:</p>
<ul>
<li><span style="color:#993300;">exec sp_MSforeachdb</span> <span style="color:#ff0000;">&#8216;DBCC CHECKDB(?) with NO_INFOMSGS, ALL_ERRORMSGS&#8217;</span></li>
<li><span style="color:#993300;">exec sp_msforeachdb</span> <span style="color:#ff0000;">&#8216;if db_id(&#8221;?&#8221;) &lt;&gt; db_id(&#8221;master&#8221;) and db_id(&#8221;?&#8221;) &lt;&gt; db_id(&#8221;tempdb&#8221;) begin use [?];exec sp_dbreindex_or_indexdefrag;end&#8217;</span></li>
<li><span style="color:#993300;">exec sp_msforeachdb</span> <span style="color:#ff0000;">&#8216;if db_id(&#8221;?&#8221;) &lt;&gt; db_id(&#8221;master&#8221;) and db_id(&#8221;?&#8221;) &lt;&gt; db_id(&#8221;tempdb&#8221;) begin use [?];exec sp_updatestats;end&#8217;</span></li>
</ul>
<p>Yesterday I was reducing the number of vlfs and to check I&#8217;d covered all databases I ran:</p>
<ul>
<li><span style="color:#993300;">sp_msforeachdb</span> <span style="color:#ff0000;">&#8216;use ?;select db_name();dbcc loginfo&#8217;</span></li>
</ul>
<p>See what I mean?</p>
<p>The only hitch is if your database name has a reserved character &#8211; here there are some with a dash &#8211; you&#8217;ll need to do [?] instead of just ?.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/paulwinans.wordpress.com/45/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/paulwinans.wordpress.com/45/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/paulwinans.wordpress.com/45/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/paulwinans.wordpress.com/45/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/paulwinans.wordpress.com/45/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/paulwinans.wordpress.com/45/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/paulwinans.wordpress.com/45/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/paulwinans.wordpress.com/45/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/paulwinans.wordpress.com/45/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/paulwinans.wordpress.com/45/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/paulwinans.wordpress.com/45/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/paulwinans.wordpress.com/45/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/paulwinans.wordpress.com/45/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/paulwinans.wordpress.com/45/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=paulwinans.wordpress.com&amp;blog=7901670&amp;post=45&amp;subd=paulwinans&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://paulwinans.wordpress.com/2009/06/11/using-sp_msforeachdb/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/04ab7881a385155654629d3b7d3d239a?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">paulwinans</media:title>
		</media:content>
	</item>
		<item>
		<title>Removing a startup stored procedure</title>
		<link>http://paulwinans.wordpress.com/2009/05/30/removing-a-startup-stored-procedure/</link>
		<comments>http://paulwinans.wordpress.com/2009/05/30/removing-a-startup-stored-procedure/#comments</comments>
		<pubDate>Sat, 30 May 2009 00:15:17 +0000</pubDate>
		<dc:creator>paulwinans</dc:creator>
				<category><![CDATA[DBA]]></category>

		<guid isPermaLink="false">http://paulwinans.wordpress.com/?p=29</guid>
		<description><![CDATA[In my combing through of the sql servers I found a startup stored procedure on one of the sql servers here. I didn&#8217;t recognize the tables it created or its name, so I asked around: no one else knew anything either. How to gracefully deal with this? Simply remove its startup property creates a timebomb. I decided to [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=paulwinans.wordpress.com&amp;blog=7901670&amp;post=29&amp;subd=paulwinans&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>In my combing through of the sql servers I found a startup stored procedure on one of the sql servers here. I didn&#8217;t recognize the tables it created or its name, so I asked around: no one else knew anything either. How to gracefully deal with this? Simply remove its startup property creates a timebomb. I decided to alert the production services manager, who gets all the issue emails, send what to do if there is a complaint and I am not available, and then drop what the procedure creates and hold my breath.</p>
<p>use tempdb<br />
go<br />
drop table &lt;&lt;table name&gt;&gt;<br />
drop table &lt;&lt;table name&gt;&gt;<br />
 <br />
&#8211; remove it as a startup procedure<br />
use master<br />
go<br />
exec sp_procoption @procname = &#8216;&lt;&lt;proc name&gt;&gt;&#8217;, @optionname = &#8216;startup&#8217;, @optionvalue = &#8216;false&#8217;<br />
go<br />
 <br />
&#8211; shows that there are no startup procedures<br />
select name from sysobjects where type = &#8216;p&#8217; and OBJECTPROPERTY(id, &#8216;ExecIsStartup&#8217;) = 1</p>
<p>&#8211; So, if people complain, then run <br />
exec master..&lt;&lt;proc name&gt;&gt;<br />
exec sp_procoption @procname = &#8216;&lt;&lt;proc name&gt;&gt;&#8217;, @optionname = &#8216;startup&#8217;, @optionvalue = &#8216;true&#8217;</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/paulwinans.wordpress.com/29/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/paulwinans.wordpress.com/29/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/paulwinans.wordpress.com/29/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/paulwinans.wordpress.com/29/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/paulwinans.wordpress.com/29/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/paulwinans.wordpress.com/29/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/paulwinans.wordpress.com/29/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/paulwinans.wordpress.com/29/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/paulwinans.wordpress.com/29/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/paulwinans.wordpress.com/29/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/paulwinans.wordpress.com/29/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/paulwinans.wordpress.com/29/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/paulwinans.wordpress.com/29/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/paulwinans.wordpress.com/29/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=paulwinans.wordpress.com&amp;blog=7901670&amp;post=29&amp;subd=paulwinans&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://paulwinans.wordpress.com/2009/05/30/removing-a-startup-stored-procedure/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/04ab7881a385155654629d3b7d3d239a?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">paulwinans</media:title>
		</media:content>
	</item>
		<item>
		<title>Cleaning up sql job ownership</title>
		<link>http://paulwinans.wordpress.com/2009/05/28/cleaning-up-sql-job-ownership/</link>
		<comments>http://paulwinans.wordpress.com/2009/05/28/cleaning-up-sql-job-ownership/#comments</comments>
		<pubDate>Thu, 28 May 2009 23:01:00 +0000</pubDate>
		<dc:creator>paulwinans</dc:creator>
				<category><![CDATA[Day to day]]></category>
		<category><![CDATA[DBA]]></category>
		<category><![CDATA[SQL Jobs]]></category>

		<guid isPermaLink="false">http://paulwinans.wordpress.com/?p=23</guid>
		<description><![CDATA[We have a lot of jobs owned by many different accounts due to the currently lax security. Before cleaning up the local admins group and removing all sysadmin role members it is important to make sure the jobs that are currently running with elevated privileges remain running with elevated privileges. Something like this site explains [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=paulwinans.wordpress.com&amp;blog=7901670&amp;post=23&amp;subd=paulwinans&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>We have a lot of jobs owned by many different accounts due to the currently lax security. Before cleaning up the local admins group and removing all sysadmin role members it is important to make sure the jobs that are currently running with elevated privileges remain running with elevated privileges. Something like <a href="http://weblogs.sqlteam.com/dmauri/articles/6914.aspx">this site</a> explains it well enough.</p>
<p>select sj.name , sl.name<br />
from msdb..sysjobs sj join master..syslogins sl on sj.owner_sid = sl.sid<br />
where sl.name &lt;&gt; &#8216;sa&#8217;</p>
<p>How to generate the sql to make those jobs be owned by sa:</p>
<p>select &#8216;exec sp_update_job @job_name = &#8221;&#8217; + sj.name + &#8221;&#8217; , @owner_login_name = &#8221;sa&#8221;&#8217;<br />
from msdb..sysjobs sj join master..syslogins sl on sj.owner_sid = sl.sid<br />
where sl.name &lt;&gt; &#8216;sa&#8217;</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/paulwinans.wordpress.com/23/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/paulwinans.wordpress.com/23/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/paulwinans.wordpress.com/23/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/paulwinans.wordpress.com/23/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/paulwinans.wordpress.com/23/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/paulwinans.wordpress.com/23/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/paulwinans.wordpress.com/23/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/paulwinans.wordpress.com/23/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/paulwinans.wordpress.com/23/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/paulwinans.wordpress.com/23/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/paulwinans.wordpress.com/23/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/paulwinans.wordpress.com/23/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/paulwinans.wordpress.com/23/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/paulwinans.wordpress.com/23/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=paulwinans.wordpress.com&amp;blog=7901670&amp;post=23&amp;subd=paulwinans&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://paulwinans.wordpress.com/2009/05/28/cleaning-up-sql-job-ownership/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/04ab7881a385155654629d3b7d3d239a?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">paulwinans</media:title>
		</media:content>
	</item>
		<item>
		<title>SQL Server 2000 sp4 and Memory</title>
		<link>http://paulwinans.wordpress.com/2009/05/28/sql-server-sp4-and-memory/</link>
		<comments>http://paulwinans.wordpress.com/2009/05/28/sql-server-sp4-and-memory/#comments</comments>
		<pubDate>Thu, 28 May 2009 16:34:58 +0000</pubDate>
		<dc:creator>paulwinans</dc:creator>
				<category><![CDATA[DBA]]></category>

		<guid isPermaLink="false">http://paulwinans.wordpress.com/?p=19</guid>
		<description><![CDATA[I configured 3 of the development sql servers to use the available memory last night. 2 had 8gb; 1 had 4. The one with 4 just required adding the /3GB and a restart; for the other two I modified the boot.ini, restarted the server, and then ran sp_configure to set the max memory and to enable awe. [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=paulwinans.wordpress.com&amp;blog=7901670&amp;post=19&amp;subd=paulwinans&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I configured 3 of the development sql servers to use the available memory last night. 2 had 8gb; 1 had 4. The one with 4 just required adding the /3GB and a restart; for the other two I modified the boot.ini, restarted the server, and then ran sp_configure to set the max memory and to enable awe. They only claimed 3gb of the available memory though.</p>
<p>After some searching I found <a href="http://support.microsoft.com/kb/899761">hotfix 899761</a> is needed for sql server 2000 sp4.  If the sql server version is 8.00.039 and it isn&#8217;t using all the available memory, apply the hotfix and get to 8.00.040. How long has sp4 been out and where have I been? A story for another time.</p>
<p>I&#8217;ve been referring to <a href="http://www.sql-server-performance.com/articles/per/awe_memory_sql2000_p1.aspx">this article</a> for years to find what combo of PAE and 3GB to use.</p>
<p>The first time I did this on Windows Server 2003 I remember crapping in my pants because I couldn&#8217;t figure out why sql server didn&#8217;t grab the memory like it did with Windows 2000.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/paulwinans.wordpress.com/19/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/paulwinans.wordpress.com/19/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/paulwinans.wordpress.com/19/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/paulwinans.wordpress.com/19/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/paulwinans.wordpress.com/19/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/paulwinans.wordpress.com/19/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/paulwinans.wordpress.com/19/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/paulwinans.wordpress.com/19/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/paulwinans.wordpress.com/19/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/paulwinans.wordpress.com/19/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/paulwinans.wordpress.com/19/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/paulwinans.wordpress.com/19/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/paulwinans.wordpress.com/19/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/paulwinans.wordpress.com/19/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=paulwinans.wordpress.com&amp;blog=7901670&amp;post=19&amp;subd=paulwinans&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://paulwinans.wordpress.com/2009/05/28/sql-server-sp4-and-memory/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/04ab7881a385155654629d3b7d3d239a?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">paulwinans</media:title>
		</media:content>
	</item>
		<item>
		<title>Local Policy Settings</title>
		<link>http://paulwinans.wordpress.com/2009/05/27/local-policy-settings/</link>
		<comments>http://paulwinans.wordpress.com/2009/05/27/local-policy-settings/#comments</comments>
		<pubDate>Wed, 27 May 2009 21:49:42 +0000</pubDate>
		<dc:creator>paulwinans</dc:creator>
				<category><![CDATA[DBA]]></category>

		<guid isPermaLink="false">http://paulwinans.wordpress.com/?p=16</guid>
		<description><![CDATA[I have a bunch of sql servers and don&#8217;t know whether the required local policies are in place to take advantage of the available memory. I first thought checking who could do what could be found via WMI but nothing surfaced. In my search I did find 2 new things: 1) the MS tool Scriptomatic [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=paulwinans.wordpress.com&amp;blog=7901670&amp;post=16&amp;subd=paulwinans&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I have a bunch of sql servers and don&#8217;t know whether the required local policies are in place to take advantage of the available memory. I first thought checking who could do what could be found via WMI but nothing surfaced. In my search I did find 2 new things: 1) the MS tool Scriptomatic 2.0 which will generate WMI scripts and 2) something called <a href="http://technet.microsoft.com/en-us/library/bb490997.aspx">secedit</a>. In the end I used ntrights.exe in a batch file as follows. As written it requires 2 parameters, the windows user requiring the permissions and server to apply the permissions.</p>
<p>@ECHO OFF<br />
IF &#8220;%1&#8243; == &#8220;&#8221; GOTO MISSINGINPUT<br />
IF &#8220;%2&#8243; == &#8220;&#8221; GOTO MISSINGINPUT<br />
@ECHO ON<br />
:: Act as part of the operating system<br />
ntrights -u %1 -m <a href="//\\%2">\\%2</a> +r SeTcbPrivilege <br />
:: Lock pages in memory            <br />
ntrights -u %1 -m <a href="//\\%2">\\%2</a> +r SeLockMemoryPrivilege<br />
:: Log on as a batch job           <br />
ntrights -u %1 -m <a href="//\\%2">\\%2</a> +r SeBatchLogonRight<br />
:: Logon as a service<br />
ntrights -u %1 -m <a href="//\\%2">\\%2</a> +r SeServiceLogonRight<br />
:: Replace a process-level token   <br />
ntrights -u %1 -m <a href="//\\%2">\\%2</a> +r SeAssignPrimaryTokenPrivilege<br />
pause<br />
exit</p>
<p>:MISSINGINPUT<br />
@ECHO OFF<br />
ECHO You must specify the windows user to apply these permissions<br />
ECHO You must specify the server on which to apply these permissions<br />
pause<br />
exit</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/paulwinans.wordpress.com/16/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/paulwinans.wordpress.com/16/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/paulwinans.wordpress.com/16/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/paulwinans.wordpress.com/16/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/paulwinans.wordpress.com/16/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/paulwinans.wordpress.com/16/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/paulwinans.wordpress.com/16/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/paulwinans.wordpress.com/16/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/paulwinans.wordpress.com/16/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/paulwinans.wordpress.com/16/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/paulwinans.wordpress.com/16/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/paulwinans.wordpress.com/16/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/paulwinans.wordpress.com/16/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/paulwinans.wordpress.com/16/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=paulwinans.wordpress.com&amp;blog=7901670&amp;post=16&amp;subd=paulwinans&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://paulwinans.wordpress.com/2009/05/27/local-policy-settings/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/04ab7881a385155654629d3b7d3d239a?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">paulwinans</media:title>
		</media:content>
	</item>
	</channel>
</rss>
