Delete all objects under the current oracle user

Source: Internet
Author: User

Delete all objects under the current oracle user SQL code --. SQL script-the only note is the following D: \ dropobj. SQL is the operation. SQL; -- used to delete all objects of the current user -- use for drop all objects in current user; set heading off; set feedback off; spool D: \ dropobj. SQL; prompt -- delete constraints select 'alter table' | table_name | 'drop constraint' | constraint_name | ';' from user_constraints where constraint_type = 'R '; prompt -- delete a table select 'drop table' | table_name | ';' from user_tables; p Rompt -- delete view select 'drop view' | view_name | ';' from user_views; prompt -- delete sequence select 'drop sequence '| sequence_name |'; 'from user_sequences; prompt -- delete the function select 'drop function' | object_name | ';' from user_objects where object_type = 'function '; prompt -- delete stored procedure select 'drop processed' | object_name | ';' from user_objects where object_type = 'processed'; prompt -- delete package prompt -- delete Package content select 'drop Package '| object_name |'; 'from user_objects where object_type = 'package'; prompt -- delete database link select 'drop database link' | object_name | '; 'From user_objects where object_type = 'database link'; prompt -- delete the hidden object select 'drop synonym' | object_name | ';' from user_objects where object_type = 'synonym '; prompt -- delete materialized view select 'drop materialized view' | object_name | ';' from user_objects where object_t Ype = 'materialized view'; spool off; set heading on; set feedback on; @ D: \ dropobj. SQL; host del D: \ dropobj. SQL; -- done for drop objects in current user; -- use this entire segment in SQL * PLUS. SQL import or copy and paste directly, and press F5 to execute.

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.