--在終端依次輸入以下命令
sqlplus
--輸入需要刪除的使用者名稱
--輸入密碼
SET HEAD OFF;
set feedback off;
SPOOL c:\drop_tables.sql;
--chr(13) ASCII中=換行 chr(10) ASCII中=斷行符號
--禁用所有約束
select 'alter table '||table_name||' disable constraint '||constraint_name||';' from user_constraints where constraint_type='R';
--delete tables
select 'drop table ' || table_name ||';'||chr(13)||chr(10) from user_tables;
--delete views
select 'drop view ' || view_name||';'||chr(13)||chr(10) from user_views;
--delete seqs
select 'drop sequence ' || sequence_name||';'||chr(13)||chr(10) from user_sequences;
--delete functions
select 'drop function ' || object_name||';'||chr(13)||chr(10) from user_objects where object_type='FUNCTION';
--delete procedure
select 'drop procedure ' || object_name||';'||chr(13)||chr(10) from user_objects where object_type='PROCEDURE';
--delete package
select 'drop package ' || object_name||';'||chr(13)||chr(10) from user_objects where object_type='PACKAGE';
--delete trigger
SELECT 'drop TRIGGER "' ||SYS_CONTEXT('USERENV','CURRENT_USER')||'"."'|| TRIGGER_NAME ||'";' ||CHR(13) ||CHR(10)FROM USER_TRIGGERS;
spool off;
@c:\drop_tables.sql;
--清空Oracle的資源回收筒
purge recyclebin;