[Script Of July 10] How to check if SQL Server database files are marked as sparse files

image image
July
10
image

Script Download:   
The script is available for download from https://gallery.technet.microsoft.com/How-to-check-if-SQL-Server-af01ebb9 (SQL) and https://gallery.technet.microsoft.com/How-to-check-if-SQL-Server-23bace0c (powershell).  You can also use Microsoft Script Browser for Windows PowerShell ISE to download the sample with one button click from within your scripting environment.

Only files associated with a database snapshot should be marked as sparse files. If a regular database is marked as a sparse file, you might encounter unexpected performance degradation and errors during normal activities. This script will find all the database files marked as sparse files in an instance.

Some people asked how to check if SQL Server database files marked as sparse files. This script will help demo how to find out all the database files marked as sparse files.

You can find more All-In-One Script Framework script samples at https://aka.ms/onescriptingallery