Difference between revisions of "Maintenance of MS SQL Database (vCentre)"

Jump to navigation Jump to search
m
Typo fix
(Reworked for SQL2008+)
m (Typo fix)
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
== Index Fragmentation ==
== Index Fragmentation ==
The vCenter database's indexes become fragmented over time, this is especially true of the performance statistic history tables, even if you have a [[[MS_SQL#Daily_Maintenance_Plan|Daily Maintenance Plan]] setup.
The vCenter database's indexes become fragmented over time, this is especially true of the performance statistic history tables, even if you have a [[MS_SQL#Daily_Maintenance_Plan|Daily Maintenance Plan]] setup.


=== Show Index Fragmentation ===
=== Show Index Fragmentation ===
Line 28: Line 28:
USE VCDB                                                                          // Update with your database name
USE VCDB                                                                          // Update with your database name
ALTER INDEX PK_VPX_HIST_STAT4_106 ON VPX_HIST_STAT4_106 REORGANIZE
ALTER INDEX PK_VPX_HIST_STAT4_106 ON VPX_HIST_STAT4_106 REORGANIZE
</source>
For tables without an index (shows <code>NULL</code> in IndexName in the results), rebuild the whole table, so for example
<source lang="sql">
USE VCDB                                                                          // Update with your database name
ALTER TABLE VPX_STAT_COUNTER REBUILD
</source>
</source>


Line 41: Line 47:
ORDER BY indexstats.avg_fragmentation_in_percent DESC
ORDER BY indexstats.avg_fragmentation_in_percent DESC
</source>
</source>


=== Pre SQL 2008 ===
=== Pre SQL 2008 ===

Navigation menu