Is it all_objects or user_objects..? I think all_objects is not appropriate here.
Given script can be executed by any user having necessary priviledges. You can also make use of USER_OBJECTS view, but in that case, you must connect to the user whos objects needs to be dropped and then execute the statement.
And of course the above script will have to be run N times (where N is some hared-to-define integer > 1) in order to wipe out all objects from a schema. Provided of course that there are some referential integrity constraints among the tables....
Jurij Modic ASCII a stupid question, get a stupid ANSI
24 hours in a day .... 24 beer in a case .... coincidence?
"The power of instruction is seldom of much efficacy except in those happy dispositions where it is almost superfluous" - Gibbon, quoted by R.P.Feynman
And on top of that, there are some objects you can't drop if you are not connected as their owner, not even if you are connected as SYS....
So the only proper way is to drop user with cascade - no other bullet proof method, unless you can connect as the owner of the schema you want to wipe out.
Jurij Modic ASCII a stupid question, get a stupid ANSI
24 hours in a day .... 24 beer in a case .... coincidence?
I would run the drop query on dba_objects but before that I would make two meta query to disable constraints. 1st foreign keys than rest of the constraints.
Bookmarks