How can I tell if a SQL Server database is being backed up

13,834

Solution 1

Yes, it can be a problem in SQL 2000. Should not be a problem in 2005+

See this ServerFault question for the reason it conflicts.

See this Serverfault question for a more sophisticated script.

Solution 2

Yes there is

select * from sys.dm_exec_requests
where command = 'backup db'
and database_id = 6 --or whatever your db id is
Share:
13,834
Guy
Author by

Guy

Solution Architect and continual fiddler. Previously a database manager and DBA for SQL Server and Oracle. IT Operational Support manager (a technincal boss). Occasional classic ASP and C# web programmer.

Updated on June 04, 2022

Comments

  • Guy
    Guy almost 2 years

    Is there a way to programmatically determine if a SQL Server backup is currently being performd on a particular database?

    We have automated database backup scripts for both data and log files, where the databases are backed up nightly and log files are backed up every 15 minutes, 24 hours a day. However, we think that the log file backup job is failing if it runs the same time as the full backup is being run.

    What I'd like to do is to make a change to my transaction log script to not run a transaction log backup while the full backup is being run.

    If there a DMV or a system table that I can query and work this out?