SQL Server,将 .BKP 文件还原到 MDF 文件,但不是 LDF(没有空间)
我遇到的问题是,我没有足够的空间来容纳我们完成的 LiteSpeed 备份中的 MDF 和 LDF 文件。
我想出了以下存储过程:
exec master.dbo.xp_restore_database
@database = 'OSiteDB',
@filename = 'L:\OSiteDB_2009_01_07_Wed_LiteSpeed_Full.BKP',
@with = 'move "O1_SITEDB" to "S:\OSiteDB_Data.mdf"',
@with = 'move "O1_SITEDB_Log" to "Some dev null location??"
有没有办法可以将 LDF 位置指定为某个空位置? 我不想要 LDF,或者,有没有办法告诉它根本不获取 ldf?
I'm in an issue where I don't have enough space to accomodate my MDF and LDF files from a LiteSpeed backup we had done.
I've come up with the following sproc:
exec master.dbo.xp_restore_database
@database = 'OSiteDB',
@filename = 'L:\OSiteDB_2009_01_07_Wed_LiteSpeed_Full.BKP',
@with = 'move "O1_SITEDB" to "S:\OSiteDB_Data.mdf"',
@with = 'move "O1_SITEDB_Log" to "Some dev null location??"
Is there a way I can specify the LDF location to some null location? I don't want the LDF, alternatively, is there a way I can tell it not to fetch the ldf at all?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您需要恢复 LDF 和 MDF。 日志是数据库不可或缺的一部分:没有它,它就不是 RDBMS 意义上的“数据库”。
作为紧急情况,您需要插入外部驱动器或恢复到 NTFS 压缩文件夹。 然后,您可以收缩数据库文件。 然而,这只是一个快速修复方法,让您能够正确地进行操作。
You need to restore the LDF as well as the MDF. The log is an integral part of the database: it's not a "database" in the RDBMS sense without it.
As an emergency, you need to plug in an external drive or restore to an NTFS compressed folder. Then, you can shrink the database files. However, this is only a quick fix and getw you going so you can do it properly.
您是否看过“WITH NORECOVERY”选项?
特别是,我相信您可以使用 WWITH NOCEOVERY 恢复数据库,然后使用 RECOVERY 恢复 LOG (没有日志文件)。
http://msdn.microsoft.com/en-us/library/ms191253。 ASPX
Have you looked at the WITH NORECOVERY options?
In particular, I believe you can restore the database WWITH NOCEOVERY and then the LOG WITH RECOVERY (with no log file).
http://msdn.microsoft.com/en-us/library/ms191253.aspx
我认为您无法避免恢复 LDF 文件。 但是,正如您所提到的,您也许可以将其恢复到临时位置。
来自 这里:
更改LDF文件的目标并看看会发生什么。
I don't think you can avoid restoring the LDF file. But, as you mentioned, you might be able to restore it into a temporary location.
From here:
Change the destination of the LDF file and see what happens.