The error message
Msg 5009, Level 16, State 8, Line 1
One or more files listed in the statement could not be found or could not be initialized.
is a run time error message and appears when you try to use a file in a statement but this file could not be found or initialized. There may be several root causes for this error. So to execute the statement you have to remove the root cause.
Please see comments for an example.
Wow! This has got to be the most helpful article I have ever read. You basically just repeated the description in the error message.
ReplyDeleteWould be more helpful if you could provide some sample cases instead of saying several root causes.
Tnx!
One example that i found on sql-server-performance.com is as follows
ReplyDeleteALTER DATABASE MyExample
ADD FILE
(
NAME = Test1dat2,
FILENAME = 'abc.ndf',
SIZE = 5MB,
MAXSIZE = 10MB,
FILEGROWTH = 50MB
);
Here a file named abc.ndf is being tried to added. As .ndf is a non primary database file extension. So file initialization can not take place and error code is returned. I will add here more scenarios if found.
This error may also occur if you try to drop a file from file group but file does not exist there.
ReplyDelete