Earlier I asked a very interesting question related to Powershell and T-SQL command. Read my earlier blog post SQL SERVER – Start Services or Stop Services with PowerShell – Question to Readers?.
Here is the question which I asked – Stop-Services ‘mysqlserver’ in powershell is equivalent to Shutdown or Shutdown With Nowait in T-SQL?
Well, I asked this question because I really had no idea about the answer. However, my personal friend and Powershell Guru Laerte Junior immediately took the challenge to find answers to this question. He comes up with a fantastic explanation of the answer with proper findings and experiments.
Laerte did multiple test to figure out the answer to the question. He used traceflags 2592 and 3605 and to log the status of the checkpoint to the SQL Server log files. I strongly encouraged everyone to read his blog post as it will absolutely teach you something new. Here is the link to his blog post: Stop-Service is like the T-SQL Shutdown or Shutdown with Nowait ?
After doing multiple test Laerte proves that STOP-SERVICE -force is like to use SHUTDOWN, performing the checkpoint in each database. Indeed a correct answer.
I did not know this before and I learned – Thanks Laerte. Did you know about this one? If you have learned this today as well, please leave a comment. The first step of learning anything is to accept we do the topic. The next step is to learn it.
Reference: Pinal Dave (http://blog.sqlauthority.com)