oracle oracle中特定表的历史记录

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/20770769/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 02:08:37  来源:igfitidea点击:

history of a specific table in oracle

sqloracleoracle-sqldeveloper

提问by Freakyuser

Can we find the history of values, updates, deletes or inserts of a specific table?

我们能否找到特定表的值、更新、删除或插入的历史记录?

I don't have the access to create a stored procedure. Can you please provide me a query in the answer or some other way to find the history?

我无权创建stored procedure. 您能否在答案中向我提供查询或以其他方式查找历史记录?

回答by Mark J. Bobak

Two possibilities come to mind.

想到了两种可能性。

1.) If you have auditing enabled, you are all set. But, I'm guessing if that was the case, you wouldn't be asking the question. If you think this request will come up again, you should investigate setting up auditing for future requests.

1.) 如果您启用了审核,则一切就绪。但是,我猜如果是这样的话,你就不会问这个问题了。如果您认为此请求会再次出现,则应调查为将来的请求设置审核。

2.) If auditing isn't set up, there's LogMiner, which allows you to examine the contents of the archived and online redo logs. This is probably your only solution, if you need the details of inserts, updates, deletes to a specific table.

2.) 如果未设置审计,则有 LogMiner,它允许您检查存档和在线重做日志的内容。如果您需要对特定表进行插入、更新、删除的详细信息,这可能是您唯一的解决方案。

Hope that helps.

希望有帮助。

回答by Maheswaran Ravisankar

It is possible if FLASHBACKhas been enabled over the schema or table. Most critical tables could have that enabled. Please check with DBA on this. If you have DBA access, then select the table name in SQL Developer, press Shift+F4and move to Flashback tab to find details.

如果FLASHBACK已在架构或表上启用,则有可能。大多数关键表都可以启用。请与 DBA 确认这一点。如果您有 DBA 访问权限,则在 中选择表名SQL Developer,按Shift+F4并移至 Flashback 选项卡以查找详细信息。

if enabled, you can use the below query ( just a sample)

如果启用,您可以使用以下查询(只是一个示例)

SELECT * FROM employee AS OF TIMESTAMP 
   TO_TIMESTAMP('2003-04-04 09:30:00', 'YYYY-MM-DD HH:MI:SS')
   WHERE name = 'JOHN';

if not enabled, you may have to write TRIGGERSfor evry DMLover that table. I agree the history of data before TRIGGERSare gone for ever, unless DBAis able to do some magic with redo logs..!

如果未启用,您可能必须在该表上写下TRIGGERS每个内容DML。我同意之前的数据历史TRIGGERS永远消失了,除非DBA能够用重做日志做一些魔术..!