暂无图片
暂无图片
暂无图片
暂无图片
暂无图片

Oracle 影响all_object表的更改

askTom 2018-05-02
833

问题描述

嗨,汤姆,


哪些操作可以更改表all_objects上的日期?例如,如果我今天在2018年5月5日在17:00:00调试一个包,则last_ddl_time和时间戳将随着调试完成的时间而更新?

问候,
约翰·朱玛

专家解答

DDL的任何东西。即使DDL是隐式执行的 (即,当您尝试运行它时,我们编译了一个过程),例如

SQL> create table t ( x int );

Table created.

SQL>
SQL> create or replace
  2  procedure p is
  3  begin
  4    insert into t values (1);
  5  end;
  6  /

Procedure created.

SQL>
SQL> select object_name, status, last_ddl_time
  2  from user_Objects
  3  where object_name in ('T','P');

OBJECT_NAME                              STATUS  LAST_DDL_TIME
---------------------------------------- ------- -------------------
P                                        VALID   03/05/2018 12:03:02
T                                        VALID   03/05/2018 12:03:02

2 rows selected.

SQL> drop table t purge;

Table dropped.

SQL>
SQL> select object_name, status, last_ddl_time
  2  from user_Objects
  3  where object_name in ('T','P');

OBJECT_NAME                              STATUS  LAST_DDL_TIME
---------------------------------------- ------- -------------------
P                                        INVALID 03/05/2018 12:03:02

1 row selected.

SQL> alter procedure p compile;

Warning: Procedure altered with compilation errors.

SQL>
SQL> select object_name, status, last_ddl_time
  2  from user_Objects
  3  where object_name in ('T','P');

OBJECT_NAME                              STATUS  LAST_DDL_TIME
---------------------------------------- ------- -------------------
P                                        INVALID 03/05/2018 12:03:27

1 row selected.

SQL> alter procedure p compile debug;

Warning: Procedure altered with compilation errors.

SQL> sho err
Errors for PROCEDURE P:

LINE/COL ERROR
-------- ----------------------------------------------------------------
3/3      PL/SQL: SQL Statement ignored
3/15     PL/SQL: ORA-00942: table or view does not exist
SQL> select object_name, status, last_ddl_time
  2  from user_Objects
  3  where object_name in ('T','P');

OBJECT_NAME                              STATUS  LAST_DDL_TIME
---------------------------------------- ------- -------------------
P                                        INVALID 03/05/2018 12:03:44

1 row selected.

SQL> create table t ( x int );

Table created.

SQL>
SQL> exec p

PL/SQL procedure successfully completed.

SQL>
SQL> select object_name, status, last_ddl_time
  2  from user_Objects
  3  where object_name in ('T','P');

OBJECT_NAME                              STATUS  LAST_DDL_TIME
---------------------------------------- ------- -------------------
P                                        VALID   03/05/2018 12:04:20
T                                        VALID   03/05/2018 12:04:20

2 rows selected.

SQL>
SQL> alter procedure p compile debug;

Procedure altered.

SQL>
SQL> select object_name, status, last_ddl_time
  2  from user_Objects
  3  where object_name in ('T','P');

OBJECT_NAME                              STATUS  LAST_DDL_TIME
---------------------------------------- ------- -------------------
P                                        VALID   03/05/2018 12:04:30
T                                        VALID   03/05/2018 12:04:20

2 rows selected.

SQL>



「喜欢这篇文章,您的关注和赞赏是给作者最好的鼓励」
关注作者
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

评论