Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Note

To use SQL Diagnostic Manager snap-in, you have to enable the provider and register the SQLdm SQLDM drive.

Anchor
Edit general settings
Edit general settings
Edit general settings

...

Cmdlet NameDescriptionExamples

-MMNever

Sets maintenance mode to Never. Note that SQL Diagnostic Manager will collect data according to its normal scheduled collection interval.

Set-SQLdmMonitoredInstance -Path (Escape-SQLdmName -Name ServeA\Instance1) -MMNever

-MMAlways

Sets maintenance mode to Until further notice. Schedule collection will not occur.

Set-SQLdmMonitoredInstance -Path (Escape-SQLdmName -Name ServeA\Instance1) -MMAlways

-MMRecurring

Sets maintenance mode to Recurring every week at the specified time.

Set-SQLdmMonitoredInstance -Path (Escape-SQLdmName -Name ServeA\Instance1) -MMRecurring -MModeDays Monday,Wednesday,Friday -MModeStartTime 01:35:00 -MModeDuration 01:00

-MModeDaysSpecifies the days of the week recurring maintenance mode will be effective.
-MModeStartTime Specifies the start time for recurring maintenance mode.
-MModeDurationSpecifies the length of time for recurring maintenance mode.

-MMOnce 

Sets maintenance mode to Occurring once at the specified time.

Set-SQLdmMonitoredInstance -Path (Escape-SQLdmName -Name ServeA\Instance1) -MMOnce -MModeStartDate "2013-03-25 15:00" -MModeEndDate "2013-03-25 15:30"

-MModeStartDateSpecifies the start date and time for one-time maintenance mode.
-MModeEndDateSpecifies the end date and time for one-time maintenance mode.


Panel
borderStyledashed
titleExample: Editing several properties at once within PowerShellborderStyledashed

PowerShell allows you to set up several properties in one command-line. On the PowerShell window, use Set-SQLdmMonitoredInstance followed by the corresponding cmdlets of the properties you want to edit. For example, consider the properties listed below:

  • Enable Query Monitoring
  • Capture Batches
  • No capture procedures
  • Set Query duration at 200 (ms)
  • Set Logical disk reads at 20
  • Set CPU usage at 100
  • Set Physical disk writes at 10
  • Exclude Application: MyExcludedApp
  • Exclude Databases: DB1, DB2, and DB3

You can customize these settings with the following PowerShell command-line:

Set-SQLdmMonitoredInstance -Path (Escape-SQLdmName -Name QA- Name Server\Instance) -QMEnabled -QMCaptureBatches 1 –QMCaptureProc 0 -QMQueryDuration 200
-QMLogicalDiskReads 20 -QMCpuUsage 100 -QMPhysicalDiskWrites 10 -QMExcludedApps MyExcludedApp -QMExcludedDatabases DB1,DB2,DB3

...