Adam Bien's Weblog
Generating DROP TABLES for ORACLE - One Statement
I forget it over and over again, now its here archived :-). The following statement generates DROP TABLE statements which really cleanup the Oracle database:
select 'drop table '||table_name||' CASCADE CONSTRAINTS;' from USER_TABLES
It is very useful for development (JPA will generate the tables for you again), and production (speeds up the performance) :-).
Nice thing: USER_TABLES and Oracle's dictionary is conceptually similar to reflection in Java.
Posted at 11:00AM Dec 16, 2008 by Adam Bien in Java EE 5 Architectures And Idioms | Kommentare[3]
[my tweets]
Rss My book: Real World Java EE - Rethinking Best Practices


Well performance decreases a little bit while doing this as user SYSTEM - so take care ;-)
Gesendet von Dirk am December 16, 2008 at 01:51 PM CET #
In MySQL, this is much easier:
DROP DATABASE xyz; CREATE DATABASE xyz
Gesendet von Michael Kuhlmann am December 18, 2008 at 11:06 AM CET #
Manual trackback: same query for dropping sequences.
Cheers :-).
Gesendet von Baptiste am December 22, 2008 at 09:38 AM CET #