如何在 SQL Server 2008 中查看事务日志

发布于 2024-10-08 10:59:13 字数 1539 浏览 4 评论 0原文

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

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

发布评论

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

评论(3

夢归不見 2024-10-15 10:59:14

您无法轻松读取事务日志文件,因为该文件没有正确记录。基本上有两种方法可以做到这一点。使用未记录或半记录的数据库函数或使用第三方工具。

注意:只有当您的数据库处于完全恢复模式时,这才有意义。

SQL 函数:

DBCC LOG 和 fn_dblog - 更多详细信息此处此处

第三方工具:

Toad for SQL ServerApexSQL 日志

您还可以查看讨论此问题的其他几个主题:

You can't read the transaction log file easily because that's not properly documented. There are basically two ways to do this. Using undocumented or semi-documented database functions or using third-party tools.

Note: This only makes sense if your database is in full recovery mode.

SQL Functions:

DBCC LOG and fn_dblog - more details here and here.

Third-party tools:

Toad for SQL Server and ApexSQL Log.

You can also check out several other topics where this was discussed:

野稚 2024-10-15 10:59:14

我不小心在错误的环境中删除了一大堆数据,这篇文章是我发现的第一个。

因为我同时恐慌并寻找解决方案,所以我选择了我看到的第一件事 - ApexSQL Logs,2000 美元,这是可以接受的成本。

但是,我后来发现 Toad for Sql Server可以从事务日志生成撤消脚本,而且只需 655 美元。

最后,找到了一个更便宜的选项 SysToolsGroup Log Analyzer,只需 300 美元。

I accidentally deleted a whole bunch of data in the wrong environment and this post was one of the first ones I found.

Because I was simultaneously panicking and searching for a solution, I went for the first thing I saw - ApexSQL Logs, which was $2000 which was an acceptable cost.

However, I've since found out that Toad for Sql Server can generate undo scripts from transaction logs and it is only $655.

Lastly, found an even cheaper option SysToolsGroup Log Analyzer and it is only $300.

夜还是长夜 2024-10-15 10:59:13

您可以使用未记录的

DBCC LOG(databasename, typeofoutput)

where typeofoutput:

0: Return only the minimum of information for each operation -- the operation, its context and the transaction ID. (Default)
1: As 0, but also retrieve any flags and the log record length.
2: As 1, but also retrieve the object name, index name, page ID and slot ID.
3: Full informational dump of each operation.
4: As 3 but includes a hex dump of the current transaction log row.

例如,DBCC LOG(database, 1)

您也可以尝试 fn_dblog。

要使用事务日志回滚事务,我将查看 StackOverflow 帖子 使用事务日志回滚事务

You could use the undocumented

DBCC LOG(databasename, typeofoutput)

where typeofoutput:

0: Return only the minimum of information for each operation -- the operation, its context and the transaction ID. (Default)
1: As 0, but also retrieve any flags and the log record length.
2: As 1, but also retrieve the object name, index name, page ID and slot ID.
3: Full informational dump of each operation.
4: As 3 but includes a hex dump of the current transaction log row.

For example, DBCC LOG(database, 1)

You could also try fn_dblog.

For rolling back a transaction using the transaction log I would take a look at Stack Overflow post Rollback transaction using transaction log.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文