Problem – I have found VLF size of my database abc is very huge and when i have tried to shrink the file i have received below error –
Could not locate file ‘xy_abc_Log’ for database ‘abc’ in sys.database_files.
Resolution –
While my investigation I have found logical fine name under sys.master_files is different as compare to sys.database_files.
select name from sys.master_files where database_id = db_id(‘abc’)
xy_abc_Data
xy_abc_STAGE_Log
select name from sys.database_files
xy_abc_Data
xy_abc_Log
You will find logical name is different hence you need to update logical file name in sys.master_files table.
use [abc]
go
ALTER DATABASE [abc] MODIFY FILE (NAME=N’xy_abc_Log’, NEWNAME=N’xy_abc_Log’)
GO