Today made a very annoying thing, accidentally put a 40 more g of the database log files deleted, and before the deletion I made a log in, dead or alive can not attach to the server has been prompted multiple logs cannot be automatically created, wasted a night of my time, and then constantly Google, Finally in a foreigner's blog found a few statements, directly, thank him on the way to record.
Use [master]go--Method 1:i with this methodexec sp_attach_single_file_db @dbname = ' TestDb ', @physname =n ' C:\Program files\ Microsoft SQL Server\mssql10. Mssqlserver\mssql\data\testdb.mdf ' go--Method 2:create DATABASE TestDb on (FILENAME = N ' C:\Program Files\Microsoft SQL Server\mssql10. Mssqlserver\mssql\data\testdb.mdf ') for Attach_rebuild_loggo
Statement 1 is to attach the file to the database, and if something like this happens to me. Therefore, the execution of statement 2 can be re-established log, tube several log files.
-- Method 3: CREATE DATABASE on = N'C:\Program Files\Microsoft SQL Server\mssql10. Mssqlserver\mssql\data\testdb.mdf') for ATTACHGO
Not to add this, basically all the solution, thank God, or play!
SQL Server attaches a database file without a log file to the servers