“数据库或磁盘已满"在 VACUUM 上有足够的可用空间 [英] "Database or disk is full" on VACUUM with plenty of free space

查看:27
本文介绍了“数据库或磁盘已满"在 VACUUM 上有足够的可用空间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我花了一个小时在许多其他线程中搜索这个确切的问题并尝试应用解决方案,但有一半的线程说问题是磁盘已满(不是),其余的我不能理解答案,否则它们对我不起作用.

I spent an hour scouring the many other threads with this exact problem and trying to apply the solutions, but half the threads say the problem is that the disk is full (it's not), and for the rest, I couldn't understand the answers or they didn't work for me.

我的 db 文件是 8MB,我的 SSD 有 314GB 可用空间.唯一的其他卷是我的 iCloud Drive,它有 237MB 的免费空间.

My db file is 8MB and my SSD has 314GB free. The only other volume is my iCloud Drive which has 237MB free.

其他线程建议更改临时目录所在的卷,但是:

Other threads suggest changing the volume the temporary directory is on, but:

(1) 我的两个卷都有足够的可用空间.

(1) Both my volumes have plenty of free space.

(2) 我找不到如何设置临时目录的说明.尝试如下语法会出现语法错误:SQLITE_TMPDIR = '/path/'

(2) I can't find directions for how to set the temp directory. Trying syntax like the following gives a syntax error: SQLITE_TMPDIR = '/path/'

(3) 我找不到如何显示当前临时目录的说明.[更新:在终端中输入env"会显示 TMPDIR=/var/folders...,它在我的 SSD 上,我知道没有空间限制.]

(3) I can't find directions for how to show what the current temporary directory is. [UPDATE: Typing "env" into the terminal shows TMPDIR=/var/folders..., which is on my SSD, with no space restrictions that I know of.]

更新:运行 pragma_integrity_check,我得到:

UPDATE: Running pragma_integrity_check, I get:

On tree page 1206 cell 0: invalid page number 1658652726
On tree page 746 cell 0: invalid page number 205562142
On tree page 94 cell 0: invalid page number 1932643690
Page 1051 is never used
Page 1079 is never used
Page 1385 is never used

更新:尝试恢复损坏的数据库的各种建议方法都失败了.

UPDATE: Various suggested ways of trying to recover the corrupt database are failing.

(1) 恢复.在我下面的代码中,sqlite>"是命令提示符.我通过在终端中输入sqlite3"来实现它.

(1) RECOVER. In my code below, "sqlite>" is the command prompt. I get to it by entering "sqlite3" into the Terminal.

sqlite>$ sqlite3 -batch bad.db .recover > salvaged.sql;# 无法识别的令牌 $

sqlite>$ sqlite3 -batch bad.db .recover > salvaged.sql; # Unrecognized token $

sqlite>sqlite3 -batch bad.db .recover > salvaged.sql;# 错误:sqlite3"附近:语法错误

sqlite>sqlite3 -batch bad.db .recover > salvaged.sql; # Error: near "sqlite3": syntax error

sqlite>-batch bad.db .recover > salvaged.sql;# 错误:-"附近:语法错误

sqlite>-batch bad.db .recover > salvaged.sql; # Error: near "-": syntax error

(2) 真空导入

出现语法错误.发现我的 SQLite 版本太旧了.下载了新版本,查找有关如何升级的说明.找到brew update sqlite".试过了,出错了,Ruby 太旧了.更新了红宝石.再次尝试brew update sqlite",得到错误,错误:sqlite 未安装."尝试brew install sqlite",得到错误sqlite is keg-only,这意味着它没有符号链接到/usr/local,因为macOS提供了一个旧的sqlite3."

Got a syntax error. Discovered my SQLite version was too old. Downloaded new version, looked for instructions on how to upgrade. Found "brew update sqlite". Tried it, got error, Ruby too old. Updated Ruby. Tried "brew update sqlite" again, got error, "Error: sqlite not installed." Tried "brew install sqlite", got error "sqlite is keg-only, which means it was not symlinked into /usr/local, because macOS provides an older sqlite3."

(3) 真空一张桌子

我的数据库只有一张表.

My database has only one table.

推荐答案

尝试从损坏的数据库中恢复数据的最佳方法是使用 sqlite3 命令行程序的 .recover 命令,该命令会打印出SQL DDL 语句用于尽可能多的数据.

The best way to try to recover data from a corrupt database is with the sqlite3 command line program's .recover command, which prints out SQL DDL statements for as much of the data as it can salvage.

示例:

$ sqlite3 -batch bad.db .recover > salvaged.sql

有关完整详细信息,请参阅文档.

See the documentation for complete details.

您可能需要最新版本的 sqlite3 shell,或者作为 下载 二进制文件或从源代码构建,因为 .recover 在 3.30 版中得到了改进.

You'll probably want the latest version of the sqlite3 shell, either as a downloaded binary or built from source, as .recover was improved in version 3.30.

这篇关于“数据库或磁盘已满"在 VACUUM 上有足够的可用空间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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