Dropping all tables in Oracle removes every user-owned table and its data, freeing the schema for a fresh start.
Loop through USER_TABLES (or ALL_TABLES for another user) and run dynamic DROP TABLE statements with CASCADE CONSTRAINTS PURGE. This deletes the tables, their constraints, and their recycle-bin remnants in one go.
You need DROP ANY TABLE or ownership of the target tables. To purge another user’s objects, also hold ALTER USER or DBA privileges.
Use DBMS_ASSERT to stop SQL injection, wrap the logic in an anonymous block, and commit afterward to release locks.
BEGIN FOR t IN (SELECT table_name FROM user_tables) LOOP EXECUTE IMMEDIATE 'DROP TABLE ' || DBMS_ASSERT.SIMPLE_SQL_NAME(t.table_name) || ' CASCADE CONSTRAINTS PURGE'; END LOOP;END;/
Connect as the schema owner or prefix table names with the schema: EXECUTE IMMEDIATE 'DROP TABLE other_schema.' || t.table_name …
Yes—drop and recreate the user: DROP USER shop_app CASCADE;
then CREATE USER shop_app IDENTIFIED BY ***;
. This erases all objects, but also removes grants and quotas.
1) Backup data first (expdp). 2) Disable application sessions. 3) Drop in non-production first. 4) Use CASCADE CONSTRAINTS PURGE to avoid leftover metadata. 5) Verify with SELECT COUNT(*) FROM user_tables afterward.
Only if Flashback Database or backups exist. Standard DROP TABLE PURGE is irreversible. Always export data first.
Yes, PURGE removes recycle-bin objects instantly, releasing tablespace. Without PURGE, space is reclaimed only after BIN$ objects are purged.
Dropping the user is faster and simpler but deletes roles, grants, and synonyms. Choose it only when you plan to recreate the schema from scratch.