• Oracle 删除某个用户下的所有对象,执行需谨慎


    Oracle 删除某个用户下的所有对象,执行需谨慎

    在PL/sql中,点"新建"->"命令窗口"->粘贴后直接执行

    --删除某个用户下的对象
    set heading off;
    set feedback off;
    spool d:/dropobj.sql;
    prompt --Drop constraint
    select 'alter table '||table_name||' drop constraint '||constraint_name||' ;' from user_constraints where constraint_type='R';
    prompt --Drop tables
    select 'drop table '||table_name ||';' from user_tables;

    prompt --Drop view
    select 'drop view ' ||view_name||';' from user_views;

    prompt --Drop sequence
    select 'drop sequence ' ||sequence_name||';' from user_sequences;

    prompt --Drop function
    select 'drop function ' ||object_name||';' from user_objects where object_type='FUNCTION';

    prompt --Drop procedure
    select 'drop procedure '||object_name||';' from user_objects where object_type='PROCEDURE';

    prompt --Drop package
    prompt --Drop package body
    select 'drop package '|| object_name||';' from user_objects where object_type='PACKAGE';

    prompt --Drop database link
    select 'drop database link '|| object_name||';' from user_objects where object_type='DATABASE LINK';

    spool off;
    set heading on;
    set feedback on;

    @@d:/dropobj.sql;
    host del d:/dropobj.sql;

  • 相关阅读:
    Bzoj4627 [BeiJing2016]回转寿司
    Bzoj1901 Zju2112 Dynamic Rankings
    COGS728. [网络流24题] 最小路径覆盖问题
    Bzoj4568 [Scoi2016]幸运数字
    Bzoj2728 [HNOI2012]与非
    HDU4609 3-idiots
    Bzoj2194 快速傅立叶之二
    Bzoj2179 FFT快速傅立叶
    模拟52 题解
    模拟51 题解
  • 原文地址:https://www.cnblogs.com/li-sx/p/9328428.html
Copyright © 2020-2023  润新知