Mittwoch, 11. Juli 2007
Drop all tables
We tried to deploy an application to a customer’s test system yesterday and needed to clean up the full database. We agreed before that they have to delete the schema and the user with all table etc. but they missed to notify their ORACLE adminstrators. We had only the permissions to work in, but not with the schema. So how to drop a few hundred tables?
DROP TABLE * CASCADE CONSTRAINTS!?
No. No such statement is possible. The solution of my workmate was a little funny:
DROP TABLE * CASCADE CONSTRAINTS!?
No. No such statement is possible. The solution of my workmate was a little funny:
- Open ORACLE SQL Developer and connect to the database / schema.
- Mark all tables to delete.
- Choose “edit / copy full path” from the applications menu.
- Paste the stuff into the script editor. You get something like “TABLE MySchema.MyTable@MyDb”.
- Open Search/replace and replace “TABLE MySchema” with “DROP TABLE MySchema”.
- Replace also “@MyDb” with “ CASCADE CONSTRAINTS;”.
- Run the script.

Geschrieben von Jörg
in Softwaretechnik
um
07:58
| Kommentare (0)
| Trackbacks (0)
Artikel mit ähnlichen Themen:
(Seite 1 von 1, insgesamt 1 Einträge)


Jörg bei Twitter

