方法1:

    drop user XXXX cascade;

    drop tablespace XXXX INCLUDING CONTENTS;

方法2:

   写存储过程实现

DECLARE
TYPE name_list
IS TABLE OF VARCHAR2(40);
TYPE type_list
IS TABLE OF VARCHAR2(20);

Tab_name name_list:
=name_list();
Tab_type type_list:
=type_list();

sql_str
VARCHAR2(500);
BEGIN
sql_str :
= 'select uo.object_name,uo.object_type from user_objects uo where uo.object_type not in(''INDEX'',''LOB'') order by uo.object_type desc';
EXECUTE IMMEDIATE sql_str BULK COLLECT INTO tab_name,tab_type;

FOR i IN Tab_name.FIRST.. Tab_name.LAST LOOP
sql_str :
= 'DROP ' || Tab_type(i) || ' ' || Tab_name(i);
EXECUTE IMMEDIATE sql_str;
END LOOP;
END;

最方便的方法就是 drop user aaa cascade;然后重建用户。

如果你不想删除后重建用户,那就:

select 'drop ' || object_type || ' ' || object_name || ';' from user_objects;

然后执行得出的结果即可。

转自:http://ljw1911.blog.163.com/blog/static/5452897200892921727197/

posted on 2011-07-20 10:57  伤寒泪  阅读(557)  评论(0编辑  收藏  举报