删除数据库内容后,MS Access(.mdb)文件大小不会减小吗? [英] Wouldn't MS Access(.mdb) file size reduce after deleting the content of database?

查看:238
本文介绍了删除数据库内容后,MS Access(.mdb)文件大小不会减小吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用JDBC-ODBC驱动程序将数据插入MS Access数据库.空白的mdb文件为2KB.填充此数据库后,大小增加到155MB.然后我删除了数据.但是我发现mdb的大小仍然与155MB相同.我没有任何错误.但是这样正常吗?我希望文件大小会减少.如果以这种方式设计,其背后的想法是什么?谢谢

I was inserting data into a MS Access database using JDBC-ODBC driver. The blank mdb file was 2KB. After populating this database, the size grew to 155MB. Then I was deleting the data. But I found the size of mdb remains the same as 155MB. I don't get any errors. But is it normal this way? I would expect the file size reduces. If it is designed in this way, what is the idea behind it? Thanks

推荐答案

在压缩数据库之前,MS Access不会回收记录空间.

MS Access doesn't reclaim the space for records until you have compacted the database.

这是您在日常维护中应该对访问数据库执行的操作,否则最终会遇到一些非常痛苦的问题.

This is something you should do to an access database as part of your regularly maintenance otherwise you will end up with some pretty painful problems.

您可以通过MS Access UI来压缩数据库(工具->数据库实用程序->
压缩和修复数据库),您可以使用以下命令提示符:

You can compact a database either through the MS Access UI (Tools -> Database Utilities ->
Compact and Repair Database) of you can use the command prompt using:

msaccess.exe "target database.accdb" /compact 

/Compact开关必须位于目标数据库之后

N.B. the /Compact switch must be after the target database

这篇关于删除数据库内容后,MS Access(.mdb)文件大小不会减小吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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