 




<?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>SQL Server with Mr. Denny &#187; SQL Server 2005</title>
	<atom:link href="http://itknowledgeexchange.techtarget.com/sql-server/tag/sql-server-2005/feed/" rel="self" type="application/rss+xml" />
	<link>http://itknowledgeexchange.techtarget.com/sql-server</link>
	<description></description>
	<lastBuildDate>Fri, 24 May 2013 17:04:09 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
		<item>
		<title>Using Event Viewer Logging for SSIS Performance Trouble Shooting</title>
		<link>http://itknowledgeexchange.techtarget.com/sql-server/using-event-viewer-logging-for-ssis-performance-trouble-shooting/</link>
		<comments>http://itknowledgeexchange.techtarget.com/sql-server/using-event-viewer-logging-for-ssis-performance-trouble-shooting/#comments</comments>
		<pubDate>Wed, 27 Mar 2013 14:00:51 +0000</pubDate>
		<dc:creator>Denny Cherry</dc:creator>
				<category><![CDATA[BIDS]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Server 2005]]></category>
		<category><![CDATA[SQL Server 2008]]></category>
		<category><![CDATA[SQL Server 2008 R2]]></category>
		<category><![CDATA[SQL Server 2012]]></category>
		<category><![CDATA[SSIS]]></category>

		<guid isPermaLink="false">http://itknowledgeexchange.techtarget.com/sql-server/?p=2131</guid>
		<description><![CDATA[So while working with a client recently I was going some performance tuning on SSIS for them.  While SSIS isn&#8217;t exactly my normal workload, the problem wasn&#8217;t really in SSIS, but just normal SQL Statements being called from SSIS. While attacking this problem, the first thing that I did was look into the SSIS package [...]]]></description>
				<content:encoded><![CDATA[<p>So while working with a client recently I was going some performance tuning on SSIS for them.  While SSIS isn&#8217;t exactly my normal workload, the problem wasn&#8217;t really in SSIS, but just normal SQL Statements being called from SSIS.</p>
<p>While attacking this problem, the first thing that I did was look into the SSIS package and see what I had gotten myself into.  There were hundreds of objects within SSIS, most of them T-SQL Scripts of Data Pump Tasks.  So simply going through them one by one wasn&#8217;t going to be all that helpful.  The client didn&#8217;t have any logging to SQL Server or to a text file setup, but they did have the SSIS package setup to log to the Windows event log.</p>
<p>Opening the Application log greated me with one event for the start of each task, and one for the completion of each task.  Not exactly the most useful information ever, but better than nothing, so I&#8217;ll take what I can get.  The first thing that I did was export the Application Event log to a CSV file and download it to my desktop so that I could do the processing on my local machine.  The CSV file has a few hundred thousand lines, so I needed to figure out what I had via scripting.  The first problem that I had was that for each SSIS event there were multiple lines within the csv when opened in Excel which you can see below.</p>
<p><img class="alignnone" src="http://mrdenny.com/wp-content/uploads/2012/07/excel.jpg" alt="" width="755" height="179" /></p>
<p>Thankfully this made the rows pretty unique looking, so an Excel Macro was able to clean this up pretty easily.  Before I got started I added some column headers into the excel sheet.  The default columns from Event Viewer are Date, Time, Source, Severity, Category, EventID, User, Computer, Description.  This covered columns A through I.  After that I put columns J through P as being Operator, SourceName, SourceID, Execution, StartTime, EndTime and DataCode as these are the specific items that SSIS is logging that you can see above.  Then it was time to bust out a little VBA and flatten out all this data.  The macro shown below looped through the data and flattened everything out so that all the data was on a single line.  Then is went through and removed all the white lines.  This macro took about 3 hours to run.</p>
<p><code>Sub CleanUpData()<br />
Dim Row As Long<br />
Dim DataRow As Long<br />
Row = 32768<br />
Do While Range("A" &amp; Row).Value = ""<br />
If Range("B" &amp; Row).Value = "" Then<br />
DataRow = Row<br />
Range("A" &amp; Row).Select<br />
Else<br />
If Left(Range("A" &amp; Row).Value, 4) = " Mes" Then<br />
Range("A" &amp; Row).Value = ""<br />
End If<br />
If Left(Range("A" &amp; Row).Value, 4) = " Ope" Then<br />
Range("J" &amp; DataRow).Value = Range("A" &amp; Row).Value<br />
Range("A" &amp; Row).Value = ""<br />
End If<br />
If Left(Range("A" &amp; Row).Value, 9) = " Source N" Then<br />
Range("K" &amp; DataRow).Value = Range("A" &amp; Row).Value<br />
Range("A" &amp; Row).Value = ""<br />
End If<br />
If Left(Range("A" &amp; Row).Value, 10) = " Source ID" Then<br />
Range("L" &amp; DataRow).Value = Range("A" &amp; Row).Value<br />
Range("A" &amp; Row).Value = ""<br />
End If<br />
If Left(Range("A" &amp; Row).Value, 4) = " Exe" Then<br />
Range("M" &amp; DataRow).Value = Range("A" &amp; Row).Value<br />
Range("A" &amp; Row).Value = ""<br />
End If<br />
If Left(Range("A" &amp; Row).Value, 4) = " Sta" Then<br />
Range("N" &amp; DataRow).Value = Range("A" &amp; Row).Value<br />
Range("A" &amp; Row).Value = ""<br />
End If<br />
If Left(Range("A" &amp; Row).Value, 4) = " End" Then<br />
Range("O" &amp; DataRow).Value = Range("A" &amp; Row).Value<br />
Range("A" &amp; Row).Value = ""<br />
End If<br />
If Left(Range("A" &amp; Row).Value, 4) = " Dat" Then<br />
Range("P" &amp; DataRow).Value = Range("A" &amp; Row).Value<br />
Range("A" &amp; Row).Value = ""<br />
End If<br />
End If<br />
Row = Row + 1<br />
Loop</code></p>
<p>Do While Row 2<br />
If Range(&#8220;A&#8221; &amp; Row).Value = &#8220;&#8221; Then<br />
Range(Row &amp; &#8220;:&#8221; &amp; Row).Select<br />
Selection.Delete<br />
End If<br />
Row = Row &#8211; 1<br />
Loop<br />
End Sub</p>
<p>Once that was done I needed to set the start times for each event on the same line as the end time for each event. That way I wasn&#8217;t scrolling through looking for stuff while trying to do my data analysis. This I was also able to do with a little Macro. In this case I started on row 14 as that was the first entry that had SSIS data. You may need to change the EndRow=14 line to what ever line your data starts on. This puts the start time and the end time into Columns R and S, but only on the line which is the OnPostExecute line.</p>
<p><code>Sub FindRunTimes()<br />
Dim EndRow As Long<br />
Dim StartRow As Long<br />
Dim SourceName As String<br />
EndRow = 14<br />
Do While Range("A" &amp; EndRow).Value = ""<br />
If Range("I" &amp; EndRow).Value = " Event Name: OnPostExecute" Then<br />
StartRow = EndRow + 1<br />
Do Until Range("K" &amp; EndRow).Value = Range("K" &amp; StartRow).Value And Range("I" &amp; StartRow).Value = " Event Name: OnPreExecute"<br />
If Range("I" &amp; StartRow).Value = "" Then<br />
MsgBox "Ran out of rows to process for ending row " &amp; EndRow<br />
Exit Sub<br />
End If<br />
StartRow = StartRow + 1<br />
Loop<br />
Range("S" &amp; EndRow).Value = Range("B" &amp; EndRow).Value<br />
Range("R" &amp; EndRow).Value = Range("B" &amp; StartRow).Value<br />
'Range("T" &amp; EndRow).Value = DateDiff("mi", Range("A" &amp; StartRow).Value &amp; " " &amp; Range("B" &amp; StartRow).Value, Range("A" &amp; EndRow).Value &amp; " " &amp; Range("B" &amp; EndRow).Value)<br />
Range("R" &amp; EndRow).Select<br />
End If<br />
EndRow = EndRow + 1<br />
Loop<br />
End Sub</code></p>
<p>Once that Macro was finished I needed to figure out which of the statements was taking to long to run. Putting a formula into the column Q marked the rows that I needed to look into a little more. In this case I was using anything with a run time of 20 minutes or longer as needing to be looked at.</p>
<p><code>=IF(HOUR(R595)=HOUR(S595)*60+MINUTE(S595),"", "X"), IF(HOUR(R595)*60+MINUTE(R595)+19&gt;=HOUR(S595)*60+MINUTE(S595)+1440,"", "X"))</code></p>
<p>Once that formula was in there all the rows that were SSIS objects that took a long time to run had an X next to them. Now I still needed to ignore the rows which were containers, but those were pretty easy to figure out from the names of the objects as most of them had container in them (in the SourceName column which was column K of my Worksheet). At this point I was able to move back to the SSIS package and start digging through the package finding the objects which had long runtimes and getting those looked at.</p>
<p>The whole reason I went through this process instead of just adding logging to the SSIS package was for a few different reasons.</p>
<ul>
<li>I didn&#8217;t want to make ANY changes to production if I didn&#8217;t have to. This SSIS package loads a production data warehouse which the business uses to run their company, so making changes to it wasn&#8217;t something I wanted to try.</li>
<li>If I had simply put logging into place I would have had to have waited another day to being looking at the problems as the ETL process only runs once a day.</li>
<li>The SSIS package takes 8+ hours to run, so sitting around waiting for it to run wasn&#8217;t exactly the best use of my time, or the clients money.</li>
</ul>
<p>If you get stuck in this same sort of problem, hopefully this approach will help you out.<br />
Denny</p>
<!-- wpms-network-global-inserts -->]]></content:encoded>
			<wfw:commentRss>http://itknowledgeexchange.techtarget.com/sql-server/using-event-viewer-logging-for-ssis-performance-trouble-shooting/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Deleting LOB Data and Shrinking the Database</title>
		<link>http://itknowledgeexchange.techtarget.com/sql-server/deleting-lob-data-and-shrinking-the-database/</link>
		<comments>http://itknowledgeexchange.techtarget.com/sql-server/deleting-lob-data-and-shrinking-the-database/#comments</comments>
		<pubDate>Wed, 13 Mar 2013 14:00:52 +0000</pubDate>
		<dc:creator>Denny Cherry</dc:creator>
				<category><![CDATA[Andre Kamman]]></category>
		<category><![CDATA[Database]]></category>
		<category><![CDATA[Database Administration]]></category>
		<category><![CDATA[DBCC PAGE]]></category>
		<category><![CDATA[Mladen Prajdić]]></category>
		<category><![CDATA[Paul Randal]]></category>
		<category><![CDATA[SQL Saturday]]></category>
		<category><![CDATA[SQL Saturday 194]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Server 2005]]></category>
		<category><![CDATA[SQL Server 2008]]></category>
		<category><![CDATA[SQL Server 2008 R2]]></category>
		<category><![CDATA[SQL Server 2012]]></category>
		<category><![CDATA[System Objects]]></category>
		<category><![CDATA[Tables]]></category>

		<guid isPermaLink="false">http://itknowledgeexchange.techtarget.com/sql-server/?p=2564</guid>
		<description><![CDATA[While attending SQL Saturday 194 in Exeter over in England one of the attendees came to Mladen Prajdić, Andre Kamman and myself with an interesting problem.  She had a database table which was about 200 Gigs in size which she wanted to delete about half of the data from the table.  The catch was that the [...]]]></description>
				<content:encoded><![CDATA[<p>While attending <a href="http://www.sqlsaturday.com/194/eventhome.aspx">SQL Saturday 194</a> in Exeter over in England one of the attendees came to Mladen Prajdić, Andre Kamman and myself with an interesting problem.  She had a database table which was about 200 Gigs in size which she wanted to delete about half of the data from the table.  The catch was that the database table was full of LOB data where the rows were very large, with an average LOB data size of over a meg.  She also needed to shrink the database after the database was deleted so that she could reclaim the space from the database.  Oh and all this had to be done on SQL Server 2005 Standard Edition. (Everything here applies to SQL Server up through SQL Server 2012 as well.)</p>
<p>Deleting the data from the database is the easy part, a simple delete loop will handle that nicely.  The problem is when you delete rows from a table which contains LOB data the LOB pages aren&#8217;t cleared when they are deallocated.  We can see this by running the following code.</p>
<p><code>CREATE DATABASE Lobtest<br />
GO<br />
use Lobtest<br />
GO<br />
CREATE TABLE t1 (c1 int IDENTITY(1,1) PRIMARY KEY, c2 ntext)<br />
GO<br />
INSERT INTO T1 (c2) VALUES (replicate('a', 20000))<br />
GO<br />
DBCC IND ('LobTest', 't1', 1)<br />
GO<br />
DBCC TRACEON(5201, -1)<br />
GO<br />
DELETE FROM t1<br />
GO<br />
DBCC IND ('LobTest', 't1', 1)<br />
GO<br />
DECLARE @dbid as int = db_id('Lobtest')<br />
DBCC PAGE (@dbid, 1, 231, 3)<br />
GO</code></p>
<p>You can see that page 231 is a LOB page which is allocated to the table t1. When you look at the actual page using DBCC PAGE after the row has been deleted we can see that there is data in the page, and that the page header shows that the page is still allocated to the table t1. This can be seen by looking in the header of the page for the header value labeled &#8220;Metadata: ObjectId = 245575913&#8243;.</p>
<p>When you go to shrink the database the SQL Server engine will get to the LOB pages and it will need to figure out if the LOB row is a part of a row which still exists or not. In order to do this SQL Server will need to scan through the pages which make up the table looking for any rows which reference the page it is trying to delete.</p>
<p>When doing shrinks after deleing large amounts of LOB data SQL Server will generate large amounts of IO while figuring this out and the shrink operation will take an extremely long time. (Paul Randle talks more about <a href="http://www.sqlskills.com/blogs/paul/why-lob-data-makes-shrink-run-slooooowly-t-sql-tuesday-006/">it here</a>.)</p>
<p>So the question that this person at SQL Saturday had was, how can I reclaim the space from my database within a reasonable time.</p>
<p>The solution that we came up with was actually pretty simple.  Do the database deletion as normal.  Then backup and restore the database.  Then do the shrink, followed by rebuilding the clustered indexes in order to fix the fragmentation issue which the shrink will introduce.</p>
<p>This works for a pretty simple reason, because the PFS page shows that the LOB page isn&#8217;t allocated even though the page is full of data (you can verify this by looking at page 1 in file 1 in the sample database created by the script above).  When the database engine backups up the database the database engine looks at the PFS pages to figure out which pages to back up.  Because the PFS pages show that the pages are empty the database engine doesn&#8217;t bother to backup the pages, so when the pages are restored they are restored as blank pages.  This means that after the restore the shrink operation can run without an issue.</p>
<p>In the case of this application there was a maintenance window which could be taken advantage of which would allow the backup and the restore to happen.</p>
<p>Another option which we came up with which would require less downtime involved using database mirroring.  By configuring database mirroring (which is initialized via a backup and restore process giving us the same basic approach) and then failing over to the mirror we would end up in the same position.  We could then shrink the database without issue (probably pausing database mirroring so that we didn&#8217;t have to wait for the second server to process the shrink in real time) and then fail back the database to the original server.</p>
<p>As geeky as it was, Mladen, Andre and I had a great time figuring this out, and the attendee had a great time watching us go through all the possible options as we excluded them one by one.  And most importantly she got her problem solved.</p>
<p>So if you end up in this situation here&#8217;s a solution that will help you shrink the database so that you can reclaim the space that the LOB data pages are taking up without having to wait forever.</p>
<p>Denny</p>
<!-- wpms-network-global-inserts -->]]></content:encoded>
			<wfw:commentRss>http://itknowledgeexchange.techtarget.com/sql-server/deleting-lob-data-and-shrinking-the-database/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Cross Database Chaining</title>
		<link>http://itknowledgeexchange.techtarget.com/sql-server/cross-database-chaining/</link>
		<comments>http://itknowledgeexchange.techtarget.com/sql-server/cross-database-chaining/#comments</comments>
		<pubDate>Wed, 26 Dec 2012 14:00:05 +0000</pubDate>
		<dc:creator>Denny Cherry</dc:creator>
				<category><![CDATA[Data Security]]></category>
		<category><![CDATA[Database]]></category>
		<category><![CDATA[Database security]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Server 2000]]></category>
		<category><![CDATA[SQL Server 2005]]></category>
		<category><![CDATA[SQL Server 2008]]></category>
		<category><![CDATA[SQL Server 2008 R2]]></category>
		<category><![CDATA[SQL Server 2012]]></category>

		<guid isPermaLink="false">http://itknowledgeexchange.techtarget.com/sql-server/?p=1091</guid>
		<description><![CDATA[Cross database chaining in SQL Server is actually a fairly old feature, first introduced in SQL Server 2000 SP3.  However this feature isn&#8217;t often understood mostly because it isn&#8217;t often used. Database chaining is when permissions cascade from one object to another because they are used by the parent object.  The perfect example is a [...]]]></description>
				<content:encoded><![CDATA[<p>Cross database chaining in SQL Server is actually a fairly old feature, first introduced in SQL Server 2000 SP3.  However this feature isn&#8217;t often understood mostly because it isn&#8217;t often used.</p>
<p>Database chaining is when permissions cascade from one object to another because they are used by the parent object.  The perfect example is a stored procedure which accesses a table.  The user only needs rights to the parent object (the stored procedure) and the rights to access the table exist automatically because the stored procedure accesses the child object (the table).</p>
<p>Cross database chaining uses this exact same concept except that the parent object is in one database and the child object is in another database.  In order to use cross database chaining the feature needs to be enabled on both databases.  This is done by using the ALTER DATABASE statement as shown below on both databases.</p>
<blockquote><p>ALTER DATABASE A_Database SET DB_CHAINING ON</p></blockquote>
<p>Once this is done, the login which is mapped to the user within the database which has the parent object needs to be mapped to a login within the database which has the child object.  The user within the database which owns the child object doesn&#8217;t need any specific rights other than to be a member of the public role.  Once this is done the cross database permission chain will be made and the stored procedure (or other parent object such as a trigger or function) will begin working.</p>
<p>Denny</p>
<!-- wpms-network-global-inserts -->]]></content:encoded>
			<wfw:commentRss>http://itknowledgeexchange.techtarget.com/sql-server/cross-database-chaining/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Second Edition of Securing SQL Server now longer available for pre-order. It&#8217;s Shipping! (repost)</title>
		<link>http://itknowledgeexchange.techtarget.com/sql-server/second-edition-of-securing-sql-server-now-longer-available-for-pre-order-its-shipping-repost/</link>
		<comments>http://itknowledgeexchange.techtarget.com/sql-server/second-edition-of-securing-sql-server-now-longer-available-for-pre-order-its-shipping-repost/#comments</comments>
		<pubDate>Thu, 09 Aug 2012 14:00:50 +0000</pubDate>
		<dc:creator>Denny Cherry</dc:creator>
				<category><![CDATA[AlwaysOn]]></category>
		<category><![CDATA[Availability Groups]]></category>
		<category><![CDATA[Azure]]></category>
		<category><![CDATA[Data Loss]]></category>
		<category><![CDATA[Data Security]]></category>
		<category><![CDATA[Database Administration]]></category>
		<category><![CDATA[Database security]]></category>
		<category><![CDATA[Microsoft Windows]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Server 2000]]></category>
		<category><![CDATA[SQL Server 2005]]></category>
		<category><![CDATA[SQL Server 2008]]></category>
		<category><![CDATA[SQL Server 2008 R2]]></category>
		<category><![CDATA[SQL Server 2012]]></category>
		<category><![CDATA[Storage]]></category>

		<guid isPermaLink="false">http://itknowledgeexchange.techtarget.com/sql-server/?p=2236</guid>
		<description><![CDATA[In case you missed the blog post over on securingsqlserver.com, I wanted to repost it here&#8230; I&#8217;m afraid that I&#8217;ve got some bad news.  You can no longer pre-order Securing SQL Server 2nd Edition from Amazon. Instead you have to settle for ordering the book outright and having it shipped to you.  That&#8217;s right, no [...]]]></description>
				<content:encoded><![CDATA[<p>In case you missed the blog post over on <a href="http://www.securi">securingsqlserver.com</a>, I wanted to repost it here&#8230;</p>
<p>I&#8217;m afraid that I&#8217;ve got some bad news.  You can no longer pre-order <a href="http://www.amazon.com/gp/product/1597499471/ref=as_li_ss_tl?ie=UTF8&amp;camp=1789&amp;creative=390957&amp;creativeASIN=1597499471&amp;linkCode=as2&amp;tag=sesqse-20">Securing SQL Server 2nd Edition</a> from Amazon.</p>
<p>Instead you have to settle for <a href="http://www.amazon.com/gp/product/1597499471/ref=as_li_ss_tl?ie=UTF8&amp;camp=1789&amp;creative=390957&amp;creativeASIN=1597499471&amp;linkCode=as2&amp;tag=sesqse-20">ordering the book outright </a>and having it shipped to you.  That&#8217;s right, no more being a pre-order book, it&#8217;s published and available to be shipped directly to you.  Currently Amazon is selling the book at full price which is $49.95, but if you have Amazon Prime it is available for Amazon Prime shipping.  Because it is considered to be a text book you get a $5 Amazon MP3 Credit (what ever terms and conditions that Amazon chooses do apply).</p>
<p>This is a totally <a href="http://www.amazon.com/gp/product/1597499471/ref=as_li_ss_tl?ie=UTF8&amp;camp=1789&amp;creative=390957&amp;creativeASIN=1597499471&amp;linkCode=as2&amp;tag=sesqse-20">updated edition</a> of the book including all sorts of new information about security within SQL Server 2012.  I of course cover things like how to secure AlwaysOn Availability Groups, how to use user defined server roles, contained users, etc. I also dive into how to properly secure SQL Server Reporting Services and SQL Server Analysis Services so they can&#8217;t be used to access data that people shouldn&#8217;t have access to.</p>
<p>All in all this book is much larger with Amazon showing it at 408 pages compared to just 272 pages for the 1st edition.  If you find someone cheaper to purchase it make sure that you are in fact ordering the second edition.  The ISBN number is <a href="http://www.amazon.com/gp/product/1597499471/ref=as_li_ss_tl?ie=UTF8&amp;camp=1789&amp;creative=390957&amp;creativeASIN=1597499471&amp;linkCode=as2&amp;tag=sesqse-20">1597499471</a>.</p>
<p>I hope that you pick up a copy of the book and that it is useful for you in securing your SQL Server environment.</p>
<p>Denny</p>
<!-- wpms-network-global-inserts -->]]></content:encoded>
			<wfw:commentRss>http://itknowledgeexchange.techtarget.com/sql-server/second-edition-of-securing-sql-server-now-longer-available-for-pre-order-its-shipping-repost/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Security Sessions at SQL PASS 2012</title>
		<link>http://itknowledgeexchange.techtarget.com/sql-server/security-sessions-at-sql-pass-2012/</link>
		<comments>http://itknowledgeexchange.techtarget.com/sql-server/security-sessions-at-sql-pass-2012/#comments</comments>
		<pubDate>Thu, 26 Jul 2012 14:00:34 +0000</pubDate>
		<dc:creator>Denny Cherry</dc:creator>
				<category><![CDATA[Data Encryption]]></category>
		<category><![CDATA[Data Loss]]></category>
		<category><![CDATA[Data Security]]></category>
		<category><![CDATA[Database]]></category>
		<category><![CDATA[Database Administration]]></category>
		<category><![CDATA[Database Design]]></category>
		<category><![CDATA[Database security]]></category>
		<category><![CDATA[Encryption]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[SQL Injection]]></category>
		<category><![CDATA[SQL PASS]]></category>
		<category><![CDATA[SQL PASS 2012]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Server 2000]]></category>
		<category><![CDATA[SQL Server 2005]]></category>
		<category><![CDATA[SQL Server 2008]]></category>
		<category><![CDATA[SQL Server 2008 R2]]></category>
		<category><![CDATA[SQL Server 2012]]></category>

		<guid isPermaLink="false">http://itknowledgeexchange.techtarget.com/sql-server/?p=2190</guid>
		<description><![CDATA[The SQL PASS session list for the SQL PASS 2012 Summit has been released.  This year there are 192 sessions being presented at the SQL PASS summit.  Last year at the 2011 summit there were only a couple of sessions on SQL Server Security.  This year there are 4 sessions.  While this appears to be a [...]]]></description>
				<content:encoded><![CDATA[<p>The <a href="http://www.sqlpass.org/summit/2012/Sessions/ConferenceSessions.aspx">SQL PASS session list</a> for the SQL PASS 2012 Summit has been released.  This year there are 192 sessions being presented at the SQL PASS summit.  Last year at the 2011 summit there were only a couple of sessions on SQL Server Security.  This year there are 4 sessions.  While this appears to be a bit better that before (if I remember correctly there were 3 last year), based on the number of large scale data breeches this year we need to be talking more about SQL Server security, and most importantly people need to actually listen.</p>
<p><a href="http://www.sqlpass.org/summit/2012/Sessions/SessionDetails.aspx?sid=2654">Where Should I Be Encrypting My Data</a> being presented by me</p>
<p><a href="http://www.sqlpass.org/summit/2012/Sessions/SessionDetails.aspx?sid=2886">SQL Server 2012 Security for Developers</a> being presented by Andreas Wolter</p>
<p><a href="http://www.sqlpass.org/summit/2012/Sessions/SessionDetails.aspx?sid=3361">The Evolution of Security in SQL Server 2012</a> being presented by Don Kiely</p>
<p><a href="http://www.sqlpass.org/summit/2012/Sessions/SessionDetails.aspx?sid=3251">SQL Injection: From Website to SQL Server</a> being presented by Mladen Prajdić</p>
<p>There are a couple of other sessions that mention <a href="http://www.sqlpass.org/summit/2012/Sessions/ConferenceSessions.aspx?k=security&amp;p=1&amp;preferred=false">security</a> in the abstract, but based on these abstracts I&#8217;m guessing that security won&#8217;t be mentioned very much during the actual sessions.</p>
<p>Denny</p>
<p>P.S. Don&#8217;t forget about my free <a href="http://itknowledgeexchange.techtarget.com/sql-server/sql-pass-2012-first-timers-webcast/">SQL PASS 2012 First Timer&#8217;s webcast</a> coming up on October 17th, 2012 at 1pm Pacific / 4pm Eastern.  You do need to <a href="https://docs.google.com/spreadsheet/viewform?formkey=dGNXcUw2Y29oZXF4V2NXSnlpRjAzcXc6MQ">sign up</a> for the session, which is FREE so get signed up.  Even if you have attended the SQL PASS summit before, this is worth it as there are some big changes in how PASS will be laid out at the convention center this year.</p>
<!-- wpms-network-global-inserts -->]]></content:encoded>
			<wfw:commentRss>http://itknowledgeexchange.techtarget.com/sql-server/security-sessions-at-sql-pass-2012/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CPU Affinity Mask and virtualizating SQL Servers</title>
		<link>http://itknowledgeexchange.techtarget.com/sql-server/cpu-affinity-mask-and-virtualizating-sql-servers/</link>
		<comments>http://itknowledgeexchange.techtarget.com/sql-server/cpu-affinity-mask-and-virtualizating-sql-servers/#comments</comments>
		<pubDate>Thu, 12 Apr 2012 14:00:51 +0000</pubDate>
		<dc:creator>Denny Cherry</dc:creator>
				<category><![CDATA[Error Message]]></category>
		<category><![CDATA[Grant Fritchey]]></category>
		<category><![CDATA[Hyper-V]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Server 2000]]></category>
		<category><![CDATA[SQL Server 2005]]></category>
		<category><![CDATA[SQL Server 2008]]></category>
		<category><![CDATA[SQL Server 2008 R2]]></category>

		<guid isPermaLink="false">http://itknowledgeexchange.techtarget.com/sql-server/cpu-affinity-mask-and-virtualizating-sql-servers/</guid>
		<description><![CDATA[If you have physical SQL Servers that you plan on moving into a virtual environment you&#8217;ll want to double check your affinity mask settings before actually moving the machine from a physical server to a VM when using P2V software.  The reason for this is that if the affinity mask is set for specific CPUs [...]]]></description>
				<content:encoded><![CDATA[<p>If you have physical SQL Servers that you plan on moving into a virtual environment you&#8217;ll want to double check your affinity mask settings before actually moving the machine from a physical server to a VM when using P2V software.  The reason for this is that if the affinity mask is set for specific CPUs and the number of CPU cores changes the affinity mask won&#8217;t be correct and you won&#8217;t be able to get into the advanced settings of sp_configure without getting an invalid settings error like that shown below.</p>
<blockquote><p>Msg 5832, Level 16, State 1, Line 1<br />
The affinity mask specified does not match the CPU mask on this system.</p></blockquote>
<p>If you haven&#8217;t P2V&#8217;ed the system before you do simply change the various affinity masks to 0 which sets them for all processors.  If you have P2V&#8217;ed the system your best option is to log into the SQL Server using the dedicated admin connection and manually change the value in the system table by using the following query.</p>
<pre class="brush: sql; title: ; notranslate">update sys.configurations
set value=0
Where Name = 'affinity mask'</pre>
<p>Hopefully you never run across this problem, but if you do there&#8217;s the solution for you.</p>
<p>UPDATE: Paul Randal reminded me that CPU Affinity has been deprecated as of SQL Server 2008 R2 so you&#8217;ll probably not want to be configuring the CPU Affinity anyway.</p>
<p>Denny</p>
<!-- wpms-network-global-inserts -->]]></content:encoded>
			<wfw:commentRss>http://itknowledgeexchange.techtarget.com/sql-server/cpu-affinity-mask-and-virtualizating-sql-servers/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Upgrading MS Ops Manager &amp; SQL Server</title>
		<link>http://itknowledgeexchange.techtarget.com/sql-server/upgrading-ms-ops-manager-sql-server/</link>
		<comments>http://itknowledgeexchange.techtarget.com/sql-server/upgrading-ms-ops-manager-sql-server/#comments</comments>
		<pubDate>Mon, 09 Apr 2012 17:06:35 +0000</pubDate>
		<dc:creator>Denny Cherry</dc:creator>
				<category><![CDATA[Error 29112]]></category>
		<category><![CDATA[MERGE statement]]></category>
		<category><![CDATA[Microsoft Operations Manager]]></category>
		<category><![CDATA[Microsoft System Center]]></category>
		<category><![CDATA[OperationsManager]]></category>
		<category><![CDATA[OperationsManagerDW]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Server 2005]]></category>
		<category><![CDATA[SQL Server 2008 R2]]></category>
		<category><![CDATA[System Center Management Configuration Service]]></category>

		<guid isPermaLink="false">http://itknowledgeexchange.techtarget.com/sql-server/upgrading-ms-ops-manager-sql-server/</guid>
		<description><![CDATA[Something which has come up when upgrading Microsoft Operations Manager 2007 to 2012 is that there is an extra step which isn&#8217;t really documented in the Ops Manager upgrade guide.  You see when upgrading from Ops Manager 2007 to 2012 you also need to upgrade the SQL Server to SQL Server 2008 R2 as that [...]]]></description>
				<content:encoded><![CDATA[<p>Something which has come up when upgrading Microsoft Operations Manager 2007 to 2012 is that there is an extra step which isn&#8217;t really documented in the Ops Manager upgrade guide.  You see when upgrading from Ops Manager 2007 to 2012 you also need to upgrade the SQL Server to SQL Server 2008 R2 as that is required by Ops Manager 2012.  As the install of Ops Manager 2007 to probably from 2007 or 2008 it&#8217;s probably running on SQL Server 2005 today so that requires that the database be upgraded before the Ops Manager software can be upgraded as one of the prerequisites for running Ops Manager 2012 is that you are running SQL Server 2008 R2.</p>
<p>The problem comes from the fact that when you upgrade SQL Server there is a setting called the compatibility mode which doesn&#8217;t get changed by default.  The reason for this is that you can continue to use older T-SQL syntax while still upgrading the database engine to the newest version.  When the compatibility mode is left at the older level (in this case SQL Server 2005 compatibility mode) newer T-SQL features aren&#8217;t available.  In the case of Ops Manager going from SQL Server 2005 to SQL Server 2008 R2 the feature in question that is needed is the MERGE statement which wasn&#8217;t available in SQL Server 2005.</p>
<p>The annoying thing here is that Microsoft doesn&#8217;t test for the compatibility mode when going through the Ops Manager upgrade process so this doesn&#8217;t get flagged.  This means that you&#8217;ll get through the service upgrade and when you get into the second migrating phase, doing the management group updates) the System Center Management Configuration Service will throw Error number 29112 and the entire Ops Manager system will stop working.  Why it is throwing this error message is because the Management Configuration Service is attempting to create stored procedures which use the MERGE statement which the SQL Server 2005 compatibility mode doesn&#8217;t understand.</p>
<p>Thankfully fixing this is very easy.  Log into the SQL Server database engine which you are using to host the Ops Manager databases.  In the object explorer within SQL Server Management Studio right click on the OperationsManager and OperationsManagerDW databases and select properties (do one database at a time).  On the options tab change the compatibility mode from SQL Server 2005 to SQL Server 2008.  Then click OK as shown below (click to enlarge).</p>
<p><a href="http://cdn.ttgtmedia.com/ITKE/uploads/blogs.dir/20/files/2012/04/opsmgt.jpg"><img class="alignnone size-thumbnail wp-image-2034" src="http://cdn.ttgtmedia.com/ITKE/uploads/blogs.dir/20/files/2012/04/opsmgt.jpg" alt="" width="128" height="92" /></a></p>
<p>If you prefer this change can also be made with a couple of simple ALTER DATABASE statements as shown below.</p>
<pre class="brush: sql; title: ; notranslate">ALTER DATABASE [OperationsManager] SET COMPATIBILITY_LEVEL = 100
ALTER DATABASE [OperationsManagerDW] SET COMPATIBILITY_LEVEL = 100</pre>
<p>Either way once the change is made there is no restart of the database engine required.  Just fire up the System Center Management Configuration Service and let it do it&#8217;s thing and it&#8217;ll complete that step of the upgrade process.</p>
<p>I hope this helps,</p>
<p>Denny</p>
<!-- wpms-network-global-inserts -->]]></content:encoded>
			<wfw:commentRss>http://itknowledgeexchange.techtarget.com/sql-server/upgrading-ms-ops-manager-sql-server/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Init Replication From Backup</title>
		<link>http://itknowledgeexchange.techtarget.com/sql-server/init-replication-from-backup/</link>
		<comments>http://itknowledgeexchange.techtarget.com/sql-server/init-replication-from-backup/#comments</comments>
		<pubDate>Thu, 01 Mar 2012 14:00:19 +0000</pubDate>
		<dc:creator>Denny Cherry</dc:creator>
				<category><![CDATA[Replication]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Server 2000]]></category>
		<category><![CDATA[SQL Server 2005]]></category>
		<category><![CDATA[SQL Server 2008]]></category>
		<category><![CDATA[SQL Server 2008 R2]]></category>

		<guid isPermaLink="false">http://itknowledgeexchange.techtarget.com/sql-server/init-replication-from-backup/</guid>
		<description><![CDATA[One of the great features with SQL Replication is the ability to initialize a subscription from backup instead of from a snapshot.  The official use for this is to take a database backup and restore it to a subscriber then replicate any additional changes to the backup. However this technique can be used to get [...]]]></description>
				<content:encoded><![CDATA[<p>One of the great features with SQL Replication is the ability to initialize a subscription from backup instead of from a snapshot.  The official use for this is to take a database backup and restore it to a subscriber then replicate any additional changes to the backup.</p>
<p>However this technique can be used to get replication back up and running after moving the publisher to another SQL Server.  Simply setup the publication just like normal, then backup the database and add the subscription using the &#8220;initialize with backup&#8221; value for the @sync_type parameter as shown in the sample code below.</p>
<p>If you were going to actually initialize a new subscription using a backup like the feature was written to be used, then after the backup has happened restore the database to the subscriber under the correct database name.</p>
<pre class="brush: sql; title: ; notranslate">BACKUP DATABASE YourDatabase TO DISK='E:\Backup\YourDatabase.bak' WITH FORMAT, STATS=10
GO
USE YourDatabase
GO
EXEC sp_addsubscription @publication = N'YourDatabase Publication', @subscriber=N'ReportServer', @destination_db = N'ReportingDatabase', @article='all',
@sync_type='initialize with backup', @backupdevicetype='disk', @backupdevicename='e:\Backup\YourDatabase.bak'
GO</pre>
<p>This technique should work on all versions of SQL Server from SQL Server 2000 up through SQL Server 2012 without issue.</p>
<p>Denny</p>
<!-- wpms-network-global-inserts -->]]></content:encoded>
			<wfw:commentRss>http://itknowledgeexchange.techtarget.com/sql-server/init-replication-from-backup/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Schema Design Changes shouldn&#8217;t just be done once</title>
		<link>http://itknowledgeexchange.techtarget.com/sql-server/schema-design-changes-shouldnt-just-be-done-once/</link>
		<comments>http://itknowledgeexchange.techtarget.com/sql-server/schema-design-changes-shouldnt-just-be-done-once/#comments</comments>
		<pubDate>Mon, 05 Dec 2011 14:00:54 +0000</pubDate>
		<dc:creator>Denny Cherry</dc:creator>
				<category><![CDATA[Federated Database]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Server 2005]]></category>
		<category><![CDATA[SQL Server 2008 R2]]></category>

		<guid isPermaLink="false">http://itknowledgeexchange.techtarget.com/sql-server/?p=1813</guid>
		<description><![CDATA[Just because you did a schema design change before doesn&#8217;t mean that you shouldn&#8217;t look into doing another one.  A while back, before I started working with Phreesia, they decided to fix some performance problems by federating some data.  The data is question is basically a large named value pair table which holds survey answers.  [...]]]></description>
				<content:encoded><![CDATA[<p>Just because you did a schema design change before doesn&#8217;t mean that you shouldn&#8217;t look into doing another one.  A while back, before I started working with <a href="http://www.phreesia.com">Phreesia</a>, they decided to fix some performance problems by federating some data.  The data is question is basically a large named value pair table which holds survey answers.  The performance problem that they were trying to solve was that they allow people to fill out the survey more than once, and when they change an answer only the changed values are saved.  Figuring out the newest set of answers became a very expensive query to run.  Because of this, and to make index rebuilding faster it was decided to federate the data across multiple tables basically named answer_1, answer_2, answer_3, etc.</p>
<p>This was working fine for a good year or two, but then the system grew.  As the database got more data loaded into the tables the number of tables that were a member of the federation grew to 125.  There was a view which was used for reading data which did a UNION ALL between the 125 tables.  Querying this view required massive amounts of memory just for storing the execution plans, a whole 8 Megs per execution plan that hit the view.  And there were two of these views.  This is because the blob data was being stored in another set of federated tables.  The first view was just the answer_{n} table and the other view joined all the answer_{n} tables to the tables holding the blob data called answer_lob_{n}.  The way the tables were designed was that if the meta data for the lob data was in answer_1 then the actual lob data was in answer_lob_1 and if the meta data was in answer_2 then the lob data was stored in answer_lob_2.  This made the definition of the two views to look something like this.</p>
<pre class="brush: sql; title: ; notranslate">CREATE VIEW basedata
AS
SELECT *
FROM answer_1
UNION ALL
SELECT *
FROM answer_2
UNION ALL
...
GO
CREATE VIEW lobdata
AS
SELECT *
FROM answer_1
JOIN answer_lob_1 on answer_1.AnswerId = answer_lob_1.AnswerId
UNION ALL
SELECT *
FROM answer_2
JOIN answer_lob_2 on answer_2.AnswerId = answer_lob_2.AnswerId
UNION ALL
...
GO
</pre>
<p>Now when monitoring this server the CPU was running at about 30% during business hours and the PFE was running about 21k seconds (about 5.8 hours).  The server has 24 cores in it running at about 2.8Ghz and 256 Gigs of memory.</p>
<p>Working with the development team we decided to move the data from the answer_{n} tables into a single table called answer and the data from the answer_lob_{n} tables into a single table called answer_lob.  Making this change on this system was actually pretty easy.  Thankfully 100% of the access to these tables was done through stored procedures within the database.  Some of the procedures were using dynamic SQL, such as to insert the data so that the data would get in the correct table, but there weren&#8217;t all that may stored procedures in the database so there weren&#8217;t that many to deal with.</p>
<p>When we made this schema change there was another very important change that we made.  We added a bit column to the answer table which specified identified the row as being the most current version of the person&#8217;s answer.  This would then allow us to created filtered indexes on the table that had this bit column in the where clause so that we could create VERY small indexes when compared to the total size of the table.</p>
<p>Because of the changes in the schema, removing the views, ditching all the dynamic SQL, and filtering the indexes we got some major performance changes.  The CPU on the SQL Server went from 30% to 5% during normal business hours (when we made the schema change, this was the only change that we released during that release so that we could be sure that there were no problems introduced by the change).  On the PLE metric I mentioned above we went from a PLE of 21k to a massive 35k which is 9.7 hours.  This is a major improvement on both metrics.</p>
<p>Now the big question is, why didn&#8217;t they make the same changes that I had them make before?  The answer is that a lot of the SQL Server features that we used (specifically the filtered indexes) weren&#8217;t available before because back then the SQL Server was running on SQL Server 2005.  One of the changes which I made to the system in order to get the prepped for these schema changes included upgrading to SQL Server 2008 R2 so that we could take advantage of filtered indexes and &#8220;optimize for ad hoc workloads&#8221; (there&#8217;s a lot of dynamic SQL as the developers like to use linq for a lot of the data access for smaller parts of the system), just not for these specific tables.</p>
<p>As you can hopefully see from this example, that just because schema changes were made by someone in the past (these changes were made by some VERY capable consultants) when new technology comes out that you now have available to you it can be really worth it to make changes to the schema to take advantage of this new technology.  With these changes that have now been made this system can grow about 19-20x the current load before upgrading is required were with the old schema and performance the system could only grow 2-3x the current load.  And that means a much longer life for the server and much less money needing to be spent upgrading the server.  Also if we had waited until the server had been upgraded to make the schema changes moving the data from the old tables into the new table would have taken weeks or months instead of the 10 days or so that it took to migrate the data.  You see the new answer table has 156 Gigs (500 million rows) of data plus 500 Gigs of indexes and the answer_lob table has 455 Gigs of data (believe it or not this table has only 1.5 Gigs of non-clustered indexes on it).</p>
<p>If you have been putting off doing a schema redesign even after upgrading your database application to a new version of SQL Server (or what ever your database platform is) it might be a good time to look at the system and see what changes you can make.</p>
<p>Denny</p>
<p style="text-align: center"><a href="http://sqlexcursions.com/napa-2011-sign-up"><img class="aligncenter size-full wp-image-1819" src="http://cdn.ttgtmedia.com/ITKE/uploads/blogs.dir/20/files/2011/10/2012-napa-banner.jpg" alt="" width="500" height="61" /></a></p>
<!-- wpms-network-global-inserts -->]]></content:encoded>
			<wfw:commentRss>http://itknowledgeexchange.techtarget.com/sql-server/schema-design-changes-shouldnt-just-be-done-once/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>It&#8217;s #sqlpass summit session announcement time</title>
		<link>http://itknowledgeexchange.techtarget.com/sql-server/its-sharp-sqlpass-summit-session-announcement-time/</link>
		<comments>http://itknowledgeexchange.techtarget.com/sql-server/its-sharp-sqlpass-summit-session-announcement-time/#comments</comments>
		<pubDate>Wed, 15 Jun 2011 17:27:10 +0000</pubDate>
		<dc:creator>Denny Cherry</dc:creator>
				<category><![CDATA[BI]]></category>
		<category><![CDATA[Encryption]]></category>
		<category><![CDATA[SQL PASS]]></category>
		<category><![CDATA[SQL PASS 2011]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Server 11]]></category>
		<category><![CDATA[SQL Server 2000]]></category>
		<category><![CDATA[SQL Server 2005]]></category>
		<category><![CDATA[SQL Server 2008]]></category>
		<category><![CDATA[SQL Server 2008 R2]]></category>
		<category><![CDATA[SQL Server 2012]]></category>
		<category><![CDATA[SSAS]]></category>
		<category><![CDATA[Stacia Misner]]></category>

		<guid isPermaLink="false">http://itknowledgeexchange.techtarget.com/sql-server/its-sharp-sqlpass-summit-session-announcement-time/</guid>
		<description><![CDATA[So I&#8217;ve managed to trick the kind folks of the SQL PASS program committee once again this year.  I&#8217;ve gotten two sessions accepted for the summit. The first is a &#8220;regular session&#8221; which is the normal 75 minute community session during which I&#8217;ll be presenting &#8220;Where should I be encrypting my data&#8221; during which I&#8217;ll [...]]]></description>
				<content:encoded><![CDATA[<p>So I&#8217;ve managed to trick the kind folks of the SQL PASS program committee once again this year.  I&#8217;ve gotten two sessions accepted for the summit.</p>
<p>The first is a &#8220;regular session&#8221; which is the normal 75 minute community session during which I&#8217;ll be presenting &#8220;Where should I be encrypting my data&#8221; during which I&#8217;ll be talking about all the various ways to encrypt data within the SQL Server database.  These techniques will for the most part work on any version of SQL Server from SQL 6.5 all the way through SQL Server &#8220;Denali&#8221; (which we&#8217;ll hopefully know the name of before the summit).</p>
<p>The second session is one of the new half day sessions where I&#8217;ll be presenting with the lovely, brilliant and highly talented Stacia Misner called &#8220;So how does the BI workload impact the database engine?&#8221;.  During this session we&#8217;ll be looking at a variety of things including how ETL extracts and loads actually impact the databases they touch, and why running queries from SSAS and a data warehouse are faster than running them from the OLTP application.  This session won&#8217;t be so much a BI session on how to do BI tasks, but how those BI tasks function under to the hood of the core SQL Server engine.</p>
<p>See you at the summit.</p>
<p>Denny</p>
<!-- wpms-network-global-inserts -->]]></content:encoded>
			<wfw:commentRss>http://itknowledgeexchange.techtarget.com/sql-server/its-sharp-sqlpass-summit-session-announcement-time/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
