Thor Logo dbatools

Shrink

Invoke-DbaDbShrink

Chrissy LeMaire (@cl), netnerds.net

Invoke-DbaDbShrink View Source Chrissy LeMaire (@cl), netnerds.net Windows, Linux, macOS Synopsis Reduces the physical size of database files by removing unused space from data and log files. Shrinks can cause severe index fragmentation (to the tune of 99%) Shrinks can cause massive growth in the database’s transaction log Shrinks can require a lot of time and system resources to perform data movement Description Reduces database file sizes by removing unused space from data files, log files, or both.

Read more

Invoke-DbaDbUpgrade

Stephen Bennett, sqlnotesfromtheunderground.wordpress.com

Invoke-DbaDbUpgrade View Source Stephen Bennett, sqlnotesfromtheunderground.wordpress.com Windows, Linux, macOS Synopsis Upgrades database compatibility level and performs post-upgrade maintenance tasks Description Performs the essential steps needed after upgrading SQL Server or moving databases to a newer instance. Updates database compatibility level to match the hosting SQL Server version and sets target recovery time to 60 seconds for SQL Server 2016 and newer. Executes critical post-upgrade maintenance including DBCC CHECKDB with DATA_PURITY to detect data corruption, DBCC UPDATEUSAGE to correct page counts, sp_updatestats to refresh statistics, and sp_refreshview to update all user views with new metadata.

Read more