开发者

How to consolidate multiple LOG files into one .LDF file in SQL2000

Here is what sp_helpfile says about my current database (recovery model is Simple) in SQL2000:

name                          fileid filename                            size         maxsize    growth      usage

MasterScratchPad_Data     1      C:\SQLDATA\MasterScratchPad_Data.MDF    6041600 KB   Unlimited  5120000 KB  data only
MasterScratchPad_Log      2      C:\SQLDATA\MasterScratchPad_Log.LDF     2111304 KB   Unlimited  10%         log only
MasterScratchPad_X1_Log   3      E:\SQLDATA\MasterScratchPad_X1_Log.LDF  191944 KB    Unlimited  10%         log only

I'm trying to prepare this for a detach then an attach to a sq开发者_Python百科l2008 instance but I don't want to have the 2nd .LDF file (I'd like to have just one file for the log).

I have backed up the database. I have issued: BACKUP LOG MasterScratchPad WITH TRUNCATE_ONLY. I have run multiple DBCC SHRINKFILE commands on both of the LOG files.

How can I accomplish this goal of having just one .LDF? I cannot find anything on how to delete the one with fileid of 3 and/or how to consolidate multiple files into one log file.


You'll have to use the ALTER DATABASE command, with the REMOVE FILE option. However, the file "cannot be removed unless it is empty", and I'm not entirely sure how you empty a log file--if the steps you've done don't do it, maybe detach and re-attach the database?

It's been some time since I've had access to SQL 2000, so I can't help much more than that.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜