Mysql – Need to stop SQL Server when using Disk Defragmenter

defragdefragmentationMySQLsql serverwindows-server-2012

Our provider told me today that I should stop Microsoft SQL Server and other database systems like MySQL when using the Windows Disk Defragmenter.

Otherwise, the database might get corrupted.

Since I never heard about such a scenario and have some doubts, my question is:

Is it true that the Defragmenter might damage open files?

Best Answer

Defragmenting the disk while SQL Services are running is as safe as running defrag with the services stopped or on other, non database related data(*).

Windows own Defrag application, as well as pretty much all the alternatives, all use the file system defrag APIs built into the OS and file system, so there shouldn't be any great risk from defragging open files.

Your performance on that drive will take a serious hit, however, which might be worth thinking about depending on how responsive you need the database to be, as you're leaving it available, but that's about all you need to worry about.

(*) I wouldn't advise any major disk maintenance operations unless you had a backup, but of course you have a backup - it's your SQL database, right?

Related Topic