批量删除表,导入表

列出当前用户的所有表,创建删除命令的sql脚本,保存成一个文件
 
SET HEAD OFF
SPOOL  /tmp/database/drop_tables.sql  //保存路径
select 'drop table '||table_name||';' from user_tables;
spool off;
@/tmp/database/drop_tables.sql;  //执行
@drop_tables.sql
 
 
 
导入dmp格式的数据库
imp usrname/password@oadb file=XXX.dmp
fromuser=username touser=username
ignore=y full=y  log=tank.log tablespaces=tablespaces;
 
 
ignore  表示如果表存在就不导入表结构只导入表里面的数据
full      导出的时候导出全部数据库,默认只导出当前用户数据库

猜你喜欢

转载自625.iteye.com/blog/2045974