Before Detaching Ensure Database could not be used by any client or End process and follow steps.Detach the database, delete the log file, and re-attach without db_1.ldf. We can't emphasize how dangerous this can be pls take Full Back up. Your database may not come back up sometimes, it may come up as suspect, you may have to revert to a backup (if you have one).
While attaching DB if you get this error run below query to rebuild emo_1.ldf
File activation failure. The physical file name "D:\MSSQLDATA\eMO_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 1 Could not open new database 'Test'. CREATE DATABASE is aborted.
USE [eMO] GO
CREATE DATABASE [Test] ON (FILENAME = N'D:\MSSQL\Data\eMO.mdf') FOR ATTACH_REBUILD_LOG GO
Thanks to Arun Kumar A.B System Administrator Chitradurga HO
Updates:
Follow us on WhatsApp, Telegram Channel, Twitter and Facebook for all latest updates
Post a Comment