您的位置:首页 > 数据库

SQL Server 2005/2008 日志文件丢失后恢复数据库的办法(ldf lost/corrupt, how to restore/recover DB without LDF file)

2011-11-10 10:16 1326 查看
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
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: