Oracle deletes all objects under a user and performs with caution

Source: Internet
Author: User

Oracle deletes all objects under a user and performs with caution

In PL/SQL, click "New", "Command Window", Paste and execute directly

--Delete an object under a user
Set heading off;
Set feedback off;
Spool D:/dropobj.sql;
Prompt--drop Constraint
Select ' ALTER TABLE ' | | table_name| | ' drop constraint ' | | constraint_name| | '; ' from user_constraints where constraint_type= ' R ';
Prompt--drop Tables
Select ' Drop table ' | | table_name | | '; ' from User_tables;

Prompt--drop View
Select ' Drop View ' | | view_name| | '; ' from User_views;

Prompt--drop sequence
Select ' Drop sequence ' | | sequence_name| | '; ' from user_sequences;

Prompt--drop function
Select ' Drop function ' | | object_name| | '; ' from user_objects where object_type= ' FUNCTION ';

Prompt--drop procedure
Select ' drop procedure ' | | object_name| | '; ' from user_objects where object_type= ' PROCEDURE ';

Prompt--drop Package
Prompt--drop Package body
Select ' Drop Package ' | | object_name| | '; ' from the user_objects where object_type= ' package ';

Prompt--drop Database link
Select ' Drop database link ' | | object_name| | '; ' from user_objects where object_type= ' DATABASE LINK ';

Spool off;
Set heading on;
Set feedback on;

@@d:/dropobj.sql;
Host del D:/dropobj.sql;

Oracle deletes all objects under a user and performs with caution

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.