删除一个Oracle用户的对象

类别:数据库 点击:0 评论:0 推荐:

--删除某个用户下的对象
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://com.8s8s.com/it/it20699.htm