Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Quick cleanup of a SQL 2016 instance for DB Owners, Orphaned users and enabling Query Store
$Instance = ""
Set-DbaDatabaseOwner -SqlServer $Instance
Remove-SqlOrphanUser -SqlServer $Instance
Set-DbaQueryStoreConfig -SqlServer $Instance `
-State ReadWrite `
-FlushInterval 600 `
-CollectionInterval 10 `
-MaxSize 100 `
-CaptureMode All `
-CleanupMode Auto `
-StaleQueryThreshold 100 `
-AllDatabases
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.