Invoke-SqlIndexDefrag
Defragments an index.
Syntax
Invoke-SqlIndexDefrag [-index] <Index> [<CommonParameters>]
Detailed Description
The Invoke-SqlIndexDefrag function defragments the specified index.
Related Commands
Parameters
Name |
Description |
Required? |
Pipeline Input |
Default Value |
index |
|
true |
true (ByValue) |
|
Input Type
None
You can pipe SMO Index objects to Invoke-SqlIndexDefrag
Return Values
None
This function does not generate any output.
Notes
Performs the equivalent of DBCC INDEXDEFRAG
Examples
EXAMPLE 1
Get-SqlDatabase "Z002\sql2k8" "pubs" | Get-SqlTable -name authors | Get-SqlIndex | Invoke-SqlIndexDefrag
This command defragments the indexes of the authors table