I'm pretty sure that we've all found ourselves in the situation where we've run an INSERT, UPDATE or DELETE script and it seems to be taking an age to run. We've done all the usual checks, there's no blocking going on, things are happening but it just seems to be taking an age to finish. ... Continue Reading →
Failed to perform AlwaysOn Manual Failover using the wizard – Availability-group DDL Operations are permitted only when you are using the master database .
Routine maintenance rolls around and it's time to failover your AG's to new Primary's to allow for patching and restarts... the weapon of choice will be the SSMS Failover wizard - and why not its does the job nicely and give us some nice visuals as it progresses through each failover. On this... Continue Reading →
Copying Data From One Table To Another – To Disable Indexes or Not To Disable Indexes, That’s the Question.
As the famous Bard once said, "To disable indexes or not to disable indexes, that is the question?". Well maybe that wasn't quite what he said but it was a discussion that came up here just recently. We've found ourselves inheriting a process that has to copy all the data from one database into another,... Continue Reading →
UNDERCOVER TOOLBOX: sp_Snapshot – The Easy Way To Create Database Snapshots for One or Many Database
This post refers to an older version of this procedure. Please see HERE for the latest version. sp_Snapshot is a procedure that we've written to quickly and easily create a database snapshot of one or multiple databases. Prerequisites sp_Snapshot uses STRING_SPLIT, if you're running on a version of SQL Server prior to 2016 or have... Continue Reading →
UNDERCOVER TOOLBOX: sp_ChangeAgentJobOperator – Scripting out change of notification operator , Deleting and/or Creating.
Sometimes you may find that people add SQL agent operators, these same operators may at some point need a clear down but what do you do when the operator you want to delete is set as the notification operator for numerous other jobs? You use the GUI , Right click the operator and click... Continue Reading →
UNDERCOVER TOOLBOX: Checking Your Backup Paths Exist and Automatically Creating Them if they Don’t
Where do you send your backup files? Here at SQLUndercover, we like all our databases to have their own backup folder, it just makes it nice and easy to find things. But what happens if someone creates a new database but doesn't create a backup folder for that database? Unless you're doing some kind of... Continue Reading →
Duplicate Agent jobs – A good reason not to meddle with Msdb
Some time ago I came across a strange issue where I found a number of duplicated SQL Agent jobs, the odd thing is SQL will not allow you to have more than one agent job with the same name - they need to be unique. To demonstrate here is an example of what i... Continue Reading →
Who’s Updated My Rows?! Interrogating the Transaction Logs
I'm pretty much positive that we've all been here at one time or another. We're sitting at our desk watching Klaus' latest SQL Quickie when a red faced colleague comes marching up to our desk and splutters out, in their rage "Someone's updated all my rows, can you find out who did it?". Now usually,... Continue Reading →
Restores using Invalid Backup Default Locations
Recently I was looking through the error log on one of my test machines and I spotted some unusual errors: SQL ERROR: 3634 - The operating system returned the error '3(The system cannot find the path specified.)' while attempting 'DeleteFile' SQL ERROR: 18272 - During restore restart, an I/O error occurred on checkpoint file... Continue Reading →
UNDERCOVER TOOLBOX: Generate a Temporary Table Definition to Match the Resultset of a Query
Have you ever needed to store the results of a complex query in a temp table? How did you go about working out what the definition for that temp table should be, the columns and their data types? It can be a bit of a pain, not to mention time consuming to have to go... Continue Reading →
