<?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>John Sansom - SQL Server DBA in the UK &#187; Administration</title>
	<atom:link href="http://www.johnsansom.com/index.php/category/administration/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.johnsansom.com</link>
	<description>SQL Server DBA Blog, with straightforward advice, quality resources and musings about SQL Server</description>
	<lastBuildDate>Fri, 10 Sep 2010 12:45:37 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Simplify Your DBCC CHECKDB Output</title>
		<link>http://www.johnsansom.com/index.php/2010/07/simplify-your-dbcc-checkdb-output/</link>
		<comments>http://www.johnsansom.com/index.php/2010/07/simplify-your-dbcc-checkdb-output/#comments</comments>
		<pubDate>Wed, 14 Jul 2010 11:30:57 +0000</pubDate>
		<dc:creator>John Sansom</dc:creator>
				<category><![CDATA[Administration]]></category>
		<category><![CDATA[SQL Server Tips]]></category>
		<category><![CDATA[SQLServerPedia Syndication]]></category>
		<category><![CDATA[CHECKDB]]></category>
		<category><![CDATA[SQL Server Admins]]></category>

		<guid isPermaLink="false">http://www.johnsansom.com/?p=2467</guid>
		<description><![CDATA[If you’re a SQL Server Database Administrator and you don’t know what CHECKDB is then you need to stop whatever it is your are doing right now and read this. Seriously, just go ahead and do it now. It will only take you ten minutes to get to grips with the basics and it could [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: justify;">
<div id="attachment_2475" class="wp-caption alignright" style="width: 310px;  border: 1px solid #dddddd; background-color: #f3f3f3; padding-top: 4px; margin: 10px; text-align:center; float: right;"><img class="size-medium wp-image-2475" title="Defend Your Data" src="http://www.johnsansom.com/wp-content/uploads/2010/07/castle-300x200.jpg" alt="Defend Your Data" width="300" height="200" /><p style=' padding: 0 4px 5px; margin: 0;'  class="wp-caption-text">&quot;Defend Your Data&quot;</p></div>
<p>If you’re a SQL Server Database Administrator and you don’t know what CHECKDB is then you need to stop whatever it is your are doing right now and <a title="CHECKDB" href="http://msdn.microsoft.com/en-us/library/ms176064(SQL.90).aspx">read this</a>. Seriously, just go ahead and do it now. It will only take you ten minutes to get to grips with the basics and it could save not only your job but also the company you work for. CHECKDB is arguably the most valuable tool in the DBA toolkit and you would be a fool to miss it.</p>
<p style="text-align: justify;">Now as I’m sure you already know, when you perform a DBCC CHECKDB operation, by default you will be provided with a considerable amount of informational output, not all of which you may be interested in.</p>
<p style="text-align: justify;">If like me, you like to make life easy for yourself and you are really only interested in output pertaining to any errors that have been found, then you will pleased to hear of the handy argument <em>NO_INFOMSGS</em> available to you (see example below). Using this argument with your CHECKDB operations will suppress “informational only” output, leaving you in a position to more easily identify any errors that may have been reported.</p>
<p style="padding-left: 30px;"><em><span style="color: #000080;">DBCC CHECKDB(‘DatabaseName’) WITH NO_INFOMSGS, ALL_ERRORMSGS</span></em></p>
<p style="text-align: justify;">Note: Technically you do not need to use the ALL_ERRORMSGS argument for errors to be displayed in the more recent versions of SQL Server as this is the default behaviour however, if like a lot of DBA’s you manage multiple versions of SQL Server then it’s good practice to include it in order to be absolutely certain you will get the output your desire across the board.</p>
<p style="text-align: justify;">Life’s complicated enough as it is, so let’s keep things simple when we can.</p>
<h3>Similar Posts on &#8220;keeping things simple&#8221; and &#8220;looking after your data&#8221;</h3>
<ul>
<li><a title="DBA Survival Skills - Think Defensively" href="http://www.johnsansom.com/index.php/2010/04/dba-survival-skills-think-defensively/">DBA Survival Skills – Think Defensively</a></li>
<li><a title="TLC and SQL Server Error Log Management" href="http://www.johnsansom.com/index.php/2010/04/tlc-and-sql-server-error-log-management/">TLC and SQL Server Error Log Management</a></li>
<li><a href="http://www.johnsansom.com/index.php/2009/07/the-database-administrators-primary-responsibility/">SQL Server Essentials – Part 1: The Database Administrator’s Primary Responsibility</a></li>
<li><a href="http://www.johnsansom.com/index.php/2009/07/why-you-should-be-using-the-full-recovery-model/">SQL Server Essentials – Part 2: Why you should be using the FULL Recovery Model</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.johnsansom.com/index.php/2010/07/simplify-your-dbcc-checkdb-output/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>The Politics of SQL Server Performance</title>
		<link>http://www.johnsansom.com/index.php/2010/06/the-politics-of-sql-server-performance/</link>
		<comments>http://www.johnsansom.com/index.php/2010/06/the-politics-of-sql-server-performance/#comments</comments>
		<pubDate>Wed, 30 Jun 2010 13:29:44 +0000</pubDate>
		<dc:creator>John Sansom</dc:creator>
				<category><![CDATA[Administration]]></category>
		<category><![CDATA[Performance Tuning]]></category>
		<category><![CDATA[Professional Development]]></category>
		<category><![CDATA[SQLServerPedia Syndication]]></category>
		<category><![CDATA[SQL Server Performance Politics]]></category>
		<category><![CDATA[SQL Server Performance Tuning]]></category>

		<guid isPermaLink="false">http://www.johnsansom.com/?p=2326</guid>
		<description><![CDATA[Like most DBA’s I’m sure you often find yourself delivering information to the business concerning the performance of your SQL Server platform but have you ever stopped to consider the wider implications of your actions? As a SQL Server Database Administrator you are responsible for the overall health and well being of your SQL Server [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: justify;">Like most DBA’s I’m sure you often find yourself delivering information to the business concerning the performance of your SQL Server platform but have you ever stopped to consider the wider implications of your actions?</p>
<p style="text-align: justify;">As a SQL Server Database Administrator you are responsible for the overall health and well being of your SQL Server database servers. As part of this, one of your key responsibilities is ensuring that SQL Server is providing a sufficient level of performance.</p>
<p style="text-align: justify;">You probably proactively manage and monitor the performance of your environment in order to validate this, perhaps through the creation and review of baseline performance metrics or with the use of third party monitoring tools.</p>
<h2><strong>You Are Monitoring Performance Right?</p>
<p></strong></h2>
<div id="attachment_2359" class="wp-caption alignright" style="width: 310px;  border: 1px solid #dddddd; background-color: #f3f3f3; padding-top: 4px; margin: 10px; text-align:center; float: right;"><a href="http://www.johnsansom.com/wp-content/uploads/2010/06/FastPerf1.jpg"><img class="size-medium wp-image-2359" title="High Performance" src="http://www.johnsansom.com/wp-content/uploads/2010/06/FastPerf1-300x199.jpg" alt="" width="300" height="199" /></a><p style=' padding: 0 4px 5px; margin: 0;'  class="wp-caption-text">&quot;Ensuring High Performance&quot;</p></div>
<p style="text-align: justify;">If you are not currently monitoring the performance of your environment you absolutely should be! As a DBA you have no excuse for not monitoring your SQL Server environment given that you can roll your own performance monitoring solution with very little effort. Doing so is essential to understanding both the resource demands placed on SQL Server and ensuring that it is delivering the performance required by your users.</p>
<p>For details on how to get started and roll your own performance monitoring solutions take a look at Brent Ozar’s excellent <a title="SQL Server Perfmon (Performance Monitor) Best Practices" href="http://www.brentozar.com/archive/2006/12/dba-101-using-perfmon-for-sql-performance-tuning/">SQL Server Perfmon (Performance Monitor) Best Practices</a>.</p>
<h2><strong>T-SQL Query Performance Monitoring</strong></h2>
<p style="text-align: justify;">As part of your performance monitoring activity you will want to regularly review and identify the poorest performing T-SQL queries in your environment. There are a variety of different methods you can use to do this and a number of these are listed below.</p>
<p>How to Identify Poorly Performing Queries:</p>
<ul>
<li><a title="Performance Dashboard Reports" href="http://www.microsoft.com/downloads/details.aspx?FamilyId=1d3a4a0d-7e0c-4730-8204-e419218c1efc&amp;displaylang=en">Performance Dashboard Reports</a></li>
<li>SQL Server DMV’s - <a title="How to identify the most costly SQL Server queries using DMV’s  Read more: http://www.johnsansom.com/index.php/2009/05/how-to-identify-the-most-costly-sql-server-queries-using-dmvs/#ixzz0sL5vlOcP  Under Creative Commons License: Attribution Non-Commercial No Derivatives" href="http://www.johnsansom.com/index.php/2009/05/how-to-identify-the-most-costly-sql-server-queries-using-dmvs/">How to identify the most costly SQL Server queries using DMV’s</a></li>
<li><a title="SQL Server Profiler" href="http://msdn.microsoft.com/en-us/library/ms187929.aspx">SQL Server Profiler</a></li>
<li>Third Party Monitoring Tools &#8211; (Insert your favourite product here)</li>
</ul>
<p style="text-align: justify;">So now that you have identified the most poorly performing T-SQL queries, what next?</p>
<p><strong> </strong></p>
<h2><strong>Providing Feedback to the Business</strong></h2>
<p style="text-align: justify;">
<div id="attachment_2339" class="wp-caption alignright" style="width: 310px;  border: 1px solid #dddddd; background-color: #f3f3f3; padding-top: 4px; margin: 10px; text-align:center; float: right;"><a href="http://www.johnsansom.com/wp-content/uploads/2010/06/SuperDBA2.jpg"><img class="size-medium wp-image-2339" title="Super DBA" src="http://www.johnsansom.com/wp-content/uploads/2010/06/SuperDBA2-300x194.jpg" alt="Super DBA" width="300" height="194" /></a><p style=' padding: 0 4px 5px; margin: 0;'  class="wp-caption-text">&quot;Super DBA&quot;</p></div>
<p>With your T-SQL query performance metrics and analysis in hand you’re keen to share the details of your findings with the business but before you go any further, just stop and think for a moment about what it is you are about to do.</p>
<p style="text-align: justify;">You have in your hands a conclusive list of information that not only identifies the worst performing T-SQL queries for your database server but you also have a mountain of evidence in support of this, a clear and irrefutable case. The information you posses has the potential to make quite a few people look bad and possibly even stupid, especially if your analysis has identified some particularly poor coding practices.</p>
<p style="text-align: justify;">So before you publicise your findings and publically declare to the entire development team that they’re a bunch of idiots and you have the data to prove it, I implore you to take heed of the number one rule in SQL Server Performance Politics&#8230;..</p>
<h2><strong>&#8230;..No One Likes a Smart Ass</strong></h2>
<p><strong> </strong></p>
<p style="text-align: justify;">Being the clever DBA that you are I am certain that you have an abundance of great ideas as to how to improve the performance of the queries you have identified. Whether it be through the creation of new indexes or even a complete overhaul of some of the worst T-SQL you have ever laid eyes upon.</p>
<p style="text-align: justify;">Don’t bring attention to your own amazing work by putting down the work of others either. You will not win yourself any friends and there is no gain to be had from directly showcasing the mistakes of others. Simply put, if you are not the author of said source code then the best thing you can initially do is to just keep your mouth shut. This is done to give the author the time to digest the information you have provided.</p>
<p style="text-align: justify;">So how do you go about effectively implementing change? Funny you should ask. Next up, <a title="How to Provide Great Feedback" href="http://www.johnsansom.com/index.php/2010/07/how-to-provide-great-feedback/">How To Provide Great Feedback</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.johnsansom.com/index.php/2010/06/the-politics-of-sql-server-performance/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>DBA Survival Skills &#8211; Think Defensively</title>
		<link>http://www.johnsansom.com/index.php/2010/04/dba-survival-skills-think-defensively/</link>
		<comments>http://www.johnsansom.com/index.php/2010/04/dba-survival-skills-think-defensively/#comments</comments>
		<pubDate>Mon, 12 Apr 2010 13:17:31 +0000</pubDate>
		<dc:creator>John Sansom</dc:creator>
				<category><![CDATA[Administration]]></category>
		<category><![CDATA[Disaster Recovery]]></category>
		<category><![CDATA[Professional Development]]></category>
		<category><![CDATA[SQLServerPedia Syndication]]></category>

		<guid isPermaLink="false">http://www.johnsansom.com/?p=2044</guid>
		<description><![CDATA[No matter how much of a Super Hero DBA you consider yourself to be, I can guarantee you that there that there will come a time when you have to deal with either a disaster scenario or some form of mistake. Interestingly however, it is what happens next that separates the Pro&#8217;s from everyone else. Things can [...]]]></description>
			<content:encoded><![CDATA[<p>No matter how much of a Super Hero DBA you consider yourself to be, I can guarantee you that there that there will come a time when you have to deal with either a disaster scenario or some form of mistake. Interestingly however, it is what happens next that separates the Pro&#8217;s from everyone else.</p>
<h2>Things can and will go wrong</h2>
<p>So faced with the absolute certainty that things can and will go wrong at some point, what can you do about it?</p>
<p>My advice is to arm yourself with this knowledge. If you know that something will go wrong at some point then you can prepare what you plan to do about it ahead of time so that you are not caught out unexpectedly.</p>
<h2>Adopting a defensive mindset</h2>
<p>Your database environments are business assets and in your role as a DBA it is your responsibility to guard and protect them.</p>
<p>Before you implement any administrative tasks whether it be deploying a set of database patches to your environment, modifying table data or creating new objects, whatever changes you plan to make, I advise you to always adopt a doomsayer&#8217;s frame of mind before carrying out the implementation.</p>
<p>Ask yourself:</p>
<ul>
<li>What is the worst that could happen?</li>
<li>What are the things that could go wrong?</li>
<li>Have I covered myself adequately?</li>
</ul>
<h2>Preparation is the key</h2>
<p>Having identified possible risks for a given scenario you should then plan how you can either avoid them completely or what you will do if they come to bare.</p>
<p>To give you an idea of the type of preparation you may wish to undertake you could plan how you might:</p>
<ul>
<li>Avoid risk completely
<ul>
<li>Do you really need to make this change i.e. does it have to be done?</li>
</ul>
</li>
</ul>
<ul>
<li>Minimise risks where possible
<ul>
<li>Backup your databases</li>
<li>Leverage database Snapshots</li>
<li>Ensure adequate testing has been performed</li>
<li>Perform certain types of changes during maintenance windows or out of business hours in order to minimize any possible impact there could be.</li>
</ul>
</li>
</ul>
<ul>
<li>Devise risk response plans
<ul>
<li>Outline a plan of the steps that you will take in the event of a specific risk or disaster scenario occurring.</li>
<li>Test the plan.</li>
</ul>
</li>
</ul>
<h2>Start thinking defensively today</h2>
<p>Adopting defensive thinking is the first step to ensuring that you are ready to fight back against disaster scenarios and eventualities outside of your control.</p>
<p>Start thinking defensively today, what&#8217;s the worst that could happen?</p>
<h3>Similar Posts</h3>
<ul>
<li><a title="The Database Administrator's Primary Responsibility" href="http://www.johnsansom.com/index.php/2009/07/the-database-administrators-primary-responsibility/">SQL Server Essentials: Part 1 &#8211; The Database Administrator&#8217;s Primary Responsibility</a></li>
<li><a title="Why you should be using the FULL Recover Model" href="http://www.johnsansom.com/index.php/2009/07/why-you-should-be-using-the-full-recovery-model/">SQL Server Essentials: Part 2 &#8211; Why you should be using the FULL recover model</a></li>
<li><a title="SQL Server Disaster Recovery Planning - Getting Started" href="http://www.johnsansom.com/index.php/2009/02/disaster-recovery-planning-getting-started/">SQL Server Disaster Recover Planning: Getting started&#8230;</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.johnsansom.com/index.php/2010/04/dba-survival-skills-think-defensively/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>TLC and SQL Server Error Log Management</title>
		<link>http://www.johnsansom.com/index.php/2010/04/tlc-and-sql-server-error-log-management/</link>
		<comments>http://www.johnsansom.com/index.php/2010/04/tlc-and-sql-server-error-log-management/#comments</comments>
		<pubDate>Tue, 06 Apr 2010 12:36:26 +0000</pubDate>
		<dc:creator>John Sansom</dc:creator>
				<category><![CDATA[Administration]]></category>
		<category><![CDATA[SQLServerPedia Syndication]]></category>
		<category><![CDATA[SQL Server Error Log]]></category>

		<guid isPermaLink="false">http://www.johnsansom.com/?p=2024</guid>
		<description><![CDATA[One of the very first tasks I like to do when presented with a new SQL Server Instance is to review what&#8217;s been happening of late in the SQL Server Error Log file. Doing so can often provide a quick insight into items that require my attention. It&#8217;s not uncommon to encounter backup failure messages, [...]]]></description>
			<content:encoded><![CDATA[<div>
<div id="attachment_2035" class="wp-caption alignright" style="width: 160px;  border: 1px solid #dddddd; background-color: #f3f3f3; padding-top: 4px; margin: 10px; text-align:center; float: right;"><a href="http://www.johnsansom.com/wp-content/uploads/2010/04/tlc.jpg"><img class="size-thumbnail wp-image-2035 " src="http://www.johnsansom.com/wp-content/uploads/2010/04/tlc-150x150.jpg" alt="" width="150" height="150" /></a></p>
<p><p style=' padding: 0 4px 5px; margin: 0;'  class="wp-caption-text">&quot;TLC&quot;</p></div>
<p style="text-align: justify;">One of the very first tasks I like to do when presented with a new SQL Server Instance is to review what&#8217;s been happening of late in the SQL Server Error Log file. Doing so can often provide a quick insight into items that require my attention. It&#8217;s not uncommon to encounter backup failure messages, performance warnings or even nasty error messages.</p>
<p style="text-align: justify;">If the SQL Server Instance has not been given a dose of TLC (<a id="oxnm" title="no not that 90's R&amp;B group" href="http://en.wikipedia.org/wiki/TLC_(band)">no not that 90&#8242;s R&amp;B group</a>) for some time, you can often encounter a rather large error log file. This can be a pain to work with because it can take an age to open up in management studio and navigation can be cumbersome.</p>
<h3>Managing the SQL Server Error Log</h3>
<p style="text-align: justify;">So in order to make working with your SQL Server Error log files easier, it&#8217;s a good idea to proactively manage their size.</p>
<ol style="text-align: justify;">
<li>There are two ways that you can go about this. Modify the configuration properties for your <a id="f2en" title="SQL Server Error Log" href="http://msdn.microsoft.com/en-us/library/ms187885.aspx">SQL Server Error Log</a> files. (In SQL Server Management Studio simply right click the SQL Server Log folder in Object Explorer and choose configure).</li>
<li>Make use of the system stored procedure <a id="uyfg" title="sp_cycle_errorlog" href="http://msdn.microsoft.com/en-us/library/ms182512.aspx">sp_cycle_errorlog</a> to immediately cycle the error log.</li>
</ol>
<p style="text-align: justify;">By default SQL Server retains the last six sql server error log files. The number of files for retention can be modified be editing the configuration properties for the <a id="mw-a" title="SQL Server Error log" href="http://msdn.microsoft.com/en-us/library/ms187885.aspx">SQL Server Error log</a>.</p>
<p style="text-align: justify;">I&#8217;m not going to waste time re-inventing the wheel here as there are already some great tutorials available on the net via your trusty friend Google. I particularly like the general overview of SQL Server Error Logs available at <a id="uc9m" title="SQL Server Pedia" href="http://sqlserverpedia.com/blog/sql-server-bloggers/sql-server-error-logs-2/">SQL Server Pedia</a>.</p>
<h3 style="text-align: justify;">Cut that large log down to size</h3>
<p style="text-align: justify;">The way I like to do things is even before looking to define a suitable log management scheme for a server, as soon as I encounter a large error log file I like to cycle that log right away using <a id="w0m." title="sp_cycle_errorlog" href="http://msdn.microsoft.com/en-us/library/ms182512.aspx">sp_cycle_errorlog</a>. This gets things under control immediately. Simply execute:</p>
<p style="padding-left: 30px; text-align: justify;"><span style="color: #000080;"><em>EXEC master.sys.sp_cycle_errorlog;</em></span></p>
<p style="text-align: justify;">Give your SQL Server Logs some TLC today&#8230;</p>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.johnsansom.com/index.php/2010/04/tlc-and-sql-server-error-log-management/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>SQL Snippet: Who owns that SQL Server Job?</title>
		<link>http://www.johnsansom.com/index.php/2010/03/sql-snippet-who-owns-that-sql-server-job/</link>
		<comments>http://www.johnsansom.com/index.php/2010/03/sql-snippet-who-owns-that-sql-server-job/#comments</comments>
		<pubDate>Wed, 10 Mar 2010 12:20:08 +0000</pubDate>
		<dc:creator>John Sansom</dc:creator>
				<category><![CDATA[Administration]]></category>
		<category><![CDATA[SQL Server Agent Jobs]]></category>
		<category><![CDATA[SQL Server Tips]]></category>
		<category><![CDATA[SQLServerPedia Syndication]]></category>
		<category><![CDATA[TSQL]]></category>

		<guid isPermaLink="false">http://www.johnsansom.com/?p=1990</guid>
		<description><![CDATA[Here is a handy T-SQL script that will list all SQL Server Agent Job owners by job. From an administration perspective, this query can come in handy when you need to ensure/validate the job owners on your server. One common mistake that I have seen is that when a user creates a new SQL Server [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: justify;">Here is a handy T-SQL script that will list all SQL Server Agent Job owners by job.</p>
<p>From an administration perspective, this query can come in handy when you need to ensure/validate the job owners on your server. One common mistake that I have seen is that when a user creates a new SQL Server Agent Job via SQL Server Management Studio, by default their Login will be assigned as the owner of the job. This is often not a desirable choice of owner and so it&#8217;s good idea to do a little house keeping every once in a while and check who the current Job Owners are for your environment.</p>
<div class="codecolorer-container sql default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="sql codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #993333; font-weight: bold;">USE</span> msdb;<br />
<br />
<span style="color: #993333; font-weight: bold;">SELECT</span><br />
A<span style="color: #66cc66;">.</span>Name <span style="color: #993333; font-weight: bold;">AS</span> JobName<span style="color: #66cc66;">,</span><br />
B<span style="color: #66cc66;">.</span>name <span style="color: #993333; font-weight: bold;">AS</span> JobOwner<br />
<span style="color: #993333; font-weight: bold;">FROM</span> dbo<span style="color: #66cc66;">.</span>sysjobs A<br />
<span style="color: #993333; font-weight: bold;">INNER</span> <span style="color: #993333; font-weight: bold;">JOIN</span> master<span style="color: #66cc66;">.</span>sys<span style="color: #66cc66;">.</span>syslogins B <span style="color: #993333; font-weight: bold;">ON</span><br />
A<span style="color: #66cc66;">.</span>owner_sid <span style="color: #66cc66;">=</span> B<span style="color: #66cc66;">.</span>sid;</div></div>
<h3>More Handy SQL Snippets</h3>
<ul>
<li><a title="What SQL Server Agent Jobs were running at that time?" href="http://www.johnsansom.com/index.php/2009/12/sql-agent-jobs-time-query/">What SQL Server Agent Jobs were running at &#8220;that&#8221; time?</a></li>
<li><a title="Most Costly SQL Server Queries" href="http://www.johnsansom.com/index.php/2009/05/how-to-identify-the-most-costly-sql-server-queries-using-dmvs/?preview=true&amp;preview_id=499&amp;preview_nonce=25ddb9893e">How to identify the most costly SQL Server queries using DMV’s</a></li>
<li><a title="Highest SQL Server Waits by Percentage" href="http://www.johnsansom.com/index.php/2009/12/sql-snippet-wait-types/">Highest SQL Server Waits by Percentage</a></li>
<li><a title="Identify All Active SQL Server Sessions" href="http://www.johnsansom.com/index.php/2009/06/dmv-query-to-identify-all-active-sql-server-sessions/">Identify All Active SQL Server Sessions</a></li>
</ul>
<p>I hope you find this SQL Snippet useful in your administration of SQL Server. If you have any questions regarding this snippet, SQL Server Agent Jobs or anything to do with SQL Server then let me know!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.johnsansom.com/index.php/2010/03/sql-snippet-who-owns-that-sql-server-job/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SQL Snippet: What SQL Server Agent Jobs were running at that time?</title>
		<link>http://www.johnsansom.com/index.php/2009/12/sql-agent-jobs-time-query/</link>
		<comments>http://www.johnsansom.com/index.php/2009/12/sql-agent-jobs-time-query/#comments</comments>
		<pubDate>Wed, 30 Dec 2009 09:00:22 +0000</pubDate>
		<dc:creator>John Sansom</dc:creator>
				<category><![CDATA[Administration]]></category>
		<category><![CDATA[SQL Server Tips]]></category>
		<category><![CDATA[SQLServerPedia Syndication]]></category>
		<category><![CDATA[SQL Server administration]]></category>
		<category><![CDATA[SQL Server Jobs]]></category>

		<guid isPermaLink="false">http://www.johnsansom.com/?p=1733</guid>
		<description><![CDATA[Here is a SQL Snippet that can be used to identify the SQL Server Agent Jobs that were running on a server at a particular point in time. This can come in very handy if you need to troubleshoot a performance issue after the fact and want to find out if there were any jobs [...]]]></description>
			<content:encoded><![CDATA[<p>Here is a SQL Snippet that can be used to identify the SQL Server Agent Jobs that were running on a server at a particular point in time.</p>
<p>This can come in very handy if you need to troubleshoot a performance issue after the fact and want to find out if there were any jobs running on your server at a particular point in time retrospectively. The cumbersome alternative is to use a combination of the Job Activity Monitor,Job History and Schedules interfaces within SQL Server Management Studio (SSMS).</p>
<p>To use this snippet simply substitute in the DateTime that you are interested in.</p>
<div class="codecolorer-container sql default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="sql codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&nbsp;<span style="color: #808080; font-style: italic;">/*--------------------------------------------------------------------------------------------------------------<br />
Date: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 29/12/09<br />
Author: &nbsp; &nbsp; &nbsp; &nbsp; John Sansom<br />
Description:&nbsp; &nbsp; Script to identify SQL Server Agent jobs that were <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; running on the server at a particular time<br />
----------------------------------------------------------------------------------------------------------------*/</span><br />
<br />
DECLARE @jobsRunningAt DATETIME;<br />
<br />
<span style="color: #808080; font-style: italic;">--Modify the value here to be the DateTime you are Interested in.</span><br />
<span style="color: #993333; font-weight: bold;">SET</span> @jobsRunningAt <span style="color: #66cc66;">=</span> <span style="color: #ff0000;">'2009/12/28'</span>;<br />
<br />
<span style="color: #993333; font-weight: bold;">WITH</span> JobHistorySummary <span style="color: #993333; font-weight: bold;">AS</span><br />
<span style="color: #66cc66;">&#40;</span><br />
&nbsp; &nbsp; <span style="color: #993333; font-weight: bold;">SELECT</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; jobs<span style="color: #66cc66;">.</span>job_id<span style="color: #66cc66;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; job_name <span style="color: #66cc66;">=</span> jobs<span style="color: #66cc66;">.</span><span style="color: #66cc66;">&#91;</span>name<span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; step_id<span style="color: #66cc66;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; step_name<span style="color: #66cc66;">,</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; run_time<span style="color: #66cc66;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; run_time_hours <span style="color: #66cc66;">=</span> run_time<span style="color: #66cc66;">/</span><span style="color: #cc66cc;">10000</span><span style="color: #66cc66;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; run_time_minutes <span style="color: #66cc66;">=</span> <span style="color: #66cc66;">&#40;</span>run_time%10000<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">/</span><span style="color: #cc66cc;">100</span><span style="color: #66cc66;">,</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; run_time_seconds <span style="color: #66cc66;">=</span> <span style="color: #66cc66;">&#40;</span>run_time%10000<span style="color: #66cc66;">&#41;</span>%100<span style="color: #66cc66;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; run_time_elapsed_seconds <span style="color: #66cc66;">=</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#40;</span>run_time<span style="color: #66cc66;">/</span><span style="color: #cc66cc;">10000</span> <span style="color: #808080; font-style: italic;">/*run_time_hours*/</span> <span style="color: #66cc66;">*</span> <span style="color: #cc66cc;">60</span> <span style="color: #66cc66;">*</span> <span style="color: #cc66cc;">60</span> <span style="color: #808080; font-style: italic;">/* hours to minutes to seconds*/</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">+</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#40;</span>run_time%10000<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">/</span><span style="color: #cc66cc;">100</span> <span style="color: #808080; font-style: italic;">/* run_time_minutes */</span> <span style="color: #66cc66;">*</span> <span style="color: #cc66cc;">60</span> <span style="color: #808080; font-style: italic;">/* minutes to seconds */</span> <span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">+</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#40;</span>run_time%10000<span style="color: #66cc66;">&#41;</span>%100<span style="color: #66cc66;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; Start_Date <span style="color: #66cc66;">=</span> CONVERT<span style="color: #66cc66;">&#40;</span>DATETIME<span style="color: #66cc66;">,</span> RTRIM<span style="color: #66cc66;">&#40;</span>run_date<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; Start_DateTime <span style="color: #66cc66;">=</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; CONVERT<span style="color: #66cc66;">&#40;</span>DATETIME<span style="color: #66cc66;">,</span> RTRIM<span style="color: #66cc66;">&#40;</span>run_date<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">+</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#40;</span>run_time<span style="color: #66cc66;">/</span><span style="color: #cc66cc;">10000</span> <span style="color: #66cc66;">*</span> <span style="color: #cc66cc;">3600</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">+</span> <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#40;</span>run_time%10000<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">/</span><span style="color: #cc66cc;">100</span><span style="color: #66cc66;">*</span><span style="color: #cc66cc;">60</span><span style="color: #66cc66;">&#41;</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">+</span> <span style="color: #66cc66;">&#40;</span>run_time%10000<span style="color: #66cc66;">&#41;</span>%100 <span style="color: #808080; font-style: italic;">/*run_time_elapsed_seconds*/</span><span style="color: #66cc66;">&#41;</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">/</span> <span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">23.999999</span><span style="color: #66cc66;">*</span><span style="color: #cc66cc;">3600</span> <span style="color: #808080; font-style: italic;">/* seconds in a day*/</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; End_DateTime <span style="color: #66cc66;">=</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; CONVERT<span style="color: #66cc66;">&#40;</span>DATETIME<span style="color: #66cc66;">,</span> RTRIM<span style="color: #66cc66;">&#40;</span>run_date<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">+</span> <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#40;</span>run_time<span style="color: #66cc66;">/</span><span style="color: #cc66cc;">10000</span> <span style="color: #66cc66;">*</span> <span style="color: #cc66cc;">3600</span><span style="color: #66cc66;">&#41;</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">+</span> <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#40;</span>run_time%10000<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">/</span><span style="color: #cc66cc;">100</span><span style="color: #66cc66;">*</span><span style="color: #cc66cc;">60</span><span style="color: #66cc66;">&#41;</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">+</span> <span style="color: #66cc66;">&#40;</span>run_time%10000<span style="color: #66cc66;">&#41;</span>%100<span style="color: #66cc66;">&#41;</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">/</span> <span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">86399.9964</span> <span style="color: #808080; font-style: italic;">/* Start Date Time */</span><span style="color: #66cc66;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">+</span> <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#40;</span>run_duration<span style="color: #66cc66;">/</span><span style="color: #cc66cc;">10000</span> <span style="color: #66cc66;">*</span> <span style="color: #cc66cc;">3600</span><span style="color: #66cc66;">&#41;</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">+</span> <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#40;</span>run_duration%10000<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">/</span><span style="color: #cc66cc;">100</span><span style="color: #66cc66;">*</span><span style="color: #cc66cc;">60</span><span style="color: #66cc66;">&#41;</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">+</span> <span style="color: #66cc66;">&#40;</span>run_duration%10000<span style="color: #66cc66;">&#41;</span>%100 <span style="color: #808080; font-style: italic;">/*run_duration_elapsed_seconds*/</span><span style="color: #66cc66;">&#41;</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">/</span> <span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">86399.9964</span> <span style="color: #808080; font-style: italic;">/* seconds in a day*/</span><span style="color: #66cc66;">&#41;</span><br />
&nbsp; &nbsp; <span style="color: #993333; font-weight: bold;">FROM</span> msdb<span style="color: #66cc66;">.</span>dbo<span style="color: #66cc66;">.</span>sysjobs jobs <span style="color: #993333; font-weight: bold;">WITH</span><span style="color: #66cc66;">&#40;</span>NOLOCK<span style="color: #66cc66;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #993333; font-weight: bold;">INNER</span> <span style="color: #993333; font-weight: bold;">JOIN</span> msdb<span style="color: #66cc66;">.</span>dbo<span style="color: #66cc66;">.</span>sysjobhistory history <span style="color: #993333; font-weight: bold;">WITH</span><span style="color: #66cc66;">&#40;</span>NOLOCK<span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">ON</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; jobs<span style="color: #66cc66;">.</span>job_id <span style="color: #66cc66;">=</span> history<span style="color: #66cc66;">.</span>job_id<br />
&nbsp; &nbsp; <span style="color: #993333; font-weight: bold;">WHERE</span> step_name <span style="color: #66cc66;">=</span> <span style="color: #ff0000;">'(Job outcome)'</span> <span style="color: #808080; font-style: italic;">--Only interested in final outcome of jobs</span><br />
<span style="color: #66cc66;">&#41;</span><br />
<span style="color: #993333; font-weight: bold;">SELECT</span> <br />
&nbsp; &nbsp; job_id<span style="color: #66cc66;">,</span><br />
&nbsp; &nbsp; job_name<span style="color: #66cc66;">,</span><br />
&nbsp; &nbsp; Start_DateTime<span style="color: #66cc66;">,</span><br />
&nbsp; &nbsp; End_DateTime<br />
<span style="color: #993333; font-weight: bold;">FROM</span> JobHistorySummary<br />
<span style="color: #993333; font-weight: bold;">WHERE</span> Start_DateTime <span style="color: #66cc66;">&lt;=</span> @jobsRunningAt <span style="color: #993333; font-weight: bold;">AND</span> End_DateTime <span style="color: #66cc66;">&gt;=</span> @jobsRunningAt<br />
<span style="color: #993333; font-weight: bold;">ORDER</span> <span style="color: #993333; font-weight: bold;">BY</span> End_DateTime <span style="color: #993333; font-weight: bold;">DESC</span>;</div></div>
<h2>Similar Posts</h2>
<ul>
<li><a title="Identify All Active SQL Server Sessions" href="http://www.johnsansom.com/index.php/2009/06/dmv-query-to-identify-all-active-sql-server-sessions/">Identify All Active SQL Server Sessions</a></li>
<li> <a title="Most Costly SQL Server Queries" href="http://www.johnsansom.com/index.php/2009/05/how-to-identify-the-most-costly-sql-server-queries-using-dmvs/?preview=true&amp;preview_id=499&amp;preview_nonce=25ddb9893e">How to identify the most costly SQL Server queries using DMV’s </a></li>
<li><a title="Highest SQL Server Waits by Percentage" href="http://www.johnsansom.com/index.php/2009/12/sql-snippet-wait-types/">Highest SQL Server Waits by Percentage</a></li>
</ul>
<p>I hope you find this SQL Snippet useful in your administration of SQL Server. If you have any questions regarding this snippet, SQL Server Agent Jobs or anything whatsoever to do with SQL Server then feel free to ask.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.johnsansom.com/index.php/2009/12/sql-agent-jobs-time-query/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>SQL Server Essentials – Part 2: Why you should be using the FULL Recovery Model</title>
		<link>http://www.johnsansom.com/index.php/2009/07/why-you-should-be-using-the-full-recovery-model/</link>
		<comments>http://www.johnsansom.com/index.php/2009/07/why-you-should-be-using-the-full-recovery-model/#comments</comments>
		<pubDate>Mon, 27 Jul 2009 12:15:05 +0000</pubDate>
		<dc:creator>John Sansom</dc:creator>
				<category><![CDATA[Administration]]></category>
		<category><![CDATA[Backups]]></category>
		<category><![CDATA[Disaster Recovery]]></category>
		<category><![CDATA[SQLServerPedia Syndication]]></category>
		<category><![CDATA[SQL Server administration]]></category>
		<category><![CDATA[SQL Server Backups]]></category>
		<category><![CDATA[SQL Server DR]]></category>
		<category><![CDATA[SQL Server Essentials]]></category>

		<guid isPermaLink="false">http://www.johnsansom.com/?p=1088</guid>
		<description><![CDATA[In Part 1 of the &#8220;SQL Server Essentials&#8221; series we discussed the Database Administrator&#8217;s primary responsibility. Given that your data is so important, how can you manage and ensure it&#8217;s safekeeping? Should a data loss event occur, you want to be in a position to enable you to protect the majority, if not all, of [...]]]></description>
			<content:encoded><![CDATA[<p>In <a id="xpd9" title="Part 1" href="../index.php/2009/07/the-database-administrators-primary-responsibility/">Part 1</a> of the &#8220;SQL Server Essentials&#8221; series we discussed the <a title="SQL Server Essentials – Part 1: The Database Administrator’s Primary Responsibility" href="http://www.johnsansom.com/index.php/2009/07/the-database-administrators-primary-responsibility/">Database Administrator&#8217;s primary responsibility</a>.</p>
<p>Given that your data is so important, how can you manage and ensure it&#8217;s safekeeping? Should a <em>data loss event</em> occur, you want to be in a position to enable you to protect the majority, if not all, of your data.</p>
<h2><strong>What can I do to defend myself against data loss?</strong></h2>
<p>You want to be able to create copies of your database data and to store them in a safe place, so that should a <em>data loss event </em>occur, you are able to recover any lost/damaged data as a result.</p>
<p>Fortunately help is at hand in order to achieve this objective. The most basic and simple defence mechanism at your disposal is the <em>SQL Server backup and restore component</em>. It provides an essential safeguard for protecting critical data stored in SQL  Server databases.</p>
<h2 style="font-weight: normal;"><strong>SQL Server data backup<br />
</strong></h2>
<p>There are several <em>scopes </em>of data backups available for use in SQL Server. These being:</p>
<ul>
<li>a whole database</li>
<li>a partial database</li>
<li>a set of files</li>
<li>a set of filegroups</li>
</ul>
<p>For each of these SQL Server supports both <em>FULL </em>and <em>DIFFERENTIAL </em>backups.</p>
<ul>
<li>A <em>full backup</em> contains all the data in a specific database or set of  filegroups or files, and also enough log to allow for recovering that data.</li>
<li>A <em>differential backup</em> contains only the data that has changed since the  differential base (last <em>full backup</em>).</li>
</ul>
<p>For detailed documentation regarding SQL Server Backups, there is excellent coverage in SQL Server Books Online. A good starting point would be <a id="x5z." title="Backing Up and Restoring Databases in SQL Server" href="http://msdn.microsoft.com/en-us/library/ms187048.aspx">Backing Up and Restoring Databases in SQL Server</a>. You should consider this as part of your <strong>Essential Reading List</strong>.</p>
<h2><strong>Data loss, it will happen to you </strong></h2>
<p>You should always work under the assumption that <strong>a <em>data loss</em> event will occur</strong> at some point and that it will have a detrimental impact to your database. Adopting this frame of mind will assist you with planning accordingly for such an event, so that you are not caught out unexpectedly.</p>
<p>Remember, a <em>data loss event</em> does not have to be a huge catastrophe. It could be something that in essence is quite simple. For example, the dropping of a database table, or perhaps a developer may need to recover a prior version of a Stored Procedure or Trigger&#8217;s source code. If you would like to learn more about the different types<em> of data loss events </em>refer back to Part 1 of the SQL Server Essentials Series,<a title="SQL Server Essentials Part1: The Database Administrators Primary Responsibility" href="http://www.johnsansom.com/index.php/2009/07/the-database-administrators-primary-responsibility/"> The Database Administrators Primary Responsibility</a>.</p>
<p>You can protect yourself against all but the most extreme data loss scenarios by taking a few simple steps and <strong>ensuring you undertake sufficient planning</strong> for your requirements.</p>
<h2><strong><strong><img class="alignnone size-thumbnail wp-image-1094" title="safe" src="http://www.johnsansom.com/wp-content/uploads/2009/07/safe-150x150.png" alt="safe" width="150" height="150" /></strong></strong></h2>
<h2><strong>You may need to take a FULL database backup right now</strong></h2>
<p>Should you discover that you do not have a backup of your database data whatsoever, then you are currently <strong>very exposed</strong> to a <em>data loss event </em>and should create a <em>database backup</em> either immediately or as soon as it is practical to do so.</p>
<ul>
<li><a id="vr.v" title="How to: Back Up a Database (SQL Server Management Studio)" href="http://msdn.microsoft.com/en-us/library/ms187510.aspx">How to: Back Up a Database (SQL Server Management Studio)</a></li>
<li><a id="bnpe" title="How to: Create a Full Database Backup (Transact-SQL)" href="http://msdn.microsoft.com/en-us/library/ms191304.aspx">How to: Create a Full Database Backup (Transact-SQL)</a></li>
</ul>
<p>There are several ways in which you can determine if your SQL Server database has been backed up. A Database Administrator will often create scripts in order to manage such a task. Some examples include:</p>
<ul>
<li><a href="http://www.mssqltips.com/tip.asp?tip=1601">Script to retrieve SQL Server database backup history; last week, most recent and no backups</a></li>
<li><a title="SQL Server backup History Analysis" href="http://www.mssqltips.com/tip.asp?tip=1596">SQL Server Backup History Analysis</a></li>
<li><a href="http://www.mssqltips.com/tip.asp?tip=1800">Script to check that backup files still exist for SQL Server</a></li>
</ul>
<h2><strong>Why a FULL database backup alone is not sufficient</strong></h2>
<p>As you may have gathered by this point, a SQL Server <em>Full database backup provides</em> a copy of your data that is <strong><em>accurate only as of the time it was taken</em></strong>. So any transactions that have subsequently occurred since your database backup, are exposed and vulnerable to a <em>data loss event</em>.</p>
<p>If your database data is relatively static or perhaps you have a <em>read-only database</em>, then this may not be a concern for you and your regular <em>Full database backups</em> may prove sufficient for your requirements.</p>
<p>If on the other hand, your database experiences frequent transactional activity involving data modifications, for example a typical Online Transaction Processing (OLTP) database, then you will want to ensure your data is protected at all times. You will want to ensure that you can <strong>recover your database to a particular point in time</strong>.</p>
<p>To facilitate this need, each SQL Server database records all <em>transactions </em>and database modifications made by each <em>transaction</em>, within the <em><a id="j2gk" title="Transaction Log" href="http://msdn.microsoft.com/en-us/library/ms190925.aspx">Transaction Log</a></em>. The extent to which this information is logged however, is determined by the <em>Recovery Model</em> that your database is using.<br />
<span style="text-decoration: underline;"><br />
SQL Server Recover Models</span></p>
<p>As described in SQL Server Books Online, <a id="r9rp" title="Introduction to Backup and Restore Strategies in SQL Server" href="http://msdn.microsoft.com/en-us/library/ms191239.aspx">Introduction to Backup and Restore Strategies in SQL Server</a>:<br />
<span style="font-size: xx-small;"> </span></p>
<p>&#8220;Backup and restore operations occur within the context of a recovery model. A recovery model is a database property that controls how the transaction log is managed. Also, the recovery model of a database determines what types of backups and what restore scenarios are supported for the database. Typically a database uses either the simple recovery model or the full recovery model. The full recovery model can be supplemented by switching to the bulk-logged recovery model before bulk operations. For an introduction to these recovery models and how they affect transaction log management, see <a id="ctl00_MTContentSelector1_mainContentContainer_ctl09" href="http://msdn.microsoft.com/en-us/library/ms366344.aspx">Recovery Models and Transaction Log Management</a>.</p>
<p><span style="font-size: xx-small;"> </span></p>
<p>The <strong>full recovery model</strong> uses log backups to prevent data loss in the <strong>broadest range of failure scenarios</strong>, and backing and restoring the transaction log (<em>log backups</em>) is required. The advantage of using log backups is that they let you restore a database to any point of time that is contained within a log backup (<em>point-in-time recovery</em>). You can use a series of log backups to roll a database forward to any point in time that is contained in one of the log backups. Be aware that to minimize your restore time, you can supplement each full backup with a series of differential backups of the same data.&#8221;</p>
<p>To summarise the key message here, <strong>in order to be able to restore your database to a particular point in time you &#8220;must&#8221; be using the <em>Full Recovery Model</em>.</strong></p>
<p>For a detailed explanation of these concepts, please refer to SQL Server Books Online:<a id="hjwi" title="Backup Under the Full Recovery Model" href="http://msdn.microsoft.com/en-us/library/ms190217.aspx">Backup Under the Full Recovery Model</a> which again should be considered as part of your  <strong>Essential Reading List</strong>.</p>
<h2><strong>Final Thoughts</strong></h2>
<p>I hope you have enjoyed reading this post and that it proves useful in your administration of SQL Server. As always, if you have any queries, comments or suggestions then please do feel free to leave them below using the comments form.</p>
<p>Database backups and SQL Server disaster recovery planning are detailed topics and require much more consideration, research and planning than are presented in this post alone. The important point to take away with you, is that if you want to ensure that you are able to recover your database to a specific point in time, say in response to a <em>data loss event</em>, then you must be using the <em>Full Recovery Model</em>.</p>
<p>In a future installment of the  SQL Server Essentials series, we will be taking a closer look at SQL Server backups and discussing how you can plan and devise your very own backup strategy.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.johnsansom.com/index.php/2009/07/why-you-should-be-using-the-full-recovery-model/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>SQL Server Essentials – Part 1: The Database Administrator’s Primary Responsibility</title>
		<link>http://www.johnsansom.com/index.php/2009/07/the-database-administrators-primary-responsibility/</link>
		<comments>http://www.johnsansom.com/index.php/2009/07/the-database-administrators-primary-responsibility/#comments</comments>
		<pubDate>Mon, 20 Jul 2009 06:24:55 +0000</pubDate>
		<dc:creator>John Sansom</dc:creator>
				<category><![CDATA[Administration]]></category>
		<category><![CDATA[Disaster Recovery]]></category>
		<category><![CDATA[Professional Development]]></category>
		<category><![CDATA[SQLServerPedia Syndication]]></category>
		<category><![CDATA[DBA Primary Responsibility]]></category>
		<category><![CDATA[SQL Server Data Loss]]></category>
		<category><![CDATA[SQL Server DBA]]></category>
		<category><![CDATA[SQL Server Essentials]]></category>

		<guid isPermaLink="false">http://www.johnsansom.com/?p=987</guid>
		<description><![CDATA[You&#8217;re busy coding away at your workstation when all of a sudden your manager walks over to you all excited and begins discussing with you, the details of this great new application your company has just aquired. It turns out that he wants you to look after and administer this newly aquired application platform, which [...]]]></description>
			<content:encoded><![CDATA[<p>You&#8217;re busy coding away at your workstation when all of a sudden your manager walks over to you all excited and begins discussing with you, the details of this great new application your company has just aquired. It turns out that he wants you to look after and administer this newly aquired application platform, which by the way, has a SQL Server engine.</p>
<p>You&#8217;re a natural when it comes to solving problems and you think you can handle it for sure, that is until slowly but surely it dawns on you that you have never actually had to administer a SQL Server database server before. In fact, you&#8217;re not even sure where you should begin.</p>
<p>Well fear not my friend! Whether you are an accidental DBA, just getting started with learning SQL Server technology or perhaps you just want to polish up on the basics. This is the first in a series of blog posts just for you guys and girls that want to get up to speed on the essentials of SQL Server, the core stuff that you just absolutely must know.</p>
<p>So with no time to loose, let&#8217;s get started&#8230;..</p>
<h2>What is the primary and most important responsibility of a SQL Server Database Administrator?</h2>
<p>Before you even go anywhere near a keyboard or launch SQL Server Management Studio, the first lesson that you absolutely must take on board is that the primary responsibility of a SQL Server database administrator is <em>&#8220;data&#8221;</em>.</p>
<h2>What&#8217;s so special about data?</h2>
<p>Data is arguably the most valuable asset of a business. It is the lifeblood of the organisation, whithout which it cannot function. As a SQL Server database administrator you have to safeguard your data.</p>
<p>The variety of information that data can describe is possibly limitless, with each variety just as important as the next, to the business it belongs to. Some examples of information that data may be used to describe include:</p>
<ul>
<li>An Application Backend/Data store</li>
<li>Storing and collecting vast amounts of data from the Large Hardron Collider at <a title="CERN" href="http://public.web.cern.ch/public/">CERN</a> or Modelling the <a href="http://www.ornl.gov/sci/techresources/Human_Genome/home.shtml">human genome</a></li>
<li>Customer/Client Contact Details</li>
<li>Financial Information / Banking Systems / Credit Card Processing</li>
<li>Company Sales Figures</li>
<li>Order Inventory System</li>
<li>Website Content</li>
<li>Train Timetables / Aircraft Reservation</li>
<li>Library / DVD / Car Rental</li>
</ul>
<p>The list is, as I&#8217;m sure you can imagine, potentially infinte. What should be immediately clear to you however, is that if anything bad were to happen to your data, for example a <em>data loss event</em> were to occur, it would almost certainly have a negative impact to the business. Possibly even serious enough to result in closure. Seriously this can and unfortunatly does happen!</p>
<div id="attachment_1013" class="wp-caption alignnone" style="width: 160px;  border: 1px solid #dddddd; background-color: #f3f3f3; padding-top: 4px; margin: 10px; text-align:center;"><img class="size-thumbnail wp-image-1013" title="YourFired" src="http://www.johnsansom.com/wp-content/uploads/2009/07/YourFired-150x150.jpg" alt="YourFired" width="150" height="150" /><p style=' padding: 0 4px 5px; margin: 0;'  class="wp-caption-text">&quot;You&#39;re Fired!&quot; </p></div>
<p>Do <strong>NOT </strong>let <a href="http://www.techcrunch.com/2009/03/23/online-backup-company-carbonite-loses-customers-data-blames-and-sues-suppliers/">this</a> happen to you.</p>
<h2>Data Loss Event Types</h2>
<p>To give you an idea of what you&#8217;re going to be up against, consider that <a title="Wikipedia:Data Loss Events" href="http://en.wikipedia.org/wiki/Data_loss">Wikpedia </a>categorises <em>data loss events</em> into 5 main categories:</p>
<p><strong> </strong></p>
<ul>
<li><em>Intentional Action</em>
<ul>
<li>Intentional deletion of a file or program</li>
</ul>
</li>
<li><em>Unintentional Action</em>
<ul>
<li>Accidental deletion of a file or program</li>
<li>Misplacement of CDs or floppies</li>
<li>Administration errors</li>
<li>Inability to read unknown file format</li>
</ul>
</li>
<li><em>Failure</em>
<ul>
<li><a title="Power failure" href="http://en.wikipedia.org/wiki/Power_failure">Power failure</a>, resulting in data in volatile memory not being saved to permanent memory.</li>
<li>Hardware failure, such as a <a title="Head crash" href="http://en.wikipedia.org/wiki/Head_crash">head crash</a> in a hard disk.</li>
<li>A software <a title="Crash (computing)" href="http://en.wikipedia.org/wiki/Crash_%28computing%29">crash</a> or freeze, resulting in data not being saved.</li>
<li>Software bugs or poor <a title="Usability" href="http://en.wikipedia.org/wiki/Usability">usability</a>, such as not confirming a file delete command.</li>
<li><a title="Data corruption" href="http://en.wikipedia.org/wiki/Data_corruption">Data corruption</a>, such as filesystem corruption or database corruption.</li>
</ul>
</li>
<li><em>Disaster</em>
<ul>
<li><a title="Natural disaster" href="http://en.wikipedia.org/wiki/Natural_disaster">Natural disaster</a>, <a title="Earthquake" href="http://en.wikipedia.org/wiki/Earthquake">earthquake</a>, <a title="Flood" href="http://en.wikipedia.org/wiki/Flood">flood</a>, <a title="Tornado" href="http://en.wikipedia.org/wiki/Tornado">tornado</a>, etc.</li>
<li><a title="Fire" href="http://en.wikipedia.org/wiki/Fire">Fire</a></li>
</ul>
</li>
<li><em>Crime</em>
<ul>
<li>Theft, hacking, sabotage, etc.</li>
<li>A malicious act, such as a <a title="Computer worm" href="http://en.wikipedia.org/wiki/Computer_worm">worm</a>, <a title="Computer virus" href="http://en.wikipedia.org/wiki/Computer_virus">virus</a>, <a title="Hacker (computer security)" href="http://en.wikipedia.org/wiki/Hacker_%28computer_security%29">hacker</a> or theft of physical media.</li>
</ul>
</li>
</ul>
<h2>Understanding your responsibility</h2>
<div id="attachment_1015" class="wp-caption alignnone" style="width: 160px;  border: 1px solid #dddddd; background-color: #f3f3f3; padding-top: 4px; margin: 10px; text-align:center;"><img class="size-thumbnail wp-image-1015" title="worldonyourshoulders" src="http://www.johnsansom.com/wp-content/uploads/2009/07/worldonyourshoulders-150x150.jpg" alt="The weight of the world on your shoulders" width="150" height="150" /><p style=' padding: 0 4px 5px; margin: 0;'  class="wp-caption-text">&quot;The weight of the world on your shoulders&quot;</p></div>
<p>I want you to sit back and to take a moment to think about what it is that you are about to become responsible for.</p>
<p>Make no mistake, as a SQL Server database administrator it is<strong> YOU </strong>who is responsible for safeguarding the database data. Your actions could be what makes the difference between a <em>data loss event</em> being fatal to your business or merely just a nuissance.</p>
<h2>What can I do to look after my data?</h2>
<p>Now that you know the Database Administrator&#8217;s primary responsibility is the data in their custody, what with all these potential risks vying to get at your precious data, what can you do to defend yourself?</p>
<p>Find out in Part 2 of the <a title="SQL Server Essentials Series" href="http://www.johnsansom.com/index.php/sql-server-essentials/">SQL Server Essentials Series</a>, where we will look at the SQL Server database administrator&#8217;s most formidable defence method and discuss <a title="Why You Should be Using the FULL Recover Model" href="http://www.johnsansom.com/index.php/2009/07/why-you-should-be-using-the-full-recovery-model/"><em>Why you should be using the FULL Recovery Model</em> </a>for your databases.</p>
<p>Have you got a tale to tell about <em>data loss</em>? Please feel free to share your thoughts using the comments box below.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.johnsansom.com/index.php/2009/07/the-database-administrators-primary-responsibility/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>SQL Server Reporting Services Tip: email subscription tweak</title>
		<link>http://www.johnsansom.com/index.php/2009/07/permit-ssrs-subscription-email/</link>
		<comments>http://www.johnsansom.com/index.php/2009/07/permit-ssrs-subscription-email/#comments</comments>
		<pubDate>Thu, 09 Jul 2009 12:24:00 +0000</pubDate>
		<dc:creator>John Sansom</dc:creator>
				<category><![CDATA[Administration]]></category>
		<category><![CDATA[Reporting Services]]></category>
		<category><![CDATA[SQL Server Tips]]></category>
		<category><![CDATA[Reporting Services Email Delivery]]></category>
		<category><![CDATA[SQL Server Reporting Services]]></category>

		<guid isPermaLink="false">http://www.johnsansom.com/?p=760</guid>
		<description><![CDATA[What&#8217;s the problem? How to configure SQL Server Reporting Services 2005 to permit users to assign the delivery email address for their own subscriptions. Why does SQL Server work this way? When you subscribe to a report, the e-mail delivery settings you work with vary depending on whether your Role includes the &#8220;Manage individual subscriptions&#8221; [...]]]></description>
			<content:encoded><![CDATA[<p><strong>What&#8217;s the problem?</strong></p>
<p>How to configure SQL Server Reporting Services 2005 to permit users to assign the delivery email address for their own subscriptions.</p>
<p><strong>Why does SQL Server work this way?</strong></p>
<p>When you subscribe to a report, the e-mail delivery settings you work with vary depending on whether your <em>Role</em> includes the &#8220;Manage individual subscriptions&#8221; task or the &#8220;Manage all subscriptions&#8221; task. See <a title="E-Mail Delivery in Reporting Services" href="http://msdn.microsoft.com/en-us/library/ms160334.aspx">E-Mail Delivery in Reporting Services</a> for further information.</p>
<p>By default, a Reporting Services <em>user </em>cannot modify the email delivery target for their own subscriptions. Now providing a user the ability to Manage All Subscriptions on a given Report Server is not really a practical solution.</p>
<p><strong>How can I make it work my way?</strong></p>
<p>As an alternative what you can do is modify the security settings of the Report Server to allow a user to specify the delivery email address for their own subscriptions.</p>
<p>This requires a configuration change to the <a title="Report Server Configuration File" href="http://msdn.microsoft.com/en-us/library/ms157273.aspx">Report Server Configuration File</a></p>
<p>Modify the value for the &#8220;SendEmailToUserAlias&#8221; XML Attribtue to be “<strong>false</strong>” in order to permit any email address to be specified.</p>
<p>See <a title="Configuring A Report Server for Email Delivery" href="http://msdn.microsoft.com/en-us/library/ms159155.aspx">Configuring a Report Server for Email Delivery</a> for detailed instructions.</p>
<p><strong>Additional Considerations</strong></p>
<p><strong> </strong></p>
<p>If you are going to permit your Report Server users to be able to specifiy the delivery address for their subscriptions then it is wise in my opinon to also limit the Domains to which you permit delivery to, for example only trusted domains internal to the organisation. This can also be configured within the very same Report Server configuration file.</p>
<p>There you have it. Simple when you know how.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.johnsansom.com/index.php/2009/07/permit-ssrs-subscription-email/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The Definitive Introduction to SQL Server Indexes</title>
		<link>http://www.johnsansom.com/index.php/2009/06/the-definitive-introduction-to-sql-server-indexes/</link>
		<comments>http://www.johnsansom.com/index.php/2009/06/the-definitive-introduction-to-sql-server-indexes/#comments</comments>
		<pubDate>Mon, 29 Jun 2009 08:23:07 +0000</pubDate>
		<dc:creator>John Sansom</dc:creator>
				<category><![CDATA[Administration]]></category>
		<category><![CDATA[Index Optimisation]]></category>
		<category><![CDATA[Performance Tuning]]></category>
		<category><![CDATA[Introduction to SQL Server Indexes]]></category>
		<category><![CDATA[SQL Server Index Optimization]]></category>
		<category><![CDATA[SQL Server Indexes]]></category>

		<guid isPermaLink="false">http://www.johnsansom.com/?p=757</guid>
		<description><![CDATA[It normally is not my style to write a blog post solely about a particular article someone else has published. Typically I just go ahead and add quality resources to the SQL Server Resources area of this site that I have either found myself or had recommended to me. In this case however an exception [...]]]></description>
			<content:encoded><![CDATA[<p>It normally is not my style to write a blog post solely about a particular article someone else has published. Typically I just go ahead and add quality resources to the <a title="SQL Server Resources" href="http://www.johnsansom.com/index.php/sql-server-resources/">SQL Server Resources</a> area of this site that I have either found myself or had recommended to me.</p>
<p>In this case however an exception must be made!</p>
<p>Brad McGehee has published what could potentially be <strong>the best introduction to SQL Server Indexes</strong> that I have ever read. It explains in detailed yet incredibly clear language, not only the mechanics of indexes but also the architecture of these data structures (illustrated by some excellent diagrams).</p>
<p>I highly recommend that you read <a title="Brad's Sure Guide to Indexes " href="http://www.simple-talk.com/sql/database-administration/brads-sure-guide-to-indexes/">Brad&#8217;s Sure Guide to Indexes</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.johnsansom.com/index.php/2009/06/the-definitive-introduction-to-sql-server-indexes/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
