This months TSQL Tuesday subject is a shout out and high-five to those people who have inspired or made a contribution to my DBA life. So here goes: Before I started my career as a Database Administrator I worked in the motor trade for approx 12 years , I worked with some great people and gathered... Continue Reading →
UNDERCOVER TOOLBOX: Find Untrusted Foreign Keys and Orphaned Key data
SQL Server tracks untrusted Foreign keys in sys.Foreign keys with a column called is_not_trusted, there may be a number of reasons why a Foreign key may have become untrusted below are a couple of examples: Foreign key was disabled using the 'NOCHECK' option then re-enabled using 'CHECK' (not to be confused with 'WITH CHECK') Foreign key was... 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 →
Concatenation Truncation – Are your strings being truncated?
It wasn't until recently that i paid attention to truncation during concatenation, but that's because whenever I used concatenation before it was only using short data lengths so I didn't see the effects of truncation. When I first noticed that truncation can occur I was building a Huge piece of dynamic SQL , Don't... 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 →
7 ways to Query Always On Availability Groups using SQL
There are multiple ways to query availability group information, below are some of my favourite goto queries when I need to obtain information about Always on Availability groups for various tasks. Show All availability groups visible to this server where this Server is the Primary replica Show All availability... 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 →
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 →
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 →
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 →
