DBCC SHRINKFILE, as the name implies, shrinks files not databases. Of course, from a file system standpoint, a database is nothing more than a set of files, so that makes sense. Shrink all the files in a database and you’ve shrunk the database.Click to see full answer. Keeping this in view, does DBCC Shrinkfile lock database?It sure can. The lock risks of shrinking data files in SQL Server aren’t very well documented. But sometimes you may need to run a one-time operation if you’ve been able to clear out or archive a lot of data.Also Know, why you should not shrink your data files? Here’s why: data file shrink can cause *massive* index fragmentation (of the out-of-order pages kind, not the wasted-space kind) and it is very expensive (in terms of I/O, locking, transaction log generation). After the shrink, the logical fragmentation (out-of-order pages) is almost 100%. Simply so, what happens when you shrink a database? When you shrink a database, you are asking SQL Server to remove the unused space from your database’s files. The process SQL uses can be ugly and result in Index fragmentation. If you have a growing database, this means that database will grow again.Is it safe to shrink SQL database?1 Answer. This is true that shrinking a database is not recommended. You can understand it like this when you shrink the database then it leads to increase in fragmentation now to reduce the fragmentation you try to rebuilt the index which will eventually lead to increase in your database size.