Showing posts with label schema. Show all posts
Showing posts with label schema. Show all posts

Monday, April 20, 2009

drop all tables in an Oracle schema

Here's the script to drop all tables in a schema:

SET NEWPAGE 0
SET SPACE 0
SET LINESIZE 80
SET PAGESIZE 0
SET ECHO OFF
SET FEEDBACK OFF
SET HEADING OFF
SET MARKUP HTML OFF
SET ESCAPE \
SPOOL DELETEME.SQL
select 'drop table ', table_name, 'cascade constraints \;' from user_tables;
SPOOL OFF
@DELETEME