Recreate All Spatial Indexes at once?

250
3
07-20-2018 11:22 AM
Highlighted
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?

Reply
0 Kudos
3 Replies
Highlighted
MVP Esteemed Contributor

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:
    arcpy.RebuildIndexes_management(fc)
Highlighted
MVP Regular Contributor

Rebuild Indexes—Help | ArcGIS Desktop 

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

Highlighted
New Contributor III

Thank you for the help Asrujit!

Matt

Reply
0 Kudos