tigertoolbox icon indicating copy to clipboard operation
tigertoolbox copied to clipboard

Why doesn´t you permit to execute the rebuild on online mode on SQL Azure?

Open japineda3 opened this issue 4 years ago • 2 comments

Hi, Why doesn´t you include the version of SQL Azure in this check?

### /* Refer to http://docs.microsoft.com/sql/t-sql/functions/serverproperty-transact-sql */ IF (SELECT SERVERPROPERTY('EditionID')) IN (1804890536, 1872460670, 610778273, -2117995310) SET @editionCheck = 1 -- supports enterprise only features: online rebuilds, partitioned indexes and MaxDOP ELSE SET @editionCheck = 0; -- does not support enterprise only features: online rebuilds, partitioned indexes and MaxDOP

 The version of SQL Azure is 1674378470. You can execute online rebuild on SQL Azure. 

 Then, when you execute the adaptativeindexdefrag which @onlineRebuild = 1 , as in the code you checks is:

_Indexes will be defragmented' + CASE WHEN @onlineRebuild = 0 OR @editionCheck = 0 THEN ' OFFLINE;' ELSE ' ONLINE;' END + ' /* Set online rebuild options; requires Enterprise Edition; not compatible with partition operations, Columnstore indexes in table and XML or Spatial indexes. Up to SQL Server 2008R2, not compatible with clustered indexes with LOB columns in table or non-clustered indexes with LOBs in INCLUDED columns. In SQL Server 2012, not compatible with clustered indexes with LOB columns in table.*/ IF @sqlmajorver <= 11 AND @onlineRebuild = 1 AND @editionCheck = 1 AND @ixtype IN (1,2) AND @containsLOB = 0 AND (@dealMaxPartition IS NULL OR (@dealMaxPartition IS NOT NULL AND @partitionCount = 1)) SET @rebuildcommand = @rebuildcommand + N'ONLINE = ON, ';

japineda3 avatar Apr 12 '21 11:04 japineda3

Had the same problem. Added my SELECT SERVERPROPERTY('EditionID') ID to the IN-List

cpotemski avatar Sep 03 '21 06:09 cpotemski

I also have a similar problem with REBUILD/REORGANIZE operations on a partition level. They are supported on Standard Edition of Sql Server, but @editionCheck forbids its usage. I think these feature checks should be more granular, binary separation Enterprise/Non-Enterprise is not working well enough.

gbtb avatar Feb 08 '23 01:02 gbtb