Multiple methods for deleting all objects under a user in Oracle

Source: Internet
Author: User

The methods for deleting all objects under an Oracle user may not be available to everyone. The following describes two common methods for deleting all objects under an Oracle user, we hope this will help you learn how to delete Oracle users.

Method 1:

Drop user XXXX cascade;

Drop tablespace xxxx including contents;

Method 2:

Write Stored Procedure Implementation

DECLARE
TYPE name_list is table of VARCHAR2 (40 );
TYPE type_list is table of VARCHAR2 (20 );

Tab_name name_list: = name_list ();
Tab_type type_list: = type_list ();

SQL _str VARCHAR2 (500 );
BEGIN
SQL _str: = select uo. object_name, uo. object_type from user_objects uo where uo. object_type not in (INDEX, LOB) order by uo. object_type desc;
Execute immediate SQL _str BULK COLLECT INTO tab_name, tab_type;

FOR I IN Tab_name.FIRST .. Tab_name.LAST LOOP
SQL _str: = DROP | Tab_type (I) | Tab_name (I );
Execute immediate SQL _str;
End loop;
END;
 

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.