AKAWN® LIMITED

SQL Server specialists

Starting the SQL Agent from the command line

If you’ve attempted to start the SQL Agent from the command prompt you likely would have received the following message:
 
image1
It is possible to run the Agent, you just require arguments i.e.

  • -c which allows you to use the command prompt, so always required
  • -v optional verbose mode which includes the standard SQL Server Agent error log entries
  • -iinstancename if you are using a named instance

Below shows with -c used for a default instance
 
image2
Yes there will probably be times when you’ll need to use the above to troubleshoot Agent issues.
 
CTRL + C will stop the Agent.

Pausing the SQL Server service

The Pause option on the SQL Server service account prevents new connections, but allows existing connections to continue operating.
 
image1
image2
When would you use this? Most likely during a patching or outage cycle to allow existing users to gracefully exit while preventing new connections.

Remote shutdown

The shutdown /i command has come in handy many a time and especially when you find that a server just doesn’t appear to be restarting and you’re unable to connect to it.
 
image1
So if you find yourself in that situation, give this a try and see if it help to resolve the issue.

tempdb AUTOGROW_ALL_FILES

In case you missed it, AUTOGROW_ALL_FILES was added in SQL Server 2016 and tempdb has this enabled by default.
 
Further info is mentioned here.

image1
What this means is that you should be extra careful that you don’t run out of disk space when suddenly all files need to grow.

SSMS SQL Server cmdlets

In SQL Server Management Studio 17.0 the PowerShell module was moved into the PowerShell gallery.
 
This means that you may see the following:
image1
image2
When you go to https://www.powershellgallery.com/ you currently see:
image3
I don’t know about you, but it suddenly seems that a simple tweak to SSMS has become a headache for DBAs.
 
Performing a search gives 4 results and it looks like the matteot_msft is the correct one. Having company package under a users name doesn’t sound like a good idea to me, possibly this should be a team account?
image4
So how do you download it?
 
image5
lol mind blown, KISS appears to have gone out the window :)
 
If you’ve made it this far and have an internet connection the supplied method is:
Inspect

Install

 
Lets give it a try:
 
It’s now requesting NuGet provider version ‘2.8.5.201’ or newer
image6
Once completed you’ll see the folder and files
image7_1
For the next step, I received the following message which requested for -Force to be used:
image9
image10
Once completed, the SSMS error message no longer occurs
image11