2

In Informix, I can do a select from the systables table, and can investigate its version column to see what numeric version a given table has. This column is incremented with every DDL statement that affects the given table. This means I have the ability to see whether a table's structure has changed since the last time I connected.

Is there a similar way to do this in Oracle?

4

3 回答 3

3

您可以使用跟踪表更改的 DDL 触发器来执行此操作(甚至更多)。这里有一篇带示例的有趣文章。

于 2010-01-26T16:20:18.940 回答
3

并不真地。Oracle DBA/ALL/USER_OBJECTS 视图有一个 LAST_DDL_TIME 列,但它受结构更改以外的操作的影响。

于 2010-01-26T16:08:55.267 回答
2

如果你真的想这样做,你必须使用 Oracle 的审计功能来审计更改。它可能很简单:

AUDIT ALTER TABLE WHENEVER SUCCESSFUL on [schema I care about];

这至少会捕捉到成功的变化,忽略掉和创造。不幸的是,通过挖掘审计跟踪来展开表的历史结构堆栈作为练习留给 Oracle 中的读者,或授权变更管理包。

您还可以通过编写在 DDL 语句上调用的系统事件触发器来滚动您自己的审计。如果你真的想看看发生了什么变化,你最终不得不编写自己的 SQL 解析器。

于 2010-01-26T19:16:12.560 回答