为什么我们需要 LDF 文件和 MDF 文件? [英] Why do we need the LDF files along with MDF files?

查看:37
本文介绍了为什么我们需要 LDF 文件和 MDF 文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我删除与我的 .mdf 文件位于同一文件夹中的 .ldf 文件会发生什么?

What would happen if I delete the .ldf file that is in the same folder that my .mdf file?

推荐答案

LDF 文件是 事务日志 并且是所有 SQL 服务器配置所必需的.根据恢复模式,将决定如何使用它.然而,所有查询基本上都存储在这里,直到成功提交到数据库 (MDF).

The LDF file is the transaction log and is required for all SQL server configurations. Depending on the recovery mode, will determine how it is used. However all queries basically get stored here until successfully committed to the database (MDF).

当 SQL 服务器服务正在运行时,您将无法删除它.您可以分离数据库、删除日志文件 (LDF) 并重新附加数据文件 (MDF).但是它只会创建一个新的日志文件.你真的不需要删除它.如果它变得太大,您将需要对其进行管理,通常是通过备份过程进行管理.

You will not be able to delete it while SQL server service is running. You can detach the database, delete the log file (LDF) and reattach the data file (MDF). However it will just create a new log file. You really should not need to delete it. If it is getting too large you will need to manage it, typically through the backup process.

这篇关于为什么我们需要 LDF 文件和 MDF 文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆