What necessary steps to safely restart a machine hosting Microsoft SQL Server?

2.8K    Asked by Logan Harris in SQL Server , Asked on Aug 26, 2021

Are there any essential steps necessary to prevent data corruption when restarting a server hosting an MS SQL Server instance? What is the best way to restart sql server?

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?


Answered by Yash raj

The best is to restart sql server using a console or shutdown command during a low/minimum activity period also called maintenance window to minimize the impact on your business.


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.



Your Answer

Interviews

Parent Categories