数据库磁盘映像格式不正确或文件加密或不是一个数据库 [英] database disk image is malformed or file is encrypted or is not a database

查看:1318
本文介绍了数据库磁盘映像格式不正确或文件加密或不是一个数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要将数据库从手机,它是没有根来垫复制所以我也喜欢采用别人的方法:复制/data/data/../databases/test.db到/ SD卡在第一和。然后,我在我的电脑或在我朋友的电脑使用adb外壳sqlite3的命令,也有一些问题:1)有时,它可以成功地打开2)有时,它显示文件加密或不是一个数据库3)有时,它显示数据库磁盘映像格式有误

I need to copy the database from phones which is without "Root" to pads. So I also adopt the method like others: copy /data/data/../databases/test.db to /sdcard at first. And then I use adb shell sqlite3 command in my PC or in my friends' PC, there are some question: 1) sometimes, it can open successfully 2)sometimes,it show "file is encrypted or is not a database" 3) sometimes, it show "database disk image is malformed"

注:sqlite3的版本是不同的。

Note: the sqlite3 version are different.

的文件加密或不是一个数据库的根本原因是版本的问题,是不是?

the root cause of "file is encrypted or is not a database" is the version problem, is it right?

什么是根本原因数据库磁盘映像格式有误?我搜索了一些资料关于它的互联网上,但我仍无法修复它。

what is the root cause "database disk image is malformed"? I search some information about it on internet, but I can't still fix it.

谢谢!

编辑1:测试手机是HTC HD
编辑2:我这个线程:<一href=\"http://groups.google.com/group/android-developers/browse_thread/thread/2b8a8fa9b955eecd/0615c6111d93ea02?lnk=raot\" rel=\"nofollow\">http://groups.google.com/group/android-developers/browse_thread/thread/2b8a8fa9b955eecd/0615c6111d93ea02?lnk=raot还有消息:我会非常强烈建议你反对这样做。有
不保证二进制数据库文件将横跨兼容
Android版本以及所有自定义光盘要少得多。

Edit 1:The test phone is HTC HD Edit 2: I this thread: http://groups.google.com/group/android-developers/browse_thread/thread/2b8a8fa9b955eecd/0615c6111d93ea02?lnk=raot There are message: I would very strongly advise you against doing this. There is no guarantee that the binary database file will be compatible across Android version and much less across all custom ROMs.

这似乎根本原因数据库磁盘映像格式有误是sqlite3的版本。但如何数据库备份到SD卡是最好的方法?是否有另一种方式?

It seems the root cause of "database disk image is malformed" is the Sqlite3 version. But how to backup the database to sdcard is best way? Are there another ways?

编辑3:<一href=\"http://stackoverflow.com/questions/10342535/issue-file-is-encrypted-or-is-not-a-database-opening-a-sqlite-file-in-some-and\">link 1
<一href=\"http://stackoverflow.com/questions/6444170/sqlite3-wal-databaseerror-file-is-encrypted-or-is-not-a-database\">link 2
链接3

推荐答案

我的直觉是,认为该数据库文件成为传输过程中莫名其妙地损坏。从我的经验,如果数据库文件损坏,这对于完成。

My instinct is to think that the database file becomes corrupted somehow during the transfer. From my experience, if a database file is corrupted, it's done for.

您应该验证数据库文件没有损坏源,并与在目的上都编译

You should verify that the database file is not corrupted on both the source and the destination with the following pragma:

PRAGMA integrity_check; 

如果一切都很好,结果集为单列纪录值确定

If all is good, the result set is a single column record with the value ok.

只是要清楚,对于任何下列三种情形的,你的数据库是pretty太多损坏,无法使用:

Just to be clear, for any of the following three scenarios, your database is pretty much corrupted and unusable:


  • sqlite3的甚至不会打开数据库文件,并返回一些错误

  • sqlite3的将打开数据库文件,但是当你运行一些语句返回一些错误

  • sqlite3的将打开数据库文件,但杂INTEGRITY_CHECK 不返回确定

  • sqlite3 won't even open the database file and return some error
  • sqlite3 will open the database file, but return some error when you run some statements
  • sqlite3 will open the database file, but pragma integrity_check doesn't return ok

由于您的源和目标似乎是使用SQLite 3.xyz,文件格式的不应的是一个问题(也有少数例外,但我怀疑他们是源你的疼痛)。

Since both your source and destination seem to be using sqlite 3.x.y.z, the file format shouldn't be an issue (there are a few exceptions, but I doubt any of them are the source of your pain).

您可能想要做的另一件事是,以验证该文件是在源和目标是相同的。你可以比较他们的哈希值(MD5,SHA1,或其他)。

Another thing you probably want to do is to verify that the files are identical at the source and destination. You can compare their hashes (md5, sha1, or others).

这篇关于数据库磁盘映像格式不正确或文件加密或不是一个数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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