向后兼容sqlite DB

时间:2015-02-09 15:49:59

标签: sqlite compatibility

在我的应用程序中,我使用了SQLite v3.8.4的合并嵌入版本。在过去,我遇到了关于page_size>的v3.7的兼容性问题。 32768.现在我想使用v3.6.20(RHEL6上的默认值)保持对数据库文件的向后兼容性,但是当我尝试在RHEL6机器上打开我的DB文件时,我看到错误:

Error: file is encrypted or is not a database

我可以将数据库转储到SQL文件,然后再次将其导入到v3.7。这似乎可以在v3.6.20上读取,但我的数据库大小为3 GB,对于我来说,每次转储等待2个小时是不可行的。

我可以在v3.8上设置哪些选项来生成兼容v3.6的数据库?

数据库转储

$ hexdump -C works-on-3.6.20.sqlite | head -n 8
00000000  53 51 4c 69 74 65 20 66  6f 72 6d 61 74 20 33 00  |SQLite format 3.|
00000010  04 00 01 01 00 40 20 20  00 00 00 01 00 2d 8c 51  |.....@  .....-.Q|
00000020  00 00 00 00 00 00 00 00  00 00 00 12 00 00 00 01  |................|
00000030  00 00 00 00 00 00 00 00  00 00 00 01 00 00 00 00  |................|
00000040  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
00000050  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 01  |................|
00000060  00 2d e2 21 05 00 00 00  02 03 f6 00 00 22 fd 07  |.-.!........."..|
00000070  03 fb 03 f6 01 8f 02 38  00 7c 01 61 81 62 07 07  |.......8.|.a.b..|
$ hexdump -C fails-on-3.6.20.sqlite | head -n 8
00000000  53 51 4c 69 74 65 20 66  6f 72 6d 61 74 20 33 00  |SQLite format 3.|
00000010  80 00 02 02 00 40 20 20  00 00 00 04 00 00 00 2b  |.....@  .......+|
00000020  00 00 00 00 00 00 00 00  00 00 00 14 00 00 00 01  |................|
00000030  00 00 00 00 00 00 00 00  00 00 00 01 00 00 00 00  |................|
00000040  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
00000050  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 04  |................|
00000060  00 2d e6 04 0d 7f fc 00  18 75 a4 00 7f 36 7f c9  |.-.......u...6..|
00000070  7e 6b 7f 0b 7d 8f 7e 38  7c 7e 7d 62 7b ab 7c 47  |~k..}.~8|~}b{.|G|

1 个答案:

答案 0 :(得分:3)

非工作数据库已启用WAL mode,这是在3.7.0版中引入的。 Disable它。