在管理oracle时有时要删除一些表,一个一个手动删除不但费时也费力,可以利用脚本批量删除某用户下的表,在oracle中将删除语句导入到一个文件中,然后执行文件
set pagesize 0;
spool /tmp/drop.sql
select 'drop table '||table_name||' cascade'||';' from all_tables where owner='USERNAME';
spool off
执行脚本
@/tmp/drop.sql;
set pagesize 0;
spool /tmp/drop.sql
select 'drop table '||table_name||' cascade'||';' from all_tables where owner='USERNAME';
spool off
执行脚本
@/tmp/drop.sql;