2015-02-09 118 views
1

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

Error: file is encrypted or is not a database 

我可以将数据库转储到一个SQL文件,然后再导入到3.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 |[email protected] .....-.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 |[email protected] .......+| 
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

'hexdump -C databasefile | head -n 8'为工作和非工作文件? – 2015-02-09 15:58:24

+0

@CL。编辑问题 – vz0 2015-02-09 16:02:27

回答

3

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

+0

就是这样。我已通过手动发布PRAGMA journal_mode = DELETE更新了数据库;现在可以工作了,谢谢! – vz0 2015-02-09 16:12:15