If you lost your log file(*.ldf) with any reason, there is a simple way to recover the damaged DB, this solution is copied from Microsot Experts Exchange forum, I have done my test, it works.
1. Stop SQL Server;
2. Backup mdf to a save location;
3. Start SQL Server, the DB will be suspect;
4. Run the following SQL to recover DB
ALTER DATABASE yourdb SET EMERGENCY;
ALTER DATABASE yourdb SET SINGLE_USER;
DBCC CHECKDB (yourdb, REPAIR_ALLOW_DATA_LOSS) ;
ALTER DATABASE yourdb SET MULTI_USER;
ALTER DATABASE yourdb SET ONLINE
本文提供了一种简单的方法来恢复损坏的 SQL Server 数据库,包括停止 SQL Server、备份 MDF 到安全位置、启动 SQL Server 后设置数据库为紧急模式、运行 SQL 脚本来恢复数据库,并最终设置数据库为多用户模式。

110

被折叠的 条评论
为什么被折叠?



