1.先查询该SQL然后执行查询出来的SQL,不然空表导不出来
select 'alter table '||t.TABLE_NAME||' allocate extent;' from user_tables t where t.NUM_ROWS=0;
2.导出数据库dmp文件到指定位置(需在命令窗口执行,电脑中需安装oracle客户端,不然无法执行)
服务器端的数据库导出dmp
exp name/password@服务器ip:1521/orcl file=d:\bak\lee.dmp log=d:\bak\lee_exp.log statistics=none owner=name
本地的数据库导出dmp
exp name/password@orcl file=d:\bak\lee.dmp log=d:\bak\lee_exp.log statistics=none owner=name
还原库到一个新用户下
创建用户
create user 用户名 identified by 密码 ;
授权
grant dba to 用户名;
导入dmp文件(服务器oracle服务)
imp name/password@服务器ip:1521/orcl file=d:\bak\lee.dmp fromuser=name1 touser=name ignore=yes
导入dmp文件(本地oracle服务)
imp name/password@localhost/orcl file=d:\bak\lee.dmp fromuser=name1 touser=name ignore=yes