原来在这篇里讲的,需要经过复杂的设置,如果从服务器上还原到本地来还原,就有可能出现还原不了的问题。
http://www.jb51.cc/article/p-nrymqkun-uc.html
CREATE DATABASE xm
ON (FILENAME = 'D:\data\2005\xm.mdf')
FOR ATTACH_REBUILD_LOG ;
如果是用此方法还原,数据库需要是干净的关闭状态,异常的情况基本上是不干净的关闭,也就是此方法基本也无效,但配合一工具,
http://download.csdn.net/download/misterliwei/3407041
此方法也是可实现。
原理:
http://www.jb51.cc/article/p-fzdwouwq-sp.html
其实MSsql 2005还提供了另一还原attach_force_rebuild_log
CREATE DATABASE xm
ON (FILENAME = 'D:\data\2005\xm.mdf')
FOR attach_force_rebuild_log;
详见:
http://www.sqlservercentral.com/Forums/Topic306817-146-1.aspx
里面提到:
DBCC REBUILD_LOG doesnot work with sql 2005.
DBCC REBUILD_LOG 方法在2005中不能运行,
Its replaced with Alter database for attach_rebuild_log and for attach_force_rebuild_log. Second one is not documented. |