Drop all from schema owner

-- To drop all user objects under a schemad
set heading off;
set feedback off;
set echo on;
set serveroutput off;
set termout off;
spool drop_all_objects.sql
select CASE object_type 
	WHEN 'TABLE' then 'DROP ' || object_type || ' ' || object_name || ' CASCADE CONSTRAINTS PURGE;'
	WHEN 'VIEW' then 'DROP ' || object_type || ' ' || object_name || ' CASCADE CONSTRAINTS;'
	else 'DROP ' || object_type || ' ' || object_name || ';'
	END as "--text"
from user_objects
where object_name not like '%BIN$%' and object_type not in ('PACKAGE BODY', 'TABLE PARTITION', 'INDEX', 'INDEX PARTITION')
order by object_type, object_name; 
spool off;
set echo on feedback on
spool drop_all.log
@drop_all_objects.sql
spool off
/
purge recyclebin
/
CREATE OR REPLACE TYPE BULK_LOAD_OBJ   AS OBJECT
 ( generic_key varchar2(200)  
  )
/
CREATE OR REPLACE TYPE bulk_load_ntt AS TABLE OF bulk_load_obj
/
create or replace TYPE  "RECORD_KEY_VARRAY"   AS VARRAY(1000) OF VARCHAR2(100);
/
quit
 

猜你喜欢

转载自buralin.iteye.com/blog/1759628