Sunday, August 5, 2012

Drop all tables from users schemas in Oracle

Many times we need to clear/delete all TABLE from users schema.We can't directly delete all table.it is tedious task to delete table one by one by command. here is short way to do this.

Execute following statement which will create drop query for every table.

SELECT 'DROP TABLE ' || TABLE_NAME || ' CASCADE CONSTRAINTS;' FROM user_tables;

Now, analyze results and copy appropriate statements, paste and execute them against the database.

This is the simple way to delete all tables from user's schema.


This approach can also be used in order to drop all SEQUENCE from user's schema.

SELECT 'DROP SEQUENCE ' || sequence_name || ';' FROM user_sequences;


That's it. enjoy...!!!