日期:2014-05-16  浏览次数:20421 次

oracle 数据库 删除用户所有对象

在命令行下执行sqlplus 用户名/密码 (不要删system)

?

?

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;