This article was previously published under Q271223
This article has been archived. It is offered "as is" and will no longer be updated.
The following scenario produces an error:
A database is set up with more than one log file (.ldf).
That database is detached successfully from the server through the use of sp_detach_db.
The log files for that database are deleted, moved, or renamed.
The sp_attach_single_file_db command is run, specifying the primary data file.
This is the error message returned in SQL Server 7.0:
Server:Msg 5105, Level 16, State 10, Line 1 Device activation error. The physical file name 'FullPathToLogFile\LogFileName.ldf' may be incorrect. Server: Msg 945, Level 14, State 1, Line 1 Database 'twologtest' cannot be opened because some of the files could not be activated. Server: Msg 1813, Level 16, State 1, Line 1 Could not open new database 'twologtest'. CREATE DATABASE is aborted.
This is the error message returned in SQL Server 2000:
Server: Msg 1813, Level 16, State 2, Line 1 Could not open new database 'twologtest'. CREATE DATABASE is aborted. Device activation error. The physical file name 'FullPathToFirstLogFile\FirstLogFileName.ldf' may be incorrect. Device activation error. The physical file name 'FullPathToSecondLogFile\SecondLogFileName.ldf' may be incorrect.
This behavior is by design.
Use sp_attach_db rather than sp_attach_single_file_db to attach a database with multiple log files. You cannot attach a database that has been created with multiple log files without also attaching all the log files.
The sp_attach_single_file_db command is not intended to be used with databases that have multiple log files.