Backup, restore, and test

Similar to the SqlServer module command, dbatools also has commands to back up and restore databases. However, it offers a lot more control over the details, and more tooling around backup to supplement them. A few example commands are as follows:

# Backup the databases selected
Backup-DbaDatabase -SqlInstance Server1 -Database HR, Finance

# Restore databases
Restore-DbaDatabase -SqlInstance server1instance1 -Path \server2ackups

# List backup history
Get-DbaBackupHistory -SqlInstance server1

# Measure backup throughput
Measure-DbaBackupThroughput -SqlInstance server1

The core feature tool in dbatools relating to backup, however, is the automated backup test command, that enables dbas to verify that their backups actually can be restored! The following example will test the last backup for every single database in the target instance by doing a test restore on every one of them and using DBCC CHECK to ensure data integrity:

Test-DbaLastBackup -SqlInstance server1

Scheduled in a daily agent job or scheduled task, this allows automatic verification of every single backup and ensures backups can actually be used to recover from catastrophe.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.145.156.250