Create or replace procedure Drop_all ascursor Cur_obj is SelectUO. object_name, UO. Object_type fromuser_objects UOwhereUo. object_name notinch('Drop_all') and UO. Object_type notinch('LOB'); /*cursor cur_tablespace is select UT. Tablespace_name from User_tablespaces ut where UT. Tablespace_name not in (' SYSTEM ', ' sysaux ', ' UNDOTBS1 ', ' TEMP ', ' USERS ');*/v_obj_name user_objects. object_name%type; V_obj_type user_objects. Object_type%type;/*v_tablespaces_name user_tablespaces. Tablespace_name%type;*/sql_str1 varchar2 ( -);/*sql_str2 varchar2 (+);*/begin open Cur_obj; Loop fetch cur_obj into V_obj_name, V_obj_type; Exit when Cur_obj%NotFound; SQL_STR1:='Drop'|| V_obj_type | |' '||V_obj_name; Execute immediate sql_str1; End Loop; Close cur_obj;/*Open cur_tablespace; Loop fetch cur_tablespace into v_tablespaces_name; Exit when Cur_tablespace%notfound; SQL_STR2: = ' drop tablespace ' | | V_tablespaces_name | | ' including contents '; Execute immediate sql_str2; End Loop; Close Cur_tablespace;*/End Drop_all; This stored procedure can erase almost all objects under the user. You can delete the tablespace by releasing the contents of the note. This process cannot be rolled back and should never be used in a production environment or in a useful environment. I do not take any responsibility for the results of this process. This script is suitable for use when the user is not very convenient to delete. A simpler approach would be to delete the user and rebuild the user.
How Oracle removes all objects under a single user