TSQL-Tuesday #104: Code You Would Hate To Live Without

This month’s TSQL Tuesday is hosted by Bert Wagner (w | t) and he asks us to write about code you’ve written that you would hate to live without.

Over the years I’ve used other people’s code regularly. It could have gone from Github, Stack Overflow, blogs, etc.

I have always appreciated the way the SQL Server community (and other communities) share their code to help others.

I have worked alongside lots of people who were not very keen on sharing. People told me that their code was theirs and only theirs and that nobody is to see it. Although I don’t agree, I do understand people not wanting to share their code. They may have worked hard on it and the person could have an advantage over other people who don’t have that “special” piece of code. There is a couple of caveats to that:

Read more →

Decrypting SQL Server Objects with dbatools

There are lots of great articles that describe how the command for decrypting SQL Server objects when they’re saved with encryption like Encrypting and Decrypting SQL Server Stored Procedures, Views, and User-Defined Functions Simple Way to Decrypt SQL Server Stored Procedure

Most of them rely on T-SQL and SSMS but I wanted to do the same thing with PowerShell. This way I can execute it for several objects at a time and maybe even in multiple databases and instances.

Read more →

Log Shipping With dbatools – Part 4: Recover a Log Shipped Database

In the third part of the series we discussed the way to get the log shipping errors using the command “Get-DbaLogShippingError”.

This blog will be about how to recover a log shipped database.

Out-of-the-box solutions

I can be very short in this paragraph, there is no out-of-the-box solution to recover a log shipped database.

Why this command

Initially, log shipping was meant to be used as a warm standby. You have your data on another instance but you still have some human intervention to get it all back up. Imagine the following situation. You have set up log shipping using either the GUI or the commands in dbatools.

Read more →

Log Shipping With dbatools – Part 3: Get Log Shipping Errors

In the second part of the series we discussed the way to test the log shipping status using the command “Test-DbaLogShippingStatus”.

This blog will be about how to get log shipping errors to analyze why your log shipping isn’t working.

Out-of-the-box solutions

There are several options to get the log shipping errors right out of the box. One of them is using queries and the other one is the event viewer.

Read more →

Log Shipping With dbatools - Part 2: Test Log Shipping Status

In the first part of the series I described the command Invoke-DbaLogShipping.

This makes it possible to set up log shipping. This blog post will be about the command to test log shipping status. Before I describe the command, I want to discuss the options that are available in the SQL Server Management Studio (SSMS) and SQL Server.

Out-of-the-box monitoring

Microsoft has made it possible to check the log shipping using SSMS. This can be done using queries or by using the “Transaction Log Shipping Status” report.

Read more →