Attach the database, you will be reminded to find the log file when attached
According to the above phenomenon there are two sentences can be solved: one: Use MASTER; EXEC sp_detach_db @dbname = ' TestDB '; EXEC sp_attach_single_file_db @dbname = ' TestDB ', @physname = ' D:\Program Files\Microsoft SQL Server\mssql10_50.s Ql2008\mssql\data\testdb.mdf ' notation two: CREATE DATABASE TestDB on (FILENAME = ' D:\Program Files\Microsoft SQL Server\m Ssql10_50.sql2008\mssql\data\testdb.mdf '--Enter the directory where the. mdf file is located) for Attach_rebuild_log to execute any of the syntax in the Query window, you may be prompted with the following prompt: File activation failed. The physical file name ' D:\Program Files\Microsoft SQL Server\mssql10_50.sql2008\mssql\data\testdb.ldf ' may be incorrect. The new log file ' D:\Program Files\Microsoft SQL Server\mssql10_50.sql2008\mssql\data\testdb_log. LDF ' has been created. My understanding is that the original log file name may not match the system naming rules, but at this point the database can be seen with the database file attached.
SQL Server attaches a database (. mdf) file method that does not have a log file