Last active
September 3, 2020 00:47
-
-
Save EitanBlumin/16005cbee79572040ef6f9025ca4aab4 to your computer and use it in GitHub Desktop.
Oh no! You activated data compression but it's not supported on a replica/mirror/log-shipped secondary! Quick, undo it!
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT UndoCompressionCommand = N'ALTER INDEX ' + QUOTENAME(ix.name) + ' ON ' | |
+ QUOTENAME(SCHEMA_NAME(t.schema_id)) + '.' + QUOTENAME(t.name) | |
+ ' REBUILD WITH(DATA_COMPRESSION=NONE,ONLINE=ON,SORT_IN_TEMPDB=ON);' | |
FROM sys.partitions AS p | |
INNER JOIN sys.indexes AS ix | |
ON p.object_id = ix.object_id | |
AND p.index_id = ix.index_id | |
AND data_compression <> 0 | |
INNER JOIN sys.tables AS t | |
ON t.object_id = ix.object_id | |
WHERE t.is_ms_shipped = 0 | |
AND SCHEMA_NAME(t.schema_id) <> 'sys' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment