T-SQL Tuesday: The Cloud, Globalization and Automation

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 Koen Verbeeck (blog | twitter), is all about how technology has changed a lot in the past years and the potential impact these changes will have on SQL Server Pros.

In Koen’s invitation, he specifically called out the cloud, globalization and automation.

The Cloud

When it comes to the cloud, I think on-prem is still a safe bet and will be for at least another decade.

My first bill from Amazon Web Services arrived nearly ten years ago on June 1, 2007 (it was for $0.61, not bad). Since then, I’ve played in the cloud off and on, and was even the technical editor for a book about Automating Microsoft Azure with PowerShell. When it comes to work work, however, everything is still on-prem. Similarly, my awesome homelab is tucked safely in a storage room at my house.

Ultimately, when it comes to the cloud, I think it’ll be at least another 10-15 years before a majority of organizations fully move away from on-prem. And as they do, I’ll go along with them, but like many organizations, I’m in no rush. The “Datacenter” in my Cloud and Datacenter Management MVP is strong.

At the same time, I know that my varied systems background lends itself to the confidence that I can adjust to cloud movement with no issues. I’d encourage DBAs with a weak systems background invest more time into understanding their whole environment and not just SQL Server itself.

Globalization

Is this offshoring? If so, I’ve seen situations where it’s worked, and situations where it hasn’t. I’m not really concerned.

Automation

Y’all know what I’m gonna say here! I love automation and PowerShell. I know for a fact that PowerShell and T-SQL together are the future of SQL Server administration. As someone who often presents about dbatools, the popular SQL PowerShell community project, I’ve seen the excitement and relief that PowerShell automation brings to SQL Server Database Pros.

From making it way easier to migrate entire instances to automating backup testing and verification, PowerShell makes it straight up more enjoyable to be a DBA.

Backups

For years, I’ve used Ola Hallengren’s Maintenance Solution, but I always found it stressful to know that at each location, I’d have to spend a chuck of time working on the process to perform restores as required.


A whole instance of Ola backups

What happens if an entire instance goes down? Now, thanks to Stuart Moore, restoring the most recent database backups to another instance is as easy as

Get-ChildItem \nas\sql\sql2016 | Restore-DbaDatabase -SqlInstance sql2016a -MaintenanceSolutionBackup

What about logins with their passwords, SIDS, permissions and all that? I export every login within my estate every day to a text file using Export-SqlLogin.

What about jobs? Well, we don’t export those yet, but they’re on the list ;) Here’s a video of Restore-DbaDatabase to keep you occupied in the meantime.

SPNs

These used to be a pain, but they aren’t anymore. Now, thanks to Drew Furgiuele, dbatools offers a suite of SPN-related commands that help make Service Principal Name management way easier.

Test-DbaSpn tests for SPNs that should exist and can be piped to Out-GridView and then to Set-DbaSpn. So easy, it makes SPN management fun!

We also have a quick 5 minute video that gives a tour of the four SPN commands.

Migrations

As previously mentioned, migrations can be automated and even scheduled. Check out this video where an entire instance is migrated with a single command.

Finding things

Ever needed to find a stored procedure that contains specific text? When I did development, I had to all the time. dbatools offers an easy, awesome way to do this. You can even search using regular expressssssions! What?!

And it’s smoking fast, too. I once evaluated 37,545 stored procedures on 9 servers in less than seconds!

We’ve even made it easy to find databases, orphaned files, user owned objects, jobs, unused indexes and more. Hell, we even have a command for finding dbatools commands!

In conclusion, automation is life

Intrigued? Check out our whole catalog of commands that automate common (and not so common) SQL Server tasks.

Thanks for joining me for this month’s T-SQL Tuesday.

Chrissy is a PowerShell MVP who has worked in IT for nearly 20 years, and currently serves as a Sr. Database Engineer in Belgium. Always an avid scripter, she attended the Monad session at Microsoft’s Professional Developers Conference in Los Angeles back in 2005 and has worked and played with PowerShell ever since. Chrissy is currently pursuing an MS in Systems Engineering at Regis University and helps maintain RealCajunRecipes.com in her spare time. She holds a number of certifications, including those relating to SQL Server, SuSE Linux, SharePoint and network security. She recently became co-lead of the SQL PASS PowerShell Virtual Chapter. You can follow her on Twitter at @cl.

Posted in PowerShell, SQL Server

Leave a Reply

Your email address will not be published. Required fields are marked *

*