sqlite整理数据库文件vacuum命令失败-“diskisfull/thedatabasediskimageismalformed”_拔剑-浆糊的传说_新浪博客

SQLite在执行VACUUM时因创建临时文件导致失败,该文件大小接近原始数据库。失败原因可能是临时目录磁盘空间不足。在Unix/Linux系统中,SQLite会按照SQLITE_TMPDIR、TMPDIR、/var/tmp等目录顺序寻找有权访问的临时目录。解决方法包括直接在SQLite中设置临时目录或通过环境变量指定。
摘要由CSDN通过智能技术生成
sqlite整理数据库文件vacuum命令失败 -“disk is full / the database disk image is malformed”
------------
root cause:

The OP noted that during a VACUUM, SQLite creates a temporary file that is approximately the same size as the original database. It does this in order to maintain the database ACID properties. SQLite uses a directory to hold the temporary files it needs while doing the VACUUM. In order to determine what directory to use, it descends a hierarchy looking for the first directory that has the proper access permissions. If it finds a directory that it doesn't have access to, it will ignore that directory and continue to descend the hierarchy looking for one that it does. I mention this in case anyone has specified an environment variable and SQLite seems to be ignoring it.

In his answer CL gives the hierarchy for Linux and in his comment mentions that the hierarchy is OS-dependent. For completeness, here is the hierarchies (in so far as I can determine them from the code).

For Unix (and 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值