Category Archives for "Helpful Scripts"

Jun 12

Stop Jobs That Run Too Long

By Lori Brown | Helpful Scripts , Jobs , SQL Administration , SQL Server

Since I seem to run across lots of questions about how to make sure that no jobs get in the way of ETL or other stressful data loads, I thought that I should post some ways you can stop jobs. https://learn.microsoft.com/en-us/sql/relational-databases/system-stored-procedures/sp-stop-job-transact-sql?view=sql-server-ver16 I have always done this by having a monitoring job that executes on a […]

Continue reading
Apr 11

Replication Slow at Subscriber Due to Missing Indexes

By Lori Brown | Helpful Scripts , Indexes , Replication , SQL Server

Problem Have you ever had transactional replication mysteriously start showing significant latency at a subscriber server?  If so, check to see if the primary keys from the publisher database are missing on the subscriber database! Replication was showing long latency while the publisher and subscriber servers were not heavily utilized.  Microsoft generated stored procedures that […]

Continue reading
Oct 12

Using Extended Events to Find Statement Causing a Job to Run Long or Hang

By Lori Brown | Extended Events , Helpful Scripts , Jobs , Performance Tuning , SQL Administration , SQL Server

On one of the servers that we monitor, it was reported that periodically a specific job would seem to hang and take forever to complete.  I was asked to set up something to help find exactly what statement in the job that was the root cause of the hang.  Since the issue only occurred intermittently, […]

Continue reading
Oct 14

Find All Databases with Less Than 20 Percent Free Space and Grow Them

By Lori Brown | Function , Helpful Scripts , SQL Administration , SQL Maintenance , SQL Server

This is kind of a continuation of one of my previous posts.  (https://www.sqlrx.com/find-and-modify-file-growth-settings-for-all-databases/ ) Thousands of databases in a SQL instance can make a DBA’s life a bit challenging.  Automation suddenly becomes very important.  My new client had been shrinking their databases frequently, mistakenly thinking that doing so was a good thing.  I needed to […]

Continue reading
Aug 16

Find the Last Time Databases or Logs were Restored

By Lori Brown | Backup and Restore , Helpful Scripts , Log Shipping , SQL Administration , SQL Maintenance , SQL Server

I have a client that uses a lot of disconnected log shipping on a few servers.  They do this because they want to have a copy of their database that is actually hosted by software vendors for reporting purposes.  So, disconnected log shipping it is!  We pull down files that have been FTP’d to the […]

Continue reading
1 2 3 5
>