Batch drop and batch flashback in oracle

Source: Internet
Author: User


Oracle batch drop and batch flashback raise the question: if you do not write a stored procedure, drop can only generate one table at a time. In this case, how can I delete multiple tables at a time? Solution: Use select statements to query all the tables you want to delete and combine these statements into SQL statements that can be executed. Copy these statements and paste them to the following. Naturally, all the statements are deleted. Www.2cto.com asked the following question: how can I restore the deleted table? Solution: All the deleted tables will be stored in the recycle bin at 10 Gb, which can be restored in the recycle bin and restored in batches. SQL code block -- batch Delete table table_name user_tables [SQL] SQL> select 'drop table' | table_name | ';' from user_tables where table_name like 't_% '; www.2cto.com 'droptable' | TABLE_NAME | ';' ------------------------------------------ drop table T_STU; drop table T_SCORE; drop table T_COUSE; SQL> drop table T_STU; table dropped SQL> drop table T_SCORE; Table dropped SQL> drop table T_COUSE; table dropped SQL> -- batch restore table original_name recyclebin [SQL] SQL> select 'flashback table' | original_name | 'to before drop; 'From recyclebin where original_name like 't_% '; 'flashbacktable' | returns rows flashback table T_STU to before drop; flashback table T_SCORE to before drop; flashback table T_COUSE to before drop; www.2cto.com SQL> flashback table T_STU to before drop; Done SQL> flashback table T_SCORE to before drop; Done SQL> flashback table T_COUSE to before drop; Done

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.