This is a VERY rough recipe that I just wrote for a coworker. It assumes you have Oracle SQLDeveloper and a shell handy.
- sql> select /*csv*/ 'DROP ',user_objects.object_type,' ',user_objects.object_name from user_objects where object_type in ('INDEX','TABLE');
- F5 (run as script)
- Select everything in your output window and copy it to /tmp/objects
- bash> cat /tmp/objects | grep -v OBJECT_NAME | sed s/\"//g | sed s/\,//g | sed s/$/\;/ > /tmp/drop.sql
- In SQLNavigator, clear your query and output screens (pencil eraser)
- File -> Open /tmp/drop.sql
- F5 (run as script) -- drops may cascade, which will cause errors later in the script; ignore
- sql> purge recyclebin;
- sql> select * from user_objects; -- should return 0 rows now.
This can easily be adapted to whatever Oracle client and text editor you have handy. In place of the seds and greps, use a basic text editor to remove the header line, remove all commas and quotes, and add a semicolon to each line.