删除一个Oracle用户的对象

发表于:2007-07-02来源:作者:点击数: 标签:
--删除某个用户下的对象 set heading off; set feedback off; spool c:\dropobj. sql ; prompt --Drop tables select @#drop table @# || table_name ||@#;@#||chr(13)||chr(10) from user_tables; prompt --Drop view select @#drop view @# || view_name||

--删除某个用户下的对象
set heading off;
set feedback off;
spool c:\dropobj.sql;
 
 prompt --Drop tables
 select @#drop table @# || table_name ||@#;@#||chr(13)||chr(10) from user_tables;
 
 prompt --Drop view
 select @#drop view @# || view_name||@#;@#||chr(13)||chr(10) from user_views;
 
 prompt --Drop sequence
 select @#drop sequence @# || sequence_name||@#;@#||chr(13)||chr(10) from user_sequences;
 
 prompt --Drop function
 select @#drop function @# || object_name||@#;@#||chr(13)||chr(10) from user_objects  where object_type=@#FUNCTION@#;

 prompt --Drop procedure
 select @#drop procedure @# || object_name||@#;@#||chr(13)||chr(10) from user_objects  where object_type=@#PROCEDURE@#;
 
 prompt --Drop package
 select @#drop package @# || object_name||@#;@#||chr(13)||chr(10) from user_objects  where object_type=@#PACKAGE@#;
 
spool off;
set heading on;
set feedback on;

@@c:\dropobj.sql;
host del c:\dropobj.sql;

原文转自:http://www.ltesting.net