< Back

Select-DbaBackupInformation

Mon Jan 13, 2020 1:39 pm

NAME Select-DbaBackupInformation



SYNOPSIS

Select a subset of backups from a dbatools backup history object





SYNTAX

Select-DbaBackupInformation [-BackupHistory] <System.Object> [[-RestoreTime] <Datetime>] [-IgnoreLogs <Switch>]

[-IgnoreDiffs <Switch>] [[-DatabaseName] <System.String[]>] [[-ServerName] <System.String[]>] [[-ContinuePoints]

<System.Object>] [[-LastRestoreType] <System.Object>] [-EnableException <Switch>] [<CommonParameters>]





DESCRIPTION

Select-DbaBackupInformation filters out a subset of backups from the dbatools backup history object with

parameters supplied.





PARAMETERS

-BackupHistory [<System.Object>]

A dbatools.BackupHistory object containing backup history records



Required? false

Position? named

Default value

Accept pipeline input? False

Accept wildcard characters? false



-ContinuePoints [<System.Object>]

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



Required? false

Position? named

Default value

Accept pipeline input? False

Accept wildcard characters? false



-DatabaseName [<System.String[]>]

A string array of Database Names that you want to filter to



Required? false

Position? named

Default value

Accept pipeline input? False

Accept wildcard characters? false



-EnableException [<Switch>]

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.



Required? false

Position? named

Default value

Accept pipeline input? False

Accept wildcard characters? false



-IgnoreDiffs [<Switch>]

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



Required? false

Position? named

Default value

Accept pipeline input? False

Accept wildcard characters? false



-IgnoreLogs [<Switch>]

This switch will cause Log Backups to be ignored. So will restore to the last Full or Diff backup only



Required? false

Position? named

Default value

Accept pipeline input? False

Accept wildcard characters? false



-LastRestoreType [<System.Object>]

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



Required? false

Position? named

Default value

Accept pipeline input? False

Accept wildcard characters? false



-RestoreTime [<Datetime>]

The point in time you want to restore to



Required? false

Position? named

Default value

Accept pipeline input? False

Accept wildcard characters? false



-ServerName [<System.String[]>]

A string array of Server Names that you want to filter



Required? false

Position? named

Default value

Accept pipeline input? False

Accept wildcard characters? false



<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,

ErrorAction, ErrorVariable, WarningAction, WarningVariable,

OutBuffer, PipelineVariable, and OutVariable. For more information, see

about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).



INPUTS



OUTPUTS



NOTES





Tags: Backup, Restore

Author:Stuart Moore (@napalmgram), stuart-moore.com



Website: https://dbatools.io

Copyright: (c) 2018 by dbatools, licensed under MIT

License: MIT https://opensource.org/licenses/MIT



-------------------------- EXAMPLE 1 --------------------------



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

-------------------------- EXAMPLE 2 --------------------------



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

-------------------------- EXAMPLE 3 --------------------------



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

-------------------------- EXAMPLE 4 --------------------------



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 Diff backups.



RELATED LINKS

https://dbatools.io/Select-DbaBackupInformation