Updates compatibility level, then runs CHECKDB with data_purity, DBCC updateusage, sp_updatestats and finally sp_refreshview against all user views.
Runs the below processes against the databases
— Puts compatibility of database to level of SQL Instance
— Runs CHECKDB DATA_PURITY
— Runs DBCC UPDATESUSAGE
— Updates all users statistics
— Runs sp_refreshview against every view in the database
Invoke-DbaDatabaseUpgrade -SqlInstance PRD-SQL-MSD01 -Database Test
Runs the upgrade command skipping the sp_refreshview update on all views.
Invoke-DbaDatabaseUpgrade -SqlInstance PRD-SQL-INT01 -Database Test -NoRefreshView
If database Test is already at the correct compatibility, runs every necessary step.
Invoke-DbaDatabaseUpgrade -SqlInstance PRD-SQL-INT01 -Database Test -Force
Get only specific databases using GridView and pass those to Invoke-DbaDatabaseUpgrade.
Get-DbaDatabase -SqlInstance sql2016 | Out-GridView -Passthru | Invoke-DbaDatabaseUpgrade
This command was created by Stephen Bennett. You can find Stephen on his blog.