dbatools
dbatools copied to clipboard
Get-DbaBackupInformation and Get-DbaDbBackupHistory return inconsistent values
Verified issue does not already exist?
Yes
What error did you receive?
I noticed that the value of some properties are not standard to both functions. Below is a table summarizing what I get, with the obvious inconsistencies marked in bold.
Property Name | Get-DbaBackupInformation |
Get-DbaDbBackupHistory |
---|---|---|
InstanceName | always empty | instance name |
CompressionRatio | always 0.00 | compression ratio |
Type | 'Database', 'Database Differential', 'Transaction Log' | 'Full', 'Differential', 'Log' |
BackupSetId | backup_set_uuid (msdb.dbo.backupset) | backup_set_id (msdb.dbo.backupset) |
Software | always empty | software name |
FileList | 'Type', 'Size' | 'FileType', no 'Size' |
LastRecoveryForkGUID | always 00000000-0000-00... | actual value (msdb.dbo.backupset) |
Steps to Reproduce
$Properties = @(
'InstanceName',
'CompressionRatio',
'Type',
'BackupSetId',
'Software',
'FileList',
'LastRecoveryForkGUID'
)
Get-DbaBackupInformation -SqlInstance server\instance -Path 'c:\backups\db1' | Select-Object $Properties | Out-GridView
Get-DbaDbBackupHistory -SqlInstance server\instance -Database db1 | Select-Object $Properties | Out-GridView
Are you running the latest release?
Yes
Other details or mentions
Am I missing something obvious here? Is that wanted behavior ?
If this needs to be addressed, I would be happy to start tackling some of those items. However, I would need guidance regarding what the standard should be. Also, these changes might break other functions in the module, and existing code relying on dbatools. Finally, depending on decisions it might be worth splitting this issue into smaller ones.
What PowerShell host was used when producing this error
VS Code (terminal)
PowerShell Host Version
PSVersion 5.1.19041.1320 PSEdition Desktop PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...} BuildVersion 10.0.19041.1320 CLRVersion 4.0.30319.42000 WSManStackVersion 3.0 PSRemotingProtocolVersion 2.3 SerializationVersion 1.1.0.1
SQL Server Edition and Build number
Microsoft SQL Server 2012 (SP4-GDR) (KB4583465) - 11.0.7507.2 (X64) Nov 1 2020 00:48:37 Copyright (c) Microsoft Corporation Standard Edition (64-bit) on Windows NT 6.2 <X64> (Build 9200: ) (Hypervisor)
.NET Framework Version
.NET Framework 4.7 SDK .NET Framework 4.7 Targeting Pack .NET Framework 4.7 Targeting Pack (ENU)
For a lot of those the difference is that get-dbabackupinformation fetches info from files, and a few of those cannot be calculated. e.g. msdb "knows" that db size is x and the compressed backup is x*0.7, so it can give you the compression percentage. The backup file doesn't store the "uncompressed size" .
Hi Simone,
Thanks for the feedback!
In your opinion, is any effort worthwhile here?
Despite those two functions using different sources, the columns "Type" and "FileList" could still be made more consistent.
Also, what do you think about Get-DbaBackupInformation
returning the backup_set_uuid instead of the backup_set_id in a column called BackupSetId ?
Let me know what you think. I'd be happy to work on that if you think it makes sense. Otherwise, feel free to close the issue.
Cheers
I feel that maybe @Stuart-Moore can weigh in on those, not sure if it's something intended or just a hiccup.
Hi @Stuart-Moore - can you have a look at this issue? Thanks.