SQLite发生磁盘I / O错误 [英] disk I/O error with SQLite

查看:285
本文介绍了SQLite发生磁盘I / O错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个(很小的)动态网站,(大约)是一个使用SQLite数据库的Perl CGI脚本。包DBI是Perl中使用的抽象层。

I have a (tiny) dynamic website that is (roughly) a Perl CGI script using a SQLite database. Package DBI is the abstraction layer used in Perl.

大约一周前,我开始看到此错误消息:

About one week ago, I started to see this error message:

disk I/O error(10) at dbdimp.c line 271

由于这是运行Apache的托管站点,因此我看不到如果硬盘(几乎)已满。已禁用对命令 df的访问。...但是我使用(UNIX)Shell命令 yes> blah来测试磁盘是否仍可以创建新文件。我的数据库非常小-不到50 KB。

Since this is a hosted site running Apache, I cannot see if the hard disk is (nearly) full. Access to command "df" is disabled.... but I used the (UNIX) shell command "yes > blah" to test the disk can still create new files. My database is very tiny -- less than 50 kilobytes.

我检查了文件和目录权限:目录和所有父目录均为a + r,a + x(全部+读/可执行)。包含我的SQLite数据库文件的目录也是a + w(全部+写)。数据库文件本身具有a + w,a + r(全部+读/写)。

I checked file and directory permissions: Directory and all parents are a+r,a+x (all + read/executable). The directory containing my SQLite database file is also a+w (all + write). The database file itself has a+w,a+r (all + read/write).

我编写了一个简单的Perl程序来测试我是否可以运行失败的选择查询:运行正常。

I wrote a simple Perl program to test I can run the failing select query: It runs fine.

我在数据库上运行了查询 VACUUM。我再次尝试测试-没有任何改善。

I ran query "VACUUM" on the database. I tried my tests again -- no improvement.

我将SQLite数据库转储到原始SQL(使用SQLite shell命令 .dump)并进行了重建。我再次尝试测试-没有改善。

I dumped the SQLite database to raw SQL (using SQLite shell command ".dump") and rebuilt. I tried my tests again -- no improvement.

有什么建议吗?我很困惑...通常,上面的列表可以捕获大多数编程/设置错误。

Any suggestions? I am so confused... Normally, the above list can catch most programming/setup errors.

推荐答案

另一个原因是:


  • 数据库文件是可写的

  • 数据库日志文件(以 -journal )是不可可写的

  • Database file is writeable
  • Database journal file (ending in -journal) is not writable

当数据库文件不可写时,您将获得只读数据库错误。如果可写但日记文件不可写,则会显示 I / O错误。

When the database file isn't writable, you get a "readonly database" error. When it's writable, but the journal file is not, you get "I/O error" instead.

这篇关于SQLite发生磁盘I / O错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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