Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
mwoodward
Starting Member
3 Posts |
Posted - 2007-07-27 : 10:47:02
|
| I have tried unsuccessfully to attach a database that doesnt have its corresponding log file. Is this possible in SQL 2005? Please help. |
|
|
Kristen
Test
22859 Posts |
|
|
mwoodward
Starting Member
3 Posts |
Posted - 2007-07-27 : 11:07:35
|
| Yes. None of this works, of course its probably me. I tried: EXEC sp_attach_single_file_db @dbname = 'Hospitals', @physname = 'c:\temp\hospitals.mdf'and get the following: File activation failure. The physical file name "C:\Data\Hospitals_log.ldf" may be incorrect.The log cannot be rebuilt because the database was not cleanly shut down.Msg 1813, Level 16, State 2, Line 1Could not open new database 'hospitals'. CREATE DATABASE is aborted. |
 |
|
|
Kristen
Test
22859 Posts |
Posted - 2007-07-27 : 11:31:59
|
| "The log cannot be rebuilt because the database was not cleanly shut down"MDF file can only be reliably copied when the SQL Server Service is stopped (and was stopped by a clean shutdown, not just turning the power off!!), and thus not running.Looks like this wasn't the case for this MDF file?Kristen |
 |
|
|
mwoodward
Starting Member
3 Posts |
Posted - 2007-07-27 : 11:33:52
|
| Correct. I was installing IIS at the time and got the blue screen of death. I subsequently got my computer rebuilt, but only backed up the .mdf file and not .ldf file |
 |
|
|
Kristen
Test
22859 Posts |
Posted - 2007-07-27 : 13:19:36
|
| I reckon you are out of luck then. Better to make a Backup file, rather than rely on a Detach / copy of the MDF file I'm afraid. And even then you can only be sure its OK by restoring and then performing a consistency check o the database (DBCC CHECKDB)Kristen |
 |
|
|
|
|
|