Author | Stuart Moore (@napalmgram), stuart-moore.com |
Availability | Windows, Linux, macOS |
Want to see the source code for this command? Check out Select-DbaBackupInformation on GitHub.
Want to see the Bill Of Health for this command? Check out Select-DbaBackupInformation.
Select a subset of backups from a dbatools backup history object
Select-DbaBackupInformation filters out a subset of backups from the dbatools backup history object with parameters supplied.
Select-DbaBackupInformation
[-BackupHistory] <Object>
[[-RestoreTime] <DateTime>]
[-IgnoreLogs]
[-IgnoreDiffs]
[[-DatabaseName] <String[]>]
[[-ServerName] <String[]>]
[[-ContinuePoints] <Object>]
[[-LastRestoreType] <Object>]
[-EnableException]
[<CommonParameters>]
PS C:\> $Backups = Get-DbaBackupInformation -SqlInstance Server1 -Path \\server1\backups$
PS C:\> $FilteredBackups = $Backups | Select-DbaBackupInformation -RestoreTime (Get-Date).AddHours(-1)
Returns all backups needed to restore all the backups in \server1\backups$ to 1 hour ago
PS C:\> $Backups = Get-DbaBackupInformation -SqlInstance Server1 -Path \\server1\backups$
PS C:\> $FilteredBackups = $Backups | Select-DbaBackupInformation -RestoreTime (Get-Date).AddHours(-1) -DatabaseName ProdFinance
Returns all the backups needed to restore Database ProdFinance to an hour ago
PS C:\> $Backups = Get-DbaBackupInformation -SqlInstance Server1 -Path \\server1\backups$
PS C:\> $FilteredBackups = $Backups | Select-DbaBackupInformation -RestoreTime (Get-Date).AddHours(-1) -IgnoreLogs
Returns all the backups in \server1\backups$ to restore to as close prior to 1 hour ago as can be managed with only full and differential backups
PS C:\> $Backups = Get-DbaBackupInformation -SqlInstance Server1 -Path \\server1\backups$
PS C:\> $FilteredBackups = $Backups | Select-DbaBackupInformation -RestoreTime (Get-Date).AddHours(-1) -IgnoreDiffs
Returns all the backups in \server1\backups$ to restore to 1 hour ago using only Full and Log backups.
A dbatools.BackupHistory object containing backup history records
Alias | |
Required | True |
Pipeline | true (ByValue) |
Default Value |
The point in time you want to restore to
Alias | |
Required | False |
Pipeline | false |
Default Value | (Get-Date).addmonths(1) |
This switch will cause Log Backups to be ignored. So will restore to the last Full or Diff backup only
Alias | |
Required | False |
Pipeline | false |
Default Value | False |
This switch will cause Differential backups to be ignored. Unless IgnoreLogs is specified, restore to point in time will still occur, just using all available log backups
Alias | |
Required | False |
Pipeline | false |
Default Value | False |
A string array of Database Names that you want to filter to
Alias | |
Required | False |
Pipeline | false |
Default Value |
A string array of Server Names that you want to filter
Alias | |
Required | False |
Pipeline | false |
Default Value |
The Output of Get-RestoreContinuableDatabase while provides 'Database',redo_start_lsn,'FirstRecoveryForkID' values. Used to filter backups to continue a restore on a database
Sets IgnoreDiffs, and also filters databases to only those within the ContinuePoints object, or the ContinuePoints object AND DatabaseName if both specified
Alias | |
Required | False |
Pipeline | false |
Default Value |
The Output of Get-DbaDbRestoreHistory -last
This is used to check the last type of backup to a database to see if a differential backup can be restored
Alias | |
Required | False |
Pipeline | false |
Default Value |
By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.
This avoids overwhelming you with "sea of red" exceptions, but is inconvenient because it basically disables advanced scripting.
Using this switch turns this "nice by default" feature off and enables you to catch exceptions with your own try/catch.
Alias | |
Required | False |
Pipeline | false |
Default Value | False |