Oracle Automatic Survival Clearance script

Source: Internet
Author: User

In order to build a test library in the project, often encounter to clear the current library, is a toss, spare time, write a script to stay as a backup.

The script is as follows:

Select '--clear table ' from dual union ALL SELECT ' Drop table ' | | A.table_name | | ' | | '; ' from user_tables a UNION ALL select '--clear sequence ' from dual--Qing sequence union ALL select ' Drop sequence ' | |  a.sequence_name| | ' | | '; ' from user_sequences A--clear stored Procedure UNION ALL SELECT '--clear stored procedure ' from dual union ALL SELECT ' drop procedure ' | |  a.object_name| | '  | | '; '  From User_procedures a where a.object_type= ' PROCEDURE '--Clear Package UNION ALL SELECT '--clear package ' from dual union ALL select DISTINCT ' Drop Package ' | |  a.object_name| | '  | | '; ' From User_procedures a where a.object_type= ' package ' union ALL SELECT '--Clear custom function ' from dual union ALL select ' Drop functio N ' | |  a.object_name| | '   | | '; ' From User_procedures a WHERE a.object_type = ' FUNCTION '

After a copy of the command that automatically survives after running in PL/SQL,

Create a new command window, paste the copied command into the window, and run it directly.

Finally, the following statement is executed to generate the Guide-Library statement

--Import Library

Select ' Imp username/password @ database file= ' | | ' DMP file ' | | ' Full=y ' from dual

Open the cmd window, mark the above copy of the Guide Library command, modify, enter.

--Export Library

SELECT ' Exp username/password @ database file= ' | | ' DMP file ' | | ' Full=y ' from dual

Oracle Automatic Survival Clearance script

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.