How Oracle removes all objects under a single user

Source: Internet
Author: User

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.