SQL Server Backup Performance
- tags
- #SQLServer
- categories
- SQLServer
Understanding SQL Server Backup Performance
Test Your SQL Server Backup Speed
SELECT
database_name
,backup_start_date
,backup_finish_date
,DATEDIFF(SS,backup_start_date,backup_finish_date) as diff_sec
,CAST(CAST((backup_size / (DATEDIFF(ss, backup_start_date,backup_finish_date))) / (1024 * 1024) AS numeric(12, 3)) AS varchar(16)) + 'MB/sec' speed
FROM msdb..backupset
where backup_start_date > DATEADD(dd, -10, GETDATE())
ORDER BY database_name, backup_start_date
SELECT
bs.database_name AS DatabaseName
, CAST(bs.backup_size/1024.0/1024/1024 AS DECIMAL(10, 2)) AS BackupSizeGB
, CAST(bs.backup_size/1024.0/1024 AS DECIMAL(10, 2)) AS BackupSizeMB
, CAST(bs.compressed_backup_size/1024.0/1024/1024 AS DECIMAL(10, 2)) AS CompressedSizeGB
, CAST(bs.compressed_backup_size/1024.0/1024 AS DECIMAL(10, 2)) AS CompressedSizeMB
, bs.backup_start_date AS BackupStartDate
, bs.backup_finish_date AS BackupEndDate
, CAST(bs.backup_finish_date - bs.backup_start_date AS TIME) AS AmtTimeToBkup
, DATEDIFF(SS, bs.backup_start_date, bs.backup_finish_date) as TimeInSec
, CAST((bs.backup_size / (DATEDIFF(ss, bs.backup_start_date, bs.backup_finish_date))) / (1024 * 1024) AS numeric(12, 3)) as speed_MB_sec
, bmf.physical_device_name AS BackupDeviceName
FROM msdb.dbo.backupset bs
JOIN msdb.dbo.backupmediafamily bmf
ON bs.media_set_id = bmf.media_set_id
WHERE 1=1
and bs.database_name = 'VT_DWH' -- uncomment to filter by database name
and bs.backup_start_date > DATEADD(dd, -1000, GETDATE())
and bs.type = 'D' -- change to L for transaction logs
ORDER BY
bs.database_name, bs.backup_start_date
To solve your problem, please refer to the following links:
- Options to Improve SQL Server Backup Performance
- Is your SQL Server backup running slow? Here’s how you can speed it up
- Super-Fast Backup and Restore Throughput for SQL Server
- MS SQL Server backup optimization
- How to Make SQL Server Backups Go Faster
Below are some sample queries for download
To solve the problem, I suggest that the following part of the query:
backup database DBNAME to disk='C:\1\DBNAME.bak' with buffercount=16 ,maxtransfersize=4194304