Tuesday, January 22, 2013 9:16 AM
I am aware that a similar question has been asked and apparently answered but the resolution is not helping me unfortunately. When I try to run DBCC SHRINKFILE, while in the correct database context, I am getting the error
Msg 8985, Level 16, State 1, Line 3
Could not locate file 'Callisto_Log' for database 'Callisto' in sys.database_files. The file either does not exist, or was dropped.
I have checked sys.database_files for the logical name and it is correct and I have not dropped the log. I am attempting to run it as a SQL command rather than as part of a maintenance plan.
Tuesday, January 22, 2013 9:43 AM
If you copy and paste the value from the output of sys.database_files into your DBCC SHRINKFILE command how does it work? Be careful to query sys.database_files from the same query window as you have your SHRINKFILE command.
Erland Sommarskog, SQL Server MVP, firstname.lastname@example.org
- Proposed As Answer by Rui Travassos Tuesday, January 22, 2013 11:26 AM
Tuesday, January 22, 2013 1:14 PMCould you possibly check for leading spaces in the actual file name?
Tuesday, January 22, 2013 2:57 PMHi there, I have tried this without success - I even tried changing the logical name so I could be certain that it didn't have any trailing spaces or hidden characters (funnily enough, changing it worked so the name is obvisouly correct). I have just been looking and found a workaround by using the file ID from sys.database_files instead of the logical name and it worked fine... I'd still love to know why the name didn't though!