<?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; msdb</title>
	<atom:link href="http://benchmarkitconsulting.com/tag/msdb/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>Bloated MSDB database</title>
		<link>http://benchmarkitconsulting.com/colin-stasiuk/2009/07/07/bloated-msdb-database/</link>
		<comments>http://benchmarkitconsulting.com/colin-stasiuk/2009/07/07/bloated-msdb-database/#comments</comments>
		<pubDate>Tue, 07 Jul 2009 15:19:16 +0000</pubDate>
		<dc:creator>Colin Stasiuk</dc:creator>
				<category><![CDATA[Benchmark IT Consulting]]></category>
		<category><![CDATA[Colin Stasiuk]]></category>
		<category><![CDATA[Maintenance]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[bloat]]></category>
		<category><![CDATA[bloating]]></category>
		<category><![CDATA[msdb]]></category>
		<category><![CDATA[SQL]]></category>

		<guid isPermaLink="false">http://benchmarkitconsulting.com/?p=803</guid>
		<description><![CDATA[So how do you drop databases? Do you use a simple DROP DATABASE statement? Do you detach the database and remove the files manually? Do you use the GUI? Run these two quick and dirty queries for me: SELECT COUNT(*) FROM   msdb.dbo.backupset SELECT COUNT(*) FROM   msdb.dbo.backupset WHERE  database_name NOT IN (SELECT name FROM master.dbo.sysdatabases)   So how much of your MSDB database is filled with backup [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignnone size-full wp-image-804" title="ierjflks" src="http://benchmarkitconsulting.com/wp-content/uploads/2009/07/ierjflks.jpg" alt="ierjflks" width="127" height="194" /></p>
<p>So how do you drop databases?</p>
<p>Do you use a simple DROP DATABASE statement?</p>
<p>Do you detach the database and remove the files manually?</p>
<p>Do you use the GUI?</p>
<p>Run these two quick and dirty queries for me:</p>
<p><code style="font-size: 12px;"><span style="color:blue">SELECT </span><span style="color:magenta">COUNT</span><span style="color:gray">(*)<br />
</span><span style="color:blue">FROM   </span><span style="color:black">msdb.dbo.backupset</span></code></p>
<p><code style="font-size: 12px;"><span style="color:blue">SELECT </span><span style="color:magenta">COUNT</span><span style="color:gray">(*)<br />
</span><span style="color:blue">FROM   </span><span style="color:black">msdb.dbo.backupset<br />
</span><span style="color:blue">WHERE  </span><span style="color:black">database_name </span><span style="color:gray">NOT </span><span style="color:blue">IN </span><span style="color:gray">(</span><span style="color:blue">SELECT </span><span style="color:black">name </span><span style="color:blue">FROM </span><span style="color:black">master.dbo.sysdatabases</span><span style="color:gray">)</span></code></p>
<p> </p>
<p><img class="alignnone size-full wp-image-805" title="fdlkfldkd" src="http://benchmarkitconsulting.com/wp-content/uploads/2009/07/fdlkfldkd.gif" alt="fdlkfldkd" width="144" height="145" /></p>
<p>So how much of your MSDB database is filled with backup history of databases that have long since been dropped from your instance?</p>
<p>MSDB love and care is not something that usually gets alot of press but if you&#8217;re a stickler for wanting to keep things neat and tidy take a look at the information in your MSDB and whether or not you&#8217;re storing (and backing up) more data then you need to.</p>
<p>Want to rid yourself of some MSDB bloating?</p>
<p><code style="font-size: 12px;"><span style="color:blue">SELECT DISTINCT</span><span style="color:gray">(</span><span style="color:black">database_name</span><span style="color:gray">)<br />
</span><span style="color:blue">FROM   </span><span style="color:black">msdb.dbo.backupset<br />
</span><span style="color:blue">WHERE  </span><span style="color:black">database_name </span><span style="color:gray">NOT </span><span style="color:blue">IN </span><span style="color:gray">(</span><span style="color:blue">SELECT </span><span style="color:black">name </span><span style="color:blue">FROM </span><span style="color:black">master.dbo.sysdatabases</span><span style="color:gray">)</span></code></p>
<p>So now that you have a list of those old databases that still have backup history kicking around&#8230; now what?</p>
<p>Don&#8217;t jump the gun and write a DELETE statement for msdb.dbo.backupset&#8230; what about the other backup tables like backupfile, etc?</p>
<p>Answer: msdb.dbo.sp_delete_database_backuphistory</p>
<p><code style="font-size: 12px;"><span style="color:blue">EXEC&nbsp;</span><span style="color:black">msdb.dbo.</span><span style="color:darkred">sp_delete_database_backuphistory&nbsp;</span><span style="color:#434343">@db_nm&nbsp;</span><span style="color:blue">=&nbsp;</span><span style="color:red">N&#39;&lt;&lt;DATABASE_NAME&gt;&gt;&#39;</p>
<p></span></code></p>
<p>Using this system stored procedure you&#8217;ll ensure that you&#8217;ve removed all the backup history for the specified database.</p>
<p>(As always, please use with caution)</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=Bloated+MSDB+database+http://tinyurl.com/ljtr6r" 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/07/bloated-msdb-database/&amp;title=Bloated+MSDB+database" 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/07/bloated-msdb-database/&amp;title=Bloated+MSDB+database" 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/07/bloated-msdb-database/&amp;title=Bloated+MSDB+database" 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/07/bloated-msdb-database/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Moving MSDB &#8211; Notifications via DatabaseMail</title>
		<link>http://benchmarkitconsulting.com/colin-stasiuk/2009/04/20/moving-msdb-notifications-via-databasemail/</link>
		<comments>http://benchmarkitconsulting.com/colin-stasiuk/2009/04/20/moving-msdb-notifications-via-databasemail/#comments</comments>
		<pubDate>Mon, 20 Apr 2009 17:12:09 +0000</pubDate>
		<dc:creator>Colin Stasiuk</dc:creator>
				<category><![CDATA[Benchmark IT Consulting]]></category>
		<category><![CDATA[Colin Stasiuk]]></category>
		<category><![CDATA[Maintenance]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[DatabaseMail]]></category>
		<category><![CDATA[ENABLE_BROKER]]></category>
		<category><![CDATA[msdb]]></category>
		<category><![CDATA[Notifications]]></category>

		<guid isPermaLink="false">http://benchmarkitconsulting.com/?p=655</guid>
		<description><![CDATA[If you&#8217;ve ever moved MSDB and have notifications setup using DatabaseMail then you probably already know what I (re)learned today. If you move MSDB your notifications will stop working.  Why you may ask? It&#8217;s because the ENABLE_BROKER configuration is set to false when you move MSDB.  Now I can&#8217;t seem to find (google) any information [...]]]></description>
			<content:encoded><![CDATA[<p>If you&#8217;ve ever moved MSDB and have notifications setup using DatabaseMail then you probably already know what I (re)learned today.</p>
<p>If you move MSDB your notifications will stop working.  Why you may ask?</p>
<p>It&#8217;s because the ENABLE_BROKER configuration is set to false when you move MSDB.  Now I can&#8217;t seem to find (google) any information as to WHY this is (please send comments if you have further info) but in order to get your notifications up and running again you&#8217;ll need to run the following command:</p>
<p>ALTER DATABASE msdb SET ENABLE_BROKER;</p>
<p>If this takes a while to run then chances are you are being blocked by another process (chances are the SQL Server Agent)</p>
<p>If you&#8217;re interested in reading more here is the <a href="http://msdn.microsoft.com/en-us/library/ms345408.aspx" target="_blank">Microsoft BOL Link</a> on moving system databases.</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=Moving+MSDB+%26%238211%3B+Notifications+via+DatabaseMail+http://tinyurl.com/c3j6g5" 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/20/moving-msdb-notifications-via-databasemail/&amp;title=Moving+MSDB+%26%238211%3B+Notifications+via+DatabaseMail" 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/20/moving-msdb-notifications-via-databasemail/&amp;title=Moving+MSDB+%26%238211%3B+Notifications+via+DatabaseMail" 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/20/moving-msdb-notifications-via-databasemail/&amp;title=Moving+MSDB+%26%238211%3B+Notifications+via+DatabaseMail" 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/20/moving-msdb-notifications-via-databasemail/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>

