I got a request today to compare 2 DBs and see if they’ve got all the same tables. It seemed easy enough since I’ve got the redgate Schema Compare tool, but it actually isn’t. See, for some reason Schema Compare doesn’t work very well on my box, and it’s a big overkill for what I … Continue reading Comparing DB objects in Powershell→
One of the places PS shines is in its ability to let you work the way you want. So often I find someone stagnating in PS because they can’t figure out with “proper” way to do the task. So they stare at the screen for along time, try a few things, and finally give up. … Continue reading Learning Powershell in Steps→
Ok, I got some answers from the PS homework, so now it’s time for my solutions. If you didn’t get a chance to look at the assignments, take a look at them here real quick if you like and test yourself: http://www.midnightdba.com/DBARant/?p=647 As with anything there can be multiple solutions to each problem, and while … Continue reading Powershell Homework Answers→
Ok, well I’ve done quite a few PS posts now, and while it’s great to learn, it’s also great to test yourself. So here are some exercises you can use to test your skills. These are all very common PS taskes for enterprise admins. Some will be easy, and some will be more difficult. So … Continue reading Test your Powershell prowess→
As long as I’m on a roll here with server-level ops, I thought I’d go ahead and cover dropping DBs in PS. This should be a fairly short post as there’s not much to this, but it’s worth talking about anyway. Dropping DBs isn’t any big deal in T-SQL: DROP DATABASE SeansDB And the PS … Continue reading Dropping DBs in Powershell→
Today we’re going to continue our exploration of the server-level in PS. You’ll remember before we’ve explored it a little bit when we talked about querying cluster nodes. So today we’re going to kill users in a DB. This is incredibly easy to do in PS. First, let’s take a look at the T-SQL counterpart. … Continue reading Killing SPIDs in Powershell→
I’m recycling this December 2010 post for T-SQL Tuesday #016. Here’s a cute little piece of code to add up the sizes of all your DBs on a server. It comes in handy when you’re trying to see how much space you’ll need to duplicate the server either for DR, or reporting, or even just … Continue reading T-SQL Tuesday #016: Get DB Sums With Powershell→
It quite often happens that there will be some kind of issue keeping your app from hitting the DB. Sometimes the issue is with SQL itself, but most of the time there’s something else involved. The problem is that when it’s reported through the error stack at the app level, it only says that the … Continue reading Pinging SQL Server in Powershell→
Quite often it can be useful to not only get a list of DB sizes, but also sum it up in the last line. This can be useful for estimating backup file sizes, server sizing and more. Here I’ll show you a couple ways to sum up DB sizes so take your pick. Title: Sum … Continue reading New Video: Sum DB Sizes with Powershell→
A user request came in to write something in powershell that would replace sp_MSForEachDB. I took it a step further and showed you how to make it even more flexible for an enterprise environment. Title: Replace sp_MSForEachDB with Powershell (right-click to download video) Author: Sean McCown Date: 12/29/2010 Length: 14:15 Size: 19,475 KB