Created
June 13, 2013 19:31
-
-
Save lennonjesus/5776629 to your computer and use it in GitHub Desktop.
Script to drop all table in a oracle database
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- drop all tables in current schema | |
declare | |
table_name varchar2(30); | |
cursor usertables is select * from user_tables where table_name not like 'BIN$%'; | |
begin | |
for next_row in usertables | |
loop | |
execute immediate 'drop table ' || next_row.table_name || ' cascade constraints'; | |
end loop; | |
-- drop all sequences | |
FOR i IN (SELECT sequence_name FROM user_sequences) | |
LOOP | |
EXECUTE IMMEDIATE('DROP SEQUENCE ' || user || '.' || i.sequence_name); | |
END LOOP; | |
end; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment