Tuesday, March 27, 2012

Attach database without log file

How can I attach a database file if my log file is not available. I only have the database file because the log file was deleted. When I try attaching the database file, I get the error that it can not find the log file.

What is strange is that if I delete the log file for another database, I can still attach the database file and it creates a new log file for me.

I am using SQL Server 2000.

Thanks

AlexanderThere is a system stored proc for doing this called Sp_attach_single_file_db.
Though this will only work if the database had previously been detached cleanly. i.e. if it was detached and then the log file was lost you should be ok. If you lost the log file before detaching, your best bet is to restore a backup.|||Ronba,

Thanks fro your reply, I later discovered the same thing that you said. I was trying to attach the single file, but the database was not previously detached cleanly.

Alexander

No comments:

Post a Comment