Script for Dropping all objects for an schema.



How to Drop all objects for a user.


select * from (select 'ALTER TABLE '||owner||'.'||table_name||' drop CONSTRAINT '||constraint_name||';' from dba_constraints
where owner IN ('SAPSR3') and constraint_type in ('R','P')
and constraint_name not like 'BIN$%'
order by constraint_type desc)
union all
select 'drop '||object_type||' '||owner||'.'||object_name||';' from dba_objects where owner in
('SAPSR3')
and object_type in ('VIEW','TABLE','SEQUENCE','PROCEDURE','FUNCTION','PACKAGE', 'SYNONYM', 'MATERIALIZED VIEW')
and object_name not like 'BIN$%';

 

Comments