当前位置:  数据库>oracle

Oracle 闪回触发器的bug

    来源: 互联网  发布时间:2017-03-28

    本文导语: 做了一个测试。SQL> create table test1 (cola varchar2(10) );表已创建。SQL> create table test2 (colb varchar2(10));表已创建。SQL> select * from test1;未选定行SQL> select * from test2;未选定行SQL> create or replace trigger trigger1  2    before insert on test1  3    for...

做了一个测试。SQL> create table test1 (cola varchar2(10) );表已创建。SQL> create table test2 (colb varchar2(10));表已创建。SQL> select * from test1;未选定行SQL> select * from test2;未选定行SQL> create or replace trigger trigger1
  2    before insert on test1
  3    for each row
  4  declare
  5  begin
  6    insert into test2(colb) values('trigger1');
  7  end trigger1;
  8  /触发器已创建SQL> select object_name,object_id from user_objects where object_name in ('TRIGGER1','TEST1');OBJECT_NAME                                                                    
--------------------------------------------------------------------------------
 OBJECT_ID                                                                     
----------                                                                     
TEST1                                                                          
    101621                                                                     
                                                                               
TRIGGER1                                                                       
    101623                                                                     
                                                                                SQL> col object_name for a20
SQL> /OBJECT_NAME           OBJECT_ID                                                
-------------------- ----------                                                
TEST1                    101621                                                
TRIGGER1                 101623                                                 SQL> insert into test1(cola) values('no1');已创建 1 行。SQL> commit;提交完成。SQL> select * from test1;COLA                                                                           
--------------------                                                           
no1                                                                             SQL> select * from test2;COLB                                                                           
--------------------                                                           
trigger1                                                                        --到这里,表现一切正常。下面开始删除恢复。SQL> drop table test1;表已删除。SQL> select object_name,object_id from user_objects
  2  where object_name in ('TRIGGER1','TEST1');未选定行--如果没加purge选项,则两者都被删除到回收站,虽然user_object视图看不到,在底层表obj$中能看到。
SQL> flashback table TEST1 to before drop;闪回完成。SQL> select object_name,object_id from user_objects
  2  where object_name in ('TRIGGER1','TEST1');OBJECT_NAME           OBJECT_ID                                                
-------------------- ----------                                                
TEST1                    101621                                                 --闪回成功后,www.linuxidc.com在视图中,正常对象只能看到表TEST1,不能看到触发器。SQL> grant select on obj$ to ncoadev;授权成功。--切换到sys用户,授权访问指定对象。SQL> select name,obj# from sys.obj$ where obj# in (101621,101623);NAME                                                               OBJ#        
------------------------------------------------------------ ----------        
TEST1                                                            101621        
BIN$mlTKEo1FAGjgQ38AAAEAaA==$0                                   101623         --obj$表中,能看到 ID为101623的触发器还在,但名字被Oracle打了内部标记。此时,用pl/sql dev等工具是看不到那个触发器的。SQL> select * from test2;COLB                                                                           
--------------------                                                           
trigger1                                                                        SQL> insert into test1(cola) values('no2');已创建 1 行。SQL> commit;提交完成。SQL> select * from test2;COLB                                                                           
--------------------                                                           
trigger1                                                                       
trigger1     --又插入了一条记录,证明触发器还是生效的,但很难管理了。更麻烦的是后面:SQL> create or replace trigger trigger1
  2    before insert on test1
  3    for each row
  4  declare
  5  begin
  6    insert into test2(colb) values('trigger2');
  7  end trigger1;
  8  /触发器已创建--如果开发人员看不到触发器了,认为触发器丢失,又建立了一个新的同名触发器trigger1,仍然能建立。SQL> select * from test2;COLB                                                                           
--------------------                                                           
trigger1                                                                       
trigger1                                                                        SQL> insert into test1(cola) values('no3');已创建 1 行。SQL> commit;提交完成。SQL> select * from test2;COLB                                                                           
--------------------                                                           
trigger1                                                                       
trigger1                                                                       
trigger2                                                                       
trigger1     --此时,两个触发器都生效了,都作用在这个表上,会给系统带来什么影响呢??    这算不算一个bug呢?     




















































    
 
 
 
本站(WWW.)旨在分享和传播互联网科技相关的资讯和技术,将尽最大努力为读者提供更好的信息聚合和浏览方式。
本站(WWW.)站内文章除注明原创外,均为转载、整理或搜集自网络。欢迎任何形式的转载,转载请注明出处。












  • 相关文章推荐
  • Oracle bug之Thin JDBC driver
  • 给200分:oracle的jdbc有BUG??为何在servlet中记录数不能超过120条?
  • 大家来看看是不是oracle jdbc的bug?
  • Oracle 12c发布简单介绍及官方下载地址
  • 在linux下安装oracle,如何设置让oracle自动启动!也就是让oracle那个服务自动启动,不是手动的
  • oracle 11g最新版官方下载地址
  • 请问su oracle 和su - oracle有什么不同?
  • Oracle 12c发布简单介绍及官方下载地址 iis7站长之家
  • 虚拟机装Oracle R12与Oracle10g
  • Oracle数据库(Oracle Database)体系结构及基本组成介绍
  • Oracle 数据库开发工具 Oracle SQL Developer
  • 如何设置让Oracle SQL Developer显示的时间包含时分秒
  • Oracle EBS R12 支持 Oracle Database 11g
  • Oracle 10g和Oracle 11g网格技术介绍
  • SCO unix下安装oracle,但没有光盘,请大家推荐一个oracle下载站点(unix版本的)。谢谢!!!!
  • oracle中如何把表中具有相同值列的多行数据合并成一行
  • 请问大家用oracle数据库, 用import oracle.*;下的东西么? 还是用标准库?
  • Oracle 数据库(oracle Database)性能调优技术详解
  • Linux /$ORACLE_HOME $ORACLE_HOME
  • ORACLE日期相关操作
  • Linux系统下Oracle的启动与Oracle监听的启动
  • ORACLE数据库常用字段数据类型介绍
  • 请问在solaris下安装ORACLE,用root用户和用oracle用户安装有什么区别么?
  • Oracle 12c的九大最新技术特性介绍
  • 网间Oracle的连接,远程连接Oracle服务器??


  • 站内导航:


    特别声明:169IT网站部分信息来自互联网,如果侵犯您的权利,请及时告知,本站将立即删除!

    ©2012-2021,,E-mail:www_#163.com(请将#改为@)

    浙ICP备11055608号-3