Oracle SQL - DML 语句是否会导致对象无效?

发布于 2024-11-16 23:54:55 字数 228 浏览 3 评论 0原文

我正在为我的公司编写一些批处理脚本,我在一些历史批处理脚本中看到了以下步骤:

  1. 有一个 Delete from table where.... 语句
  2. Oracle 导入工具是用于导入单个记录
  3. 重新编译架构

我不认为您需要在删除然后导入(插入)后重新编译架构。我错了吗? DDL 语句(例如删除和插入)是否有可能导致对象无效?

I'm working on writing some batch scripts for my company, and I see in some historical batch scripts with the following steps:

  1. There is one Delete from table where.... statement
  2. The Oracle import tool is used to import a single record
  3. Recompile the schema

I don't believe you would need to recompile the schema after a delete and then import (insert). Am I wrong? Is it ever possible that DDL statements such as delete and insert could case an object to be invalid?

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

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

发布评论

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

评论(2

智商已欠费 2024-11-23 23:54:55

我假设您在导入时指定了 TABLES 参数?如果是这样,则您处于 TABLE 模式,这意味着不会导入过程对象、视图等。 imp 命令确实对进程可能导入的任何 PL/SQL 程序单元执行 COMPILE。可以想象,这可能会使其他依赖对象无效,从而导致批处理脚本中的重新编译步骤无效。当然,很多时候这种事情会被放入基于用作模板的另一个脚本的脚本中,并且很可能是不必要的。

I assume you're specifying TABLES parameter on the import? If so, you're in TABLE mode, which means that procedural objects, views, etc. are not imported. The imp command does perform a COMPILE on any PL/SQL program units that may be imported by the process. This could conceivably invalidate other dependent objects, hence the recompile step in the batch script. Of course, many times this sort of thing is put into a script based on another script that was used as a template, and could easily be unnecessary.

年少掌心 2024-11-23 23:54:55

想不出为什么会发生这种情况,除非你的 DML 弄乱了数据字典,这听起来是一个非常糟糕的主意......

另一种想法是,重新编译可能会产生执行所需 COMMIT 的副作用?

Can't think of a reason why this would happen, unless your DML is messing with the data-dictionary, which sounds like a very bad idea...

As another thought, maybe the recompilation has the side-effect of doing a needed COMMIT?

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