Just a quick note on a scenario I ran into, and what I did to fix it: Scenario A user was running a stored procedure that created a table. Rather than having a table created in the "dbo" schema, it was creating a table with their user name as the...
Programming
When a High Availability (HA) environment failed over, on the node that became Secondary, the backup jobs did not gracefully handle the change. The Maintenance Plans are supposed to intelligently determine whether each database is Primary or Secondary in an HA environment, and skip the backup if it is not...
Here is a situation I just came across (boiled down and simplified). An end user was having to manually find a user id, navigate to an image folder, and then search through hundreds of images to find the one corresponding with that user. Sure, they were in numerical order, but still,...
This is perhaps my most commonly used query when troubleshooting. From SQL Server DMV’s in action ebook. The output shows the spid (process identifier), the ecid (this is similar to a thread within the same spid and is useful for identifying queries running in parallel), the database name, the user...
PowerShell script to quickly change all Recovery Options to “Restart the Service”. https://gist.github.com/benf101/a3c7020c0a582aca06059b750bd08528
Creating and writing to output file in PowerShell.
This is a PowerShell script that puts out the XML required to update your Red Gate MultiScript servers. Manually entering the SQL instances from within the application can be a daunting task if you have a large number to do. This script will have you up and running in seconds....
When using AlwaysOn, you must connect using your listener name, not your node name. If you connect with the node name, it will only work until there is a failover, which would defeat the purpose of your High Availability setup, right?
While this seems like a simple thing to do, I recently discovered so many ways not to do it (also known as failing) that I just had to document this one.
This script will return all SQL instances running on a server or list of servers. cls Import-Module -Name SQLPS -DisableNameChecking $servers = “SERVER_NAME”, “SERVER_NAME_2”, “ETC”; foreach($server in $servers) { $path = “SQLServer:\SQL\” + $server; $instances = Get-ChildItem -Path $path; $instances; }