VACUUM 是否在数据库目录之外执行 I/O 操作?
对于通过 Perl 程序访问的 SQLite 数据库,我可以使用 INSERT 和 DELETE 命令,但不能使用 VACUUM,这会引发:
磁盘I/O错误
如果我以 root 身份运行该程序,则没有问题,因此肯定是某些权限问题。我检查了该过程中涉及的每个文件的权限,应该没问题。 VACUUM 命令是否在数据库目录之外执行 I/O 操作?
my $dbh = DBI->connect("dbi:SQLite:someDB.db", undef, undef, {RaiseError => 1, AutoCommit => 1});
my $sth = $dbh->prepare("VACUUM;");
$sth->execute;
With an SQLite database I access through a Perl program I can use the INSERT
and DELETE
commands but not VACUUM
, which raises:
disk I/O error
If I run the program as root I got no problem so it must be some permission issue. I checked permissions for every file involved in the process and it should be OK. Is the VACUUM command performing I/O operations outside the database directory?
my $dbh = DBI->connect("dbi:SQLite:someDB.db", undef, undef, {RaiseError => 1, AutoCommit => 1});
my $sth = $dbh->prepare("VACUUM;");
$sth->execute;
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您想查看 VACUUM 期间执行的 I/O 操作,您可以使用 strace。它将列出 SQLite 执行的所有系统调用,包括磁盘 IO。
If you'd like to see I/O operations which are executed during
VACUUM
you can use strace. It will list all system calls executed by SQLite, including disk IO.