Help! My database is stuck in SINGLE_USER mode!

HELP! My database is stuck in single user mode! I answered this twitter post a while back and figured it would make a fun blog post. So what do I mean that the database is stuck in single user mode? Simply speaking, it means that the database is in single user mode and you can’t seem to get it back into multi user mode. As an example I set my local AdventureWorks2012 database to single user mode, opened a session to that database, tried an alter database to get it back to multi user and this is what I got. [Read More]

Using PowerShell to Export SQL Data to CSV. How well does it perform?

So here we are at week 4 of the #SQLNewBlogger challenge. Earlier in the week I responded to the following post on Twitter #sqlhelp, and after I posted my response I thought that this would make a fun blog post. I have used PowerShell to export SQL Server tables to CSV files before so I know that my suggestion works, but I was wondering if I could determine how performance would be for a larger table. [Read More]

Modify SQL Agent Jobs using PowerShell and SMO

So here we are, week 2 of the #SQLNewBlogger Challenge. This is a follow on to last weeks post Monitoring SQL Agent Jobs when you work for Mr Krabs where I showed you how to go about monitoring SQL Server agent jobs using PowerShell and SMO. This can be very helpful if you are on a limited budget and can’t afford any fancy monitoring tools. This week I have decided to stick to the same subject, but I’m gonna kick it up a notch. [Read More]

Monitoring SQL Agent Jobs when you work for Mr Krabs

For those of you who don’t know who Mr. Krabs is, he is a character in the TV show Sponge Bob Square Pants. Mr. Krabs owns the Krusty Krab restaurant and is a very frugal business owner. Every decision he makes is driven completely on how it will impact his bottom line. Thinking about Mr. Krabs reminds me of one of my first SQL Server DBA jobs. I was starting just as the old DBA was leaving and there wasn’t a lot of time for turnover. [Read More]

Intro to SQL Server Automation with PowerShell

March 26th, 2015, a date which will live in infamy! Well, at least for me it will. March 26th, 2015 marks the date I gave my first presentation at my local SQL PASS user group meeting. Here is the picture as proof! I was very excited to be able to share some of my knowledge with everyone who showed up. I hope to be able to do it again some time. [Read More]

Configure SQL Server Agent using SMO

Saw this on twitter and thought I would throw it up on the blog. Easier than responding on twitter. [System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SqlServer.Smo") | Out-Null; $SQLServerInstance = "MSSQLSERVER" $srv = New-Object "Microsoft.SqlServer.Management.Smo.Server" $SQLServerInstance $srv.JobServer.MaximumHistoryRows = 1002 $srv.JobServer.Alter() You can manipulate most if not all SQL Server configurations through SMO. This simple post has inspired me a bit. I think it would be useful to show how I came to find the information I needed to modify this setting. [Read More]