Running SQL Nexus using Command Line Parameters


SQL Nexus is a tool that helps you identify the root cause of SQL Server performance issues. It loads and analyzes performance data collected by SQLDiag and PSSDiag. It can dramatically reduce the amount of time you spend manually analyzing data. One of the least commonly known facts is that the SQL Nexus tool also allows you to run it’s reports using command line arguments or even import diagnostic data automatically. The command line help reference is shown below:

/Sserver

Specifies a SQL Server name to connect to

/D”database”

Database to connect to

/E

Log in to SQL using Windows/integrated security

/Uuser

Specifies a SQL (non-Windows) login name

/Ppassword

Specifies the password for a SQL (non-Windows) login

“/Cconnstring”

Specifies the SqlClient ConnectionString to use (can be used instead of /S /E).

“/Ipath”

Import SQL diagnostic data from this path

“/Rreport”

Specifies a report file name to run.

“/Opath”

Specifies an export path for reports executed via /R

/X

Exit after importing (/I) or exporting (/O) the specified report

(/R)

 

/Vparam=value

Specify the value of a form parameter

 

Automating Report Execution

The first scenario that I want to outline is the need to automate a report execution especially when you need to execute the reports repeatedly after activities like performance testing or during some other iterative activity which requires analysis of various sets of diagnostic data.

This can be achieved using the command line parameters shown below:

sqlnexus.exe /S”.” /X /D”sqlnexus” /R”<full or relative path>\Summary.rdl” /O”<path where the log file and report should be exported>”

As you can see from the screenshot below, you can see that I have a standard report i.e. “Bottleneck Analysis_C.xls” that was exported and a non-standard report which I created Summary.xls in the same folder. This also gives additional opportunity to create your own performance reports and schedule them using the SQL Nexus executable.

Report Output

After you have the exported reports, you could also write additional automation to email the reports as required.

Automating Data Import

SQL Nexus also allows you to perform data imports automatically using the command line parameters. The command line shown below performs data import from the specified folder into a SQL Server database called sqlnexustest on the default SQL server instance installed on the machine.

sqlnexus.exe /S”.” /X /D”sqlnexustest” /I”C:\temp\output”

If the database does not exist on the SQL Server instance, then it will be created. The settings for SQL Nexus utility will be used during the data import which were saved when the last time the UI was used. So if you have disabled the profiler trace import from the UI and saved your settings, then the command line execution will not import the profiler traces.

Advertisements

One thought on “Running SQL Nexus using Command Line Parameters

It is always good to hear from you! :)

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s