T-SQL Tuesday #104: Code I Would Hate To Live Without

TSQL2SDAY-150x150

Today's blog post is part of T-SQL Tuesday. T-SQL Tuesday is the brainchild of Adam Machanic. It is a monthly blog party on the second Tuesday of each month. Everyone is welcome to participate.

This month’s T-SQL Tuesday, hosted by my buddy and YouTube star Bert Wagner (blog | twitter), is all about the SQL Server tools I use and love. This post is about PowerShell, of course.

Start-DbaMigration

dbatools is such a fun toolset to work on, but specifically, I can no longer live without Start-DbaMigration. Even in smaller shops, migrations are often required and they are always a lot of work.

At least they used to be, before I built the command that started it all: Start-DbaMigration. Start-DbaMigration is an instance to instance migration command that migrates just about everything. It's really a wrapper that simplifies nearly 30 other copy commands, including Copy-DbaDatabase, Copy-DbaLogin, and Copy-DbaSqlServerAgent.

Here is what it looks like in action:

So simple. To migrate an entire instance, all I had to do was execute the following:

1Start-DbaMigration -Source sql2016 -Destination sql2017 -BackupRestore -NetworkShare \\nas\sql

How cool is that?! It is such a relief that I no longer have to dread migrations. I don't have to go find sp_help_revlogin and execute it then copy the stuff over. I don't have to figure out the default paths of whatever. I don't have to worry that I'll copy over a job but not its associated schedule.

Everything is just done for me, and I can sleep better at night 😴

Bonus: dbachecks

Ever since I was a baby DBA working for a company with a small budget, I've always wanted something like dbachecks. dbatchecks helps automate the checklists that we gotta go through every day, week, month, quarter, year and so on.

This used to be a manual pain, but now it's automated, open-source, free and gorgeous 💅.

That whole module is some awesome code. And you can read about it here.

Thanks for joining me for this month's T-SQL Tuesday. Sorry I never write about things in-depth.