How to find out SQL Server database backup

Is there a way to programmatically determine if SQL Server is currently backing up to a specific database?

We have automated database backup scripts for data files and logs, where databases are backed up at night and log files are backed up every 15 minutes, 24 hours a day. However, we believe that the log file backup job does not work if it runs at the same time that the full backup is in progress.

What I want to do is make changes to the transaction log of the script so as not to start the backup of the transaction log when performing a full backup.

If there is a DMV or system table, which can I query and execute this?

+3
source share
2 answers

Yes, that could be a problem in SQL 2000. There shouldn't be a problem in 2005 +

See this ServerFault question for its cause.

See this Serverfault question for a more complex script.

+1
source

Yes there is

select * from sys.dm_exec_requests
where command = 'backup db'
and database_id = 6 --or whatever your db id is
+10
source

Source: https://habr.com/ru/post/1749479/


All Articles