Recreate All Spatial Indexes at once?

07-20-2018 11:22 AM
New Contributor III

I just upgraded by Enterprise Geodatabases from SQL Server 2005 to SQL Server 2014 and now I am getting the "Failed to compress the database.  Underlying DBMS error [dbo.DEFAULT]" error message.  From looking at other people's questions, it looks like I need to recreate the spatial indexes on all my feature classes.  My question is:

Is there a tool or script that will recreate all of the feature classes in my geodatabase at once?  So I don't have to do it one at a time?

0 Kudos
3 Replies
MVP Emeritus

Conceptually you can use the RebuildIndexes_management() in a loop.  Something like this: (untested!)

import arcpy
arcpy.env.workspace = r'X:\use\path\of\connection\file

fcList = arcpy.ListFeatureClasses()
for fc in fcList:
That should just about do it....
MVP Regular Contributor

Rebuild Indexes—Help | ArcGIS Desktop 

The tool can be used directly. Just select the SDE Connection file..

New Contributor III

Thank you for the help Asrujit!


0 Kudos