1

I am running simple DBCC CHECKDB ('DBNAME') command on my machine every thing works perfect!

But when i execute same command on the live server the command executes without any error, but it creates one extra file int the same location as my mdf file. For instance, if my mdf file name is "mydatabase.mdf" then this command is creating one more file with name "mydatabase.mdf ". Additionally, I am not able to delete this file.

Whats wrong here?

2
  • How have you determined that DBCC CHECKDB is the process that has created this file? Are you able to delete it after CHECKDB has finished? Does anything show up with that name (including the trailing space) in dbname.sys.database_files (or sys.master_files for that matter)? Jun 9, 2013 at 23:44
  • after running DBCC CHECKDB this files are created where my actual mdf files are located, there is space in extension of this file like ".mdf " and i am not able to delete this file after checkdb finished only i need to stop sql and then i am able to delete this file this issue in sql 2005 not able to reproduce on 2008
    – Yogesh
    Jun 11, 2013 at 7:55

2 Answers 2

0

Checkdb normally uses the alternate file stream. I'm guessing that when the database was defined there was a space in the filename. Sql cleaned it up when creating the database but not when the Checkdb is running. You can check on this by looking at the output from sys.database_files. You might need to look at the actual data in the pages in the master database to see this. Fixing it would require that the database be detached then reattached with the correct filenames.

1
  • Hi, I checked as you said found the space in the mdf file physical name path but there is no space in actual mdf file name how to modify this entry in sys.database_files will that work because dettached db and attached it again is not working
    – Yogesh
    Jun 11, 2013 at 8:31
0

Checkdb creates a snapshot in the background. Snapshots are supported by sparse files (they look large in Windows but are typically almost empty).

Could it be that you are looking at this file?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.