<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss 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/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>A Wandering Mind</title>
	
	<link>http://awanderingmind.com</link>
	<description>How I deal with all the clutter in my head... and other geeky goodness</description>
	<lastBuildDate>Sun, 13 May 2012 20:56:17 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/awanderingmind/Fzqz" /><feedburner:info uri="awanderingmind/fzqz" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item>
		<title>Presenting At #SQLSat121 in Philly</title>
		<link>http://feedproxy.google.com/~r/awanderingmind/Fzqz/~3/vGvaPQsusy4/</link>
		<comments>http://awanderingmind.com/2012/05/13/presenting-at-sqlsat121-in-philly/#comments</comments>
		<pubDate>Sun, 13 May 2012 20:56:17 +0000</pubDate>
		<dc:creator>Josh</dc:creator>
				<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[automation]]></category>
		<category><![CDATA[Presentations]]></category>
		<category><![CDATA[productivity]]></category>

		<guid isPermaLink="false">http://awanderingmind.com/?p=699</guid>
		<description><![CDATA[I&#8217;m excited to announce that I&#8217;ll be presenting at SQL Saturday 121 in Philadelphia on June 9th! My session is titled &#8220;Avoiding Monkey At The Monitor By Delegating&#8220;; I&#8217;ll be showing some ways to securely delegate menial DBA work so that you can focus on more important (less urgent) work. While the session is really [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m excited to announce that I&#8217;ll be presenting at SQL Saturday 121 in Philadelphia on June 9th! My session is titled &#8220;<a href="http://sqlsaturday.com/viewsession.aspx?sat=121&amp;sessionid=7654" target="_blank">Avoiding Monkey At The Monitor By Delegating</a>&#8220;; I&#8217;ll be showing some ways to securely delegate menial DBA work so that you can focus on more important (less urgent) work. While the session is really geared towards DBAs, it could be useful for some developers as well, since we&#8217;ll be talking about things like permission chaining and certificate security as well.</p>
<p>I&#8217;m obviously psyched to be part of a great group of speakers. I&#8217;d be lying if I wasn&#8217;t a little nervous too, since this is my first time presenting at this level (or really any outside of my company, for that matter). So, I&#8217;ll be practicing quite a bit between now and then.</p>
<p>Hope to see you there!</p>
]]></content:encoded>
			<wfw:commentRss>http://awanderingmind.com/2012/05/13/presenting-at-sqlsat121-in-philly/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://awanderingmind.com/2012/05/13/presenting-at-sqlsat121-in-philly/</feedburner:origLink></item>
		<item>
		<title>T-SQL Tuesday #28 – Jack of All Trades, Master Of None</title>
		<link>http://feedproxy.google.com/~r/awanderingmind/Fzqz/~3/xW1jFGQpr34/</link>
		<comments>http://awanderingmind.com/2012/03/13/t-sql-tuesday-28-jack-of-all-trades-master-of-none/#comments</comments>
		<pubDate>Tue, 13 Mar 2012 21:55:56 +0000</pubDate>
		<dc:creator>Josh</dc:creator>
				<category><![CDATA[SQL Server]]></category>

		<guid isPermaLink="false">http://awanderingmind.com/?p=696</guid>
		<description><![CDATA[It&#8217;s T-SQL Tuesday again! This month is being hosted by Argenis Fernandez, and the topic is specialization. I am late to the game because, go figure, I was held up at work troubleshooting issues. Shocking, I know, that a DBA would be kept late at work! In my time working with SQL Server I&#8217;ve done [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://sqlblog.com/blogs/argenis_fernandez/archive/2012/03/05/t-sql-tuesday-028-jack-of-all-trades-master-of-none.aspx"><img class="alignleft size-full wp-image-320" title="TSQL2sDay150x150" src="http://awanderingmind.com/wp-content/uploads/2010/08/TSQL2sDay150x150.jpg" alt="T-SQL Tuesday" width="150" height="150" /></a></p>
<p>It&#8217;s T-SQL Tuesday again! This month is being hosted by <a href="http://sqlblog.com/blogs/argenis_fernandez/archive/2012/03/05/t-sql-tuesday-028-jack-of-all-trades-master-of-none.aspx">Argenis Fernandez</a>, and the topic is specialization. I am late to the game because, go figure, I was held up at work troubleshooting issues. Shocking, I know, that a DBA would be kept late at work!</p>
<p>In my time working with SQL Server I&#8217;ve done my best to keep my focus fairly small (I would say I&#8217;m a performance / admin specialist &#8211; maybe that&#8217;s a future blog post to describe what that means). What with all the various features that are contained within the sphere of the overall SQL Server product offering, it&#8217;d be fairly easy for my ADD-riddled brain to jump completely off the deep end. The problem is, as we know, trying to be an expert in everything ends up causing you to be an expert at nothing.</p>
<p>But even with keeping my SQL focus narrow, my job has expanded greatly in the last year or so after I left the production DBA group. Being the only full-time DBA on the current team means that I&#8217;ve also had to pick up other skills, such as VMWare and AD domain administration to name a few. Has this hurt my SQL Server skills? I&#8217;d have to say yes, as it&#8217;s taken away time and brainpower I could have devoted to learning / fine-tuning my SQL Server skillset. But at the same time, it is a necessary evil in today&#8217;s &#8220;do more with less&#8221; world, and I need to accept that.</p>
<p>So how do I try and balance out the lost time? In my spare time at home, of course. Naturally things like family time take precedence, but I do make a point to spend a few hours every week playing around in my home lab setup. This has helped keep me pretty sharp, though I certainly wish I could do more. Especially with SQL 2012 coming out, the &#8220;To Learn / Play&#8221; list just keeps growing and growing.</p>
<p>I&#8217;d love to hear from other folks who&#8217;ve found their roles at work shifting and expanding, and how you have tried to keep some relative priority on SQL Server as your &#8220;specialty&#8221;.</p>
]]></content:encoded>
			<wfw:commentRss>http://awanderingmind.com/2012/03/13/t-sql-tuesday-28-jack-of-all-trades-master-of-none/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://awanderingmind.com/2012/03/13/t-sql-tuesday-28-jack-of-all-trades-master-of-none/</feedburner:origLink></item>
		<item>
		<title>Finding All Access Groups For A Windows Login With sys.login_token</title>
		<link>http://feedproxy.google.com/~r/awanderingmind/Fzqz/~3/7ZyTlVR53UU/</link>
		<comments>http://awanderingmind.com/2012/03/09/finding-all-access-groups-for-a-windows-login-with-sys-login_token/#comments</comments>
		<pubDate>Sat, 10 Mar 2012 02:02:34 +0000</pubDate>
		<dc:creator>Josh</dc:creator>
				<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[T-SQL Programming]]></category>
		<category><![CDATA[Permissions]]></category>

		<guid isPermaLink="false">http://awanderingmind.com/?p=691</guid>
		<description><![CDATA[Recently I had a requirement to determine how a certain Windows user gained access to an instance of SQL. Let&#8217;s say, for example, you want to audit certain DDL code executions for some users, but not for others. We could do this at the individual login level, but that would be tedious to keep up. [...]]]></description>
			<content:encoded><![CDATA[<p>Recently I had a requirement to determine how a certain Windows user gained access to an instance of SQL. Let&#8217;s say, for example, you want to audit certain DDL code executions for some users, but not for others. We could do this at the individual login level, but that would be tedious to keep up. Instead, we want to use Windows domain groups to selectively enable the audit process. The trouble is, when a user is logged in all we see is their individual user name, not the name of the groups that, but virtue of them being a member, give them access to the server. Or do we?</p>
<p>I was reading <a href="http://www.sommarskog.se/grantperm.html">a post by Erland Sommarskog</a> on the subject of permission granting through stored procedures, and noticed his use of a system view called sys.user_tokens. This view (according to BOL) &#8220;Returns one row for every database principal that is part of the user token.&#8221; In essence, it shows one row per role or group that the user is part of. For example, if a user is a member of a Windows group that has access to the database, a row will be present for that.</p>
<p>This got me thinking, was there an equivalent for the server level? Sure enough, there is the sys.login_tokens view. This shows one row per server level authentication token. For some reason it seems to return duplicate rows at times, but when joined on the sys.server_principals table it does indeed seem to work as I hoped.</p>
<pre class="brush: sql; title: ; notranslate">

select	slt.name,
		ssp.type_desc
from	sys.login_token slt
			JOIN sys.server_principals ssp
				ON slt.sid = ssp.sid
where	ssp.type_desc = 'WINDOWS_GROUP'
</pre>
<p>This way I can tell what domain groups a user is a member of that gives them access to the server.</p>
]]></content:encoded>
			<wfw:commentRss>http://awanderingmind.com/2012/03/09/finding-all-access-groups-for-a-windows-login-with-sys-login_token/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://awanderingmind.com/2012/03/09/finding-all-access-groups-for-a-windows-login-with-sys-login_token/</feedburner:origLink></item>
		<item>
		<title>Time Tracking = Transparency To Clients</title>
		<link>http://feedproxy.google.com/~r/awanderingmind/Fzqz/~3/KEvA2JIbJx8/</link>
		<comments>http://awanderingmind.com/2012/03/07/time-tracking-transparency-to-clients/#comments</comments>
		<pubDate>Thu, 08 Mar 2012 01:23:29 +0000</pubDate>
		<dc:creator>Josh</dc:creator>
				<category><![CDATA[GTD]]></category>
		<category><![CDATA[Life As A DBA]]></category>
		<category><![CDATA[perspective]]></category>
		<category><![CDATA[priorities]]></category>
		<category><![CDATA[productivity]]></category>

		<guid isPermaLink="false">http://awanderingmind.com/?p=687</guid>
		<description><![CDATA[A short while ago, I read a great post by Kendra Little (@Kendra_Little on Twitter) on how using some common consulting tricks can be useful even for those not in a consulting role. One item that resonated in particular was the idea of tracking your time, for the purposes of finding places where your time is probably [...]]]></description>
			<content:encoded><![CDATA[<p>A short while ago, I read <a href="http://www.brentozar.com/archive/2012/02/three-consulting-tools-make-better-dba/">a great post by Kendra Little</a> (<a href="http://twitter.com/#!/Kendra_Little">@Kendra_Little</a> on Twitter) on how using some common consulting tricks can be useful even for those not in a consulting role. One item that resonated in particular was the idea of tracking your time, for the purposes of finding places where your time is probably not being used wisely (Kendra uses the example of not planning for disaster recovery, a clear &#8220;must-do&#8221; for a good DBA). I&#8217;ve tried various methods of tracking my time before, including everything from home-grown applications (I suck at GUI programming on a side note) to simple notepad paper. Everything failed miserably for one of two reasons.</p>
<h4>It Was Too Hard To Use</h4>
<p>My cruddy GUI programming skills aside, I had never found something lightweight enough that I could really use it consistantly without slowing down. In my work I am constantly switching tasks, so whatever method I used needed to not require ten clicks to switch from one task to another. If it was anything less than <em>really easy</em>, I would simply give up after a few days.</p>
<h4>It Didn&#8217;t Give Useful Data</h4>
<p>Recording time is one thing, but of equal importance is the <em>metadata</em> associated with that slice of time. What project was I working on (if there was a defined project, not something that&#8217;s always true)? For what client? What &#8220;tags&#8221; or other little flags were associated with a piece of work (for instance, was my time spent dealing with a &#8220;walk-up&#8221;, or was it unplanned troubleshooting)? Without this enriched data, simply knowing that I spent from 8 AM to 9:45AM working on task &#8216;XYZ&#8217; really isn&#8217;t very useful.</p>
<p>Well, thanks to Kendra&#8217;s suggestion, I&#8217;ve finally found a tool that I&#8217;m sticking with. <a href="http://toggl.com">Toggl</a> is nothing short of fantastic! It&#8217;s easy to use, quick, and allows me to easily tag and classify work without a lot of extra effort. It&#8217;s been downright fascinating seeing how my time is really spent, and I&#8217;m finding it&#8217;s often quite different than what I perceive. I might feel like I&#8217;ve spent every waking moment working on a particular effort, only to find that my judgement is skewed simply because I find that particular work unpleasant (nothing to throw off your gut feeling like hating what you&#8217;re doing).</p>
<p>Most importantly, it&#8217;s enabled true, accurate (at least mostly so) transparency with my superiors and customers. When I report weekly to my boss, I can say with integrity what I have (and conversely, have not) been spending my time (and therefore the company&#8217;s money) on. It&#8217;s been invaluable in tweaking my workload to better suit our client&#8217;s needs, but also in identifying easy automation / delegation opportunities. Clearly a win for both sides!</p>
]]></content:encoded>
			<wfw:commentRss>http://awanderingmind.com/2012/03/07/time-tracking-transparency-to-clients/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://awanderingmind.com/2012/03/07/time-tracking-transparency-to-clients/</feedburner:origLink></item>
		<item>
		<title>The Importance of Making Junk</title>
		<link>http://feedproxy.google.com/~r/awanderingmind/Fzqz/~3/EorlwiG3F9s/</link>
		<comments>http://awanderingmind.com/2012/01/22/the-importance-of-making-junk/#comments</comments>
		<pubDate>Sun, 22 Jan 2012 19:58:13 +0000</pubDate>
		<dc:creator>Josh</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[perspective]]></category>
		<category><![CDATA[productivity]]></category>
		<category><![CDATA[writing]]></category>

		<guid isPermaLink="false">http://awanderingmind.com/?p=682</guid>
		<description><![CDATA[I was just sitting here looking over some old code projects of mine, and thinking &#8220;Man this stuff is junk. How&#8217;d I write this?! And why&#8217;d I waste my time on it?&#8221; These included a Java library for parsing tweets for data mining (boy that was going to be a great open source project), my [...]]]></description>
			<content:encoded><![CDATA[<p>I was just sitting here looking over some old code projects of mine, and thinking &#8220;Man this stuff is junk. How&#8217;d I write this?! And why&#8217;d I waste my time on it?&#8221; These included a Java library for parsing tweets for data mining (boy that was going to be a great open source project), my first .NET application that was for work and used Microsoft Access as a back-end, and various other half-started works that never really took hold. At first this was rather discouraging, since it reminded me of my genetic pre-disposition to not following through on my projects (a topic for another day for sure).</p>
<p>Then it hit me: it&#8217;s only by writing all this crap (and believe me, most of it really is steaming piles of crap), trying out different routes and ideas, and ultimately letting them fall off that I&#8217;ve been able to improve my skills as much as I have. Picture the proverbial writer sitting at the typewriter with a pile of crumpled papers next to them, head in hands. But then, one day, something clicks, and out comes a masterpiece.</p>
<p>It&#8217;s not important that all we produce is wonderful, glittery, and perfect. No, what&#8217;s really crucial is that we keep going and pushing ourselves, especially when it seems like all we churn out is junk. That junk is <em>gold</em>, because it&#8217;s what teaches us to do better. As long as we keep learning from our mistakes and bad ideas, then we grow as professionals and human beings. And sooner or later, you might just produce that golden egg.</p>
]]></content:encoded>
			<wfw:commentRss>http://awanderingmind.com/2012/01/22/the-importance-of-making-junk/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://awanderingmind.com/2012/01/22/the-importance-of-making-junk/</feedburner:origLink></item>
		<item>
		<title>One (Very Important) Goal For 2012 – AUTOMATE EVERYTHING</title>
		<link>http://feedproxy.google.com/~r/awanderingmind/Fzqz/~3/dxlVUglQDvE/</link>
		<comments>http://awanderingmind.com/2012/01/02/one-very-important-goal-for-2012-automate-everything/#comments</comments>
		<pubDate>Mon, 02 Jan 2012 21:54:31 +0000</pubDate>
		<dc:creator>Josh</dc:creator>
				<category><![CDATA[Life As A DBA]]></category>
		<category><![CDATA[Powershell]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[automation]]></category>
		<category><![CDATA[productivity]]></category>

		<guid isPermaLink="false">http://awanderingmind.com/?p=674</guid>
		<description><![CDATA[Yep, you heard me right. I am going to automate everything I do. Or, at least, try to. I&#8217;m not going to talk in detail about why I&#8217;m doing this, other than to say: I have better things to do with my time than perform mundane, repeatable tasks. I recently re-read John Sansom&#8217;s excellent blog [...]]]></description>
			<content:encoded><![CDATA[<p>Yep, you heard me right. I am going to <strong>automate everything I do</strong>. Or, at least, try to.</p>
<p>I&#8217;m not going to talk in detail about why I&#8217;m doing this, other than to say:</p>
<ol>
<li>I have better things to do with my time than perform mundane, repeatable tasks.</li>
<li>I recently re-read John Sansom&#8217;s <a href="http://www.johnsansom.com/the-best-database-administrators-automate-everything/">excellent blog post</a> on the subject, and, as is usually the case with John&#8217;s work, found it rather inspiring. Bravo John!</li>
</ol>
<p>Instead, I&#8217;m going to talk a little about two kinds of &#8220;automation&#8221;, and why I generally pick one that might not, at first glance, be the right choice.</p>
<h1>Full versus Partial Automation</h1>
<p>I will define something that is <strong>fully automated</strong> as a task or operation which requires absolutely zero manual effort on my part. That is, I don&#8217;t have to push a button, flip a switch, type a command, or even know that it is happening, unless something goes wrong. An example of something that is already fully automated in my world is the weekly and daily database maintenance that I have installed, using Ola Hallengren&#8217;s <a href="http://ola.hallengren.com/" target="_blank">excellent (and freely available) scripts</a>. These run every night and ensure that my databases are backed up, corruption free, and optimized. Unless something goes *bump* and the jobs fail, I don&#8217;t get so much as an e-mail upon completion.</p>
<p>By contrast, a process that is <strong>partially automated</strong> requires some manual effort, but is still optimized such as to require as little work on my part as possible. I may need to open a script, enter a few parameters, or run a Powershell command, but outside of that, all the logic and processing is done behind the scenes, with perhaps a pretty little progress bar showing that work is, well, progressing. An example of this might be setting up of a server side SQL trace; I have a series of scripts ready that, given a database name and a path at which to place the trace files, will setup a standardized trace, grant rights on some signed stored procedures to allow non-DBAs to read the trace data, and even generate a README file to be sent to the requesting team with a series of instructions.</p>
<p>In an ideal world, I suppose that all of the mundane daily work I have to take care of would be in the former (<strong>fully automated</strong>) category. But in reality, I find that there&#8217;s a bit of a diminishing return on putting more and more effort into fully automating tasks. Consider this scenario / requirement: the request and creation of new databases.</p>
<p>At a basic level, the process we follow is something like this:</p>
<ol>
<li>A developer requests a new database via our in-house ticketing system.</li>
<li>We (my team) ensure that the request at least contains the following details:</li>
<ol>
<li>The name of the database.</li>
<li>The server on which to create it (or at least a version of SQL Server).</li>
<li>The initial size of the database.</li>
<li>The domain users or group that requires access to the database.</li>
</ol>
<li>Assuming we&#8217;ve got all the information required, we will go out to the database server where the databases will be placed, and determine a suitable location to place the data files. This is usually determined by simple the simple rule of &#8220;whichever volume has the most space&#8221;, with a few exceptions. If there is not enough space on the server, we&#8217;ll inform the requestor that there will be a delay, and start the process of ordering more storage.</li>
<li>Once we know where the data and log files will be placed, we will create the database, take a full backup (to initialize the differential backup chain), and grant the access requested.</li>
</ol>
<p>Now, I could certainly envision writing some kind of application that would allow developers to submit requests for new databases and process everything straight through based on the rules outlines above, similar to what I see on my web host&#8217;s control panel for MySQL databases. But, at the same time, constructing such as system would take a lot of time and effort. Contrast that with a partial automation solution, such as:</p>
<ul>
<li>Provide an InfoPath form for the requests, forcing people to enter the necessary details in before submitting the request, thereby eliminating back-and-forth chatter.</li>
<li>Use a Powershell script that, when given a server name, database, and log file size, will connect via WMI and determine a list of suitable locations for placing the database files, then prompt the user to select one. When selections are made, the database is created and a full backup taken. This eliminates logging into the computer (to look at drives) and stepping through a bunch of GUI screens to create the database.</li>
<li>Have a second Powershell script that can accept a text file containing domain groups / users and role names, which will then grant the access required on a specified database. The file could be generated from the InfoPath form. Again, this eliminates some GUI clicks, and minimizes the chance of fat-fingering group / user names.</li>
</ul>
<p>While this will not prevent someone from having to manually process the request, it will significantly cut down on the pain to do so, without a great deal of effort / complexity. Especially considering that these requests are fairly infrequent (perhaps one to three a month), I see no reason to spend additional time on providing a fully automated solution, when the partial one provides almost as much value.</p>
<p>Over the course of the year, I&#8217;ll be blogging about the various processes / means I use to accomplish this goal.</p>
<p>How do you automate your processes, and how do you determine a &#8220;break-even&#8221; point, if you will?</p>
]]></content:encoded>
			<wfw:commentRss>http://awanderingmind.com/2012/01/02/one-very-important-goal-for-2012-automate-everything/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<feedburner:origLink>http://awanderingmind.com/2012/01/02/one-very-important-goal-for-2012-automate-everything/</feedburner:origLink></item>
		<item>
		<title>Are your processes generic?</title>
		<link>http://feedproxy.google.com/~r/awanderingmind/Fzqz/~3/4xVEcWkNg54/</link>
		<comments>http://awanderingmind.com/2011/12/11/are-your-processes-generic/#comments</comments>
		<pubDate>Mon, 12 Dec 2011 01:40:28 +0000</pubDate>
		<dc:creator>Josh</dc:creator>
				<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[The Lone DBA]]></category>
		<category><![CDATA[automation]]></category>
		<category><![CDATA[productivity]]></category>

		<guid isPermaLink="false">http://awanderingmind.com/?p=667</guid>
		<description><![CDATA[This post is the sixth in an ongoing series about how to survive as the only DBA in your organization. Since October of last year, I’ve been assigned to a team that is responsible for owning and maintaining the development infrastructure. It’s a great team of seasoned professionals, but not a single other DBA. As a result, [...]]]></description>
			<content:encoded><![CDATA[<p>This post is the sixth in an <a href="http://awanderingmind.com/category/sql/the-lone-dba/">ongoing series</a> about how to survive as the only DBA in your organization. Since October of last year, I’ve been assigned to a team that is responsible for owning and maintaining the development infrastructure. It’s a great team of seasoned professionals, but not a single other DBA. As a result, I’ve had to think very carefully about how I go about my daily work, so as to give our customers consistently good service, while still allowing those without a lot of SQL Server related knowledge to pick up my work when I’m not available.</p>
<h2>Why is being generic a good thing?</h2>
<p>When I think of the word &#8220;generic&#8221;, I usually picture those off-brand foods at most grocery stores, with their simplistic labels and lackluster colors. But in the case of processes, being &#8220;generic&#8221; really means &#8220;standardized, yet flexible&#8221;. This is a good thing, because it means your processes can answer many different (but ultimately) related needs.</p>
<p>Let&#8217;s take an example: a development team needs to trace activity in their database. We&#8217;re going to assume that just granting this group rights to run the trace is not an option, since, let&#8217;s say, they&#8217;ve taken the server down with a poorly done client side trace in the past (don&#8217;t laugh, it happened to me). In any case, let&#8217;s look at three options to answer this request:</p>
<h3>Have the developers sit with you while you run a Profiler trace</h3>
<p>I don&#8217;t like this for several reasons, not the least of which is that it is going to take a good chunk of my time. Because of course, the developer will probably have no idea what they are looking for, and may not be able to product the condition they are trying to capture on demand. It also still uses Profiler, which, as far as I&#8217;m concerned, should be banned.</p>
<h3>Script out a one-time trace and have it run on the server</h3>
<p>This is better, because it takes a lot less of my time to simply setup a server-side trace and let it run. I can then let the developer&#8217;s read in the trace files via something like a signed stored procedure (a topic for another day perhaps). But there&#8217;s still the one-off aspect: who&#8217;s to say that the next time the developers need this I&#8217;ll be around, have saved the trace definition, etc?</p>
<h3>Write a templatized script that accepts a database name and a path for trace files, and use it going forward</h3>
<p>This, to me at least, is the best option. After a slightly longer initial setup (one-time to write and document the script, plus test it), setting up subsequent traces will take very little time. In addition, the use of a template will mean a consistent experience / process for my customers, even when I&#8217;m not around. Even when I am around, it will also make it easier for DBA Junior to handle the request, leaving me to look at more interesting things. And by making the script flexible enough to handle different servers / databases, it becomes much more useful. </p>
<p>I go so far as to have a &#8220;no one-off&#8221; policy at work. That is, if I do something, I script it, put some parameters in, and save it off to source control. Then I publish it in our procedures manual, so that if a similar request comes in the team can handle it right away. It leads to a lot of scripts that are not highly used, but it also means less work in the long term, and a great bag of tricks in the process.</p>
<h2>But, can something be <em>too</em> generic?</h2>
<p>Sure it can. I&#8217;ve fallen into the trap many times of trying to have one process fit way too many needs, only to end up with a monstrous, un-followable mess. If you&#8217;ve got a ton of &#8220;if this is true, do this, otherwise do this&#8221; type of logic in your process, you might want to consider if you&#8217;re really answering related needs. This is kind of like the process equivalent of that awful stored procedure we&#8217;ve all seen; you know, the one that has twenty plus input parameters, and has every one in the WHERE clause as <code>WHERE ((some_field = @some_parameter) OR (@some_parameter = NULL))</code>. It looks good, but in the end the execution is piss poor.</p>
]]></content:encoded>
			<wfw:commentRss>http://awanderingmind.com/2011/12/11/are-your-processes-generic/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://awanderingmind.com/2011/12/11/are-your-processes-generic/</feedburner:origLink></item>
		<item>
		<title>The Lone DBA – Why Documentation Is Good</title>
		<link>http://feedproxy.google.com/~r/awanderingmind/Fzqz/~3/VlNKRAUpVbg/</link>
		<comments>http://awanderingmind.com/2011/10/19/the-lone-dba-why-documentation-is-good/#comments</comments>
		<pubDate>Wed, 19 Oct 2011 12:00:53 +0000</pubDate>
		<dc:creator>Josh</dc:creator>
				<category><![CDATA[The Lone DBA]]></category>

		<guid isPermaLink="false">http://awanderingmind.com/?p=661</guid>
		<description><![CDATA[This post is the fifth in an ongoing series about how to survive as the only DBA in your organization. Since October of last year, I&#8217;ve been assigned to a team that is responsible for owning and maintaining the development infrastructure. It&#8217;s a great team of seasoned professionals, but not a single other DBA. As a result, [...]]]></description>
			<content:encoded><![CDATA[<p>This post is the fifth in an <a href="http://awanderingmind.com/category/sql/the-lone-dba/">ongoing series</a> about how to survive as the only DBA in your organization. Since October of last year, I&#8217;ve been assigned to a team that is responsible for owning and maintaining the development infrastructure. It&#8217;s a great team of seasoned professionals, but not a single other DBA. As a result, I&#8217;ve had to think very carefully about how I go about my daily work, so as to give our customers consistently good service, while still allowing those without a lot of SQL Server related knowledge to pick up my work when I&#8217;m not available.</p>
<h3>Why I Hate Writing Documentation</h3>
<p>The answers to this question are pretty straightforward, but as we&#8217;ll see, there&#8217;s counter-arguments in most cases.</p>
<h4>It Makes The Work Take Longer</h4>
<p>It&#8217;s true that documenting a process means taking longer to actually complete the work. Consider the added time to take screenshots, write down steps, and (of course) test to ensure completeness, and it could well double the amount of time required.</p>
<p>On the other hand, this increase in time should be pretty much a one-time occurence, with occasional tune-ups of the documentation required as procedures change and evolve. So really, it&#8217;s not that much extra work.</p>
<h4>The Logic Is Too Complex To Document</h4>
<p>STOP!</p>
<p>On this one I have to call my own bullshit. <strong>There is no such thing as a process that is too complex to document.</strong> It may take pages upon pages of screenshots and steps, and turn into a forty page monstrosity, but it&#8217;s still quantifiable.</p>
<p>So let&#8217;s be honest here: what we&#8217;re really saying is that <strong>we&#8217;re too lazy to take the time to document our process, because it would take a long time</strong>. Everyone agreed? Let&#8217;s just suck it up then and move on, because <strong>laziness is never an excuse for bad practice</strong>.</p>
<h4>It&#8217;s Really Boring</h4>
<p>Well that one is easy to answer. You see, all you have to do is&#8230; um&#8230; well&#8230;</p>
<p><strong>*thinks*</strong></p>
<p>Okay, you&#8217;ve got me. I can&#8217;t really think of a way to make writing documentation fun. Oh well, there are some things in our jobs that just aren&#8217;t going to be fun. All we can do is minimize them, perhaps by <a href="http://awanderingmind.com/2011/10/17/the-lone-dba-why-automating-processes-is-good/">automating things as much as possible</a>?</p>
<h3>Why I Love Writing Documentation</h3>
<h4>It Lets Me Outsource</h4>
<p>If I have a process thoroughly documented, it makes it easier to hand off to a junior DBA or other staff. This then frees me up to do more interesting or important things. Why spend time doing things that someone else could do just as well, when I could be doing things that provide real value to my customers?</p>
<h4>It Ensures Consistent Service</h4>
<p>To me this is the big one. If my documentation is complete, I can leave for vacation knowing that my customers will be well taken care of while I&#8217;m gone. Good customer service means consistency: they provide the same input (a request to restore a database), and receive the same output (the database is restored and permissions re-granted). Without documentation there&#8217;s no guarantee that someone else on my team would handle the request the same way I would; with it, the customer won&#8217;t even notice a difference.</p>
<p>So now I&#8217;ll pose a question to the community: How do you motivate yourself to write documentation? How do you ensure it is kept up to date?</p>
]]></content:encoded>
			<wfw:commentRss>http://awanderingmind.com/2011/10/19/the-lone-dba-why-documentation-is-good/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://awanderingmind.com/2011/10/19/the-lone-dba-why-documentation-is-good/</feedburner:origLink></item>
		<item>
		<title>The Lone DBA – Why Automating Processes Is Good</title>
		<link>http://feedproxy.google.com/~r/awanderingmind/Fzqz/~3/nqJEedDugWw/</link>
		<comments>http://awanderingmind.com/2011/10/17/the-lone-dba-why-automating-processes-is-good/#comments</comments>
		<pubDate>Mon, 17 Oct 2011 19:35:36 +0000</pubDate>
		<dc:creator>Josh</dc:creator>
				<category><![CDATA[Life As A DBA]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[The Lone DBA]]></category>
		<category><![CDATA[automation]]></category>
		<category><![CDATA[Powershell]]></category>

		<guid isPermaLink="false">http://awanderingmind.com/?p=650</guid>
		<description><![CDATA[This post is the fourth in an ongoing series about how to survive as the only DBA in your organization. Since October of last year, I’ve been assigned to a team that is responsible for owning and maintaining the development infrastructure. It’s a great team of seasoned professionals, but not a single other DBA. As [...]]]></description>
			<content:encoded><![CDATA[<p>This post is the fourth in an <a href="http://awanderingmind.com/category/sql/the-lone-dba/">ongoing series</a> about how to survive as the only DBA in your organization. Since October of last year, I’ve been assigned to a team that is responsible for owning and maintaining the development infrastructure. It’s a great team of seasoned professionals, but not a single other DBA. As a result, I’ve had to think very carefully about how I go about my daily work, so as to give our customers consistently good service, while still allowing those without a lot of SQL Server related knowledge to pick up my work when I’m not available.</p>
<h3>Automation Is A (Lone) DBA&#8217;s Best Friend</h3>
<p>I subscribe wholly to the sentiment expressed in <a href="http://www.johnsansom.com/the-best-database-administrators-automate-everything/">John Sansom&#8217;s excellent post</a>, titled &#8220;The Best Database Administrators Automate Everything&#8221;. Time is something we cannot make more of for ourselves, and as such is highly precious. If you are spending time doing repetitive work that could be either partially or fully automated, that is time wasted.</p>
<p>But there&#8217;s another benefit as well to automating processes: it makes them easier to hand-off. Let&#8217;s consider the example of restoring a copy of a production database to a test server. The typical steps I would complete would be:</p>
<ol>
<li>Determine the location that the backup file was placed at by the production DBA group (I do not have access to production backups, so they must copy them down to my server).</li>
<li>Determine where the database files should be placed on the server using this logic:</li>
<ol>
<li>If the database already exists on the server, the files should be placed at the same location as they currently reside.</li>
<li>If the database does not exist, then the files should be placed at the default data and log location as specified in the server configuration.</li>
</ol>
<li>If the database exists, set the database to single user mode using the &#8220;WITH ROLLBACK IMMEDIATE&#8221; option to effectively kill any open connections to the database.</li>
<li>Issue the restore command, using native commands or the Litespeed equivalent if the database came from a server using Litespeed.</li>
<li>Execute the databases specific post restore script from the source code repository. These scripts reset permissions for developers, synchronize users, etc.</li>
</ol>
<p>While none of these steps are particularly hard, documenting them and teaching them to others would not be a small amount of work. Consider that step two involves querying system tables (or stepping through some screens in SSMS), and steps three and four require knowledge of T-SQL commands for restoring databases.</p>
<p>Instead, I chose to write a Powershell script which handles as much of the logic as possible. All it requires is a server name and the name of a backup file, and it handles the rest (except step five, but I&#8217;m working on that). This way, instead of teaching all that logic, all I need to do is show someone how to find the backup file (further simplified by standardizing paths across all the servers) and run the script.</p>
<p>I don&#8217;t know about you, but I&#8217;d much rather write code to do a job than write a document about how to do the job manually.</p>
]]></content:encoded>
			<wfw:commentRss>http://awanderingmind.com/2011/10/17/the-lone-dba-why-automating-processes-is-good/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://awanderingmind.com/2011/10/17/the-lone-dba-why-automating-processes-is-good/</feedburner:origLink></item>
		<item>
		<title>The Lone DBA – What Makes A Process Simple?</title>
		<link>http://feedproxy.google.com/~r/awanderingmind/Fzqz/~3/n1Rgs_wv2gA/</link>
		<comments>http://awanderingmind.com/2011/10/17/the-lone-dba-what-makes-a-process-simple/#comments</comments>
		<pubDate>Mon, 17 Oct 2011 12:00:23 +0000</pubDate>
		<dc:creator>Josh</dc:creator>
				<category><![CDATA[Life As A DBA]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[The Lone DBA]]></category>
		<category><![CDATA[Simplicity]]></category>

		<guid isPermaLink="false">http://awanderingmind.com/?p=646</guid>
		<description><![CDATA[This post is the third in an ongoing series about how to survive as the only DBA in your organization. Since October of last year, I’ve been assigned to a team that is responsible for owning and maintaining the development infrastructure. It’s a great team of seasoned professionals, but not a single other DBA. As [...]]]></description>
			<content:encoded><![CDATA[<p>This post is the third in an <a href="http://awanderingmind.com/category/sql/the-lone-dba/">ongoing series</a> about how to survive as the only DBA in your organization. Since October of last year, I’ve been assigned to a team that is responsible for owning and maintaining the development infrastructure. It’s a great team of seasoned professionals, but not a single other DBA. As a result, I’ve had to think very carefully about how I go about my daily work, so as to give our customers consistently good service, while still allowing those without a lot of SQL Server related knowledge to pick up my work when I’m not available.</p>
<h3>What Makes A Process Simple?</h3>
<blockquote><p>sim·ple   [sim-puhl] adjective</p>
<ol>
<li>easy to understand, deal with, use, etc.: a simple matter; simple tools.</li>
<li>not elaborate or artificial; plain: a simple style</li>
<li>not ornate or luxurious; unadorned: a simple gown</li>
<li>unaffected; unassuming; modest: a simple manner</li>
<li>not complicated: a simple design</li>
</ol>
</blockquote>
<p>When I design a process for my team to follow, I always do my best to follow the definition above, especially the first and last lines. Processes should be easy to follow and only as complex as they need to be, no more. Programmers can sometimes get carried away with complexity, because a) it&#8217;s fun, b) it lets us stretch our muscles a little. That&#8217;s all fine and good in your lab, but when you&#8217;re trying to design something to be used in the real world by actual people (other than yourself), complexity can be a huge problem.</p>
<p>Take this example: your team needs a way to locate information about a particular server, including what it&#8217;s used for, make and model, etc. Here&#8217;s two choices for how you fulfill this requirement.</p>
<h4>Option A &#8211; Command line / SQL scripts and a SQL Database</h4>
<p>Sounds easy enough, right? And a relational database seems like the perfect place to store this kind of structured information.</p>
<p>Well, that&#8217;s great, for someone who is comfortable writing T-SQL code to interrogate a database. And who understands the structure of the database. And, oh by the way, can even find where the database is.</p>
<p>I&#8217;m guilty as charged on this one. When I started on my team there was no repository for server inventory, so I made one. I&#8217;d call it a pretty well designed database, normalization and structure wise, but there&#8217;s one glaring flaw: no interface. Every operation, such as adding a server, removing one, looking up information about one, etc, is done via T-SQL scripts (hand-written mostly). Fine for me, but my teammates are going to quickly get lost and just call me when they need information.</p>
<p>Let&#8217;s assume I&#8217;ve even saved scripts in our code library for common operations, such as looking up a server&#8217;s information by its name (not always a valid assumption, certainly). Even with that shortcut, so the team doesn&#8217;t have to write JOIN statements, consider the list of steps required to look up a server:</p>
<ol>
<li>locate the correct script in the repository</li>
<li>Open the script in SSMS (do they have that installed?)</li>
<li>Connect to the server where the management database resides (do they know where that is?)</li>
<li>Look through the script and find the &#8220;find/replace&#8221; tags (I would at least use SSMS template parameters, though it&#8217;s debatable if that is easier)</li>
<li>Execute the script and interpret the resulting text output</li>
</ol>
<p>Hmm&#8230; five steps and several questions. Not very simple.</p>
<h4>Option B &#8211; A Small Web Application With A SQL Back End</h4>
<p>With this choice, we still get the benefits of storing the data in relational format, but with a cleaner interface (even my crappy UI design skills can manage this one). Most competent admins can understand a web interface with fields and buttons, so they should have little problem using it once trained (and of course, its use would be documented).</p>
<p>Consider the steps required to perform the same operation here:</p>
<ol>
<li>Open a web browser and browse to the web site (do they know where it is?)</li>
<li>Select the &#8220;Find Server By Name&#8221; option presented on the home page.</li>
<li>Enter the server name and click the &#8220;Find&#8221; button.</li>
</ol>
<p>We&#8217;re down to three steps and only one question (do they know what the site address / URL is). Now we&#8217;re getting into the realm of simple.</p>
<p>One could certainly argue that there&#8217;s an even easier solution, along the lines of a folder on a searchable network drive with a set of Word documents, one per server, in standard format. I wouldn&#8217;t discount that argument, but I just really had folders full of Word documents, especially when you have to go through all of them one at a time to change some common field.</p>
<p>You could also argue that the process of writing a web application (and supporting it) would outweigh the simplicity gained by having the information presented in that manner. After all, can anyone else on your team understand C# code? What happens when it breaks and you&#8217;re on vacation? That may be true, but I honestly believe that if you write your code properly (and, drumroll please, <em>simply</em>) then the application should be pretty much self-sufficient. Good code hums along and doesn&#8217;t require babysitting.</p>
<p>So the next time you&#8217;re designing a process for your team, remember to keep things as simple as you can. Your teammates will thank you.</p>
]]></content:encoded>
			<wfw:commentRss>http://awanderingmind.com/2011/10/17/the-lone-dba-what-makes-a-process-simple/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://awanderingmind.com/2011/10/17/the-lone-dba-what-makes-a-process-simple/</feedburner:origLink></item>
	</channel>
</rss><!-- Dynamic page generated in 0.708 seconds. --><!-- Cached page generated by WP-Super-Cache on 2012-05-13 16:56:40 -->

