我可以检测Oracle中表的DDL的版本吗?

发布于 2024-08-19 09:13:57 字数 138 浏览 9 评论 0原文

在 Informix 中,我可以从 systables 表中进行选择,并且可以调查其版本列以查看给定表的数字版本。此列随着影响给定表的每个 DDL 语句而递增。这意味着我能够查看自上次连接以来表的结构是否已更改。

Oracle中有类似的方法吗?

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?

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

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

发布评论

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

评论(3

〆凄凉。 2024-08-26 09:13:57

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

Not really. The Oracle DBA/ALL/USER_OBJECTS view has a LAST_DDL_TIME column, but it is affected by operations other than structure changes.

送君千里 2024-08-26 09:13:57

您可以使用跟踪表更改的 DDL 触发器来做到这一点(以及更多)。 此处有一篇有趣的文章和示例。

You can do that (and more) with a DDL trigger that keeps track of changes to tables. There's an interesting article with example here.

伤痕我心 2024-08-26 09:13:57

如果您确实想这样做,则必须使用 Oracle 的审核功能来审核更改。它可以很简单:

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

这至少会捕获成功的更改,忽略删除和创建。不幸的是,通过挖掘审计跟踪来展开表的历史结构堆栈留给了 Oracle 中的读者或许可变更管理包的练习。

您还可以通过编写在 DDL 语句上调用的系统事件触发器来进行自己的审计。如果您确实想了解发生了什么变化,那么您最终必须编写自己的 SQL 解析器。

If you really want to do so, you'd have to use Oracle's auditing functions to audit the changes. It could be as simple as:

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

That would at least capture the successfuly changes, ignoring drops and creates. Unfortunately, unwinding the stack of the table's historical strucuture by mining the audit trail is left as an exercise to the reader in Oracle, or to licensing the Change Management Pack.

You could also roll your own auditing by writing system-event triggers which are invoked on DDL statements. You'd end up having to write your own SQL parser if you really wantedto see what was changing.

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