如何恢复意外删除的记录?

发布于 2024-07-12 05:10:56 字数 56 浏览 15 评论 0原文

我不小心删除了一条记录,该记录是根文件夹,程序会自动级联删除所有内容。 如何恢复意外删除的记录?

I accidentally deleted a record which is a root folder, for which the program automatically cascade deletes everything. How do I undelete accidentally deleted records?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(8

且行且努力 2024-07-19 05:10:56

看看undark。 我已经用过了。 如果记录未被覆盖,它可以从 SQLite 数据库文件中导出行(删除或未删除)。 最新版本此处

SQLite-Deleted-Records-Parser 不会提供相同类型的输出,但可能有用。

还有一些产品,例如 SQLite Forensic ExplorerSQLite 修复Sqlite 数据库恢复SQLiteDoctor

如果您是开发人员,您可以使用 litereplica 避免再次遇到相同的问题。 它向 SQLite 添加了单主复制。

但请记住启用时间点恢复,因为当事务被复制到副本时,诸如 DROP TABLE 或 DELETE FROM 之类的意外命令也将被复制。 通过 PITR,您将能够转到之前的时间点。

或者定期使用备份 API。 尽管它在每次备份时传输整个数据库。

请记住:如果您在事务处于活动状态时复制 SQLite 文件或使用常规备份方法
副本可能已损坏

Take a look at undark. I already used it. It it can export the rows (deleted or not) from a SQLite db file if the records were not overwritten. Last version here.

The SQLite-Deleted-Records-Parser does not give the same type of output, but can be useful.

And there are also some products like the SQLite Forensic Explorer, SQLite Repair, Sqlite Database Recovery and SQLiteDoctor.

If you are a developer you can avoid having the same problem again using litereplica. It adds single-master replication to SQLite.

But remember to enable the point-in-time recovery because as the transactions are replicated to the replicas an accidental command like DROP TABLE or DELETE FROM will also be replicated. With PITR you will be able to go to a previous point-in-time.

Or use the Backup API regularly. Although it transfers the entire db on each backup.

And remember: if you copy an SQLite file or use a regular backup approach while a transaction is active
the copy can be corrupted.

放飞的风筝 2024-07-19 05:10:56

不幸的是我也不知道有什么办法。 但是,在对 SQLite 数据库文件执行 VACUUM 之前,删除的数据通常不会从技术上删除。 也许您仍然可以使用文件上的某种十六进制编辑器恢复一些数据。

Unfortunately I don't know of a way, either. However, until you do a VACUUM on the SQLite database file the deleted data is generally not technically removed. Perhaps you might be able to still recover some of the data using some sort of hex editor on the file.

岁月打碎记忆 2024-07-19 05:10:56

抱歉——不。 备份是我所知道的唯一选择。

将来,考虑永远不要发出 DELETE 查询,尤其是从用户可访问的表单中发出(只有数据库管理员才能这样做,如果有的话)——只需在表中包含一个将记录标记为非活动的字段,然后将其纳入您的数据库中。 WHERE 子句中的查询。

Sorry -- nope. Backups are the only option I know of.

In the future, consider never issuing DELETE queries, especially from user-accessible forms (let only the DB admin do it, if anyone) -- just include a field in your tables that marks a record as inactive and then factor that in to your queries in the WHERE clause.

黑寡妇 2024-07-19 05:10:56

可以通过十六进制编辑器进入并查看数据。 我能找到的唯一信息说元数据已经消失,因此记录不会回来,但数据本身可能仍然存在。 这与数据的重要性有很大关系,我怀疑它还没有重要到让你挖出一个十六进制编辑器。

It might be possible to go in and see the data via a hex-editor. The only info I could find said that metadata was gone so the records weren't going to come back, but the data itself might still be there. It has a lot to do with how important the data is, I suspect it's not important enough for you to dig out a hex editor.

夏夜暖风 2024-07-19 05:10:56

数据并不总是立即从文件中删除。 如果文件太多而您又绝望了,您可以在文件上使用 UNIX 命令 strings。 这可能会帮助您恢复人类可读数据的各种位和片段,但这将是一个艰难且不准确的过程。

The data isn't always removed from the file straightaway. If there's lots of it and you're desperate, you could use the UNIX command strings on the file. This may help you to recover various bits and pieces of human-readable data, but it'll be a hard and inaccurate process.

自此以后,行同陌路 2024-07-19 05:10:56

我能够按照从损坏的 SQLite 数据库恢复数据的说明恢复丢失的数据。

$ sqlite3 数据库名称.sqlite .recovery > Recovery.sql

输出文件包含一个名为lost_and_found 的表。 通过查看数据,我能够找出每行最初来自哪些表。 每个恢复的行有四列与 sqlite 相关,其余的是数据。 由于每个源表的列数不同,因此恢复的数据将添加 NULL。

I was able to recover the lost data following the instructions for Recovering Data From A Corrupt SQLite Database.

$ sqlite3 databasename.sqlite .recovery > recovered.sql

The output file contained a table called lost_and_found. I was able to work out which tables each of the rows were originally from by looking at the data. Each recovered row has four columns that relate to sqlite, and the remainder are the data. As each source table will have had different numbers of columns, the recovered data will have NULLs added.

一桥轻雨一伞开 2024-07-19 05:10:56

决不。 如果没有有效的备份,您将无法恢复它。

No way. Without a working backup you won't be able to restore this.

那请放手 2024-07-19 05:10:56

如果您不小心删除了根文件夹及其内容:

Check the Recycle Bin or Trash for possible recovery.
If you have a recent backup, restore the data from that backup.
Look for an "undo" feature within the application.
Contact the application's support team for assistance.
In critical cases, consider professional data recovery services.
Learn from the incident and implement safeguards to prevent future accidental deletions.

If you accidentally deleted a root folder and its contents:

Check the Recycle Bin or Trash for possible recovery.
If you have a recent backup, restore the data from that backup.
Look for an "undo" feature within the application.
Contact the application's support team for assistance.
In critical cases, consider professional data recovery services.
Learn from the incident and implement safeguards to prevent future accidental deletions.
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文