OCP 1Z0 053 109

109.Which statement describes the effect of table redefinition on the triggers attached to the table? 
A. All triggers on the table are invalidated and are automatically revalidated with the next DML execution 
on the table. 
B. All triggers on the table are invalidated and must be manually recompiled before the next DML 
execution on the table. 
C. All triggers on the table remain valid. 
D. Only triggers that are affected by the changes to the structure of the table are invalidated and 
automatically revalidated with the next DML execution on the table. 
Answer: A

感觉描述有歧义,在线重定义后,trriger关联的是重定义前的表,而不是重定义后的表。

http://docs.oracle.com/cd/E11882_01/server.112/e25494/tables.htm#ADMIN11672

Results of the Redefinition Process

The following are the end results of the redefinition process:

  • The original table is redefined with the columns, indexes, constraints, grants, triggers, and statistics of the interim table.

  • Dependent objects that were registered, either explicitly using REGISTER_DEPENDENT_OBJECT or implicitly using COPY_TABLE_DEPENDENTS, are renamed automatically so that dependent object names on the redefined table are the same as before redefinition.

    Note:

    If no registration is done or no automatic copying is done, then you must manually rename the dependent objects.
  • The referential constraints involving the interim table now involve the redefined table and are enabled.

  • Any indexes, triggers, materialized view logs, grants, and constraints defined on the original table (prior to redefinition) are transferred to the interim table and are dropped when the user drops the interim table. Any referential constraints involving the original table before the redefinition now involve the interim table and are disabled.

  • Some PL/SQL objects, views, synonyms, and other table-dependent objects may become invalidated. Only those objects that depend on elements of the table that were changed are invalidated. For example, if a PL/SQL procedure queries only columns of the redefined table that were unchanged by the redefinition, the procedure remains valid. See "Managing Object Dependencies" for more information about schema object dependencies.

SQL> DROP TABLE emp2 PURGE;
Table dropped
SQL> DROP TABLE emp3 PURGE;
Table dropped
SQL> CREATE TABLE emp2 AS SELECT * FROM scott.emp;
Table created
SQL> ALTER TABLE emp2 ADD CONSTRAINTS pk_emp2 PRIMARY KEY (empno);
Table altered
SQL> CREATE TABLE emp3 AS SELECT * FROM scott.emp WHERE 1=2;
Table created
SQL> ALTER TABLE emp3 ADD CONSTRAINTS pk_emp3 PRIMARY KEY (empno);
Table altered
SQL> ALTER TABLE emp3 MODIFY ename VARCHAR2(50);
Table altered
SQL> CREATE OR REPLACE TRIGGER trg_emp2
  2    BEFORE UPDATE ON emp2
  3    FOR EACH ROW
  4  BEGIN
  5    dbms_output.put_line(:old.empno);
  6  END;
  7  /
Trigger created
SQL> SET serveroutput ON
SQL> UPDATE emp2 SET sal = 1 WHERE ROWNUM <=1;
7369
1 row updated
SQL> DESC emp2;
Name     Type         Nullable Default Comments 
-------- ------------ -------- ------- -------- 
EMPNO    NUMBER(4)                              
ENAME    VARCHAR2(10) Y                         
JOB      VARCHAR2(9)  Y                         
MGR      NUMBER(4)    Y                         
HIREDATE DATE         Y                         
SAL      NUMBER(7,2)  Y                         
COMM     NUMBER(7,2)  Y                         
DEPTNO   NUMBER(2)    Y                         
SQL> BEGIN
  2  DBMS_REDEFINITION.START_REDEF_TABLE(USER,'emp2','emp3');
  3  dbms_redefinition.finish_redef_table(user, 'emp2', 'emp3');
  4  END;
  5  /
PL/SQL procedure successfully completed
SQL> DESC emp2;
Name     Type         Nullable Default Comments 
-------- ------------ -------- ------- -------- 
EMPNO    NUMBER(4)                              
ENAME    VARCHAR2(50) Y                         
JOB      VARCHAR2(9)  Y                         
MGR      NUMBER(4)    Y                         
HIREDATE DATE         Y                         
SAL      NUMBER(7,2)  Y                         
COMM     NUMBER(7,2)  Y                         
DEPTNO   NUMBER(2)    Y                         

SQL> UPDATE emp2 SET sal = 1 WHERE ROWNUM <=1;
1 row updated

SQL> UPDATE emp3 SET sal = 1 WHERE ROWNUM <=1;
7369
1 row updated


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值