加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > Linux > 正文

linux – 如何验证SQLite db3文件是否有效/一致

发布时间:2020-12-13 18:45:45 所属栏目:Linux 来源:网络整理
导读:我有一些sqlite版本3 db3文件我从一个实时运行的生产系统(我知道坏sysadmin坏sysadmin)复制出于各种原因.是否有一些我可以运行的sqlite命令将验证是否可以从这些文件中读取所有数据(我不介意它是否需要一段时间). 我正在考虑攻击一些转储所有数据然后将其重
我有一些sqlite版本3 db3文件我从一个实时运行的生产系统(我知道坏sysadmin坏sysadmin)复制出于各种原因.是否有一些我可以运行的sqlite命令将验证是否可以从这些文件中读取所有数据(我不介意它是否需要一段时间).

我正在考虑攻击一些转储所有数据然后将其重新导入新文件的perl.我认为如果遇到损坏的数据,sqlite将抛出异常.有没有更好的办法?

我是CentOS 5.3和sqlite-3.3.6-2

解决方法

我想你想试试:
pragma integrity_check;

从documentation:

This pragma does an integrity check of the entire database. The
integrity_check pragma looks for out-of-order records,missing pages,
malformed records,missing index entries,and UNIQUE and NOT NULL
constraint errors. If the integrity_check pragma finds problems,
strings are returned (as multiple rows with a single column per row)
which describe the problems. […]

See also the 07001 command which does most of the checking of PRAGMA integrity_check but runs much faster.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读