<?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>JasonSamuel.com &#187; SQL Express</title>
	<atom:link href="http://www.jasonsamuel.com/category/sql-express/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.jasonsamuel.com</link>
	<description>Cool stuff I see in the IT world</description>
	<lastBuildDate>Wed, 25 Jan 2012 21:05:04 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=</generator>
		<item>
		<title>Getting admin access on a SQL Server when you don&#8217;t know the SA account password</title>
		<link>http://www.jasonsamuel.com/2011/08/09/getting-admin-access-on-a-sql-server-when-you-dont-know-the-sa-account-password/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=getting-admin-access-on-a-sql-server-when-you-dont-know-the-sa-account-password</link>
		<comments>http://www.jasonsamuel.com/2011/08/09/getting-admin-access-on-a-sql-server-when-you-dont-know-the-sa-account-password/#comments</comments>
		<pubDate>Tue, 09 Aug 2011 14:23:55 +0000</pubDate>
		<dc:creator>Jason Samuel</dc:creator>
				<category><![CDATA[SQL Express]]></category>
		<category><![CDATA[SQL Server 2005]]></category>
		<category><![CDATA[SQL Server 2008]]></category>
		<category><![CDATA[reset sa account]]></category>
		<category><![CDATA[reset sa password]]></category>
		<category><![CDATA[SQL]]></category>

		<guid isPermaLink="false">http://www.jasonsamuel.com/?p=1114</guid>
		<description><![CDATA[I was on an inherited SQL box this morning and didn&#8217;t know the SA account credentials. There was another admin service account but I didn&#8217;t have credentials for that either and unfortunately I wasn&#8217;t given any documentation on it. At first I was thinking through ways to go about resetting the SA account but then [...]<p><a href="http://www.jasonsamuel.com/2011/08/09/getting-admin-access-on-a-sql-server-when-you-dont-know-the-sa-account-password/">Getting admin access on a SQL Server when you don&#8217;t know the SA account password</a> is a post from: <a href="http://www.jasonsamuel.com">JasonSamuel.com</a></p>

More of my posts you might like:<ol>
<li><a href='http://www.jasonsamuel.com/2009/11/04/how-to-move-sql-error-logs-errorlog-to-a-different-drive/' rel='bookmark' title='How to move SQL error logs (ERRORLOG) to a different drive'>How to move SQL error logs (ERRORLOG) to a different drive</a></li>
<li><a href='http://www.jasonsamuel.com/2010/04/28/how-to-get-the-iusr-and-iwam-user-account-passwords-on-an-iis-server/' rel='bookmark' title='How to get the IUSR and IWAM user account passwords on an IIS server'>How to get the IUSR and IWAM user account passwords on an IIS server</a></li>
<li><a href='http://www.jasonsamuel.com/2010/01/12/using-log-parser-to-query-huge-log-files-and-only-display-the-results-you-need/' rel='bookmark' title='Using Log Parser to query huge log files and only display the results you need'>Using Log Parser to query huge log files and only display the results you need</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>I was on an inherited SQL box this morning and didn&#8217;t know the SA account credentials.  There was another admin service account but I didn&#8217;t have credentials for that either and unfortunately I wasn&#8217;t given any documentation on it.  At first I was thinking through ways to go about resetting the SA account but then I remembered a trick to use your Windows local administrator credentials to override the SQL login and create an admin account for yourself.  This ensures you don&#8217;t break anything by resetting an existing account.  As long as you are logged into the server as a local administrator, this will work in a pinch.</p>
<p>1. Go to:</p>
<p><code>Start &gt; Programs &gt; Microsoft SQL Server 2005 &gt; Configuration Tools &gt; SQL Server Configuration Manager</code></p>
<p>2. Right click on the SQL server you want to add an account for and click Stop.</p>
<p>3.  Once it has stopped, right click on it and open Properties.  Go to the Advanced tab.</p>
<p>4. Under &#8220;Startup Parameters&#8221;, copy and paste that whole string to Notepad as a backup.  Go back to the box and add the following right at the end of the string:</p>
<p><code>;–m</code></p>
<p>It should look like this:</p>
<p><a href="http://www.jasonsamuel.com/2011/08/09/getting-admin-access-on-a-sql-server-when-you-dont-know-the-sa-account-password/sql-server-reset-sa-password/" rel="attachment wp-att-1124"><img src="http://www.jasonsamuel.com/wp-content/uploads/2011/08/sql-server-reset-sa-password.jpg" alt="" title="sql-server-reset-sa-password" width="395" height="435" class="aligncenter size-full wp-image-1124" /></a></p>
<p>Press OK when done.  What this does is forces SQL to start in single user mode.</p>
<p>5. Now right click the SQL server you had stopped before and start it.  </p>
<p>6.  Now if you go to SQL Management Studio, it will error out.  The only way to get into it is using sqlcmd.  So open a command prompt and type:</p>
<p><code>sqlcmd</code></p>
<p>which should give you a &#8220;1>&#8221; prompt denoting line 1.  If it gives you an error saying &#8220;Login failed for user &#8216;xxxxx&#8217;. Reason: Server is in single user mode. Only one administrator can connect at this time. (Microsoft SQL Server, Error: 18461&#8243;, make sure all management consoles are closed and there are no other users logged in using it.  Also go to your Windows services and stop all the following services:</p>
<p><pre><code>SQL Server Agent
SQL Server FullText Search
SQL Server Integration Services
SQL Server Reporting Services
SQL Server VSS Writer</code></pre></p>
<p>Only SQL Server and SQL Browser should be running.  Try &#8220;sqlcmd&#8221; at the command prompt and it should let you through.</p>
<p>7. Now type the following to add your domain user account with admin privileges:</p>
<p><pre><code>EXEC sp_addsrvrolemember &#039;domain\useraccount&#039;, &#039;sysadmin&#039;;
GO</code></pre></p>
<p>it should give you blank line if it was successful.</p>
<p>8.  Now go back into the SQL Server Configuration Manager and remove the &#8220;;–m&#8221; you had placed under Startup Parameters.  Restart the SQL server again.</p>
<p>9. Now hit SQL Management studio and login using the account you have created using Windows Authentication.  You should have full admin privileges to create additional accounts, reset the SA account, change server roles, change user mapping, etc.</p>
<p>Hope this helps. <img src='http://www.jasonsamuel.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p><a href="http://www.jasonsamuel.com/2011/08/09/getting-admin-access-on-a-sql-server-when-you-dont-know-the-sa-account-password/">Getting admin access on a SQL Server when you don&#8217;t know the SA account password</a> is a post from: <a href="http://www.jasonsamuel.com">JasonSamuel.com</a></p>
<p>More of my posts you might like:<ol>
<li><a href='http://www.jasonsamuel.com/2009/11/04/how-to-move-sql-error-logs-errorlog-to-a-different-drive/' rel='bookmark' title='How to move SQL error logs (ERRORLOG) to a different drive'>How to move SQL error logs (ERRORLOG) to a different drive</a></li>
<li><a href='http://www.jasonsamuel.com/2010/04/28/how-to-get-the-iusr-and-iwam-user-account-passwords-on-an-iis-server/' rel='bookmark' title='How to get the IUSR and IWAM user account passwords on an IIS server'>How to get the IUSR and IWAM user account passwords on an IIS server</a></li>
<li><a href='http://www.jasonsamuel.com/2010/01/12/using-log-parser-to-query-huge-log-files-and-only-display-the-results-you-need/' rel='bookmark' title='Using Log Parser to query huge log files and only display the results you need'>Using Log Parser to query huge log files and only display the results you need</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.jasonsamuel.com/2011/08/09/getting-admin-access-on-a-sql-server-when-you-dont-know-the-sa-account-password/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Using Log Parser to query huge log files and only display the results you need</title>
		<link>http://www.jasonsamuel.com/2010/01/12/using-log-parser-to-query-huge-log-files-and-only-display-the-results-you-need/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=using-log-parser-to-query-huge-log-files-and-only-display-the-results-you-need</link>
		<comments>http://www.jasonsamuel.com/2010/01/12/using-log-parser-to-query-huge-log-files-and-only-display-the-results-you-need/#comments</comments>
		<pubDate>Tue, 12 Jan 2010 20:57:18 +0000</pubDate>
		<dc:creator>Jason Samuel</dc:creator>
				<category><![CDATA[IIS]]></category>
		<category><![CDATA[SQL Express]]></category>
		<category><![CDATA[SQL Server 2005]]></category>
		<category><![CDATA[SQL Server 2008]]></category>
		<category><![CDATA[Log Parser]]></category>
		<category><![CDATA[SQL]]></category>

		<guid isPermaLink="false">http://www.jasonsamuel.com/?p=332</guid>
		<description><![CDATA[Have you ever had a giant log file or CSV that you needed to go through and pull results from quickly?  Sure you can try dumping it into Excel and trying different filters and sort orders but that&#8217;s a waste of time.  It&#8217;s much faster to pull your data via a query like in a [...]<p><a href="http://www.jasonsamuel.com/2010/01/12/using-log-parser-to-query-huge-log-files-and-only-display-the-results-you-need/">Using Log Parser to query huge log files and only display the results you need</a> is a post from: <a href="http://www.jasonsamuel.com">JasonSamuel.com</a></p>

More of my posts you might like:<ol>
<li><a href='http://www.jasonsamuel.com/2010/01/08/creating-a-custom-event-log-under-event-viewer-to-log-server-events/' rel='bookmark' title='Creating a custom event log under Event Viewer to log server events'>Creating a custom event log under Event Viewer to log server events</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>Have you ever had a giant log file or CSV that you needed to go through and pull results from quickly?  Sure you can try dumping it into Excel and trying different filters and sort orders but that&#8217;s a waste of time.  It&#8217;s much faster to pull your data via a query like in a database.  Microsoft has a tool called Log Parser that does just that.  You can use queries to parse any kind of text based file.</p>
<p>You can download Log Parser 2.2 from Microsoft here:  <a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=890cd06b-abf8-4c25-91b2-f8d975cf8c07&amp;displaylang=en">http://www.microsoft.com/downloads/details.aspx?FamilyID=890cd06b-abf8-4c25-91b2-f8d975cf8c07&amp;displaylang=en</a></p>
<p>Just install it and try it out by opening up a command prompt, navigating to your install path, and running the logparser executable.  It will display a list of commands to get you familiar with it.   I first started using it to parse huge IIS logs.  It&#8217;s pretty easy to use, here&#8217;s an example of pulling the top 10 pages hit on your site:</p>
<p><code>logparser &quot;SELECT TOP 10 cs-uri-stem as Url, COUNT(cs-uri-stem) AS Hits FROM c:\logs\ex*.log GROUP BY cs-uri-stem ORDER BY Hits DESC&quot;</code></p>
<p>or all the Error 500s for a particular site:</p>
<p><code>logparser &quot;SELECT [cs-uri-stem], [cs-uri-query], Count(*) AS [Hits] FROM c:\logs\ex*.log WHERE sc-status = 500 GROUP BY [cs-uri-stem], [cs-uri-query] order by [hits], [cs-uri-stem] DESC&quot; -rtp:-1 -i:iisw3c</code></p>
<p>You can even throw the above in a batch file that schedule to run every hour and do something like:</p>
<blockquote><p>All5005Errors.bat > All500Errors.txt</p></blockquote>
<p>to log it all to disk.  Or even easier, use INTO in your SQL syntax to dump to a file like a .csv so it reads like:</p>
<p><code>logparser &quot;SELECT [cs-uri-stem], [cs-uri-query], Count(*) AS [Hits] INTO All500Errors.csv FROM c:\logs\ex*.log WHERE sc-status = 500 GROUP BY [cs-uri-stem], [cs-uri-query] order by [hits], [cs-uri-stem] DESC&quot; -rtp:-1 -i:iisw3c</code></p>
<p>There&#8217;s tons and tons of nice little queries people have written, for example I&#8217;ve personally used some from Jeff Atwood&#8217;s site here:  <a href="http://www.codinghorror.com/blog/archives/000369.html">http://www.codinghorror.com/blog/archives/000369.html</a></p>
<p>Or you can got to the IIS.NET forums where there is an entire forum and many sub-forums dedicated to Log Parser here:  <a href="http://forums.iis.net/default.aspx?GroupID=51">http://forums.iis.net/default.aspx?GroupID=51</a></p>
<p>Another cool tool over at CodePlex&#8230;Visual Log Parser:  <a href="http://www.codeplex.com/visuallogparser">http://www.codeplex.com/visuallogparser</a></p>
<p>I actually haven&#8217;t used this yet but it is out there if you get bored of using command line.  LMK if you guys decide to try it out.</p>
<p><a href="http://www.jasonsamuel.com/2010/01/12/using-log-parser-to-query-huge-log-files-and-only-display-the-results-you-need/">Using Log Parser to query huge log files and only display the results you need</a> is a post from: <a href="http://www.jasonsamuel.com">JasonSamuel.com</a></p>
<p>More of my posts you might like:<ol>
<li><a href='http://www.jasonsamuel.com/2010/01/08/creating-a-custom-event-log-under-event-viewer-to-log-server-events/' rel='bookmark' title='Creating a custom event log under Event Viewer to log server events'>Creating a custom event log under Event Viewer to log server events</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.jasonsamuel.com/2010/01/12/using-log-parser-to-query-huge-log-files-and-only-display-the-results-you-need/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>How to move SQL error logs (ERRORLOG) to a different drive</title>
		<link>http://www.jasonsamuel.com/2009/11/04/how-to-move-sql-error-logs-errorlog-to-a-different-drive/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=how-to-move-sql-error-logs-errorlog-to-a-different-drive</link>
		<comments>http://www.jasonsamuel.com/2009/11/04/how-to-move-sql-error-logs-errorlog-to-a-different-drive/#comments</comments>
		<pubDate>Wed, 04 Nov 2009 21:08:15 +0000</pubDate>
		<dc:creator>Jason Samuel</dc:creator>
				<category><![CDATA[SQL Express]]></category>
		<category><![CDATA[SQL Server 2005]]></category>
		<category><![CDATA[SQL Server 2008]]></category>

		<guid isPermaLink="false">http://www.jasonsamuel.com/?p=101</guid>
		<description><![CDATA[If you install SQL Server on your C: drive, you might notice after a while a that the ERRORLOG files begin filling it up.  It&#8217;s easy to move these off to another drive.  Just go to SQL Server Configuration Manger and under &#8220;SQL Server 2005 Services&#8221;, right click on &#8220;SQL Server&#8221; in the right pane [...]<p><a href="http://www.jasonsamuel.com/2009/11/04/how-to-move-sql-error-logs-errorlog-to-a-different-drive/">How to move SQL error logs (ERRORLOG) to a different drive</a> is a post from: <a href="http://www.jasonsamuel.com">JasonSamuel.com</a></p>
]]></description>
			<content:encoded><![CDATA[<p>If you install SQL Server on your C: drive, you might notice after a while a that the ERRORLOG files begin filling it up.  It&#8217;s easy to move these off to another drive.  Just go to SQL Server Configuration Manger and under &#8220;SQL Server 2005 Services&#8221;, right click on &#8220;SQL Server&#8221; in the right pane and click Properties.  Click on the Advanced Tab and scroll down to the &#8220;Startup Paramters section&#8221;.</p>
<p>Now be very careful here.  Click the little down arrow and select all the text you see.  Copy and paste it into Notepad so you can edit it easily.  It should look something like this:</p>
<p><code>-dc:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\DATA\master.mdf;-ec:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\LOG\ERRORLOG;-lc:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\DATA\mastlog.ldf</code></p>
<p>Edit the path for ERRORLOG to the new drive and folder.  The path must already be created so make sure you create this first.  Now paste your new paramaters back into the properties window and hit OK.  Once you make the change, restart the service and immediately all new ERRORLOGs will be written at the new path.  Here is an example of moving the logs off to the E: drive in a folder called &#8220;SQL error logs&#8221;:</p>
<p><pre><code>-dC:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\DATA\master.mdf;-eE:\SQL error logs\ERRORLOG;-lC:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\DATA\mastlog.ldf
 </code></pre></p>
<p><a href="http://www.jasonsamuel.com/2009/11/04/how-to-move-sql-error-logs-errorlog-to-a-different-drive/">How to move SQL error logs (ERRORLOG) to a different drive</a> is a post from: <a href="http://www.jasonsamuel.com">JasonSamuel.com</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.jasonsamuel.com/2009/11/04/how-to-move-sql-error-logs-errorlog-to-a-different-drive/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Served from: www.jasonsamuel.com @ 2012-02-06 18:30:28 -->
