Recover & Rebuild a database without a SQL Server Transaction Log File (.LDF).

preview_player
Показать описание
How to Attach a database with a corrupted or deleted SQL Server Transaction Log File (.LDF)?

If you want to attach a SQL Server database that does not have the transaction log file and when you try to attach the data file (.mdf), you get the following error :

"An exception occurred while executing a Transact-SQL statement or batch.
(Microsoft.SqlServer.ConnectionInfo)

→ Could not open new database 'MyDB'. CREATE DATABASE is aborted.
File activation failure. The physical file name "C:\xxx\MyDB.ldf" may be incorrect.

The log cannot be rebuilt because there were open transactions/users when the database was shutdown, no checkpoint occurred to the database, or the database was read-only. This error could occur if the transaction log file was manually deleted or lost due to a hardware or environment failure. (Microsoft SQL Server, Error: 1813)"

We can use an undocumented ATTACH_FORCE_REBUILD_LOG Command that forces the CREATE DATABASE .. FOR ATTACH statement to recover the database and creates a new log file.

Here is the command:
FOR ATTACH_FORCE_REBUILD_LOG

Рекомендации по теме
Комментарии
Автор

This video is a day saver.. a lifesaver.. Thank you for saving my day dearie. Subscribed.

SiddharthSinghFiery
Автор

আলহামদুলিল্লাহ আপনার ভিডিও দেখে অনেক উপকৃত হচ্ছি,
এভাবেই এগিয়ে যান বহুদূর।

alaminsarkar
Автор

Thank You Brother, it saved me. Thanks a lot. I just subscribed your channel. Thank you man !!!

prashantadhikari
Автор

Thank you very much . i was strugling for many days

chandpasha
Автор

Thanks so much... subscription in order

robertombuya
Автор

doesn't work the told me te recreate file

fatimaed-dahhani
Автор

You made my day. Just return gift Like and Subscribed your channel. Thank you

pcmvenkatesh
welcome to shbcf.ru