首页 > 数据库 > Oracle > 正文

删除一个Oracle用户的对象

2024-08-29 13:48:45
字体:
来源:转载
供稿:网友

  
--删除某个用户下的对象
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;

发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表