HiveBrain v1.2.0
Get Started
← Back to all entries
patternsqlMinor

What is .mdf_MSSQL_DBCC15 file

Submitted by: @import:stackexchange-dba··
0
Viewed 0 times
filemdf_mssql_dbcc15what

Problem

We use MSSQL 2016 database, I recently see a file call DatabaseName.mdf_MSSQL_DBCC15 in the same location where my database .mdf file located. It has identical file size as my .mdf database file.

Do you know what is this file and what caused it to be created?
I googled around and the term snapshot comes up here and there but I can't confirm 100%.

Solution

This would be a file created by using a DBCC.

Summarizing the pertinent information in the link that Shekar Kola provided:


The behavior of DBCC CHECKDB commands beginning with SQL Server 2014



  • DBCC CHECKDB creates an internal snapshot database.



  • The internal snapshot database is created by using physical database files.





  • Consider a database that has the three files E:\Data\my_DB.mdf, E:\Data\my_DB.ndf, and E:\Data\my_DB.ldf.



  • Consider that the internal snapshot database is created with database ID 10.



  • The internal snapshot database will be created by using the files E:\Data\my_DB.mdf_MSSQL_DBCC10 and E:\Data\my_DB.ndf_MSSQL_DBCC10.



  • Notice that new files are created in the same folder with the naming convention


_MSSQL_DBCC.


  • The new files are marked as sparse at the file system level.





  • The "Size on Disk" used by the new files will increase based on how much data is updated in the source database during the DBCC


CHECKDB command.

  • The "Size" of the new files will be the same file as the .mdf or .ndf file.




  • The new files are deleted at the end of DBCC CHECKDB processing.





  • These additional files that are created by DBCC CHECKDB have the "Delete on Close" attributes set.



  • If the operating system encounters an unexpected shutdown while the DBCC CHECKDB command is in progress, then these files will not be


cleaned up. They will accumulate space, and potentially will prevent
future DBCC CHECKDB executions from completing correctly. In that
case, you can delete these new files after you confirm that there is
no DBCC CHECKDB command currently being executed.


  • The new files are visible by using ordinary file utilities such as Windows Explorer.

Context

StackExchange Database Administrators Q#252329, answer score: 9

Revisions (0)

No revisions yet.