<?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> &#187; Security</title>
	<atom:link href="http://benchmarkitconsulting.com/category/sql-server/security/feed/" rel="self" type="application/rss+xml" />
	<link>http://benchmarkitconsulting.com</link>
	<description></description>
	<lastBuildDate>Mon, 06 Feb 2012 16:34:05 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>PWNED! (from beyond the grave)</title>
		<link>http://benchmarkitconsulting.com/colin-stasiuk/2010/08/18/pwned-from-beyond-the-grave/</link>
		<comments>http://benchmarkitconsulting.com/colin-stasiuk/2010/08/18/pwned-from-beyond-the-grave/#comments</comments>
		<pubDate>Wed, 18 Aug 2010 14:41:22 +0000</pubDate>
		<dc:creator>Colin Stasiuk</dc:creator>
				<category><![CDATA[Benchmark IT Consulting]]></category>
		<category><![CDATA[Colin Stasiuk]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[SQL Reporting Services]]></category>
		<category><![CDATA[SSRS]]></category>
		<category><![CDATA[Subscription Owners]]></category>
		<category><![CDATA[Subscriptions]]></category>

		<guid isPermaLink="false">http://benchmarkitconsulting.com/?p=1460</guid>
		<description><![CDATA[OK first off if you don&#8217;t know the definition of the word PWNED here is a tutorial&#8230; So now that you&#8217;re well versed on pwned or pwnage let&#8217;s talk about a way to ensure that the DBA (who we&#8217;ll call &#8220;Brent&#8221;) that left the company does not get all zombie and start eating your brain after [...]]]></description>
			<content:encoded><![CDATA[<p>OK first off if you don&#8217;t know the definition of the word PWNED here is a tutorial&#8230;</p>
<p><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="425" height="350" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="src" value="http://www.youtube.com/v/Fhb89V43KWc" /><embed type="application/x-shockwave-flash" width="425" height="350" src="http://www.youtube.com/v/Fhb89V43KWc"></embed></object></p>
<p>So now that you&#8217;re well versed on pwned or pwnage let&#8217;s talk about a way to ensure that the DBA (who we&#8217;ll call &#8220;Brent&#8221;) that left the company does not get all zombie and start eating your brain after he&#8217;s gone.</p>
<p><strong>**RING RING RING**</strong></p>
<p>You: Hello?</p>
<p>Them: Where is my report?</p>
<p>You: How did you get this number?</p>
<p>Them: Where is my report?</p>
<p>You:  What report?</p>
<p>Them:  Wow&#8230; Brent was way smarter then you *click*</p>
<p><img class="alignnone size-full wp-image-1165" title="brmiyajkdfjdkfd" src="http://benchmarkitconsulting.com/wp-content/uploads/2009/10/brmiyajkdfjdkfd.jpg" alt="" width="210" height="270" /></p>
<p>(and yes this is a shout out to Brent Ozar and a huge congratz to Jeremiah Peschka!!  not saying Brent would ever do this but it&#8217;s the buzz of the SQL Twitterverse this morning so I thought I had to work it in somehow <img src='http://benchmarkitconsulting.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' />  )</p>
<p>The first thing to check when something goes wrong after someone has left the company is if anything could of been tied to that user&#8217;s Active Directory account because chances are they are now disabled/deleted/removed/zombified.</p>
<p>&#8220;So here&#8217;s a little script that&#8217;s mine&#8230; you might want to execute line by line&#8230; don&#8217;t worry&#8230;.. be happy.&#8221;</p>
<p>(as always any and all scripts on this blog should never be ran&#8230; k that&#8217;s a bit much&#8230; you can run it but test it, tweak it, and make sure it works for you in your environment <img src='http://benchmarkitconsulting.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  )</p>
<p>I wrote this script to not care if the instance is the default or a named instance (why you may ask? well cause I use Powershell to run this script against all my servers and return me any reports that are not owned by a particular user):</p>

<div class="wp_syntax"><div class="code"><pre class="t-sql" style="font-family:monospace;">SET NOCOUNT ON
&nbsp;
DECLARE @InstanceName nvarchar(100)
DECLARE @ReportServerDatabaseName nvarchar(100)
DECLARE @ReportingDatabaseFoundInd bit
DECLARE @SQLSTMT nvarchar(2000)
&nbsp;
SELECT @InstanceName = @@SERVERNAME
SELECT @ReportingDatabaseFoundInd = 0
&nbsp;
IF @InstanceName = SUBSTRING(@InstanceName, ISNULL(CHARINDEX('\', @InstanceName)+1, 0), LEN(@InstanceName))
	BEGIN
		SELECT	@ReportServerDatabaseName = 'ReportServer'
	END
ELSE
	BEGIN
		SELECT	@ReportServerDatabaseName = 'ReportServer' + '$' + SUBSTRING(@InstanceName, ISNULL(CHARINDEX('\', @InstanceName)+1, 0), LEN(@InstanceName))
	END
&nbsp;
SELECT	@ReportingDatabaseFoundInd = 1
FROM	master.dbo.sysdatabases
WHERE	name = @ReportServerDatabaseName
&nbsp;
IF @ReportingDatabaseFoundInd = 1
	BEGIN
		SELECT @SQLSTMT = 'SELECT	@@SERVERNAME as [InstanceName],
									U.UserName as [SubscriptionOwner], C.[Path],
									S.[description]
							FROM	' + @ReportServerDatabaseName +
								'.dbo.subscriptions S INNER JOIN ' +
								@ReportServerDatabaseName + '.dbo.users U ON U.userid = S.ownerid INNER JOIN ' +
								@ReportServerDatabaseName + '.dbo.[Catalog] C ON S.Report_OID = C.ItemID'
		EXEC sp_executesql @SQLSTMT
	END</pre></div></div>

<p>Now if this list is a bit HUGE you can add a WHERE clause in there to look for a particular user name.</p>
<p>So now that you&#8217;ve found all the reports that are tied to the no longer existant user how do you change them?</p>

<div class="wp_syntax"><div class="code"><pre class="t-sql" style="font-family:monospace;">DECLARE @OldID uniqueidentifier
DECLARE @NewID uniqueidentifier
SELECT @OldID = UserID FROM dbo.Users WHERE UserName = 'Domain\LoginName'
SELECT @NewID = UserID FROM dbo.Users WHERE UserName = 'Domain\LoginName'
UPDATE dbo.Subscriptions SET OwnerID = @NewID WHERE OwnerID = @OldID</pre></div></div>

<p>A gotcha to watch out for with this is that the new ID that you set the report to needs to be in the users table (in your ReportServer database) so if you want to change it to a user that is not already in there you&#8217;ll have to log in as that user and add/update/delete a report to get them in there. (There is probably an easier way but that has always worked for me)</p>
<p>Enjoy!!</p>
<p><a href="http://benchmarkitconsulting.com" target="_blank"><img class="alignnone size-full wp-image-402" title="benchmark_sm" src="http://benchmarkitconsulting.com/wp-content/uploads/2009/02/benchmark_sm.jpg" alt="" width="157" height="74" /></a><a href="http://sqlserverpedia.com/wiki/Editors#Colin_Stasiuk" target="_blank"><img src="http://sqlserverpedia.com/badges/SQLServerPedia_Badge_Blogger.jpg" alt="" width="120" height="60" /> </a></p>
<p align="left"><a class="tt" href="http://twitter.com/home/?status=PWNED%21+%28from+beyond+the+grave%29+http://tinyurl.com/22pbqem" title="Post to Twitter"><img class="nothumb" src="http://benchmarkitconsulting.com/wp-content/plugins/tweet-this/icons/tt-twitter-big4.png" alt="Post to Twitter" /></a> <a class="tt" href="http://delicious.com/post?url=http://benchmarkitconsulting.com/colin-stasiuk/2010/08/18/pwned-from-beyond-the-grave/&amp;title=PWNED%21+%28from+beyond+the+grave%29" title="Post to Delicious"><img class="nothumb" src="http://benchmarkitconsulting.com/wp-content/plugins/tweet-this/icons/tt-delicious-big4.png" alt="Post to Delicious" /></a> <a class="tt" href="http://digg.com/submit?url=http://benchmarkitconsulting.com/colin-stasiuk/2010/08/18/pwned-from-beyond-the-grave/&amp;title=PWNED%21+%28from+beyond+the+grave%29" title="Post to Digg"><img class="nothumb" src="http://benchmarkitconsulting.com/wp-content/plugins/tweet-this/icons/tt-digg-big4.png" alt="Post to Digg" /></a> <a class="tt" href="http://stumbleupon.com/submit?url=http://benchmarkitconsulting.com/colin-stasiuk/2010/08/18/pwned-from-beyond-the-grave/&amp;title=PWNED%21+%28from+beyond+the+grave%29" title="Post to StumbleUpon"><img class="nothumb" src="http://benchmarkitconsulting.com/wp-content/plugins/tweet-this/icons/tt-su-big4.png" alt="Post to StumbleUpon" /></a></p>]]></content:encoded>
			<wfw:commentRss>http://benchmarkitconsulting.com/colin-stasiuk/2010/08/18/pwned-from-beyond-the-grave/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>SQL 2008 CMS Security</title>
		<link>http://benchmarkitconsulting.com/colin-stasiuk/2009/09/16/sql-2008-cms-security/</link>
		<comments>http://benchmarkitconsulting.com/colin-stasiuk/2009/09/16/sql-2008-cms-security/#comments</comments>
		<pubDate>Wed, 16 Sep 2009 13:00:22 +0000</pubDate>
		<dc:creator>Colin Stasiuk</dc:creator>
				<category><![CDATA[Benchmark IT Consulting]]></category>
		<category><![CDATA[Colin Stasiuk]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[2008]]></category>
		<category><![CDATA[Central Management Server]]></category>
		<category><![CDATA[CMS]]></category>
		<category><![CDATA[SQL]]></category>

		<guid isPermaLink="false">http://benchmarkitconsulting.com/?p=1080</guid>
		<description><![CDATA[So we&#8217;ve recently adopted the use of SQL Server 2008&#8242;s Central Managment Server for our development team.  Something that tends to get missed or not talked about in articles about CMS is the security required to connect and view the Central Management Server. There are 2 MSDB database roles that relate to the Central Managment [...]]]></description>
			<content:encoded><![CDATA[<p>So we&#8217;ve recently adopted the use of SQL Server 2008&#8242;s Central Managment Server for our development team.  Something that tends to get missed or not talked about in articles about CMS is the security required to connect and view the Central Management Server.</p>
<p><img class="alignnone size-full wp-image-1085" title="msdbfdkjfkd" src="http://benchmarkitconsulting.com/wp-content/uploads/2009/09/msdbfdkjfkd.png" alt="msdbfdkjfkd" width="391" height="182" /></p>
<p>There are 2 MSDB database roles that relate to the Central Managment Server:</p>
<p><strong>ServerGroupReaderRole:</strong>  Members of this group can only view the Central Management Server&#8217;s registered servers</p>
<p><strong>and</strong></p>
<p><strong>ServerGroupAdministratorRole:</strong> Only members of this group can add/update/delete registered servers to the Central Management Server</p>
<p>So if your first instict was to grant db_datareader access to the MSDB database it pays to take a look around and make sure that you&#8217;re not granting more security then what is required.</p>
<p><strong>Some great articles on Central Managment Servers:</strong></p>
<p><a href="http://www.brentozar.com/archive/2008/08/sql-server-2008s-new-central-management-server/" target="_blank">Configuring and Using a Central Management Server for SQL 2008 &#8211; Brent Ozar</a></p>
<p><a href="http://www.sqlskills.com/BLOGS/KIMBERLY/post/SQL-Server-2008-Central-Management-Servers-have-you-seen-these.aspx" target="_blank">SQL Server 2008 Central Managment Servers &#8211; Kimberly Tripp</a></p>
<p><a href="http://msdn.microsoft.com/en-us/library/bb934126.aspx" target="_blank">Create a Central Management Server and Server Group</a></p>
<p>Enjoy!!</p>
<p><span><a href="http://benchmarkitconsulting.com" target="_blank"><img class="alignnone size-full wp-image-402" title="benchmark_sm" src="http://benchmarkitconsulting.com/wp-content/uploads/2009/02/benchmark_sm.jpg" alt="" width="157" height="74" /></a><a href="http://sqlserverpedia.com/wiki/Editors#Colin_Stasiuk" target="_blank"><img src="http://sqlserverpedia.com/badges/SQLServerPedia_Badge_Blogger.jpg" alt="" width="120" height="60" /> </a></span></p>
<p align="left"><a class="tt" href="http://twitter.com/home/?status=SQL+2008+CMS+Security+http://tinyurl.com/qpwe77" title="Post to Twitter"><img class="nothumb" src="http://benchmarkitconsulting.com/wp-content/plugins/tweet-this/icons/tt-twitter-big4.png" alt="Post to Twitter" /></a> <a class="tt" href="http://delicious.com/post?url=http://benchmarkitconsulting.com/colin-stasiuk/2009/09/16/sql-2008-cms-security/&amp;title=SQL+2008+CMS+Security" title="Post to Delicious"><img class="nothumb" src="http://benchmarkitconsulting.com/wp-content/plugins/tweet-this/icons/tt-delicious-big4.png" alt="Post to Delicious" /></a> <a class="tt" href="http://digg.com/submit?url=http://benchmarkitconsulting.com/colin-stasiuk/2009/09/16/sql-2008-cms-security/&amp;title=SQL+2008+CMS+Security" title="Post to Digg"><img class="nothumb" src="http://benchmarkitconsulting.com/wp-content/plugins/tweet-this/icons/tt-digg-big4.png" alt="Post to Digg" /></a> <a class="tt" href="http://stumbleupon.com/submit?url=http://benchmarkitconsulting.com/colin-stasiuk/2009/09/16/sql-2008-cms-security/&amp;title=SQL+2008+CMS+Security" title="Post to StumbleUpon"><img class="nothumb" src="http://benchmarkitconsulting.com/wp-content/plugins/tweet-this/icons/tt-su-big4.png" alt="Post to StumbleUpon" /></a></p>]]></content:encoded>
			<wfw:commentRss>http://benchmarkitconsulting.com/colin-stasiuk/2009/09/16/sql-2008-cms-security/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Podcast: Auditing With SQL Server 2008</title>
		<link>http://benchmarkitconsulting.com/colin-stasiuk/2009/08/06/podcast-auditing-with-sql-server-2008/</link>
		<comments>http://benchmarkitconsulting.com/colin-stasiuk/2009/08/06/podcast-auditing-with-sql-server-2008/#comments</comments>
		<pubDate>Thu, 06 Aug 2009 17:27:48 +0000</pubDate>
		<dc:creator>Colin Stasiuk</dc:creator>
				<category><![CDATA[Benchmark IT Consulting]]></category>
		<category><![CDATA[Colin Stasiuk]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[Audit]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[SQL 2008]]></category>
		<category><![CDATA[Webcast]]></category>

		<guid isPermaLink="false">http://benchmarkitconsulting.com/?p=897</guid>
		<description><![CDATA[Well here we go.. my first podcast. Big thanks to Brent Ozar for helping both by critiquing the video ahead of time (and providing some very valuable feedback) as well as offering to encode, setup, and host the video on SQLServerPedia.com. In watching the video on SQLServerPedia I&#8217;m already thinking of ideas for topics of [...]]]></description>
			<content:encoded><![CDATA[<p>Well here we go.. my first podcast.</p>
<p>Big thanks to <a href="http://twitter.com/brento" target="_blank">Brent Ozar</a> for helping both by critiquing the video ahead of time (and providing some very valuable feedback) as well as offering to encode, setup, and host the video on <a href="http://sqlserverpedia.com/" target="_blank">SQLServerPedia.com</a>.</p>
<p>In watching the video on SQLServerPedia I&#8217;m already thinking of ideas for topics of future webcasts as well as  improvements that can/will be made down the road as well&#8230; but I guess at the end of the day everyone has to have a first video and this is mine.</p>
<p>Here is the link for the Podcast on SQLServerPedia  (larger viewing area and you can download for later if you&#8217;d like):</p>
<p><a href="http://sqlserverpedia.com/blog/sql-server-2008/guest-podcast-auditing-your-database-server/" target="_blank">Guest Podcast: Auditing Your Database Server</a></p>
<p>[media id=1 width=490 height=400]</p>
<p> </p>
<p>Thanks for watching!!</p>
<p>Enjoy!!</p>
<p><span><a href="http://benchmarkitconsulting.com" target="_blank"><img class="alignnone size-full wp-image-402" title="benchmark_sm" src="http://benchmarkitconsulting.com/wp-content/uploads/2009/02/benchmark_sm.jpg" alt="" width="157" height="74" /></a><a href="http://sqlserverpedia.com/wiki/Editors#Colin_Stasiuk" target="_blank"><img src="http://sqlserverpedia.com/badges/SQLServerPedia_Badge_Blogger.jpg" alt="" width="120" height="60" /> </a></span></p>
<p align="left"><a class="tt" href="http://twitter.com/home/?status=Podcast%3A+Auditing+With+SQL+Server+2008+http://tinyurl.com/mnpmf2" title="Post to Twitter"><img class="nothumb" src="http://benchmarkitconsulting.com/wp-content/plugins/tweet-this/icons/tt-twitter-big4.png" alt="Post to Twitter" /></a> <a class="tt" href="http://delicious.com/post?url=http://benchmarkitconsulting.com/colin-stasiuk/2009/08/06/podcast-auditing-with-sql-server-2008/&amp;title=Podcast%3A+Auditing+With+SQL+Server+2008" title="Post to Delicious"><img class="nothumb" src="http://benchmarkitconsulting.com/wp-content/plugins/tweet-this/icons/tt-delicious-big4.png" alt="Post to Delicious" /></a> <a class="tt" href="http://digg.com/submit?url=http://benchmarkitconsulting.com/colin-stasiuk/2009/08/06/podcast-auditing-with-sql-server-2008/&amp;title=Podcast%3A+Auditing+With+SQL+Server+2008" title="Post to Digg"><img class="nothumb" src="http://benchmarkitconsulting.com/wp-content/plugins/tweet-this/icons/tt-digg-big4.png" alt="Post to Digg" /></a> <a class="tt" href="http://stumbleupon.com/submit?url=http://benchmarkitconsulting.com/colin-stasiuk/2009/08/06/podcast-auditing-with-sql-server-2008/&amp;title=Podcast%3A+Auditing+With+SQL+Server+2008" title="Post to StumbleUpon"><img class="nothumb" src="http://benchmarkitconsulting.com/wp-content/plugins/tweet-this/icons/tt-su-big4.png" alt="Post to StumbleUpon" /></a></p>]]></content:encoded>
			<wfw:commentRss>http://benchmarkitconsulting.com/colin-stasiuk/2009/08/06/podcast-auditing-with-sql-server-2008/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>EDMPASS &#8211; July Meeting</title>
		<link>http://benchmarkitconsulting.com/colin-stasiuk/2009/07/03/edmpass-july-meeting/</link>
		<comments>http://benchmarkitconsulting.com/colin-stasiuk/2009/07/03/edmpass-july-meeting/#comments</comments>
		<pubDate>Fri, 03 Jul 2009 16:40:08 +0000</pubDate>
		<dc:creator>Colin Stasiuk</dc:creator>
				<category><![CDATA[Benchmark IT Consulting]]></category>
		<category><![CDATA[Colin Stasiuk]]></category>
		<category><![CDATA[PASS]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[EDMPASS]]></category>
		<category><![CDATA[SQL]]></category>

		<guid isPermaLink="false">http://benchmarkitconsulting.com/?p=796</guid>
		<description><![CDATA[In July the Edmonton Chapter of PASS is going to have it’s 2nd meeting. Details below: http://www.eventbrite.com/event/378687665 Please be sure to not only click the “Add to my calendar” but also the “Register” button so that we can plan accordingly for food and drinks.  Date:  July 29th 2009 Time: 5:00 pm &#8211; 7:00 pm Location: Stanley A. Milner library [...]]]></description>
			<content:encoded><![CDATA[<p>In July the Edmonton Chapter of PASS is going to have it’s 2nd meeting. Details below:</p>
<p><a href="http://www.eventbrite.com/event/378687665" target="_blank"><strong>http://www.eventbrite.com/event/378687665</strong></a></p>
<p><strong>Please be sure to not only click the “Add to my calendar” but also the “Register” button so that we can plan accordingly for food and drinks.</strong> </p>
<p><strong>Date:</strong>  July 29th 2009<br />
<strong>Time:</strong> 5:00 pm &#8211; 7:00 pm<br />
<strong>Location:</strong> Stanley A. Milner library<br />
<strong>Map:</strong> <a href="http://www.mapquest.com/maps/map.adp?formtype=address&amp;country=CA&amp;popflag=0&amp;latitude=&amp;longitude=&amp;name=&amp;phone=&amp;level=&amp;addtohistory=&amp;cat=&amp;address=7+Sir+Winston+Churchill+Square+NW&amp;city=Edmonton&amp;state=AB&amp;zipcode=" target="_blank">7 Sir Winston Churchill Square</a><br />
<strong>Meeting Room:</strong> 6th Floor &#8211; Room 7<br />
<strong>Speaker:</strong> Colin Stasiuk<br />
<strong>Topic:</strong> SQL Security Auditing Through The Ages</p>
<p><strong>(Live Meeting Link to follow)</strong></p>
<p><strong>Agenda:</strong><br />
5:00 pm &#8211; Pizza and Socializing<br />
5:30 pm &#8211; Sponsor Presentation<br />
5:45 pm &#8211; Feature Presentation<br />
6:45 pm &#8211; Wrap Up and Draws</p>
<p><strong>Presenter Information:</strong>   Colin Stasiuk is an MCP, MCTS SQL 2005/2008, MCITP DBDEV, and MCITP DBA.  Currently, he is an independent consultant contracted to <a href="http://www.vantixsystems.com/" target="_blank">Vantix Systems </a>and working for the Government of Alberta.  Colin is an accomplished Microsoft SQL Server DBA who has been working with SQL Server since 1996.  He is the founder of <a href="http://www.BenchmarkITConsulting.com" target="_blank">Benchmark IT Consulting</a>  and is always willing to lend a hand with questions in many SQL Server community forums and via Twitter (<a href="http://twitter.com/BenchmarkIT" target="_blank">http://twitter.com/BenchmarkIT</a>) .  His specialties include SQL Server Administration, Performance Tuning, Security, Best Practice / Standards, Upgrades, and Consolidation.</p>
<p>Colin is a proud PASS member, President of <a href="http://edmpass.com/" target="_blank">EDMPASS</a>, and is on the DBA Abstract Selection Team for this years <a href="http://summit2009.sqlpass.org/" target="_blank">PASS Summit</a>. </p>
<p> If you haven’t signed up already at <a href="http://edmpass.com/?page_id=7" target="_blank">EDMPASS.com</a> please do so now to receive meeting notifications, news, and updates from EDMPASS.</p>
<p>Hope to see you there.</p>
<p><span><a href="http://benchmarkitconsulting.com" target="_blank"><img class="alignnone size-full wp-image-402" title="benchmark_sm" src="http://benchmarkitconsulting.com/wp-content/uploads/2009/02/benchmark_sm.jpg" alt="" width="157" height="74" /></a><a href="http://sqlserverpedia.com/wiki/Editors#Colin_Stasiuk" target="_blank"><img src="http://sqlserverpedia.com/badges/SQLServerPedia_Badge_Blogger.jpg" alt="" width="120" height="60" /> </a></span></p>
<p align="left"><a class="tt" href="http://twitter.com/home/?status=EDMPASS+%26%238211%3B+July+Meeting+http://tinyurl.com/m26nct" title="Post to Twitter"><img class="nothumb" src="http://benchmarkitconsulting.com/wp-content/plugins/tweet-this/icons/tt-twitter-big4.png" alt="Post to Twitter" /></a> <a class="tt" href="http://delicious.com/post?url=http://benchmarkitconsulting.com/colin-stasiuk/2009/07/03/edmpass-july-meeting/&amp;title=EDMPASS+%26%238211%3B+July+Meeting" title="Post to Delicious"><img class="nothumb" src="http://benchmarkitconsulting.com/wp-content/plugins/tweet-this/icons/tt-delicious-big4.png" alt="Post to Delicious" /></a> <a class="tt" href="http://digg.com/submit?url=http://benchmarkitconsulting.com/colin-stasiuk/2009/07/03/edmpass-july-meeting/&amp;title=EDMPASS+%26%238211%3B+July+Meeting" title="Post to Digg"><img class="nothumb" src="http://benchmarkitconsulting.com/wp-content/plugins/tweet-this/icons/tt-digg-big4.png" alt="Post to Digg" /></a> <a class="tt" href="http://stumbleupon.com/submit?url=http://benchmarkitconsulting.com/colin-stasiuk/2009/07/03/edmpass-july-meeting/&amp;title=EDMPASS+%26%238211%3B+July+Meeting" title="Post to StumbleUpon"><img class="nothumb" src="http://benchmarkitconsulting.com/wp-content/plugins/tweet-this/icons/tt-su-big4.png" alt="Post to StumbleUpon" /></a></p>]]></content:encoded>
			<wfw:commentRss>http://benchmarkitconsulting.com/colin-stasiuk/2009/07/03/edmpass-july-meeting/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Running SSIS Packages &#8211; Security</title>
		<link>http://benchmarkitconsulting.com/colin-stasiuk/2009/05/01/running-ssis-packages-security/</link>
		<comments>http://benchmarkitconsulting.com/colin-stasiuk/2009/05/01/running-ssis-packages-security/#comments</comments>
		<pubDate>Fri, 01 May 2009 10:00:25 +0000</pubDate>
		<dc:creator>Colin Stasiuk</dc:creator>
				<category><![CDATA[Benchmark IT Consulting]]></category>
		<category><![CDATA[Colin Stasiuk]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[Integration Services]]></category>
		<category><![CDATA[SSIS]]></category>
		<category><![CDATA[SSIS Packages]]></category>

		<guid isPermaLink="false">http://benchmarkitconsulting.com/?p=684</guid>
		<description><![CDATA[So as most of my blog articles this post is inspired by an email I received asking for permissions to run SSIS packages.  In SQL Server 2005 there are 3 Database Roles in the msdb system database: MSDN Integration Services Roles 2005 Role Read action Write action db_dtsadmin Enumerate own packages. Import packages. or Enumerate all [...]]]></description>
			<content:encoded><![CDATA[<p>So as most of my blog articles this post is inspired by an email I received asking for permissions to run SSIS packages. </p>
<p>In SQL Server 2005 there are 3 Database Roles in the msdb system database:</p>
<p><a href="http://msdn.microsoft.com/en-us/library/ms141053(SQL.90).aspx" target="_blank">MSDN Integration Services Roles 2005</a></p>
<table style="width: 336pt; border-collapse: collapse;" border="0" cellspacing="0" cellpadding="0" width="448">
<colgroup span="1">
<col style="width: 86pt; mso-width-source: userset; mso-width-alt: 4205;" span="1" width="115"></col>
<col style="width: 137pt; mso-width-source: userset; mso-width-alt: 6692;" span="1" width="183"></col>
<col style="width: 113pt; mso-width-source: userset; mso-width-alt: 5485;" span="1" width="150"></col>
</colgroup>
<tbody>
<tr style="height: 13.5pt;" height="18">
<td class="xl33" style="border-bottom: #ccccff 1pt solid; border-left: silver 1pt solid; background-color: silver; width: 86pt; height: 13.5pt; border-top: silver 1pt solid; border-right: #d4d0c8;" width="115" height="18"><span style="color: #000080; font-size: x-small;"><strong>Role</strong></span></td>
<td class="xl34" style="border-bottom: #ccccff 1pt solid; border-left: #d4d0c8; background-color: silver; width: 137pt; border-top: silver 1pt solid; border-right: #d4d0c8;" width="183"><span style="color: #000080; font-size: x-small;"><strong>Read action</strong></span></td>
<td class="xl35" style="border-bottom: #ccccff 1pt solid; border-left: #d4d0c8; background-color: silver; width: 113pt; border-top: silver 1pt solid; border-right: silver 1pt solid;" width="150"><span style="color: #000080; font-size: x-small;"><strong>Write action</strong></span></td>
</tr>
<tr style="height: 12.75pt;" height="17">
<td class="xl24" style="border-bottom: #d4d0c8; border-left: silver 1pt solid; background-color: white; width: 86pt; height: 12.75pt; border-top: silver 1pt solid; border-right: #ccffcc 1pt solid;" width="115" height="17"><strong><span style="font-size: x-small;">db_dtsadmin</span></strong></td>
<td class="xl29" style="border-bottom: #d4d0c8; border-left: silver 1pt solid; background-color: white; width: 137pt; border-top: silver 1pt solid; border-right: #ccffcc 1pt solid;" width="183"><span style="font-size: x-small;">Enumerate own packages.</span></td>
<td class="xl36" style="border-bottom: #d4d0c8; border-left: silver 1pt solid; background-color: white; width: 113pt; border-top: silver 1pt solid; border-right: silver 1pt solid;" width="150"><span style="font-size: x-small;">Import packages.</span></td>
</tr>
<tr style="height: 12.75pt;" height="17">
<td class="xl25" style="border-bottom: #d4d0c8; border-left: silver 1pt solid; background-color: white; width: 86pt; height: 12.75pt; border-top: #d4d0c8; border-right: #ccffcc 1pt solid;" width="115" height="17"><span style="font-size: x-small;">or</span></td>
<td class="xl25" style="border-bottom: #d4d0c8; border-left: silver 1pt solid; background-color: white; width: 137pt; border-top: #d4d0c8; border-right: #ccffcc 1pt solid;" width="183"><span style="font-size: x-small;">Enumerate all packages.</span></td>
<td class="xl37" style="border-bottom: #d4d0c8; border-left: silver 1pt solid; background-color: white; width: 113pt; border-top: #d4d0c8; border-right: silver 1pt solid;" width="150"><span style="font-size: x-small;">Delete own packages.</span></td>
</tr>
<tr style="height: 12.75pt;" height="17">
<td class="xl26" style="border-bottom: #d4d0c8; border-left: silver 1pt solid; background-color: white; width: 86pt; height: 12.75pt; border-top: #d4d0c8; border-right: #ccffcc 1pt solid;" width="115" height="17"><strong><span style="font-size: x-small;">sysadmin</span></strong></td>
<td class="xl25" style="border-bottom: #d4d0c8; border-left: silver 1pt solid; background-color: white; width: 137pt; border-top: #d4d0c8; border-right: #ccffcc 1pt solid;" width="183"><span style="font-size: x-small;">View own packages.</span></td>
<td class="xl37" style="border-bottom: #d4d0c8; border-left: silver 1pt solid; background-color: white; width: 113pt; border-top: #d4d0c8; border-right: silver 1pt solid;" width="150"><span style="font-size: x-small;">Delete all packages.</span></td>
</tr>
<tr style="height: 22.5pt;" height="30">
<td class="xl27" style="border-bottom: #d4d0c8; border-left: silver 1pt solid; background-color: white; width: 86pt; height: 22.5pt; border-top: #d4d0c8; border-right: #ccffcc 1pt solid;" width="115" height="30"><span style="font-family: Arial; font-size: x-small;"> </span></td>
<td class="xl25" style="border-bottom: #d4d0c8; border-left: silver 1pt solid; background-color: white; width: 137pt; border-top: #d4d0c8; border-right: #ccffcc 1pt solid;" width="183"><span style="font-size: x-small;">View all packages.</span></td>
<td class="xl37" style="border-bottom: #d4d0c8; border-left: silver 1pt solid; background-color: white; width: 113pt; border-top: #d4d0c8; border-right: silver 1pt solid;" width="150"><span style="font-size: x-small;">Change own package roles.</span></td>
</tr>
<tr style="height: 22.5pt;" height="30">
<td class="xl27" style="border-bottom: #d4d0c8; border-left: silver 1pt solid; background-color: white; width: 86pt; height: 22.5pt; border-top: #d4d0c8; border-right: #ccffcc 1pt solid;" width="115" height="30"><span style="font-family: Arial; font-size: x-small;"> </span></td>
<td class="xl25" style="border-bottom: #d4d0c8; border-left: silver 1pt solid; background-color: white; width: 137pt; border-top: #d4d0c8; border-right: #ccffcc 1pt solid;" width="183"><span style="font-size: x-small;">Execute own packages.</span></td>
<td class="xl37" style="border-bottom: #d4d0c8; border-left: silver 1pt solid; background-color: white; width: 113pt; border-top: #d4d0c8; border-right: silver 1pt solid;" width="150"><span style="font-size: x-small;">Change all package roles.</span></td>
</tr>
<tr style="height: 12.75pt;" height="17">
<td class="xl27" style="border-bottom: #d4d0c8; border-left: silver 1pt solid; background-color: white; width: 86pt; height: 12.75pt; border-top: #d4d0c8; border-right: #ccffcc 1pt solid;" width="115" height="17"><span style="font-family: Arial; font-size: x-small;"> </span></td>
<td class="xl25" style="border-bottom: #d4d0c8; border-left: silver 1pt solid; background-color: white; width: 137pt; border-top: #d4d0c8; border-right: #ccffcc 1pt solid;" width="183"><span style="font-size: x-small;">Execute all packages.</span></td>
<td class="xl38" style="border-bottom: #d4d0c8; border-left: silver 1pt solid; background-color: white; width: 113pt; border-top: #d4d0c8; border-right: silver 1pt solid;" width="150"><span style="font-family: Arial; font-size: x-small;"> </span></td>
</tr>
<tr style="height: 12.75pt;" height="17">
<td class="xl27" style="border-bottom: #d4d0c8; border-left: silver 1pt solid; background-color: white; width: 86pt; height: 12.75pt; border-top: #d4d0c8; border-right: #ccffcc 1pt solid;" width="115" height="17"><span style="font-family: Arial; font-size: x-small;"> </span></td>
<td class="xl25" style="border-bottom: #d4d0c8; border-left: silver 1pt solid; background-color: white; width: 137pt; border-top: #d4d0c8; border-right: #ccffcc 1pt solid;" width="183"><span style="font-size: x-small;">Export own packages.</span></td>
<td class="xl38" style="border-bottom: #d4d0c8; border-left: silver 1pt solid; background-color: white; width: 113pt; border-top: #d4d0c8; border-right: silver 1pt solid;" width="150"><span style="font-family: Arial; font-size: x-small;"> </span></td>
</tr>
<tr style="height: 12.75pt;" height="17">
<td class="xl27" style="border-bottom: #d4d0c8; border-left: silver 1pt solid; background-color: white; width: 86pt; height: 12.75pt; border-top: #d4d0c8; border-right: #ccffcc 1pt solid;" width="115" height="17"><span style="font-family: Arial; font-size: x-small;"> </span></td>
<td class="xl25" style="border-bottom: #d4d0c8; border-left: silver 1pt solid; background-color: white; width: 137pt; border-top: #d4d0c8; border-right: #ccffcc 1pt solid;" width="183"><span style="font-size: x-small;">Export all packages.</span></td>
<td class="xl38" style="border-bottom: #d4d0c8; border-left: silver 1pt solid; background-color: white; width: 113pt; border-top: #d4d0c8; border-right: silver 1pt solid;" width="150"><span style="font-family: Arial; font-size: x-small;"> </span></td>
</tr>
<tr style="height: 23.25pt;" height="31">
<td class="xl28" style="border-bottom: silver 1pt solid; border-left: silver 1pt solid; background-color: white; width: 86pt; height: 23.25pt; border-top: #d4d0c8; border-right: #ccffcc 1pt solid;" width="115" height="31"><span style="font-family: Arial; font-size: x-small;"> </span></td>
<td class="xl30" style="border-bottom: silver 1pt solid; border-left: silver 1pt solid; background-color: white; width: 137pt; border-top: #d4d0c8; border-right: #ccffcc 1pt solid;" width="183"><span style="font-size: x-small;">Execute all packages in SQL Server Agent.</span></td>
<td class="xl39" style="border-bottom: silver 1pt solid; border-left: silver 1pt solid; background-color: white; width: 113pt; border-top: #d4d0c8; border-right: silver 1pt solid;" width="150"><span style="font-family: Arial; font-size: x-small;"> </span></td>
</tr>
<tr style="height: 12.75pt;" height="17">
<td class="xl41" style="border-bottom: silver 1pt solid; border-left: silver 1pt solid; background-color: white; width: 86pt; height: 74.25pt; border-top: silver; border-right: silver 1pt solid;" rowspan="5" width="115" height="99"><strong><span style="font-size: x-small;">db_dtsltduser</span></strong></td>
<td class="xl29" style="border-bottom: #d4d0c8; border-left: silver; background-color: white; width: 137pt; border-top: silver; border-right: #ccffcc 1pt solid;" width="183"><span style="font-size: x-small;">Enumerate own packages.</span></td>
<td class="xl36" style="border-bottom: #d4d0c8; border-left: silver 1pt solid; background-color: white; width: 113pt; border-top: silver; border-right: silver 1pt solid;" width="150"><span style="font-size: x-small;">Import packages.</span></td>
</tr>
<tr style="height: 12.75pt;" height="17">
<td class="xl25" style="border-bottom: #d4d0c8; border-left: silver; background-color: white; width: 137pt; height: 12.75pt; border-top: #d4d0c8; border-right: #ccffcc 1pt solid;" width="183" height="17"><span style="font-size: x-small;">Enumerate all packages.</span></td>
<td class="xl37" style="border-bottom: #d4d0c8; border-left: silver 1pt solid; background-color: white; width: 113pt; border-top: #d4d0c8; border-right: silver 1pt solid;" width="150"><span style="font-size: x-small;">Delete own packages.</span></td>
</tr>
<tr style="height: 22.5pt;" height="30">
<td class="xl25" style="border-bottom: #d4d0c8; border-left: silver; background-color: white; width: 137pt; height: 22.5pt; border-top: #d4d0c8; border-right: #ccffcc 1pt solid;" width="183" height="30"><span style="font-size: x-small;">View own packages.</span></td>
<td class="xl37" style="border-bottom: #d4d0c8; border-left: silver 1pt solid; background-color: white; width: 113pt; border-top: #d4d0c8; border-right: silver 1pt solid;" width="150"><span style="font-size: x-small;">Change own package roles.</span></td>
</tr>
<tr style="height: 12.75pt;" height="17">
<td class="xl25" style="border-bottom: #d4d0c8; border-left: silver; background-color: white; width: 137pt; height: 12.75pt; border-top: #d4d0c8; border-right: #ccffcc 1pt solid;" width="183" height="17"><span style="font-size: x-small;">Execute own packages.</span></td>
<td class="xl38" style="border-bottom: #d4d0c8; border-left: silver 1pt solid; background-color: white; width: 113pt; border-top: #d4d0c8; border-right: silver 1pt solid;" width="150"><span style="font-family: Arial; font-size: x-small;"> </span></td>
</tr>
<tr style="height: 13.5pt;" height="18">
<td class="xl30" style="border-bottom: silver 1pt solid; border-left: silver; background-color: white; width: 137pt; height: 13.5pt; border-top: #d4d0c8; border-right: #ccffcc 1pt solid;" width="183" height="18"><span style="font-size: x-small;">Export own packages.</span></td>
<td class="xl39" style="border-bottom: silver 1pt solid; border-left: silver 1pt solid; background-color: white; width: 113pt; border-top: #d4d0c8; border-right: silver 1pt solid;" width="150"><span style="font-family: Arial; font-size: x-small;"> </span></td>
</tr>
<tr style="height: 12.75pt;" height="17">
<td class="xl41" style="border-bottom: silver 1pt solid; border-left: silver 1pt solid; background-color: white; width: 86pt; height: 74.25pt; border-top: silver; border-right: silver 1pt solid;" rowspan="5" width="115" height="99"><strong><span style="font-size: x-small;">db_dtsoperator</span></strong></td>
<td class="xl29" style="border-bottom: #d4d0c8; border-left: silver; background-color: white; width: 137pt; border-top: silver; border-right: #ccffcc 1pt solid;" width="183"><span style="font-size: x-small;">Enumerate all packages.</span></td>
<td class="xl36" style="border-bottom: silver 1pt solid; border-left: silver 1pt solid; background-color: white; width: 113pt; border-top: silver; border-right: silver 1pt solid;" rowspan="5" width="150"><span style="font-size: x-small;">None</span></td>
</tr>
<tr style="height: 12.75pt;" height="17">
<td class="xl25" style="border-bottom: #d4d0c8; border-left: silver; background-color: white; width: 137pt; height: 12.75pt; border-top: #d4d0c8; border-right: #ccffcc 1pt solid;" width="183" height="17"><span style="font-size: x-small;">View all packages.</span></td>
</tr>
<tr style="height: 12.75pt;" height="17">
<td class="xl25" style="border-bottom: #d4d0c8; border-left: silver; background-color: white; width: 137pt; height: 12.75pt; border-top: #d4d0c8; border-right: #ccffcc 1pt solid;" width="183" height="17"><span style="font-size: x-small;">Execute all packages.</span></td>
</tr>
<tr style="height: 12.75pt;" height="17">
<td class="xl25" style="border-bottom: #d4d0c8; border-left: silver; background-color: white; width: 137pt; height: 12.75pt; border-top: #d4d0c8; border-right: #ccffcc 1pt solid;" width="183" height="17"><span style="font-size: x-small;">Export all packages.</span></td>
</tr>
<tr style="height: 23.25pt;" height="31">
<td class="xl30" style="border-bottom: silver 1pt solid; border-left: silver; background-color: white; width: 137pt; height: 23.25pt; border-top: #d4d0c8; border-right: #ccffcc 1pt solid;" width="183" height="31"><span style="font-size: x-small;">Execute all packages in SQL Server Agent.</span></td>
</tr>
<tr style="height: 23.25pt;" height="31">
<td class="xl31" style="border-bottom: silver 1pt solid; border-left: silver 1pt solid; background-color: white; width: 86pt; height: 23.25pt; border-top: silver; border-right: #ccffcc 1pt solid;" width="115" height="31"><strong><span style="font-size: x-small;">Windows administrators</span></strong></td>
<td class="xl32" style="border-bottom: silver 1pt solid; border-left: silver 1pt solid; background-color: white; width: 137pt; border-top: silver; border-right: #ccffcc 1pt solid;" width="183"><span style="font-size: x-small;">View execution details of all running packages.</span></td>
<td class="xl40" style="border-bottom: silver 1pt solid; border-left: silver 1pt solid; background-color: white; width: 113pt; border-top: silver; border-right: silver 1pt solid;" width="150"><span style="font-size: x-small;">Stop all currently running packages. </span></td>
</tr>
</tbody>
</table>
<p> <br />
In SQL Server 2008 these 3 Database Roles are now named db_ssisltduser, db_ssisoperator, and db_ssisadmin</p>
<p><a href="http://msdn.microsoft.com/en-us/library/ms141053.aspx" target="_blank"> MSDN Integration Services Roles (2008)</a></p>
<table style="width: 336pt; border-collapse: collapse;" border="0" cellspacing="0" cellpadding="0" width="448">
<colgroup span="1">
<col style="width: 86pt; mso-width-source: userset; mso-width-alt: 4205;" span="1" width="115"></col>
<col style="width: 137pt; mso-width-source: userset; mso-width-alt: 6692;" span="1" width="183"></col>
<col style="width: 113pt; mso-width-source: userset; mso-width-alt: 5485;" span="1" width="150"></col>
</colgroup>
<tbody>
<tr style="height: 13.5pt;" height="18">
<td class="xl33" style="border-bottom: #ccccff 1pt solid; border-left: silver 1pt solid; background-color: silver; width: 86pt; height: 13.5pt; border-top: silver 1pt solid; border-right: #d4d0c8;" width="115" height="18"><span style="color: #000080; font-size: x-small;"><strong>Role</strong></span></td>
<td class="xl34" style="border-bottom: #ccccff 1pt solid; border-left: #d4d0c8; background-color: silver; width: 137pt; border-top: silver 1pt solid; border-right: #d4d0c8;" width="183"><span style="color: #000080; font-size: x-small;"><strong>Read action</strong></span></td>
<td class="xl35" style="border-bottom: #ccccff 1pt solid; border-left: #d4d0c8; background-color: silver; width: 113pt; border-top: silver 1pt solid; border-right: silver 1pt solid;" width="150"><span style="color: #000080; font-size: x-small;"><strong>Write action</strong></span></td>
</tr>
<tr style="height: 12.75pt;" height="17">
<td class="xl24" style="border-bottom: #d4d0c8; border-left: silver 1pt solid; background-color: white; width: 86pt; height: 12.75pt; border-top: silver 1pt solid; border-right: #ccffcc 1pt solid;" width="115" height="17"><strong><span style="font-size: x-small;">db_ssisadmin</span></strong></td>
<td class="xl29" style="border-bottom: #d4d0c8; border-left: silver 1pt solid; background-color: white; width: 137pt; border-top: silver 1pt solid; border-right: #ccffcc 1pt solid;" width="183"><span style="font-size: x-small;">Enumerate own packages.</span></td>
<td class="xl36" style="border-bottom: #d4d0c8; border-left: silver 1pt solid; background-color: white; width: 113pt; border-top: silver 1pt solid; border-right: silver 1pt solid;" width="150"><span style="font-size: x-small;">Import packages.</span></td>
</tr>
<tr style="height: 12.75pt;" height="17">
<td class="xl25" style="border-bottom: #d4d0c8; border-left: silver 1pt solid; background-color: white; width: 86pt; height: 12.75pt; border-top: #d4d0c8; border-right: #ccffcc 1pt solid;" width="115" height="17"><span style="font-size: x-small;">or</span></td>
<td class="xl25" style="border-bottom: #d4d0c8; border-left: silver 1pt solid; background-color: white; width: 137pt; border-top: #d4d0c8; border-right: #ccffcc 1pt solid;" width="183"><span style="font-size: x-small;">Enumerate all packages.</span></td>
<td class="xl37" style="border-bottom: #d4d0c8; border-left: silver 1pt solid; background-color: white; width: 113pt; border-top: #d4d0c8; border-right: silver 1pt solid;" width="150"><span style="font-size: x-small;">Delete own packages.</span></td>
</tr>
<tr style="height: 12.75pt;" height="17">
<td class="xl26" style="border-bottom: #d4d0c8; border-left: silver 1pt solid; background-color: white; width: 86pt; height: 12.75pt; border-top: #d4d0c8; border-right: #ccffcc 1pt solid;" width="115" height="17"><strong><span style="font-size: x-small;">sysadmin</span></strong></td>
<td class="xl25" style="border-bottom: #d4d0c8; border-left: silver 1pt solid; background-color: white; width: 137pt; border-top: #d4d0c8; border-right: #ccffcc 1pt solid;" width="183"><span style="font-size: x-small;">View own packages.</span></td>
<td class="xl37" style="border-bottom: #d4d0c8; border-left: silver 1pt solid; background-color: white; width: 113pt; border-top: #d4d0c8; border-right: silver 1pt solid;" width="150"><span style="font-size: x-small;">Delete all packages.</span></td>
</tr>
<tr style="height: 22.5pt;" height="30">
<td class="xl27" style="border-bottom: #d4d0c8; border-left: silver 1pt solid; background-color: white; width: 86pt; height: 22.5pt; border-top: #d4d0c8; border-right: #ccffcc 1pt solid;" width="115" height="30"><span style="font-family: Arial; font-size: x-small;"> </span></td>
<td class="xl25" style="border-bottom: #d4d0c8; border-left: silver 1pt solid; background-color: white; width: 137pt; border-top: #d4d0c8; border-right: #ccffcc 1pt solid;" width="183"><span style="font-size: x-small;">View all packages.</span></td>
<td class="xl37" style="border-bottom: #d4d0c8; border-left: silver 1pt solid; background-color: white; width: 113pt; border-top: #d4d0c8; border-right: silver 1pt solid;" width="150"><span style="font-size: x-small;">Change own package roles.</span></td>
</tr>
<tr style="height: 22.5pt;" height="30">
<td class="xl27" style="border-bottom: #d4d0c8; border-left: silver 1pt solid; background-color: white; width: 86pt; height: 22.5pt; border-top: #d4d0c8; border-right: #ccffcc 1pt solid;" width="115" height="30"><span style="font-family: Arial; font-size: x-small;"> </span></td>
<td class="xl25" style="border-bottom: #d4d0c8; border-left: silver 1pt solid; background-color: white; width: 137pt; border-top: #d4d0c8; border-right: #ccffcc 1pt solid;" width="183"><span style="font-size: x-small;">Execute own packages.</span></td>
<td class="xl37" style="border-bottom: #d4d0c8; border-left: silver 1pt solid; background-color: white; width: 113pt; border-top: #d4d0c8; border-right: silver 1pt solid;" width="150"><span style="font-size: x-small;">Change all package roles.</span></td>
</tr>
<tr style="height: 12.75pt;" height="17">
<td class="xl27" style="border-bottom: #d4d0c8; border-left: silver 1pt solid; background-color: white; width: 86pt; height: 12.75pt; border-top: #d4d0c8; border-right: #ccffcc 1pt solid;" width="115" height="17"><span style="font-family: Arial; font-size: x-small;"> </span></td>
<td class="xl25" style="border-bottom: #d4d0c8; border-left: silver 1pt solid; background-color: white; width: 137pt; border-top: #d4d0c8; border-right: #ccffcc 1pt solid;" width="183"><span style="font-size: x-small;">Execute all packages.</span></td>
<td class="xl37" style="border-bottom: #d4d0c8; border-left: silver 1pt solid; background-color: white; width: 113pt; height: 12.75pt; border-top: #d4d0c8; border-right: silver 1pt solid;" width="150" height="17"><span style="font-size: x-small;">Bitmap </span></td>
</tr>
<tr style="height: 12.75pt;" height="17">
<td class="xl27" style="border-bottom: #d4d0c8; border-left: silver 1pt solid; background-color: white; width: 86pt; height: 12.75pt; border-top: #d4d0c8; border-right: #ccffcc 1pt solid;" width="115" height="17"><span style="font-family: Arial; font-size: x-small;"> </span></td>
<td class="xl25" style="border-bottom: #d4d0c8; border-left: silver 1pt solid; background-color: white; width: 137pt; border-top: #d4d0c8; border-right: #ccffcc 1pt solid;" width="183"><span style="font-size: x-small;">Export own packages.</span></td>
<td class="xl37" style="border-bottom: #d4d0c8; border-left: silver 1pt solid; background-color: white; width: 113pt; border-top: #d4d0c8; border-right: silver 1pt solid;" width="150"><span style="font-size: x-small;"> </span></td>
</tr>
<tr style="height: 12.75pt;" height="17">
<td class="xl27" style="border-bottom: #d4d0c8; border-left: silver 1pt solid; background-color: white; width: 86pt; height: 12.75pt; border-top: #d4d0c8; border-right: #ccffcc 1pt solid;" width="115" height="17"><span style="font-family: Arial; font-size: x-small;"> </span></td>
<td class="xl25" style="border-bottom: #d4d0c8; border-left: silver 1pt solid; background-color: white; width: 137pt; border-top: #d4d0c8; border-right: #ccffcc 1pt solid;" width="183"><span style="font-size: x-small;">Export all packages.</span></td>
<td class="xl37" style="border-bottom: #d4d0c8; border-left: silver 1pt solid; background-color: white; width: 113pt; border-top: #d4d0c8; border-right: silver 1pt solid;" width="150"><span style="font-size: x-small;"> </span></td>
</tr>
<tr style="height: 23.25pt;" height="31">
<td class="xl28" style="border-bottom: silver 1pt solid; border-left: silver 1pt solid; background-color: white; width: 86pt; height: 23.25pt; border-top: #d4d0c8; border-right: #ccffcc 1pt solid;" width="115" height="31"><span style="font-family: Arial; font-size: x-small;"> </span></td>
<td class="xl30" style="border-bottom: silver 1pt solid; border-left: silver 1pt solid; background-color: white; width: 137pt; border-top: #d4d0c8; border-right: #ccffcc 1pt solid;" width="183"><span style="font-size: x-small;">Execute all packages in SQL Server Agent.</span></td>
<td class="xl44" style="border-bottom: silver 1pt solid; border-left: silver 1pt solid; background-color: white; width: 113pt; border-top: #d4d0c8; border-right: silver 1pt solid;" width="150"><span style="font-size: x-small;"> </span></td>
</tr>
<tr style="height: 12.75pt;" height="17">
<td class="xl41" style="border-bottom: silver 1pt solid; border-left: silver 1pt solid; background-color: white; width: 86pt; height: 74.25pt; border-top: silver; border-right: silver 1pt solid;" rowspan="5" width="115" height="99"><strong><span style="font-size: x-small;">db_ssisltduser</span></strong></td>
<td class="xl29" style="border-bottom: #d4d0c8; border-left: silver; background-color: white; width: 137pt; border-top: silver; border-right: #ccffcc 1pt solid;" width="183"><span style="font-size: x-small;">Enumerate own packages.</span></td>
<td class="xl36" style="border-bottom: #d4d0c8; border-left: silver 1pt solid; background-color: white; width: 113pt; border-top: silver; border-right: silver 1pt solid;" width="150"><span style="font-size: x-small;">Import packages.</span></td>
</tr>
<tr style="height: 12.75pt;" height="17">
<td class="xl25" style="border-bottom: #d4d0c8; border-left: silver; background-color: white; width: 137pt; height: 12.75pt; border-top: #d4d0c8; border-right: #ccffcc 1pt solid;" width="183" height="17"><span style="font-size: x-small;">Enumerate all packages.</span></td>
<td class="xl37" style="border-bottom: #d4d0c8; border-left: silver 1pt solid; background-color: white; width: 113pt; border-top: #d4d0c8; border-right: silver 1pt solid;" width="150"><span style="font-size: x-small;">Delete own packages.</span></td>
</tr>
<tr style="height: 22.5pt;" height="30">
<td class="xl25" style="border-bottom: #d4d0c8; border-left: silver; background-color: white; width: 137pt; height: 22.5pt; border-top: #d4d0c8; border-right: #ccffcc 1pt solid;" width="183" height="30"><span style="font-size: x-small;">View own packages.</span></td>
<td class="xl37" style="border-bottom: #d4d0c8; border-left: silver 1pt solid; background-color: white; width: 113pt; border-top: #d4d0c8; border-right: silver 1pt solid;" width="150"><span style="font-size: x-small;">Change own package roles.</span></td>
</tr>
<tr style="height: 12.75pt;" height="17">
<td class="xl25" style="border-bottom: #d4d0c8; border-left: silver; background-color: white; width: 137pt; height: 12.75pt; border-top: #d4d0c8; border-right: #ccffcc 1pt solid;" width="183" height="17"><span style="font-size: x-small;">Execute own packages.</span></td>
<td class="xl38" style="border-bottom: #d4d0c8; border-left: silver 1pt solid; background-color: white; width: 113pt; border-top: #d4d0c8; border-right: silver 1pt solid;" width="150"><span style="font-family: Arial; font-size: x-small;"> </span></td>
</tr>
<tr style="height: 13.5pt;" height="18">
<td class="xl30" style="border-bottom: silver 1pt solid; border-left: silver; background-color: white; width: 137pt; height: 13.5pt; border-top: #d4d0c8; border-right: #ccffcc 1pt solid;" width="183" height="18"><span style="font-size: x-small;">Export own packages.</span></td>
<td class="xl39" style="border-bottom: silver 1pt solid; border-left: silver 1pt solid; background-color: white; width: 113pt; border-top: #d4d0c8; border-right: silver 1pt solid;" width="150"><span style="font-family: Arial; font-size: x-small;"> </span></td>
</tr>
<tr style="height: 12.75pt;" height="17">
<td class="xl41" style="border-bottom: silver 1pt solid; border-left: silver 1pt solid; background-color: white; width: 86pt; height: 74.25pt; border-top: silver; border-right: silver 1pt solid;" rowspan="5" width="115" height="99"><strong><span style="font-size: x-small;">db_ssisoperator</span></strong></td>
<td class="xl29" style="border-bottom: #d4d0c8; border-left: silver; background-color: white; width: 137pt; border-top: silver; border-right: #ccffcc 1pt solid;" width="183"><span style="font-size: x-small;">Enumerate all packages.</span></td>
<td class="xl36" style="border-bottom: silver 1pt solid; border-left: silver 1pt solid; background-color: white; width: 113pt; border-top: silver; border-right: silver 1pt solid;" rowspan="5" width="150"><span style="font-size: x-small;">None</span></td>
</tr>
<tr style="height: 12.75pt;" height="17">
<td class="xl25" style="border-bottom: #d4d0c8; border-left: silver; background-color: white; width: 137pt; height: 12.75pt; border-top: #d4d0c8; border-right: #ccffcc 1pt solid;" width="183" height="17"><span style="font-size: x-small;">View all packages.</span></td>
</tr>
<tr style="height: 12.75pt;" height="17">
<td class="xl25" style="border-bottom: #d4d0c8; border-left: silver; background-color: white; width: 137pt; height: 12.75pt; border-top: #d4d0c8; border-right: #ccffcc 1pt solid;" width="183" height="17"><span style="font-size: x-small;">Execute all packages.</span></td>
</tr>
<tr style="height: 12.75pt;" height="17">
<td class="xl25" style="border-bottom: #d4d0c8; border-left: silver; background-color: white; width: 137pt; height: 12.75pt; border-top: #d4d0c8; border-right: #ccffcc 1pt solid;" width="183" height="17"><span style="font-size: x-small;">Export all packages.</span></td>
</tr>
<tr style="height: 23.25pt;" height="31">
<td class="xl30" style="border-bottom: silver 1pt solid; border-left: silver; background-color: white; width: 137pt; height: 23.25pt; border-top: #d4d0c8; border-right: #ccffcc 1pt solid;" width="183" height="31"><span style="font-size: x-small;">Execute all packages in SQL Server Agent.</span></td>
</tr>
<tr style="height: 23.25pt;" height="31">
<td class="xl31" style="border-bottom: silver 1pt solid; border-left: silver 1pt solid; background-color: white; width: 86pt; height: 23.25pt; border-top: silver; border-right: #ccffcc 1pt solid;" width="115" height="31"><strong><span style="font-size: x-small;">Windows administrators</span></strong></td>
<td class="xl32" style="border-bottom: silver 1pt solid; border-left: silver 1pt solid; background-color: white; width: 137pt; border-top: silver; border-right: #ccffcc 1pt solid;" width="183"><span style="font-size: x-small;">View execution details of all running packages.</span></td>
<td class="xl40" style="border-bottom: silver 1pt solid; border-left: silver 1pt solid; background-color: white; width: 113pt; border-top: silver; border-right: silver 1pt solid;" width="150"><span style="font-size: x-small;">Stop all currently running packages </span></td>
</tr>
</tbody>
</table>
<p>So in this particular case granting the user db_dtsltduser was enough to fullfill their request as they only needed the ability to run packages that they created.  As always with security/permissions make sure you only grant what&#8217;s required instead of going to easier route of using an &#8220;admin&#8221; type of role.</p>
<p>Enjoy!!</p>
<p><span><a href="http://benchmarkitconsulting.com" target="_blank"><img class="alignnone size-full wp-image-402" title="benchmark_sm" src="http://benchmarkitconsulting.com/wp-content/uploads/2009/02/benchmark_sm.jpg" alt="" width="157" height="74" /></a><a href="http://sqlserverpedia.com/wiki/Editors#Colin_Stasiuk" target="_blank"><img src="http://sqlserverpedia.com/badges/SQLServerPedia_Badge_Blogger.jpg" alt="" width="120" height="60" /> </a></span></p>
<p align="left"><a class="tt" href="http://twitter.com/home/?status=Running+SSIS+Packages+%26%238211%3B+Security+http://tinyurl.com/decb8d" title="Post to Twitter"><img class="nothumb" src="http://benchmarkitconsulting.com/wp-content/plugins/tweet-this/icons/tt-twitter-big4.png" alt="Post to Twitter" /></a> <a class="tt" href="http://delicious.com/post?url=http://benchmarkitconsulting.com/colin-stasiuk/2009/05/01/running-ssis-packages-security/&amp;title=Running+SSIS+Packages+%26%238211%3B+Security" title="Post to Delicious"><img class="nothumb" src="http://benchmarkitconsulting.com/wp-content/plugins/tweet-this/icons/tt-delicious-big4.png" alt="Post to Delicious" /></a> <a class="tt" href="http://digg.com/submit?url=http://benchmarkitconsulting.com/colin-stasiuk/2009/05/01/running-ssis-packages-security/&amp;title=Running+SSIS+Packages+%26%238211%3B+Security" title="Post to Digg"><img class="nothumb" src="http://benchmarkitconsulting.com/wp-content/plugins/tweet-this/icons/tt-digg-big4.png" alt="Post to Digg" /></a> <a class="tt" href="http://stumbleupon.com/submit?url=http://benchmarkitconsulting.com/colin-stasiuk/2009/05/01/running-ssis-packages-security/&amp;title=Running+SSIS+Packages+%26%238211%3B+Security" title="Post to StumbleUpon"><img class="nothumb" src="http://benchmarkitconsulting.com/wp-content/plugins/tweet-this/icons/tt-su-big4.png" alt="Post to StumbleUpon" /></a></p>]]></content:encoded>
			<wfw:commentRss>http://benchmarkitconsulting.com/colin-stasiuk/2009/05/01/running-ssis-packages-security/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Server Role Audit &#8211; a quick and dirty script</title>
		<link>http://benchmarkitconsulting.com/colin-stasiuk/2009/04/28/server-role-audit-a-quick-and-dirty-script/</link>
		<comments>http://benchmarkitconsulting.com/colin-stasiuk/2009/04/28/server-role-audit-a-quick-and-dirty-script/#comments</comments>
		<pubDate>Tue, 28 Apr 2009 15:23:14 +0000</pubDate>
		<dc:creator>Colin Stasiuk</dc:creator>
				<category><![CDATA[Benchmark IT Consulting]]></category>
		<category><![CDATA[Colin Stasiuk]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[Audit]]></category>
		<category><![CDATA[role]]></category>
		<category><![CDATA[server]]></category>

		<guid isPermaLink="false">http://benchmarkitconsulting.com/?p=667</guid>
		<description><![CDATA[Every now and again I like to run a quick audit of the SQL Servers I support and ensure that logins do not have any elevated permissions on a server. With properly auditing and tracking you should be able to identify any problems when they happen but it doesn&#39;t hurt to give the server(s) a [...]]]></description>
			<content:encoded><![CDATA[<p>Every now and again I like to run a quick audit of the SQL Servers I support and ensure that logins do not have any elevated permissions on a server.  With properly auditing and tracking you should be able to identify any problems when they happen but it doesn&#39;t hurt to give the server(s) a clean sweep to make sure that nothing was missed or over looked.  Below is a script that will list all the logins and cross tab that with the server roles within SQL Server.  If a user is a member of a server role it will be marked with an &#8220;X&#8221;.</p>
<p>Hint: Using SQL Server 2008&#8242;s <a href="http://sqlserverpedia.com/wiki/Central_Management_Server">Central Management Servers</a> will allow you to get this &#8220;snapshot&#8221; for all your servers at once</p>
<p><code style="font-size: 12px;"><span style="color: #0000ff;">SELECT<br />
</span><span style="color: #434343;">@@SERVERNAME </span><span style="color: #0000ff;">AS </span><span style="color: #ff0000;">&#39;InstanceName&#39;</span><span style="color: #808080;">, </span><span style="color: #000000;">name </span><span style="color: #0000ff;">AS </span><span style="color: #000000;">Login</span><span style="color: #808080;">,<br />
</span><span style="color: #000000;">sysadmin </span><span style="color: #0000ff;">=<br />
</span><span style="color: #ff00ff;">CASE<br />
</span><span style="color: #0000ff;">WHEN </span><span style="color: #000000;">sysadmin </span><span style="color: #0000ff;">= </span><span style="color: #000000;">1 </span><span style="color: #0000ff;">THEN </span><span style="color: #ff0000;">&#39;X&#39;<br />
</span><span style="color: #0000ff;">ELSE </span><span style="color: #ff0000;">&#39;&#39;<br />
</span><span style="color: #0000ff;">END</span><span style="color: #808080;">,<br />
</span><span style="color: #000000;">securityadmin </span><span style="color: #0000ff;">=<br />
</span><span style="color: #ff00ff;">CASE<br />
</span><span style="color: #0000ff;">WHEN </span><span style="color: #000000;">securityadmin </span><span style="color: #0000ff;">= </span><span style="color: #000000;">1 </span><span style="color: #0000ff;">THEN </span><span style="color: #ff0000;">&#39;X&#39;<br />
</span><span style="color: #0000ff;">ELSE </span><span style="color: #ff0000;">&#39;&#39;<br />
</span><span style="color: #0000ff;">END</span><span style="color: #808080;">,<br />
</span><span style="color: #000000;">serveradmin </span><span style="color: #0000ff;">=<br />
</span><span style="color: #ff00ff;">CASE<br />
</span><span style="color: #0000ff;">WHEN </span><span style="color: #000000;">serveradmin </span><span style="color: #0000ff;">= </span><span style="color: #000000;">1 </span><span style="color: #0000ff;">THEN </span><span style="color: #ff0000;">&#39;X&#39;<br />
</span><span style="color: #0000ff;">ELSE </span><span style="color: #ff0000;">&#39;&#39;<br />
</span><span style="color: #0000ff;">END</span><span style="color: #808080;">,<br />
</span><span style="color: #000000;">setupadmin </span><span style="color: #0000ff;">=<br />
</span><span style="color: #ff00ff;">CASE<br />
</span><span style="color: #0000ff;">WHEN </span><span style="color: #000000;">setupadmin </span><span style="color: #0000ff;">= </span><span style="color: #000000;">1 </span><span style="color: #0000ff;">THEN </span><span style="color: #ff0000;">&#39;X&#39;<br />
</span><span style="color: #0000ff;">ELSE </span><span style="color: #ff0000;">&#39;&#39;<br />
</span><span style="color: #0000ff;">END</span><span style="color: #808080;">,<br />
</span><span style="color: #000000;">processadmin </span><span style="color: #0000ff;">=<br />
</span><span style="color: #ff00ff;">CASE<br />
</span><span style="color: #0000ff;">WHEN </span><span style="color: #000000;">processadmin </span><span style="color: #0000ff;">= </span><span style="color: #000000;">1 </span><span style="color: #0000ff;">THEN </span><span style="color: #ff0000;">&#39;X&#39;<br />
</span><span style="color: #0000ff;">ELSE </span><span style="color: #ff0000;">&#39;&#39;<br />
</span><span style="color: #0000ff;">END</span><span style="color: #808080;">,<br />
</span><span style="color: #000000;">diskadmin </span><span style="color: #0000ff;">=<br />
</span><span style="color: #ff00ff;">CASE<br />
</span><span style="color: #0000ff;">WHEN </span><span style="color: #000000;">diskadmin </span><span style="color: #0000ff;">= </span><span style="color: #000000;">1 </span><span style="color: #0000ff;">THEN </span><span style="color: #ff0000;">&#39;X&#39;<br />
</span><span style="color: #0000ff;">ELSE </span><span style="color: #ff0000;">&#39;&#39;<br />
</span><span style="color: #0000ff;">END</span><span style="color: #808080;">,<br />
</span><span style="color: #000000;">dbcreator </span><span style="color: #0000ff;">=<br />
</span><span style="color: #ff00ff;">CASE<br />
</span><span style="color: #0000ff;">WHEN </span><span style="color: #000000;">dbcreator </span><span style="color: #0000ff;">= </span><span style="color: #000000;">1 </span><span style="color: #0000ff;">THEN </span><span style="color: #ff0000;">&#39;X&#39;<br />
</span><span style="color: #0000ff;">ELSE </span><span style="color: #ff0000;">&#39;&#39;<br />
</span><span style="color: #0000ff;">END</span><span style="color: #808080;">,<br />
</span><span style="color: #000000;">bulkadmin </span><span style="color: #0000ff;">=<br />
</span><span style="color: #ff00ff;">CASE<br />
</span><span style="color: #0000ff;">WHEN </span><span style="color: #000000;">bulkadmin </span><span style="color: #0000ff;">= </span><span style="color: #000000;">1 </span><span style="color: #0000ff;">THEN </span><span style="color: #ff0000;">&#39;X&#39;<br />
</span><span style="color: #0000ff;">ELSE </span><span style="color: #ff0000;">&#39;&#39;<br />
</span><span style="color: #0000ff;">END</span><span style="color: #808080;">,<br />
</span><span style="color: #ff00ff;">CONVERT</span><span style="color: #808080;">(</span><span style="color: #0000ff;">CHAR</span><span style="color: #808080;">(</span><span style="color: #000000;">16</span><span style="color: #808080;">),</span><span style="color: #000000;">createdate</span><span style="color: #808080;">,</span><span style="color: #000000;">121</span><span style="color: #808080;">) </span><span style="color: #0000ff;">AS </span><span style="color: #ff0000;">&#39;DateCreated&#39;<br />
</span><span style="color: #0000ff;">FROM MASTER</span><span style="color: #000000;">.dbo.syslogins<br />
</span><span style="color: #0000ff;">ORDER BY </span><span style="color: #000000;">NAME</span></code></p>
<p>Enjoy!!</p>
<p><span><a href="http://benchmarkitconsulting.com" target="_blank"><img class="alignnone size-full wp-image-402" title="benchmark_sm" src="http://benchmarkitconsulting.com/wp-content/uploads/2009/02/benchmark_sm.jpg" alt="" width="157" height="74" /></a><a href="http://sqlserverpedia.com/wiki/Editors#Colin_Stasiuk" target="_blank"><img src="http://sqlserverpedia.com/badges/SQLServerPedia_Badge_Blogger.jpg" alt="" width="120" height="60" /> </a></span></p>
<p align="left"><a class="tt" href="http://twitter.com/home/?status=Server+Role+Audit+%26%238211%3B+a+quick+and+dirty+script+http://tinyurl.com/cvnkar" title="Post to Twitter"><img class="nothumb" src="http://benchmarkitconsulting.com/wp-content/plugins/tweet-this/icons/tt-twitter-big4.png" alt="Post to Twitter" /></a> <a class="tt" href="http://delicious.com/post?url=http://benchmarkitconsulting.com/colin-stasiuk/2009/04/28/server-role-audit-a-quick-and-dirty-script/&amp;title=Server+Role+Audit+%26%238211%3B+a+quick+and+dirty+script" title="Post to Delicious"><img class="nothumb" src="http://benchmarkitconsulting.com/wp-content/plugins/tweet-this/icons/tt-delicious-big4.png" alt="Post to Delicious" /></a> <a class="tt" href="http://digg.com/submit?url=http://benchmarkitconsulting.com/colin-stasiuk/2009/04/28/server-role-audit-a-quick-and-dirty-script/&amp;title=Server+Role+Audit+%26%238211%3B+a+quick+and+dirty+script" title="Post to Digg"><img class="nothumb" src="http://benchmarkitconsulting.com/wp-content/plugins/tweet-this/icons/tt-digg-big4.png" alt="Post to Digg" /></a> <a class="tt" href="http://stumbleupon.com/submit?url=http://benchmarkitconsulting.com/colin-stasiuk/2009/04/28/server-role-audit-a-quick-and-dirty-script/&amp;title=Server+Role+Audit+%26%238211%3B+a+quick+and+dirty+script" title="Post to StumbleUpon"><img class="nothumb" src="http://benchmarkitconsulting.com/wp-content/plugins/tweet-this/icons/tt-su-big4.png" alt="Post to StumbleUpon" /></a></p>]]></content:encoded>
			<wfw:commentRss>http://benchmarkitconsulting.com/colin-stasiuk/2009/04/28/server-role-audit-a-quick-and-dirty-script/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Database Role Audit (alpha version)</title>
		<link>http://benchmarkitconsulting.com/colin-stasiuk/2009/02/10/database-role-audit-feedback-requested-pls/</link>
		<comments>http://benchmarkitconsulting.com/colin-stasiuk/2009/02/10/database-role-audit-feedback-requested-pls/#comments</comments>
		<pubDate>Tue, 10 Feb 2009 18:58:07 +0000</pubDate>
		<dc:creator>Colin Stasiuk</dc:creator>
				<category><![CDATA[Benchmark IT Consulting]]></category>
		<category><![CDATA[Colin Stasiuk]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[Audit]]></category>
		<category><![CDATA[Database Role]]></category>

		<guid isPermaLink="false">http://benchmarkitconsulting.com/?p=430</guid>
		<description><![CDATA[OK so this is kind of a &#8220;part 2&#8243; to a post I made a while back about doing a SQL Server Role Audit. I wanted to go to the next level down and do the same type of thing for all database roles (system and user). This is definitely an &#8220;alpha version&#8221; of the [...]]]></description>
			<content:encoded><![CDATA[<p>OK so this is kind of a &#8220;part 2&#8243; to a post I made a while back about doing a <a href="http://benchmarkitconsulting.com/colin-stasiuk/2008/11/06/server-role-audit/" target="_blank">SQL Server Role Audit</a>. I wanted to go to the next level down and do the same type of thing for all database roles (system and user). This is definitely an &#8220;alpha version&#8221; of the script. It&#8217;s meant to run in SQL 2005/2008 but still work on databases running in 80 Compatibility Mode.</p>
<p>I would LOVE some feedback/comments/suggestions/etc&#8230; what I would love even more is a link to a better script that does the same thing <img src='http://benchmarkitconsulting.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
<p>LOL remember this is v1 so I haven&#8217;t really gone back through it and made it &#8220;net worthy&#8221; but if you could give it a run, give me some feedback, etc it would be greatly appreciated <img src='http://benchmarkitconsulting.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p><code style="font-size: 11px;"><span style="color:blue">SET&nbsp;</span><span style="color:black">NOCOUNT&nbsp;</span><span style="color:blue">ON&nbsp; <br />DECLARE&nbsp;</span><span style="color:#434343">@DatabaseRoles&nbsp;</span><span style="color:blue">NVARCHAR</span><span style="color:gray">(</span><span style="color:blue">MAX</span><span style="color:gray">)&nbsp; <br /></span><span style="color:blue">DECLARE&nbsp;</span><span style="color:#434343">@SQLSTMT&nbsp;</span><span style="color:blue">NVARCHAR</span><span style="color:gray">(</span><span style="color:blue">MAX</span><span style="color:gray">)&nbsp; <br /></span><span style="color:blue">DECLARE&nbsp;</span><span style="color:#434343">@cmptlevel&nbsp;</span><span style="color:blue">INT&nbsp; </p>
<p>SELECT&nbsp;</span><span style="color:#434343">@cmptlevel&nbsp;</span><span style="color:blue">=&nbsp;</span><span style="color:gray">(</span><span style="color:blue">SELECT&nbsp;</span><span style="color:black">cmptlevel&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color:blue">FROM&nbsp;</span><span style="color:black">master.dbo.sysdatabases&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color:blue">WHERE&nbsp;</span><span style="color:black">dbid&nbsp;</span><span style="color:blue">=&nbsp;</span><span style="color:magenta">DB_ID</span><span style="color:gray">())&nbsp; </p>
<p></span><span style="color:blue">CREATE&nbsp;TABLE&nbsp;</span><span style="color:#434343">#DatabaseRoleMatrix</span><span style="color:gray">(&nbsp; <br />&nbsp;&nbsp;</span><span style="color:black">[DatabaseUserName]&nbsp;</span><span style="color:blue">VARCHAR</span><span style="color:gray">(</span><span style="color:black">256</span><span style="color:gray">), <br />&nbsp;&nbsp;</span><span style="color:black">[DatabaseUserType]&nbsp;</span><span style="color:blue">VARCHAR</span><span style="color:gray">(</span><span style="color:black">10</span><span style="color:gray">),&nbsp; <br />&nbsp;&nbsp;</span><span style="color:black">[DatabaseRoleName]&nbsp;</span><span style="color:blue">VARCHAR&nbsp;</span><span style="color:gray">(</span><span style="color:black">256</span><span style="color:gray">),&nbsp; <br />&nbsp;&nbsp;</span><span style="color:black">[RoleAccess]&nbsp;&nbsp;&nbsp;</span><span style="color:blue">CHAR</span><span style="color:gray">(</span><span style="color:black">1</span><span style="color:gray">))&nbsp; </p>
<p></span><span style="color:blue">INSERT&nbsp;INTO&nbsp;</span><span style="color:#434343">#DatabaseRoleMatrix</span><span style="color:gray">(</span><span style="color:black">[DatabaseUserName]</span><span style="color:gray">, <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color:black">[DatabaseUserType]</span><span style="color:gray">,&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color:black">[DatabaseRoleName]</span><span style="color:gray">,&nbsp;</span><span style="color:black">[RoleAccess]</span><span style="color:gray">)&nbsp; <br /></span><span style="color:blue">SELECT&nbsp;&nbsp;</span><span style="color:gray">NULL&nbsp;</span><span style="color:blue">AS&nbsp;</span><span style="color:red">&#39;DatabaseUserName&#39;</span><span style="color:gray">,&nbsp; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color:red">&#39;Role&#39;&nbsp;</span><span style="color:blue">AS&nbsp;</span><span style="color:red">&#39;DatabaseUserType&#39;</span><span style="color:gray">,&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color:black">name&nbsp;</span><span style="color:blue">AS&nbsp;</span><span style="color:red">&#39;DatabaseRoleName&#39;</span><span style="color:gray">,&nbsp;NULL&nbsp;</span><span style="color:blue">AS&nbsp;</span><span style="color:red">&#39;RoleAccess&#39;&nbsp; <br /></span><span style="color:blue">FROM&nbsp;</span><span style="color:black">dbo.sysusers&nbsp; <br /></span><span style="color:blue">WHERE&nbsp;</span><span style="color:black">issqlrole&nbsp;</span><span style="color:blue">=&nbsp;</span><span style="color:black">1&nbsp; <br /></span><span style="color:blue">UNION&nbsp;</span><span style="color:gray">ALL&nbsp; <br /></span><span style="color:blue">SELECT&nbsp;&nbsp;</span><span style="color:black">b.name&nbsp;</span><span style="color:blue">AS&nbsp;</span><span style="color:red">&#39;DatabaseUserName&#39;</span><span style="color:gray">,&nbsp; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color:magenta">CASE <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color:blue">WHEN&nbsp;</span><span style="color:black">b.issqlrole&nbsp;</span><span style="color:blue">=&nbsp;</span><span style="color:black">1&nbsp;</span><span style="color:blue">THEN&nbsp;</span><span style="color:red">&#39;Role&#39; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color:blue">ELSE&nbsp;&nbsp;</span><span style="color:red">&#39;User&#39;&nbsp; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color:blue">END</span><span style="color:gray">,&nbsp; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color:black">c.name&nbsp;</span><span style="color:blue">AS&nbsp;</span><span style="color:red">&#39;DatabaseRoleName&#39;</span><span style="color:gray">,&nbsp;</span><span style="color:red">&#39;X&#39;&nbsp;</span><span style="color:blue">AS&nbsp;</span><span style="color:red">&#39;RoleAccess&#39;&nbsp; <br /></span><span style="color:blue">FROM&nbsp;</span><span style="color:black">dbo.sysusers&nbsp;b&nbsp;</span><span style="color:magenta">LEFT&nbsp;</span><span style="color:gray">OUTER&nbsp;</span><span style="color:blue">JOIN&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color:black">dbo.sysmembers&nbsp;&nbsp;a&nbsp;</span><span style="color:blue">ON&nbsp;</span><span style="color:black">a.memberuid&nbsp;</span><span style="color:blue">=&nbsp;</span><span style="color:black">b.uid&nbsp;</span><span style="color:magenta">LEFT&nbsp;</span><span style="color:gray">OUTER&nbsp;</span><span style="color:blue">JOIN&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color:black">dbo.sysusers&nbsp;c&nbsp;</span><span style="color:blue">ON&nbsp;</span><span style="color:black">a.groupuid&nbsp;</span><span style="color:blue">=&nbsp;</span><span style="color:black">c.uid&nbsp;&nbsp; <br /></span><span style="color:blue">WHERE&nbsp;&nbsp;&nbsp;</span><span style="color:black">b.name&nbsp;</span><span style="color:gray">NOT&nbsp;</span><span style="color:blue">IN</span><span style="color:gray">(</span><span style="color:red">&#39;db_owner&#39;</span><span style="color:gray">,</span><span style="color:red">&#39;db_accessadmin&#39;</span><span style="color:gray">, <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color:red">&#39;db_securityadmin&#39;</span><span style="color:gray">,</span><span style="color:red">&#39;public&#39;</span><span style="color:gray">,&nbsp; <br />&nbsp;</span><span style="color:red">&#39;db_ddladmin&#39;</span><span style="color:gray">,</span><span style="color:red">&#39;db_backupoperator&#39;</span><span style="color:gray">,</span><span style="color:red">&#39;db_datareader&#39;</span><span style="color:gray">, <br />&nbsp;</span><span style="color:red">&#39;db_datawriter&#39;</span><span style="color:gray">, <br />&nbsp;</span><span style="color:red">&#39;db_denydatareader&#39;</span><span style="color:gray">,</span><span style="color:red">&#39;db_denydatawriter&#39;</span><span style="color:gray">)&nbsp;&nbsp; </p>
<p></span><span style="color:blue">IF&nbsp;</span><span style="color:#434343">@cmptlevel&nbsp;</span><span style="color:gray">&gt;&nbsp;</span><span style="color:black">80&nbsp; <br /></span><span style="color:blue">BEGIN&nbsp; <br />&nbsp;&nbsp;SELECT&nbsp;</span><span style="color:#434343">@DatabaseRoles&nbsp;</span><span style="color:blue">=&nbsp;</span><span style="color:magenta">COALESCE</span><span style="color:gray">(</span><span style="color:#434343">@DatabaseRoles&nbsp;</span><span style="color:gray">+&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color:red">&#39;,[&#39;&nbsp;</span><span style="color:gray">+&nbsp;</span><span style="color:magenta">CAST</span><span style="color:gray">(</span><span style="color:black">DatabaseRoleName&nbsp;</span><span style="color:blue">AS&nbsp;VARCHAR</span><span style="color:gray">)&nbsp;+&nbsp;</span><span style="color:red">&#39;]&#39;</span><span style="color:gray">,&nbsp; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color:red">&#39;[&#39;&nbsp;</span><span style="color:gray">+&nbsp;</span><span style="color:magenta">CAST</span><span style="color:gray">(</span><span style="color:black">DatabaseRoleName&nbsp;</span><span style="color:blue">AS&nbsp;VARCHAR</span><span style="color:gray">)+&nbsp;</span><span style="color:red">&#39;]&#39;</span><span style="color:gray">)&nbsp; <br />&nbsp;&nbsp;</span><span style="color:blue">FROM&nbsp;</span><span style="color:#434343">#DatabaseRoleMatrix&nbsp; <br />&nbsp;&nbsp;</span><span style="color:blue">WHERE&nbsp;</span><span style="color:black">DatabaseRoleName&nbsp;</span><span style="color:blue">IS&nbsp;</span><span style="color:gray">NOT&nbsp;NULL&nbsp; <br />&nbsp;&nbsp;</span><span style="color:blue">GROUP&nbsp;BY&nbsp;</span><span style="color:black">DatabaseRoleName&nbsp; </p>
<p>&nbsp;&nbsp;</span><span style="color:blue">SET&nbsp;</span><span style="color:#434343">@SQLSTMT&nbsp;</span><span style="color:blue">=&nbsp;</span><span style="color:red">&#39;&nbsp; <br />SELECT&nbsp;db_name()&nbsp;as&nbsp;&#39;&#39;db_name&#39;&#39;,&nbsp;*&nbsp; <br />FROM&nbsp;#DatabaseRoleMatrix&nbsp; <br />PIVOT&nbsp; <br />(&nbsp; <br />MAX(RoleAccess)&nbsp; <br />FOR&nbsp;[DatabaseRoleName]&nbsp; <br />IN&nbsp;(&#39;&nbsp;</span><span style="color:gray">+&nbsp;</span><span style="color:#434343">@DatabaseRoles&nbsp;</span><span style="color:gray">+&nbsp;</span><span style="color:red">&#39;)&nbsp; <br />)&nbsp; <br />AS&nbsp;p <br />WHERE&nbsp;DatabaseUserName&nbsp;IS&nbsp;NOT&nbsp;NULL <br />ORDER&nbsp;BY&nbsp;DatabaseUserType&nbsp;DESC,&nbsp;DatabaseUserName&#39;&nbsp; </p>
<p>&nbsp;&nbsp;</span><span style="color:blue">EXECUTE</span><span style="color:gray">(</span><span style="color:#434343">@SQLSTMT</span><span style="color:gray">)&nbsp; <br /></span><span style="color:blue">END&nbsp; </p>
<p>IF&nbsp;</span><span style="color:#434343">@cmptlevel&nbsp;</span><span style="color:gray">&lt;&nbsp;</span><span style="color:black">90&nbsp; <br /></span><span style="color:blue">BEGIN&nbsp; <br />&nbsp;&nbsp;CREATE&nbsp;TABLE&nbsp;</span><span style="color:#434343">#WhileDatabaseRole</span><span style="color:gray">(&nbsp; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color:black">[RowNum]&nbsp;</span><span style="color:blue">INT&nbsp;</span><span style="color:#434343">IDENTITY&nbsp;</span><span style="color:gray">(</span><span style="color:black">1</span><span style="color:gray">,</span><span style="color:black">1</span><span style="color:gray">)&nbsp;</span><span style="color:blue">PRIMARY&nbsp;KEY</span><span style="color:gray">,&nbsp; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color:black">[DatabaseRoleName]&nbsp;</span><span style="color:blue">NVARCHAR</span><span style="color:gray">(</span><span style="color:black">256</span><span style="color:gray">))&nbsp; <br />&nbsp;&nbsp;&nbsp; <br />&nbsp;&nbsp;</span><span style="color:blue">DECLARE&nbsp;</span><span style="color:#434343">@RowCount&nbsp;</span><span style="color:blue">INT&nbsp; <br />&nbsp;&nbsp;DECLARE&nbsp;</span><span style="color:#434343">@DatabaseRoleList&nbsp;</span><span style="color:blue">NVARCHAR</span><span style="color:gray">(</span><span style="color:blue">MAX</span><span style="color:gray">)&nbsp; <br />&nbsp;&nbsp;</span><span style="color:blue">DECLARE&nbsp;</span><span style="color:#434343">@DatabaseRoleName&nbsp;</span><span style="color:blue">NVARCHAR</span><span style="color:gray">(</span><span style="color:blue">MAX</span><span style="color:gray">)&nbsp; <br />&nbsp;&nbsp;</span><span style="color:blue">SET&nbsp;</span><span style="color:#434343">@DatabaseRoleList&nbsp;</span><span style="color:blue">=&nbsp;</span><span style="color:red">&#39;&#39;&nbsp; </p>
<p>&nbsp;&nbsp;</span><span style="color:blue">INSERT&nbsp;INTO&nbsp;</span><span style="color:#434343">#WhileDatabaseRole</span><span style="color:gray">(</span><span style="color:black">[DatabaseRoleName]</span><span style="color:gray">)&nbsp; <br />&nbsp;&nbsp;</span><span style="color:blue">SELECT&nbsp;&nbsp;&nbsp;DISTINCT&nbsp;</span><span style="color:black">DatabaseRoleName&nbsp;&nbsp; <br />&nbsp;&nbsp;</span><span style="color:blue">FROM&nbsp;&nbsp;</span><span style="color:#434343">#DatabaseRoleMatrix&nbsp;&nbsp; <br />&nbsp;&nbsp;</span><span style="color:blue">WHERE&nbsp;</span><span style="color:black">DatabaseRoleName&nbsp;</span><span style="color:blue">IS&nbsp;</span><span style="color:gray">NOT&nbsp;NULL&nbsp; <br />&nbsp;&nbsp;</span><span style="color:blue">ORDER&nbsp;BY&nbsp;</span><span style="color:black">DatabaseRoleName&nbsp; <br />&nbsp;&nbsp;&nbsp; <br />&nbsp;&nbsp;</span><span style="color:blue">SELECT&nbsp;</span><span style="color:#434343">@RowCount&nbsp;</span><span style="color:blue">=&nbsp;MAX</span><span style="color:gray">(</span><span style="color:black">[RowNum]</span><span style="color:gray">)&nbsp;</span><span style="color:blue">FROM&nbsp;</span><span style="color:#434343">#WhileDatabaseRole&nbsp; </p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color:blue">SET&nbsp;</span><span style="color:#434343">@SQLSTMT&nbsp;</span><span style="color:blue">=&nbsp;</span><span style="color:red">&#39;SELECT&nbsp;db_name()&nbsp;as&nbsp;&#39;&#39;db_name&#39;&#39;,&nbsp;&nbsp; <br />DatabaseUserName,&nbsp;DatabaseUserType,&nbsp;&nbsp;&#39;&nbsp; <br />&nbsp;&nbsp;&nbsp; <br />&nbsp;&nbsp;</span><span style="color:blue">WHILE&nbsp;</span><span style="color:#434343">@RowCount&nbsp;</span><span style="color:gray">&lt;&gt;&nbsp;</span><span style="color:black">0&nbsp; <br />&nbsp;&nbsp;</span><span style="color:blue">BEGIN&nbsp; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;SET&nbsp;</span><span style="color:#434343">@DatabaseRoleName&nbsp;</span><span style="color:blue">=&nbsp;</span><span style="color:gray">(</span><span style="color:blue">SELECT&nbsp;</span><span style="color:black">[DatabaseRoleName]&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color:blue">FROM&nbsp;</span><span style="color:#434343">#WhileDatabaseRole&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color:blue">WHERE&nbsp;</span><span style="color:black">[RowNum]&nbsp;</span><span style="color:blue">=&nbsp;</span><span style="color:#434343">@RowCount</span><span style="color:gray">)&nbsp; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color:blue">SET&nbsp;</span><span style="color:#434343">@SQLSTMT&nbsp;</span><span style="color:blue">=&nbsp;</span><span style="color:#434343">@SQLSTMT&nbsp;</span><span style="color:gray">+&nbsp;</span><span style="color:red">&#39;&nbsp;MAX( <br />    CASE&nbsp;WHEN&nbsp;DatabaseRoleName&nbsp;=&nbsp;&#39;&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color:gray">+&nbsp;</span><span style="color:blue">CHAR</span><span style="color:gray">(</span><span style="color:black">39</span><span style="color:gray">)&nbsp;+&nbsp;</span><span style="color:#434343">@DatabaseRoleName&nbsp;</span><span style="color:gray">+&nbsp;</span><span style="color:blue">CHAR</span><span style="color:gray">(</span><span style="color:black">39</span><span style="color:gray">)&nbsp;+&nbsp; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color:red">&#39;&nbsp;THEN&nbsp;&#39;&#39;X&#39;&#39;&nbsp;END)&nbsp;AS&nbsp;&#39;&nbsp;</span><span style="color:gray">+&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color:blue">CHAR</span><span style="color:gray">(</span><span style="color:black">39</span><span style="color:gray">)&nbsp;+&nbsp;</span><span style="color:#434343">@DatabaseRoleName&nbsp;</span><span style="color:gray">+&nbsp;</span><span style="color:blue">CHAR</span><span style="color:gray">(</span><span style="color:black">39</span><span style="color:gray">)&nbsp;+&nbsp;</span><span style="color:red">&#39;,&#39;&nbsp; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color:blue">DELETE&nbsp;FROM&nbsp;</span><span style="color:#434343">#WhileDatabaseRole&nbsp;</span><span style="color:blue">WHERE&nbsp;</span><span style="color:black">[RowNum]&nbsp;</span><span style="color:blue">=&nbsp;</span><span style="color:#434343">@RowCount&nbsp; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color:blue">SET&nbsp;</span><span style="color:#434343">@RowCount&nbsp;</span><span style="color:blue">=&nbsp;</span><span style="color:#434343">@RowCount&nbsp;</span><span style="color:gray">-&nbsp;</span><span style="color:black">1&nbsp; <br />&nbsp;&nbsp;</span><span style="color:blue">END&nbsp; <br />&nbsp;&nbsp;&nbsp; <br />&nbsp;&nbsp;SELECT&nbsp;</span><span style="color:#434343">@SQLSTMT&nbsp;</span><span style="color:blue">=&nbsp;</span><span style="color:magenta">SUBSTRING</span><span style="color:gray">(</span><span style="color:#434343">@SQLSTMT</span><span style="color:gray">,&nbsp;</span><span style="color:black">1</span><span style="color:gray">,&nbsp;</span><span style="color:magenta">LEN</span><span style="color:gray">(</span><span style="color:#434343">@SQLSTMT</span><span style="color:gray">)-</span><span style="color:black">1</span><span style="color:gray">)&nbsp;+&nbsp; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color:red">&#39;&nbsp;FROM&nbsp;#DatabaseRoleMatrix&nbsp;&nbsp; <br />&nbsp;&nbsp;WHERE&nbsp;DatabaseUserName&nbsp;IS&nbsp;NOT&nbsp;NULL&nbsp;&nbsp; <br />&nbsp;&nbsp;GROUP&nbsp;BY&nbsp;DatabaseUserName,&nbsp;DatabaseUserType&nbsp;&nbsp; <br />&nbsp;&nbsp;ORDER&nbsp;BY&nbsp;DatabaseUserType&nbsp;DESC,&nbsp;DatabaseUserName&#39;&nbsp; <br />&nbsp;&nbsp;&nbsp; <br />&nbsp;&nbsp;</span><span style="color:blue">EXEC&nbsp;</span><span style="color:darkred">sp_executesql&nbsp;</span><span style="color:#434343">@SQLSTMT&nbsp; <br />&nbsp;&nbsp;&nbsp; <br />&nbsp;&nbsp;</span><span style="color:blue">DROP&nbsp;TABLE&nbsp;</span><span style="color:#434343">#WhileDatabaseRole&nbsp; <br />&nbsp;&nbsp;&nbsp; <br /></span><span style="color:blue">END&nbsp; </p>
<p>DROP&nbsp;TABLE&nbsp;</span><span style="color:#434343">#DatabaseRoleMatrix <br />&nbsp; <br /></span></code></p>
<p>UPDATE: <a href="http://www.truthsolutions.com/" target="_blank">K. Brian Kelley</a> asked if handles nested user defined database roles&#8230;. it does now <img src='http://benchmarkitconsulting.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Enjoy!!</p>
<p> <a href="http://benchmarkitconsulting.com"><img class="alignnone size-full wp-image-402" title="benchmark_sm" src="http://benchmarkitconsulting.com/wp-content/uploads/2009/02/benchmark_sm.jpg" alt="" /></a><a href="http://sqlserverpedia.com/wiki/Editors#Colin_Stasiuk" target="_blank"><img src="http://sqlserverpedia.com/badges/SQLServerPedia_Badge_Blogger.jpg" alt="" /> </a></p>
<p align="left"><a class="tt" href="http://twitter.com/home/?status=Database+Role+Audit+%28alpha+version%29+http://tinyurl.com/cbcb24" title="Post to Twitter"><img class="nothumb" src="http://benchmarkitconsulting.com/wp-content/plugins/tweet-this/icons/tt-twitter-big4.png" alt="Post to Twitter" /></a> <a class="tt" href="http://delicious.com/post?url=http://benchmarkitconsulting.com/colin-stasiuk/2009/02/10/database-role-audit-feedback-requested-pls/&amp;title=Database+Role+Audit+%28alpha+version%29" title="Post to Delicious"><img class="nothumb" src="http://benchmarkitconsulting.com/wp-content/plugins/tweet-this/icons/tt-delicious-big4.png" alt="Post to Delicious" /></a> <a class="tt" href="http://digg.com/submit?url=http://benchmarkitconsulting.com/colin-stasiuk/2009/02/10/database-role-audit-feedback-requested-pls/&amp;title=Database+Role+Audit+%28alpha+version%29" title="Post to Digg"><img class="nothumb" src="http://benchmarkitconsulting.com/wp-content/plugins/tweet-this/icons/tt-digg-big4.png" alt="Post to Digg" /></a> <a class="tt" href="http://stumbleupon.com/submit?url=http://benchmarkitconsulting.com/colin-stasiuk/2009/02/10/database-role-audit-feedback-requested-pls/&amp;title=Database+Role+Audit+%28alpha+version%29" title="Post to StumbleUpon"><img class="nothumb" src="http://benchmarkitconsulting.com/wp-content/plugins/tweet-this/icons/tt-su-big4.png" alt="Post to StumbleUpon" /></a></p>]]></content:encoded>
			<wfw:commentRss>http://benchmarkitconsulting.com/colin-stasiuk/2009/02/10/database-role-audit-feedback-requested-pls/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>db_Executor Role &#8211; updated</title>
		<link>http://benchmarkitconsulting.com/colin-stasiuk/2009/01/27/db_executor-role/</link>
		<comments>http://benchmarkitconsulting.com/colin-stasiuk/2009/01/27/db_executor-role/#comments</comments>
		<pubDate>Tue, 27 Jan 2009 14:06:33 +0000</pubDate>
		<dc:creator>Colin Stasiuk</dc:creator>
				<category><![CDATA[Benchmark IT Consulting]]></category>
		<category><![CDATA[Colin Stasiuk]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[db_executor]]></category>
		<category><![CDATA[SQL 2005]]></category>

		<guid isPermaLink="false">http://benchmarkitconsulting.com/?p=352</guid>
		<description><![CDATA[In a passing conversation the question about how you grant execute to all stored procedures to a user came up. In SQL 2005 the ability to grant the execute permission at the database level was introduced. Instead of having to build some &#39;smarts&#39; into a script to cycle through all your objects, etc you can [...]]]></description>
			<content:encoded><![CDATA[<p>In a passing conversation the question about how you grant execute to all stored procedures to a user came up.  In SQL 2005 the ability to grant the execute permission at the database level was introduced.  Instead of having to build some &#39;smarts&#39; into a script to cycle through all your objects, etc you can now solve this problem as easy as:</p>
<p><code style="font-size: 12px;"><span style="color:blue">CREATE </span><span style="color:black">ROLE db_executor<br /></span><span style="color:blue">GRANT EXECUTE TO </span><span style="color:black">db_executor<br /></span><span style="color:blue">EXEC </span><span style="color:darkred">sp_addrolemember </span><span style="color:red">&#39;db_executor&#39;</span><span style="color:gray">, </span><span style="color:red">&#39;username&#39;</p>
<p></span></code></p>
<p>So this is an &#8220;all or nothing&#8221; script so if you&#39;re wanting to be selective with which stored procedures you want to grant the permission to than this is not the solution for you&#8230; but head on over to <a href="http://facility9.com/2009/01/26/grant-execute-permissions-on-all-stored-procedures-to-a-single-user/" target="_blank">facility9</a> for a look at how you can grant execute on a &#8220;pattern&#8221; of stored procedures.</p>
<p>UPDATE:  As pointed out by <a href="http://www.truthsolutions.com/" target="_blank">K Brian Kelley</a> you might end up with more work in doing this if later down the road there is a stored procedure that you don&#39;t want the user to be able to execute. He suggests (and how can you NOT trust an MVP) granting execute not at the database level but at the schema level for more control over what the user can and cannot execute&#8230; very sound advice&#8230; Thanks!!</p>
<p><a href="http://sqlserverpedia.com/wiki/Editors#Colin_Stasiuk"><br />
<img src="http://sqlserverpedia.com/badges/SQLServerPedia_Badge_Contributor.jpg"><br />
</a></p>
<p align="left"><a class="tt" href="http://twitter.com/home/?status=db_Executor+Role+%26%238211%3B+updated+http://tinyurl.com/dloa4g" title="Post to Twitter"><img class="nothumb" src="http://benchmarkitconsulting.com/wp-content/plugins/tweet-this/icons/tt-twitter-big4.png" alt="Post to Twitter" /></a> <a class="tt" href="http://delicious.com/post?url=http://benchmarkitconsulting.com/colin-stasiuk/2009/01/27/db_executor-role/&amp;title=db_Executor+Role+%26%238211%3B+updated" title="Post to Delicious"><img class="nothumb" src="http://benchmarkitconsulting.com/wp-content/plugins/tweet-this/icons/tt-delicious-big4.png" alt="Post to Delicious" /></a> <a class="tt" href="http://digg.com/submit?url=http://benchmarkitconsulting.com/colin-stasiuk/2009/01/27/db_executor-role/&amp;title=db_Executor+Role+%26%238211%3B+updated" title="Post to Digg"><img class="nothumb" src="http://benchmarkitconsulting.com/wp-content/plugins/tweet-this/icons/tt-digg-big4.png" alt="Post to Digg" /></a> <a class="tt" href="http://stumbleupon.com/submit?url=http://benchmarkitconsulting.com/colin-stasiuk/2009/01/27/db_executor-role/&amp;title=db_Executor+Role+%26%238211%3B+updated" title="Post to StumbleUpon"><img class="nothumb" src="http://benchmarkitconsulting.com/wp-content/plugins/tweet-this/icons/tt-su-big4.png" alt="Post to StumbleUpon" /></a></p>]]></content:encoded>
			<wfw:commentRss>http://benchmarkitconsulting.com/colin-stasiuk/2009/01/27/db_executor-role/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Creating a REAL SQLAgentReaderRole</title>
		<link>http://benchmarkitconsulting.com/colin-stasiuk/2009/01/21/creating-a-real-sqlagentreaderrole/</link>
		<comments>http://benchmarkitconsulting.com/colin-stasiuk/2009/01/21/creating-a-real-sqlagentreaderrole/#comments</comments>
		<pubDate>Wed, 21 Jan 2009 20:37:41 +0000</pubDate>
		<dc:creator>Colin Stasiuk</dc:creator>
				<category><![CDATA[Benchmark IT Consulting]]></category>
		<category><![CDATA[Colin Stasiuk]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[msdb]]></category>
		<category><![CDATA[SQLAgentReaderRole]]></category>

		<guid isPermaLink="false">http://benchmarkitconsulting.com/?p=344</guid>
		<description><![CDATA[So if you follow me blog you will probably remember this post from earlier today: http://benchmarkitconsulting.com/colin-stasiuk/2009/01/21/sqlagentreaderrole-not-so-reader/ Below is the solution I&#8217;m working with to give developers access to the Job Activity Monitor but NOT the ability to create new jobs. I know adding a role to a system database is not ideal but I&#8217;m open [...]]]></description>
			<content:encoded><![CDATA[<p>So if you follow me blog you will probably remember this post from earlier today:</p>
<p><a href="http://benchmarkitconsulting.com/colin-stasiuk/2009/01/21/sqlagentreaderrole-not-so-reader/" target="_blank">http://benchmarkitconsulting.com/colin-stasiuk/2009/01/21/sqlagentreaderrole-not-so-reader/</a></p>
<p>Below is the solution I&#8217;m working with to give developers access to the Job Activity Monitor but NOT the ability to create new jobs.</p>
<p>I know adding a role to a system database is not ideal but I&#8217;m open to other suggestions <img src='http://benchmarkitconsulting.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p><code style="font-size: 12px;"><span style="color:black"><br /></span><span style="color:blue">USE </span><span style="color:black">[msdb]<br />GO<br /></span><span style="color:blue">CREATE </span><span style="color:black">ROLE [SQLAgentReadOnlyRole] </span><span style="color:blue">AUTHORIZATION </span><span style="color:black">[dbo]<br />GO<br /></span><span style="color:blue">EXEC </span><span style="color:darkred">sp_addrolemember </span><span style="color:red">N&#39;SQLAgentReaderRole&#39;</span><span style="color:gray">, </span><span style="color:red">N&#39;SQLAgentReadOnlyRole&#39;<br /></span><span style="color:black">GO<br /></span><span style="color:blue">DENY EXECUTE ON </span><span style="color:black">OBJECT::msdb.dbo.</span><span style="color:darkred">sp_add_job </span><span style="color:blue">TO </span><span style="color:black">SQLAgentReadOnlyRole<br /></span><span style="color:blue">DENY EXECUTE ON </span><span style="color:black">OBJECT::msdb.dbo.</span><span style="color:darkred">sp_add_jobserver </span><span style="color:blue">TO </span><span style="color:black">SQLAgentReadOnlyRole<br /></span><span style="color:blue">DENY EXECUTE ON </span><span style="color:black">OBJECT::msdb.dbo.</span><span style="color:darkred">sp_add_jobstep </span><span style="color:blue">TO </span><span style="color:black">SQLAgentReadOnlyRole<br /></span><span style="color:blue">DENY EXECUTE ON </span><span style="color:black">OBJECT::msdb.dbo.</span><span style="color:darkred">sp_update_job </span><span style="color:blue">TO </span><span style="color:black">SQLAgentReadOnlyRole<br /></span><span style="color:blue">DENY EXECUTE ON </span><span style="color:black">OBJECT::msdb.dbo.</span><span style="color:darkred">sp_add_jobschedule </span><span style="color:blue">TO </span><span style="color:black">SQLAgentReadOnlyRole</span></code></p>
<p>So after you create your new SQLAgentReadRoleRole you can add role members to it and they will be able to view the Job Activity Monitor but will not be able to create new jobs&#8230; use at your own risk as like I said&#8230; I&#8217;m still working with it but this is the direction I&#8217;m heading right now.</p>
<p>If anyone has a more elegant solution I&#8217;d be very interested in seeing it.</p>
<p align="left"><a class="tt" href="http://twitter.com/home/?status=Creating+a+REAL+SQLAgentReaderRole+http://tinyurl.com/7p38wd" title="Post to Twitter"><img class="nothumb" src="http://benchmarkitconsulting.com/wp-content/plugins/tweet-this/icons/tt-twitter-big4.png" alt="Post to Twitter" /></a> <a class="tt" href="http://delicious.com/post?url=http://benchmarkitconsulting.com/colin-stasiuk/2009/01/21/creating-a-real-sqlagentreaderrole/&amp;title=Creating+a+REAL+SQLAgentReaderRole" title="Post to Delicious"><img class="nothumb" src="http://benchmarkitconsulting.com/wp-content/plugins/tweet-this/icons/tt-delicious-big4.png" alt="Post to Delicious" /></a> <a class="tt" href="http://digg.com/submit?url=http://benchmarkitconsulting.com/colin-stasiuk/2009/01/21/creating-a-real-sqlagentreaderrole/&amp;title=Creating+a+REAL+SQLAgentReaderRole" title="Post to Digg"><img class="nothumb" src="http://benchmarkitconsulting.com/wp-content/plugins/tweet-this/icons/tt-digg-big4.png" alt="Post to Digg" /></a> <a class="tt" href="http://stumbleupon.com/submit?url=http://benchmarkitconsulting.com/colin-stasiuk/2009/01/21/creating-a-real-sqlagentreaderrole/&amp;title=Creating+a+REAL+SQLAgentReaderRole" title="Post to StumbleUpon"><img class="nothumb" src="http://benchmarkitconsulting.com/wp-content/plugins/tweet-this/icons/tt-su-big4.png" alt="Post to StumbleUpon" /></a></p>]]></content:encoded>
			<wfw:commentRss>http://benchmarkitconsulting.com/colin-stasiuk/2009/01/21/creating-a-real-sqlagentreaderrole/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>SQLAgentReaderRole &#8211; not so reader?</title>
		<link>http://benchmarkitconsulting.com/colin-stasiuk/2009/01/21/sqlagentreaderrole-not-so-reader/</link>
		<comments>http://benchmarkitconsulting.com/colin-stasiuk/2009/01/21/sqlagentreaderrole-not-so-reader/#comments</comments>
		<pubDate>Wed, 21 Jan 2009 18:31:01 +0000</pubDate>
		<dc:creator>Colin Stasiuk</dc:creator>
				<category><![CDATA[Benchmark IT Consulting]]></category>
		<category><![CDATA[Colin Stasiuk]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[msdb]]></category>
		<category><![CDATA[SQLAgentReaderRole]]></category>

		<guid isPermaLink="false">http://benchmarkitconsulting.com/?p=342</guid>
		<description><![CDATA[Quick&#8230; how do you give someone read only access to the Job Activity Monitor? Why you grant them SQLAgentReaderRole access in msdb&#8230;. WRONG http://technet.microsoft.com/en-us/library/ms188283.aspx The SQLAgentReaderRole is a reader role for the jobs that currently exist but wait here is where the good (or bad depending on if you&#8217;re in a good mood or not) [...]]]></description>
			<content:encoded><![CDATA[<p>Quick&#8230; how do you give someone read only access to the Job Activity Monitor?</p>
<p>Why you grant them SQLAgentReaderRole access in msdb&#8230;. WRONG</p>
<p><a href="http://technet.microsoft.com/en-us/library/ms188283.aspx" target="_blank">http://technet.microsoft.com/en-us/library/ms188283.aspx</a></p>
<p>The SQLAgentReaderRole is a reader role for the jobs that currently exist but wait here is where the good (or bad depending on if you&#8217;re in a good mood or not) part comes in.</p>
<p>Me &#8211; &#8220;Hey Mr Developer I made this change in UAT you should now be able to view the job activity monitor&#8230; just for my own curiousity I&#8217;m going to come by can you try to execute, delete, update jobs that are there.  &#8221;</p>
<p>Mr Developer &#8211; &#8220;nope&#8230; can&#8217;t do anything like that&#8221;</p>
<p>Me &#8211; &#8220;Great&#8230; can you create a new job&#8221;</p>
<p>Mr Developer &#8211; &#8220;Yup&#8221;</p>
<p>Me &#8211; &#8221; *sigh* I hate (and by hate I mean it in a love/hate kinda way) Microsoft</p>
<p>That&#8217;s right folks&#8230; SQLAgentReaderRole can create jobs.  So although it&#8217;s called SQLAgentReaderRole be careful granting this access cause whomever you add to this role can create new jobs.</p>
<p>UPDATE will come if/when I find or create a usable solution</p>
<p align="left"><a class="tt" href="http://twitter.com/home/?status=SQLAgentReaderRole+%26%238211%3B+not+so+reader%3F+http://tinyurl.com/89pj3o" title="Post to Twitter"><img class="nothumb" src="http://benchmarkitconsulting.com/wp-content/plugins/tweet-this/icons/tt-twitter-big4.png" alt="Post to Twitter" /></a> <a class="tt" href="http://delicious.com/post?url=http://benchmarkitconsulting.com/colin-stasiuk/2009/01/21/sqlagentreaderrole-not-so-reader/&amp;title=SQLAgentReaderRole+%26%238211%3B+not+so+reader%3F" title="Post to Delicious"><img class="nothumb" src="http://benchmarkitconsulting.com/wp-content/plugins/tweet-this/icons/tt-delicious-big4.png" alt="Post to Delicious" /></a> <a class="tt" href="http://digg.com/submit?url=http://benchmarkitconsulting.com/colin-stasiuk/2009/01/21/sqlagentreaderrole-not-so-reader/&amp;title=SQLAgentReaderRole+%26%238211%3B+not+so+reader%3F" title="Post to Digg"><img class="nothumb" src="http://benchmarkitconsulting.com/wp-content/plugins/tweet-this/icons/tt-digg-big4.png" alt="Post to Digg" /></a> <a class="tt" href="http://stumbleupon.com/submit?url=http://benchmarkitconsulting.com/colin-stasiuk/2009/01/21/sqlagentreaderrole-not-so-reader/&amp;title=SQLAgentReaderRole+%26%238211%3B+not+so+reader%3F" title="Post to StumbleUpon"><img class="nothumb" src="http://benchmarkitconsulting.com/wp-content/plugins/tweet-this/icons/tt-su-big4.png" alt="Post to StumbleUpon" /></a></p>]]></content:encoded>
			<wfw:commentRss>http://benchmarkitconsulting.com/colin-stasiuk/2009/01/21/sqlagentreaderrole-not-so-reader/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

