November 10, 2005 at 9:05 am
Does anyone know how to reattach a db without a log file? Somehow a user has deleted his log file but I do have the two data files.
Thanks
Jules
Jules Bui
IT Operations DBA
Backup and Restore Administrator
November 10, 2005 at 9:17 am
EXEC sp_attach_db @dbname= 'yourdatabasename',
@filename1 = N'MSSQL\Data\yourdatabasename_data.mdf'
Kindest Regards,
Sameer Raval [Sql Server DBA]
Geico Insurance
RavalSameer@hotmail.com
November 10, 2005 at 10:03 am
use sp_attach_single_file, look it up in bol
November 10, 2005 at 10:45 am
it is still asking for a log file. I think attaching a db w/o a log does not work, I have read past articles on it.
Jules Bui
IT Operations DBA
Backup and Restore Administrator
November 11, 2005 at 4:35 am
If you attach through EM just ignore the log file and it will create a new log file in the same location as the mdf.
I did have an issue once where this wouldn't work ( ever ) but I can't remember the cause or solution, sorry.
Make sure there is no ldf with the same name from another database on the server
[font="Comic Sans MS"]The GrumpyOldDBA[/font]
www.grumpyolddba.co.uk
http://sqlblogcasts.com/blogs/grumpyolddba/
November 11, 2005 at 8:31 am
If there were uncommitted transactions or there was a rollback in progress, you might not be able to reattach without the log file.
I detach databases, change the name of the log file and reattach in order to create a smaller log file.
HTH,
Michelle
November 11, 2005 at 11:13 am
You can do it by using DBCC REBUILD_LOG
Viewing 7 posts - 1 through 6 (of 6 total)
You must be logged in to reply to this topic. Login to reply