在用新代码替换后,我可以从包体中恢复旧的 Oracle pl/sql 源代码吗
我创建了一个 Oracle PL/SQL 包,其中包含标题和包含大量代码的主体。
后来,在使用不同的源代码(实际上我打算保存在不同的包名称下)重新运行 CREATE OR REPLACE PACKAGE BODY...
语句后,我最终意外地从该主体中删除了代码。
有什么方法可以从包中恢复旧的替换源代码吗?
I had created an Oracle PL/SQL package with a header and a body with lots of code.
Later, I ended up accidentally erasing the code from that body after reran the CREATE OR REPLACE PACKAGE BODY...
statement with different source code (which actually I intended to save under a different package name).
Is there any way I can recover my older replaced source code from the package?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您也许可以通过对 all_source 使用闪回查询来取回它。
例如,我的包主体当前处于版本 2,以标准用户身份执行此查询:
我知道我在今晚 9:30 左右更改了此设置,因此在以 SYSDBA 用户身份连接后,我运行了此查询:
可以找到有关闪回的更多信息 此处。 Tom Kyte 还演示了如何使用 all_source 闪回此处。
You might be able to get it back by using a flashback query on all_source.
e.g. my package body is currently at version 2, executing this query as a standard user:
I know I changed this around 9:30 this evening so after connecting as a SYSDBA user I ran this query:
More information on flashback can be found here. Tom Kyte also demostrates how to use flashback with all_source here.
除非您启用了 DDL 命令的日志记录/审核,或者备份了数据库,否则答案几乎肯定不是。
数据库定义(包括存储过程)应始终像源代码一样对待,并在代码存储库中维护
Unless you have logging/auditing of DDL commands enabled, or a backup of the database, then the answer is almost certainly not
Database definitions, including stored procedures, should always be treated like source code, and maintained in a code repository
闪回查询不适用于
all_source
视图,您需要在 sys.source$ 上执行闪回查询,如下所示:Flashback query doesn't work on
all_source
view, you need to execute a flashback query on sys.source$ like this: