Read the log file (*.LDF) in SQL Server 2008

烈酒焚心 提交于 2019-11-27 04:35:17

问题


I'm searching for a way to read the SQL Server 2008 log file, not to show the information, but to read the meaning of the symbols and the structure of the LOG table. I'm using DBCC LOG('my_table', 3).


回答1:


See my answer in this Stack Overflow post: How can I view SQL Server 2005 Transaction log file

Or

Use this command:

Select * from ::fn_dblog(null,null)

And for more information, see How Do You Decode A Simple Entry in the Transaction Log.




回答2:


First of all, in order to be able to read any meaningful data your database needs to be in full recovery mode. Otherwise you probably won't find much there. There are two ways to do this. Using undocumented SQL functions and using third-party tools.

SQL Functions:

DBCC LOG and fn_dblog - more details here and here

Third-party tools:

Toad for SQL Server (actually does a lot more than reading logs) and ApexSQL Log (focuses only on reading transaction logs).




回答3:


From your comments, if you want to see the queries users issue:

Start a trace or use extended events to capture the sql text. See How to: Create a Trace (SQL Server Profiler).



来源:https://stackoverflow.com/questions/9767054/read-the-log-file-ldf-in-sql-server-2008

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!