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 →
UNDERCOVER TOOLBOX: Sp_ChangeJobOwnerShip – Changing Ownership in bulk.
How many times have you seen SQL Agent jobs with random ownership? It can be very frustrating when you are trying to keep things standardised and new agent job creations are not being set to an owner which is part of your Standardisation. There are times when you may want to have certain jobs... 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 →
UNDERCOVER TOOLBOX: Database Files/Sizes and Growth rates
Here is a little script that gives an overview of your current ONLINE databases, their data and log File names, sizes and growth rates - if the growth rate is a percentage it will calculate this for you so that it is represented as a value in MB in addition to showing you the Percentage... 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 →
UNDERCOVER TOOLBOX: sp_ChangeDatabaseOwnership – Producing statements to Alter Authorisation
The latest addition to our toolbox is not a one size fits all, this procedure may or may not suit your needs but if you have a requirement of setting database ownership's to a specific login across the board such as SA, then this Stored procedure may well be for you. The idea of... Continue Reading →
UNDERCOVER TOOLBOX: Sp_RunningJobs – See all currently running SQL Agent Jobs
Update: 07/08/2017 - Identified and fixed a bug with the Elapsed Days not showing accurately. Update: 31/7/2017 - We have improved the Stored Procedure, the revised version now includes Days elapsed in addition to Hours, Minutes and Seconds. There are quite a few Running agent job scripts out there , most of the ones I... Continue Reading →
UNDERCOVER TOOLBOX: When was my last backup taken?
One question that seems to come up on the forums again and again is, 'how can I see when my database was last backed up?'. There are always a bunch of answers and some very convoluted scripts thrown around. As a bit of a lunchtime quickie today I thought I'd share with you a script... Continue Reading →
