What steps are necessary to safely restart a machine hosting Microsoft SQL Server? Are there any special steps necessary to prevent data corruption when restarting a server hosting an MS SQL Server instance?

For example, I recently encountered the recommendation of stopping the SQL service manually.  My understanding is that this is handled by the Windows shutdown process.

I'm sure there are a zillion steps which individual people may recommend, like that I just mentioned, but I'd like to avoid repeating obsolete or superstitious practices.  Are there any recommendations from Microsoft, or widespread industry standards?



This question relates to the short-term procedure of rebooting a machine.  There's another question regarding the long-term procedure of ensuring that a machine is unused, before taking it down permanently.
You don't have to be fancy/worried or scared when you are restarting sql server. 

Just make sure that you dont have any long running transactions. Best is to restart sql server using console or shutdown command during a low/minimum activity period also called maintenance window to minimize impact on your business.

If you have any DR setup and you dont want to be down, then best is to failover and then restart the passive or secondary node. 

Clean Shutdown SQL Server occurs in below scenarios :


Stop sql server using Services console.
Shutting down your server
running SHUTDOWN command in SSMS


In above all situations, sql server cleanly shutsdown all its databases and then terminates the service which involves commiting or rolling back all the transactions, writing all dirty pages to disk and then writing an entry into transaction log.

Improper shutdown of sql server :


shutdown with nowait
pulling power cable from your server (if you have access).
killing sqlserver.exe from task manager
Dirve failure on which sql server binaries, exe, system databases reside or windows system drive failure .. usually C:\ drive.
overheating of the server causing it to shutdown (should rarely happen !!)


SQL Server will always try to do a clean shutdown ...unless you do something improper as stated above.

Some really good reading links on what happens behind the scenes during recovery phase : 


Understanding Logging and Recovery in SQL Server
Understanding How Restore and Recovery of Backups Work in SQL Server
Simple overview of the SQL Server Recovery Process