我們在DROP某種類型時(package,function,trigger,procedure,table,view,index...)哪些會被放進RECYCLEBIN?

解决方案 »

  1.   

    看下dba_recyclebin的DDL吧,就知道支持哪些类型了:
    create or replace view sys.dba_recyclebin
    (owner, object_name, original_name, operation, type, ts_name, createtime, droptime, dropscn, partition_name, can_undrop, can_purge, related, base_object, purge_object, space)
    as
    select u.name, o.name, r.original_name,
           decode(r.operation, 0, 'DROP', 1, 'TRUNCATE', 'UNDEFINED'),
           decode(r.type#, 1, 'TABLE', 2, 'INDEX', 3, 'INDEX',
                           4, 'NESTED TABLE', 5, 'LOB', 6, 'LOB INDEX',
                           7, 'DOMAIN INDEX', 8, 'IOT TOP INDEX',
                           9, 'IOT OVERFLOW SEGMENT', 10, 'IOT MAPPING TABLE',
                           11, 'TRIGGER', 12, 'CONSTRAINT', 13, 'Table Partition',
                           14, 'Table Composite Partition', 15, 'Index Partition',
                           16, 'Index Composite Partition', 17, 'LOB Partition',
                           18, 'LOB Composite Partition',
                           'UNDEFINED'),
           t.name,
           to_char(o.ctime, 'YYYY-MM-DD:HH24:MI:SS'),
           to_char(r.droptime, 'YYYY-MM-DD:HH24:MI:SS'),
           r.dropscn, r.partition_name,
           decode(bitand(r.flags, 4), 0, 'NO', 4, 'YES', 'NO'),
           decode(bitand(r.flags, 2), 0, 'NO', 2, 'YES', 'NO'),
           r.related, r.bo, r.purgeobj, r.space
    from sys.obj$ o, sys.recyclebin$ r, sys.user$ u, sys.ts$ t
    where o.obj# = r.obj#
      and r.owner# = u.user#
      and r.ts# = t.ts#(+);
      

  2.   


    赞一个SQL> exec dbms_output.put_line(dbms_metadata.get_ddl('VIEW', 'DBA_RECYCLEBIN', '
    SYS'));
      

  3.   

    今天论坛最大的收获就是知道了这个方法,刚还去$ORACLE_HOME/rdbms/admin下去找文件呢......
    非常感谢!