How to analyze SQL indexes from the command line
Last modified: March 28, 2025
As index fragmentation affects query performance, it is highly important to trace SQL Server indexes in order to timely perform database maintenance.
-
Click Start, type ‘cmd’ in the Search programs and files text box, and press ENTER. The Command Prompt opens.
-
Specify the operation you want to perform and the required parameters and arguments (actions you want to run) in the Command Prompt, for example as follows:
dbforgesql.com /analyzeindex [/switch1[:value | [parameter1:value parameter2:value ..]] /switch2 ..]
- Press ENTER to run the process.
Select corresponding command line switches to perform the required operations:
Argument | Action and Usage |
---|---|
/connection |
This switch is used to specify a connection string. Command usage looks like: /connection:<connection_string> |
/database |
This switch is used to specify a database to manage indexes in. The command line looks like: /database:<value> |
/minindexsize |
This switch is used to specify the minimum index size in pages. Overrides global option. The command line looks like: /minindexsize:<value> |
/password |
This switch is used to specify a password. Overrides password specified in the connection string. The command line looks like:/password:<pw> |
/rebuildthreshold |
Specifies rebuild the fragmentation threshold in %. Overrides global option. The command line looks like: /rebuildthreshold:<value> |
/reorganizethreshold |
Specifies reorganize the fragmentation threshold in %. Overrides global option. The command line looks like:/reorganizethreshold:<value> |
/tempdbsort |
This switch is used to override the “Sort in tempdb” global option. The command line looks like:/tempdbsort:<On|Off> |
Want to find out more?
Overview
Take a quick tour to learn all about the key benefits delivered by dbForge Studio for SQL Server.
All features
Get acquainted with the rich features and capabilities of the tool in less than 5 minutes.
Request a demo
If you consider employing this tool for your business, request a demo to see it in action.