oracle 导出某个用户下所有表数据

1:如果要导入的用户下有空表,需要执行下面语句

select 'alter table '||table_name||' allocate extent;' from user_tables where num_rows=0

查询出的数据拷出来,再次执行

2:cmd进入命令,导出

导出用户所有的表到D盘:exp aa/1234 file=D:\biao.dmp owner=aa;

导出用户aa中的表dept到D盘:exp aa/1234 file=d:\dept.dmp tables=(dept);

导出用户aa中的表dept,emp到D盘:exp aa/1234 file=d:\dept.dmp tables=(dept,emp);  

3:删除原有用户

在cmd中输入
sqlplus / as sysdba
 drop user aa cascade

4:创建用户

create user aa identified by 1234;(aa:用户名,1234:密码)

 grant dba,connect to aa;-----授权

5:导入

将D盘的biao.dmp导入到用户bb中:
        imp aa/1234 file=d:\biao.dmp full=y

将用户aa中表dept中的数据导入到用户bb的dept表中:
        imp bb/1234 file=d:\dept.dmp tables=(dept) ignore=y full=y

总结:

exp smart/smart file=D:\smart.dmp owner=smart;
drop user smart cascade;
create user smart identified by smart;
grant dba,connect to smart;
imp smart/smart file=d:\smart.dmp full=y;

转自:https://blog.csdn.net/weixin_42126557/article/details/80180567?tdsourcetag=s_pctim_aiomsg

  • 1
    点赞
  • 26
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值