Exporting The Plan Cache

Grant Fritchey wrote a Powershell script to export query plans from the plan cache into a .sqlplan file:

I’ve gone minimal on the script. I’m creating a connection to the local instance, defining a command, and returning the data into a data set. From there, since the data set consists of a single column, I’m walking through them all to export out to a file:

It’s Powershell, so it’s a short snippet.

Related Posts

Breaking Changes Coming To dbatools

Chrissy LeMaire warns us about breaking changes coming to dbatools with release 1.0: Sometime in the next month, I’ll also be updating Start-DbaMigration to more closely match the parameters of Export-DbaInstance. Parameters like NoDatabases and NoLogins will be replaced by -Exclude Databases, Logins. So the functionality won’t necessarily change, but if you have scheduled tasks or scripts that perform migrations, you will need […]

Read More

Removing The Azure Module

Max Trinidad has built a function to remove older versions of the Azure module: As you probably know by now, “Azure RM” modules has been renamed to “Az” Module. Microsoft want you to start using this module moving forward. Currently, this new release is on version 0.5.0, and you’ll need to remove the any previous module(s) installed. […]

Read More

Categories

February 2017
MTWTFSS
« Jan Mar »
 12345
6789101112
13141516171819
20212223242526
2728