Skip to content

Add WAIT_AT_LOW_PRIORITY support to Invoke-DbaDbShrink #10193

@ReeceGoding

Description

@ReeceGoding

Summarize Functionality

Invoke-DbaDbShrink calls DBCC SHRINKFILE. As of SQL Server 2022, WAIT_AT_LOW_PRIORITY is supported by DBCC SHRINKFILE. We should give Invoke-DbaDbShrink this functionality. For the same reason that we provide StatementTimeout and the option to Invoke-DbaDbShrink in steps, WAIT_AT_LOW_PRIORITY is quite handy.

Is there a command that is similiar or close to what you are looking for?

No

Technical Details

This will be tricky for two reasons:

  • We currently use the SMO shrink method, called as $file.Shrink($shrinkSizeKB.Megabyte, $ShrinkMethod). We would need to re-write to use T-SQL.
  • Nothing else in dbatools supports WAIT_AT_LOW_PRIORITY, so we would have to figure out how calling it from PowerShell should look. It effectively has three parameters: if it should be on or off, the max duration in minutes, and what to abort.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions