I have below Select query which will generate delete statements to delete all objects in schema.
select 'DROP '||OBJECT_TYPE||' '||OWNER||'.'||OBJECT_NAME
|| case when OBJECT_TYPE = 'TABLE'
then ' CASCADE CONSTRAINTS PURGE' else '' end
||';'
from all_objects
where OWNER = 'RATOR_MONITORING';
I want to create batch file and suppose that instead of generating delete statements separetly I can create may be cursor or something and save it in batch file and run the batch file to delete all contents in schema. How to do it?
You can find many script in the Internet. Neither of them work on 100%. There can we various gotchas. Like scheduler chains or materialized view groups.
This is the one I use (it is also inspired by one I found in the Internet)