我有一些sqlite版本3 db3文件我从一个实时运行的生产系统(我知道坏sysadmin坏sysadmin)复制出于各种原因.是否有一些我可以运行的sqlite命令将验证是否可以从这些文件中读取所有数据(我不介意它是否需要一段时间).
我正在考虑攻击一些转储所有数据然后将其重新导入新文件的perl.我认为如果遇到损坏的数据,sqlite将抛出异常.有没有更好的办法?
我是CentOS 5.3和sqlite-3.3.6-2
解决方法
我想你想试试:
pragma integrity_check;
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.