简体   繁体   English

是否可以通过SQL查询从日志文件中跟踪数据库的记录?

[英]Can I trace database's records by SQL query from log file?

I need to trace changes on a record in database. 我需要跟踪数据库中记录的更改。 I have some triggers on different tables that calls one stored procedure and this sp updates records in certain table (table1). 我在不同的表上有一些触发器,这些触发器调用一个存储过程,并且此sp更新了某些表(table1)中的记录。

I will trace records in table1 to find when and from where data are changed. 我将跟踪table1中的记录,以查找何时以及从何处更改数据。

Actually I use sybase 12.5 and I would know how to read LOG file by SQL query in sybase or sql server. 实际上我使用的是sybase 12.5,我会知道如何通过sybase或sql server中的SQL查询读取LOG文件。

tanx :) 坦克斯:)

I don't think we can read transaction log using sql query unless there is some tools like Fog Light 我认为除非有Fog Light之类的工具,否则我们无法使用sql查询读取事务日志

As far as I know we can use DBCC command 据我所知,我们可以使用DBCC命令

DBCC LOG([,{0|1|2|3|4}]) DBCC LOG([,{0 | 1 | 2 | 3 | 4}])

0 - Basic Log Information (default) 0-基本日志信息(默认)

1 - Lengthy Info 1-详细信息

2 - Very Length Info 2-非常长的信息

3 - Detailed 3-详细

4 - Full 4-满

Also if this is gonna be permanent scenario, I would create a history table to audit update and delete changes. 同样,如果这将是永久的情况,我将创建一个历史表来审核更新和删除更改。 Hope I helped, sorry if I don't answer your question. 希望我能帮助您,如果我不回答您的问题,对不起。

我认为跟踪变更的唯一方法几乎就是编写触发器。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 我可以通过文件路径/使用自身来收缩SQL数据库日志文件吗? - Can I shrink a SQL database log file via file path / by using it's self? 检查SQL跟踪日志 - Check SQL trace log SQL Server 2k5-不包含日志文件的数据库备份 - SQL Server 2k5 - Backup Of Database Without Log File(s) 如何使用PHP在数组中显示SQl服务器数据库中的记录 - how can i display the records from the SQl server database in an array using PHP 如何将XML文件(在这种情况下为业务流程事件日志)导入和查询到SQL Server Express中? - How can I import and query an XML file (in this case, a business process event log) into SQL Server Express? 如何使用单个查询将数据集中的多个记录插入SQL Server 2005? - How can I use single query to insert multiple records from Dataset into SQL Server 2005? 从哪里可以获取SQL SERVER数据库文件? - From where I can get the SQL SERVER database file? 重命名SQL Server 2016群集后,数据库邮件中仍然有旧名称的痕迹 - After renaming SQL Server 2016 cluster there's still a trace of old name from Database Mail 我如何使用php从sql查询中创建csv文件 - How i can create a csv file from a sql query with php 如何在SQL Server中跟踪日志文件大小的演变? - How to trace log file size evolution in SQL Server?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM