gpt4 book ai didi

SQLite 删除的数据保留在数据库二进制文件中

转载 作者:搜寻专家 更新时间:2023-10-30 20:08:13 25 4
gpt4 key购买 nike

我从 SQLite 数据库表中删除了数据。如果您在任何 SQL 管理器(例如 SQLiteStudio)中打开数据库文件,则删除的数据不存在,但如果您在文本编辑器(例如 notepad++)中打开数据库文件,则删除的数据是可见的。因此有机会恢复数据等。

例子:

在第一张图片中,SQLiteStudio 显示未看到已删除的客户“Stan”。但是在 Notepad++ 中打开的二进制文件显示客户“Stan”。

有人知道如何让已删除的数据从 SQLite 二进制文件中消失吗?

SQLiteStudio showing that deleted customer "Stan" is not seen

Binary file open in Notepad++ shows customer "Stan"

最佳答案

要防止这种情况,请执行 PRAGMA secure_delete = ON :

When secure_delete is on, SQLite overwrites deleted content with zeros. The default setting for secure_delete is determined by the SQLITE_SECURE_DELETE compile-time option and is normally off. The off setting for secure_delete improves performance by reducing the amount of disk I/O. Applications that wish to avoid leaving forensic traces after content is deleted or updated should enable the secure_delete pragma prior to performing the delete or update, or else run VACUUM after the delete or update.

关于SQLite 删除的数据保留在数据库二进制文件中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42544858/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com