Sql-Server

數據庫備份壓縮

  • January 6, 2017

我正在嘗試查看我的所有備份是否已壓縮。我執行下面的查詢來檢查但沒有得到好的結果:

select top(10) database_name, 
case when  backup_size = compressed_backup_size then 'Compressed'
else 'Not compressed'
end as Compression, 
backup_finish_date
from msdb.dbo.backupset
where database_name ='MyDAtabase'
order by backup_start_date desc

我在用:

Microsoft SQL Server 2008 R2 (SP2) - 10.50.4000.0 (X64)

2012 年 6 月 28 日 08:36:30 版權所有 (c) Microsoft Corporation

Standard Edition (64-bit) o​​n Windows NT 6.1 (Build 7601: Service Pack 1)

預設情況下,我們設置壓縮,但是一旦我執行該查詢,我得到的結果數據庫未壓縮。

你的案例陳述是錯誤的。現在,如果值相同,則顯示壓縮,而您希望顯示未壓縮。

select top(10) database_name, 
case when  backup_size = compressed_backup_size then 'Not compressed'
else 'Compressed'
end as Compression, 
backup_finish_date
from msdb.dbo.backupset
where database_name ='MyDAtabase'
order by backup_start_date desc

引用自:https://dba.stackexchange.com/questions/160075