Restore-DbaDbSnapshot View Source Simone Bizzotto (@niphold) Windows, Linux, macOS Synopsis Restores SQL Server databases from database snapshots, reverting to the snapshot’s point-in-time state
Description Restores SQL Server databases to their exact state when a database snapshot was created, discarding all changes made since that point. This is particularly useful for quickly reverting development databases after testing, rolling back problematic changes, or returning to a known good state without restoring from backup files.
Select-DbaBackupInformation View Source Stuart Moore (@napalmgram), stuart-moore.com Windows, Linux, macOS Synopsis Filters backup history to identify the minimum backup chain needed for point-in-time database recovery
Description Analyzes backup history objects and determines the exact sequence of backups required to restore a database to a specific point in time. This function handles the complex LSN logic to identify which full, differential, and log backups are needed, eliminating the guesswork of manual restore planning.
Set-DbaDefaultPath View Source Chrissy LeMaire (@cl), netnerds.net Windows, Linux, macOS Synopsis Configures the default file paths for new databases and backups on SQL Server instances
Description Modifies the server-level default paths that SQL Server uses when creating new databases or performing backups without specifying explicit locations. This eliminates the need to manually specify file paths for routine database operations and ensures consistent placement of files across your environment.
The function validates that the specified path is accessible to the SQL Server service account before making changes.
Test-DbaBackupInformation View Source Stuart Moore (@napalmgram), stuart-moore.com Windows, Linux, macOS Synopsis Validates backup history objects to ensure successful database restoration
Description Performs comprehensive pre-restore validation on backup history objects to prevent restore failures before they occur. Input is typically from Format-DbaBackupInformation and gets parsed to verify restore readiness.
This function runs critical validation tests including LSN chain integrity for transaction log backups, backup file accessibility by the SQL Server service account, database existence conflicts, and file path availability.
Test-DbaDbRecoveryModel View Source Claudio Silva (@ClaudioESSilva) Windows, Linux, macOS Synopsis Validates whether databases are truly operating in their configured recovery model
Description When you switch a database into FULL recovery model, it will behave like a SIMPLE recovery model until a full backup is taken in order to begin a log backup chain. This function identifies the gap between configured and actual recovery model behavior.
For FULL recovery databases, the function checks if a log backup chain has been established by examining the last_log_backup_lsn in sys.
Test-DbaLastBackup View Source Chrissy LeMaire (@cl), netnerds.net Windows, Linux, macOS Synopsis Quickly and easily tests the last set of full backups for a server.
Description Restores all or some of the latest backups and performs a DBCC CHECKDB.
Gathers information about the last full backups Restores the backups to the Destination with a new name. If no Destination is specified, the originating SQL Server instance wil be used. The database is restored as “dbatools-testrestore-$databaseName” by default, but you can change dbatools-testrestore to whatever you would like using -Prefix The internal file names are also renamed to prevent conflicts with original database A DBCC CHECKDB is then performed And the test database is finally dropped Syntax Test-DbaLastBackup [[-SqlInstance] <DbaInstanceParameter[]>] [[-SqlCredential] <PSCredential>] [[-Database] <Object[]>] [[-ExcludeDatabase] <Object[]>] [[-Destination] <DbaInstanceParameter>] [[-DestinationSqlCredential] <Object>] [[-DataDirectory] <String>] [[-LogDirectory] <String>] [[-FileStreamDirectory] <String>] [[-Prefix] <String>] [-VerifyOnly] [-NoCheck] [-NoDrop] [-CopyFile] [[-CopyPath] <String>] [[-MaxSize] <Int32>] [[-DeviceType] <String[]>] [-IncludeCopyOnly] [-IgnoreLogBackup] [[-AzureCredential] <String>] [[-InputObject] <Database[]>] [[-MaxTransferSize] <Int32>] [[-BufferCount] <Int32>] [-IgnoreDiffBackup] [[-MaxDop] <Int32>] [-ReuseSourceFolderStructure] [-EnableException] [-WhatIf] [-Confirm] [<CommonParameters>] Examples Example: 1 PS C:\> Test-DbaLastBackup -SqlInstance sql2016 Determines the last full backup for ALL databases, attempts to restore all databases (with a different name and file structure), then performs a DBCC CHECKDB.
Today’s blog post is part of T-SQL Tuesday. T-SQL Tuesday is the brainchild of Adam Machanic. It is a monthly blog party on the second Tuesday of each month. Everyone is welcome to participate.
intro dbatools has been around since 2014. At first, it started with one contributor and was solely dedicated to migrating SQL Server instances, but now it’s grown into an awesome open source DBA project with over 30 contributors.