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