1

I have an sql file with alot of create, alterings and modifies to a database. If I need to back out at some point (up to a day maybe) after executing the sql script, is there an easy way to do that? For example, is there any tool to read an sql script and produce a 'rollback' script from it?

I am using sqlyog aswell, in case there happens to be any such features built-in (I havn't found any)

4

1 回答 1

3

不,抱歉,有很多语句无法通过查看 SQL 命令来反转。

  • DROP TABLE(掉落的桌子上有什么?)
  • UPDATE mytable SET timestamp = NOW()(之前的时间戳是多少?)
  • INSERT INTO mytable (id) VALUES (NULL)(假设 id 是自动递增的,创建了哪一行?)

好多其它的...

如果您想从一天的更改之前恢复数据库,请在开始更改之前进行备份。

您还可以使用二进制日志进行时间点恢复,将数据库恢复到自上次备份以来的任何时刻。

于 2014-06-24T14:40:30.800 回答