Skip to content

Instantly share code, notes, and snippets.

@JustinMcNamara74
Created March 16, 2015 17:56
Show Gist options
  • Save JustinMcNamara74/421b3ce3d15f4ee117f0 to your computer and use it in GitHub Desktop.
Save JustinMcNamara74/421b3ce3d15f4ee117f0 to your computer and use it in GitHub Desktop.
#MSSQL US/USVI IndexOptimize - USER_DATABASES
sqlcmd -E -S $(ESCAPE_SQUOTE(SRVR)) -d master -Q "EXECUTE [dbo].[IndexOptimize] @Databases = 'Envision, Envision_Web, Envision_US, Envision_US_Web', @UpdateStatistics = 'ALL', @LogToTable = 'Y'" -b
sqlcmd -E -S $(ESCAPE_SQUOTE(SRVR)) -d master -Q "EXECUTE [dbo].[IndexOptimize] @Databases = 'Envision, Envision_Web, Envision_US, Envision_US_Web', @FragmentationLow = 'INDEX_REORGANIZE,INDEX_REBUILD_ONLINE,INDEX_REBUILD_OFFLINE', PageCountLevel = 0, @UpdateStatistics = 'ALL', @LogToTable = 'Y'" -b
@JosiahSiegel
Copy link

edit "PageCountLevel" to "@PageCountLevel"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment