 




<?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>The Multifunctioning DBA &#187; SQL Admin</title>
	<atom:link href="http://itknowledgeexchange.techtarget.com/dba/tag/sql-admin/feed/" rel="self" type="application/rss+xml" />
	<link>http://itknowledgeexchange.techtarget.com/dba</link>
	<description></description>
	<lastBuildDate>Wed, 06 Feb 2013 01:01:48 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
		<item>
		<title>Index Fragmenting on Purpose</title>
		<link>http://itknowledgeexchange.techtarget.com/dba/index-fragmenting-on-purpose/</link>
		<comments>http://itknowledgeexchange.techtarget.com/dba/index-fragmenting-on-purpose/#comments</comments>
		<pubDate>Thu, 23 Aug 2012 15:17:07 +0000</pubDate>
		<dc:creator>Colin Smith</dc:creator>
				<category><![CDATA[SQL Admin]]></category>
		<category><![CDATA[SQL Administration]]></category>
		<category><![CDATA[SQL Administration. MS SQL]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[fragmentation]]></category>
		<category><![CDATA[shrink database]]></category>

		<guid isPermaLink="false">http://itknowledgeexchange.techtarget.com/dba/?p=733</guid>
		<description><![CDATA[In most cases we would like to reduce fragmentation and try to come up with ways, like reducing fill factor, to minimize the amount of fragmentation that occurs when doing inserts and updates. I , however, need to create fragmentation. I am sure that you are asking yourself why I might need to do this. [...]]]></description>
				<content:encoded><![CDATA[<p>In most cases we would like to reduce fragmentation and try to come up with ways, like reducing fill factor, to minimize the amount of fragmentation that occurs when doing inserts and updates. I , however, need to create fragmentation. I am sure that you are asking yourself why I might need to do this. That is a great question and the answer is because I need to test some re-indexing scripts and get timings on how long they are going to run. To accomplish this, I am going to use another feature of SQL Server that I try to NEVER use. The dreaded Shrink Database. The reason I am using shrink database is that it, by its nature, causes fragmentation.  So today is just a day of worst practices for me. I am doing this is a sandbox testing environment and I would not recommend ever using Shrink Database Unless you absolutely have to. If you do run Shrink Database for any reason, just know that you are going to need to clean up your indexes after and that is going to grow your database again.</p>
<!-- wpms-network-global-inserts -->]]></content:encoded>
			<wfw:commentRss>http://itknowledgeexchange.techtarget.com/dba/index-fragmenting-on-purpose/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Partition Table Load Mistake</title>
		<link>http://itknowledgeexchange.techtarget.com/dba/partition-table-load-mistake/</link>
		<comments>http://itknowledgeexchange.techtarget.com/dba/partition-table-load-mistake/#comments</comments>
		<pubDate>Tue, 21 Aug 2012 21:10:44 +0000</pubDate>
		<dc:creator>Colin Smith</dc:creator>
				<category><![CDATA[SQL Admin]]></category>
		<category><![CDATA[SQL Administration]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[Database Administration]]></category>
		<category><![CDATA[MSSQL Server]]></category>
		<category><![CDATA[Partitioning]]></category>
		<category><![CDATA[SQL]]></category>

		<guid isPermaLink="false">http://itknowledgeexchange.techtarget.com/dba/?p=724</guid>
		<description><![CDATA[I have a table that has 54 partitions and is a range right partition function. So ideally I like to have 52 partitions with data in them and the first and the last partitions are empty. Well the other day, our ETL team ran a load job that is meant to run after our weekly [...]]]></description>
				<content:encoded><![CDATA[<p>I have a table that has 54 partitions and is a range right partition function. So ideally I like to have 52 partitions with data in them and the first and the last partitions are empty. Well the other day, our ETL team ran a load job that is meant to run after our weekly load process. They had not run the weekly load process for three weeks prior to running this other job though. This means that I do not have partitions created for dates that they are going to be inserting data for. I looked at my table and I saw that my last end partition, that I like to have 0 rows, had about 15 million rows in it.  I contacted them and they told me that since they had not run the weekly job for so long they thought they would just catch up by loading all of it at the same time. Well this is an issue, becuase now if I split my partition on the weekly date that I need to, SQL Server will have to re-sort all that data into the correct partitions. This is not a quick operation. So I had to do some clean up.</p>
<p>This is fairly easy to do since I did not split my partition yet.</p>
<p>1. Create a stage out table with the same structure, indexes included, as the base table and make sure it is on the same filegroup.</p>
<p>2. Swithc that last partition out to the stage table that you just built.</p>
<p>3. Drop the stage table.</p>
<p>Now all that data is gone and my partitions looked good again. Now I asked the ETL team to run our standard weekly process to catch up and they did. Now all is well with my table.</p>
<!-- wpms-network-global-inserts -->]]></content:encoded>
			<wfw:commentRss>http://itknowledgeexchange.techtarget.com/dba/partition-table-load-mistake/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MSSQL Server and BCP</title>
		<link>http://itknowledgeexchange.techtarget.com/dba/mssql-server-and-bcp/</link>
		<comments>http://itknowledgeexchange.techtarget.com/dba/mssql-server-and-bcp/#comments</comments>
		<pubDate>Tue, 21 Aug 2012 16:18:59 +0000</pubDate>
		<dc:creator>Colin Smith</dc:creator>
				<category><![CDATA[SQL Admin]]></category>
		<category><![CDATA[SQL Administration]]></category>
		<category><![CDATA[SQL Administration. MS SQL]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[BCP]]></category>
		<category><![CDATA[Database Administration]]></category>
		<category><![CDATA[MSSQL Server]]></category>

		<guid isPermaLink="false">http://itknowledgeexchange.techtarget.com/dba/?p=722</guid>
		<description><![CDATA[I recently had a need to BCP a very large data set in and out of a database. The out is no issue. bcp [databasename].[schema].[table] direction path_to_output_file.txt -Sservername -c -T is the format that I was using and it worked fantastic. I was able to BCP out my 934Million rows. Now I had to push [...]]]></description>
				<content:encoded><![CDATA[<p>I recently had a need to BCP a very large data set in and out of a database. The out is no issue.</p>
<p>bcp [databasename].[schema].[table] direction path_to_output_file.txt -Sservername -c -T</p>
<p>is the format that I was using and it worked fantastic. I was able to BCP out my 934Million rows.</p>
<p>Now I had to push it back into a different table. I built the table and started my BCP.</p>
<p>bcp [databasename].[schema].[table] <strong>IN</strong> path_to_output_file.txt -Sservername -c -T</p>
<p>Well that got me about 800 Millione records before I blew up my log file. Ouch&#8230; So I had to change the BCP command and tell it to commit after so may rows had been inserted. This is an important step so that you do not blow up your log. Simple as this.</p>
<p>bcp [databasename].[schema].[table] direction path_to_output_file.txt -Sservername -c -T -b2000000</p>
<p>That will push the data in and ever 2Million rows inserted it will commit and save your log.</p>
<p>&nbsp;</p>
<p>have fun using BCP from the command line.</p>
<!-- wpms-network-global-inserts -->]]></content:encoded>
			<wfw:commentRss>http://itknowledgeexchange.techtarget.com/dba/mssql-server-and-bcp/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Powershell to Drop Procs</title>
		<link>http://itknowledgeexchange.techtarget.com/dba/powershell-to-drop-procs/</link>
		<comments>http://itknowledgeexchange.techtarget.com/dba/powershell-to-drop-procs/#comments</comments>
		<pubDate>Fri, 17 Aug 2012 12:00:13 +0000</pubDate>
		<dc:creator>Colin Smith</dc:creator>
				<category><![CDATA[POSH]]></category>
		<category><![CDATA[Powershell Tips]]></category>
		<category><![CDATA[Scripting]]></category>
		<category><![CDATA[Scripts]]></category>
		<category><![CDATA[SQL Admin]]></category>
		<category><![CDATA[SQL Administration]]></category>
		<category><![CDATA[SQL Administration. MS SQL]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[Database Administration]]></category>
		<category><![CDATA[MSSQL Server]]></category>
		<category><![CDATA[Powershell]]></category>
		<category><![CDATA[scripting]]></category>
		<category><![CDATA[Sql server]]></category>

		<guid isPermaLink="false">http://itknowledgeexchange.techtarget.com/dba/?p=716</guid>
		<description><![CDATA[I was asked by a developer if I could drop all the procs in a database except the ones that he knew were being used. I thought Powershell can do that. So I told him that I could if he provided me a list of the ones that he did not want to be droped. [...]]]></description>
				<content:encoded><![CDATA[<p>I was asked by a developer if I could drop all the procs in a database except the ones that he knew were being used. I thought Powershell can do that. So I told him that I could if he provided me a list of the ones that he did not want to be droped. So he sent me a list and I got to work. I thought it would be a good idea to script out all the procs before I dropped them just in case. So below is the code that I came up with.</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>connect-sql &#8220;name&#8221;<br />
sqlscript-options</p>
<p>$db = $s.Databases | where{$_.Name -like &#8220;*DEV&#8221;}<br />
$db.name<br />
$procs = $db.StoredProcedures  | where{$_.IsSystemObject -eq 0}<br />
$procs | select name<br />
&#8220;###################################&#8221;#<br />
&#8220;#####################################&#8221;<br />
foreach($proc in $procs)<br />
{<br />
$pname = $proc.name<br />
$pname<br />
$proc.script($so) | Out-File C:\Procs\$pname.sql -Force<br />
if(($pname -notlike &#8220;dba*&#8221;) -and ($pname -ne &#8220;procname&#8221;))<br />
{<br />
$proc.Drop()<br />
}<br />
}</p>
<p>&nbsp;</p>
<p>So lets take a look at this. First you will notice that I am saying connect-sql, and you probably do not have this cmdlet. Well that is because I wrote it as a function that I import in my profile so that it is available. Here is what that function does.<br />
function connect-sql ($arg)<br />
{<br />
if($arg -eq $null)<br />
{<br />
$server = Read-Host &#8220;enter instance name to connect to&#8221;<br />
}<br />
else<br />
{<br />
$server = $arg<br />
}<br />
$s = New-Object (&#8216;Microsoft.SqlServer.Management.Smo.Server&#8217;) $server<br />
}</p>
<p>&nbsp;</p>
<p>So really it is just a shortcut for me to instatiate a SMO connection.</p>
<p>&nbsp;</p>
<p>You also see a sqlscript-options and that is also not a real cmdlet. Also a function and here is what that does.</p>
<p>&nbsp;</p>
<p>function sqlscript-options<br />
{<br />
$so = new-object (‘Microsoft.SqlServer.Management.Smo.ScriptingOptions’)<br />
$so.DriIndexes = $TRUE<br />
$so.IncludeIfNotExists = 1<br />
$so.SchemaQualify = 1<br />
$so.AllowSystemObjects = 0<br />
$so.DriPrimaryKey = $TRUE<br />
$so.DriForeignKeys = $TRUE<br />
$so.driallconstraints = $TRUE<br />
$so.IncludeDatabaseContext = $TRUE<br />
$so.Indexes = $true<br />
$so.AllowSystemObjects = $False<br />
$so.triggers = $true<br />
}</p>
<p>&nbsp;</p>
<p>So it sets up some options for when I script out objects. Give this a shot and see what you think.</p>
<!-- wpms-network-global-inserts -->]]></content:encoded>
			<wfw:commentRss>http://itknowledgeexchange.techtarget.com/dba/powershell-to-drop-procs/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SQLskills Training: Why I need it.</title>
		<link>http://itknowledgeexchange.techtarget.com/dba/sqlskills-training-why-i-need-it/</link>
		<comments>http://itknowledgeexchange.techtarget.com/dba/sqlskills-training-why-i-need-it/#comments</comments>
		<pubDate>Fri, 21 Jan 2011 19:02:20 +0000</pubDate>
		<dc:creator>Colin Smith</dc:creator>
				<category><![CDATA[SQL Admin]]></category>
		<category><![CDATA[Training]]></category>

		<guid isPermaLink="false">http://itknowledgeexchange.techtarget.com/dba/sqlskills-training-why-i-need-it/</guid>
		<description><![CDATA[About three years ago I became a DBA. This was not by design and I never set out to be a DBA. I started out at a help desk, worked my way into a techshop (Working on deploying and repairing laptops and desktops for the company), and then finally got to what I thought my [...]]]></description>
				<content:encoded><![CDATA[<p>About three years ago I became a DBA. This was not by design and I never set out to be a DBA. I started out at a help desk, worked my way into a techshop (Working on deploying and repairing laptops and desktops for the company), and then finally got to what I thought my end game was, a Windows System Administrator. I loved it, came into work every day and was very happy to do so. I thought I would be happy forever. Honestly I bet I would have if the opportunity to become a DBA at my company had not come up. One day my boss asked if I would like to change roles and try out being a DBA. At first I wanted nothing to do with it but I wanted to do some research and determine what was best for me.</p>
<p>After a few days of research and talking to some other DBA&#8217;s, I found that being a DBA would be a big challenge. I mean, I had a lot to learn about Windows Administration still but at my company things in that area were becoming stale. I was not learning a lot everyday anymore and I was good at what I did. I really did want a challenge again. I also found that a good DBA is more sought after then a good Windows Administrator and I thought that if I can rise to the challenge and be a great DBA then I will have great security in what I do.</p>
<p>So with that in mind I took the job and I knew nothing about databases. I mean I had installed SQL Server many times, and now I know I did a very poor job at that, but that was about all I had ever done with SQL Server. Databases were very intimidating to me and that was part of the challenge. Getting out of my comfort zone and learning something new.</p>
<p>So far I think that I have done well, I have read books, I am working on MCITP: DBA, I try to attend webinars and free training wherever I can, and I was also able to go to PASS for the first time. All of that is great, but I have never had a formal MSSQL training class. I would love to be able to learn from the experts (and <a title="SQLskills" href="http://www.sqlskills.com/">SQLskills</a> has those) and talk with them one on one when I am having trouble wrapping my head around something. Blog posts are great but nothing can replace, for me, the immediate response you get when learning face to face. So I think that I would really gain a lot from attending one of these classes. Pass was GREAT and I learned a lot and I have already put some of that new found knowledge into practice and seen great results. I really think that attending a more formal training would be just so much more beneficial to me than even PASS.</p>
<p>To be a great DBA, I know that I need to understand the internals of how SQL Server works and I know that I do not have that skill set yet. I am striving to get it, again by watching training like the MCM training videos, but sometimes that is over my head and I think if I had a better understanding of what is going on under the covers I would be able to better serve my customers, have servers that run faster, and save my company money all at the same time. That is my goal as a DBA.<span> </span>And that is why I would love to attend a training event put on by <a title="SQLskills" href="http://www.sqlskills.com/">SQLskills</a>.</p>
<p>Once back from that training I think that I would be able to better assess the environment that I have to deal with now. I inherited this from someone who was not a DBA and honestly things are messy right now and need a lot of work. So I think that this class would give me the ability to correctly assess what is happening in my environment and make the right choices to get things where they need to be and configured properly. Right now I have about 200 Instances of SQL Server installed and my boss has talked with me about trying to do a consolidation of these instances. The knowledge gained from a SQLskills.com class would be invaluable to me, especially right now, when I am working on figuring everything out. I am talking about purchasing new hardware, upgrading SQL Server licensing, moving into virtual environments, and I do not want to screw things up. With the amount of money that is going to have to be spent to do things right I need to make sure that I also do things right and make sure everything performs better than it should when we are done. All the knowledge that I gain is knowledge that I can put into practice from day one being back from the class.</p>
<p>For more details on the class check out<span> </span><span style="font-size: 10pt"><a href="http://www.sqlskills.com/Master1-Dallas-20110221.asp">http://www.sqlskills.com/Master1-Dallas-20110221.asp</a></span></p>
<!-- wpms-network-global-inserts -->]]></content:encoded>
			<wfw:commentRss>http://itknowledgeexchange.techtarget.com/dba/sqlskills-training-why-i-need-it/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The SQL Server Community</title>
		<link>http://itknowledgeexchange.techtarget.com/dba/the-sql-server-community/</link>
		<comments>http://itknowledgeexchange.techtarget.com/dba/the-sql-server-community/#comments</comments>
		<pubDate>Tue, 30 Mar 2010 02:50:16 +0000</pubDate>
		<dc:creator>Colin Smith</dc:creator>
				<category><![CDATA[Help]]></category>
		<category><![CDATA[PASS]]></category>
		<category><![CDATA[SQL Admin]]></category>
		<category><![CDATA[SQL community]]></category>

		<guid isPermaLink="false">http://itknowledgeexchange.techtarget.com/dba/the-sql-server-community/</guid>
		<description><![CDATA[As you know, I am pretty new to being a DBA and new to the community of SQL Server. I come from a background of being a Windows Administrator and I can say, that I never really found a lot of support from a community. I really never found a community to ask for support. [...]]]></description>
				<content:encoded><![CDATA[<p>As you know, I am pretty new to being a DBA and new to the community of SQL Server. I come from a background of being a Windows Administrator and I can say, that I never really found a lot of support from a community. I really never found a community to ask for support. I can honestly say that is not the case with SQL Server. The community is pretty big, and very tight and solid.</p>
<p>I know that I was a bit afraid of trying to get my foot in the door with the communtiy, and I think that a lot of people are like me in that respect. The thing with this communtiy is that you do not have to be. No question is dumb or below anybody to answer. We have all probably had that question or one similiar.</p>
<p>If you want to get involved then become a member of <a title="PASS" href="http://www.sqlpass.org/" target="_blank">PASS</a> and also get on <a title="twitter" href="http://twitter.com/">Twitter</a> if you are not already. I have never been a big fan of social networking like Twitter but it is an invaluable tool for beinbg involved in the SQL Server community. When I signed up I only followed a few people, only people like MR. Denny (<a title="Mr. Denny" href="http://itknowledgeexchange.techtarget.com/sql-server/">Blog</a> | <a title="Mr. Denny Twitter" href="http://twitter.com/mrdenny">Twitter</a>) and Brent Ozar( <a title="Brent Ozar" href="http://www.brentozar.com/">Blog</a>| <a title="Brent Ozar Twitter" href="http://twitter.com/BrentO">Twitter</a>), because I read the blogs all the time. That is where I started and I also read Brent Ozars <a title="Brent on Twitter" href="http://www.brentozar.com/archive/2009/12/i-need-sqlhelp/">blog post about Twitter</a>. He talks about following groups, and I recommend that, as well as the #sqlhelp hashtag which works really well.</p>
<p>Also do not be afraid to tweet. Get involved and let people know that you want to be involved. Do that and you will see that we all are on the same team and are willing to help everyone out if we can.</p>
<p>I hope that this helps and I hope to see you out there.</p>
<!-- wpms-network-global-inserts -->]]></content:encoded>
			<wfw:commentRss>http://itknowledgeexchange.techtarget.com/dba/the-sql-server-community/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
