expdp user/password dumpfile=temp.dmp directory= bak_dic
expdp scott/新用户 dumpfile=scott.dmp schemas=scott
impdp system/新用户 dumpfile=scott.dmp remap_schema=scott:新用户
或者参考http://blog.csdn.net/zftang/article/details/6387325
可以参考:http://www.cnblogs.com/SR71BlackBird/p/5498586.html
1.在本地oracle数据库里执行
create directory bak_dir as 'e:\要备份的文件夹';
create public database link temp_link connect to localtest(本地的用户)
identified by 密码 using '(DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = 远程服务器的ip)(PORT = 1521)) ) (CONNECT_DATA = (sid = 远程服务器的sid) ) )';
测试
select * from 对应远程服务器上的表@temp_link;
删除(用完了可以删除)
drop directory bak_dir;
drop public database link temp_link;
2.编写批处理命令
以下代码复制到一个记事本中,改后缀名为 bat。例如 "备份.bat"
@echo off
echo 备份执行开始!
set filename=%Date:~0,4%%Date:~5,2%%Date:~8,2%
expdp 本地用户名/本地用户对应的密码 network_link=temp_link schemas=要备份的远程服务器上的用户 dumpfile=%filename%.dmp DIRECTORY=bak_dir
echo 备份执行完成!
上面表示按照日期生成备份文件名。
结束
create directory
aa
as 'D:\aa';
grant read,write on directory aa to king2;
expdp
king2/king2@test02
schemas=king2
directory=aa
dumpfile=expuser.dmp
create directory aa as 'D:\aa'; grant read,write on directory aa to king2; expdp king2/king2@test02 schemas=king2 directory=aa dumpfile=expuser.dmp
create directory
aa
as 'D:\aa';
grant read,write on directory aa to king2;
expdp
king2/king2@test02
schemas=king2
directory=aa
dumpfile=expuser.dmp
create directory
aa
as 'D:\aa';
grant read,write on directory aa to king2;
expdp
king2/king2@test02
schemas=king2
directory=aa
dumpfile=expuser.dmp
impdp king2/king2@test02 schemas=king2 directory=aa dumpfile=king.dmp
create directory
aa
as 'D:\aa';
grant read,write on directory aa to king2;
expdp
king2/king2@test02
schemas=king2
directory=aa
dumpfile=expuser.dmp
http://wenku.baidu.com/link?url=nD1-I2MbF0tc6vstroemAIZvoAoS2RKYWq-gqdWJ3JKoHuLyggNlLCqIthMJDcgYaVk8tLQIg0ozP_wVyFnmrdKDp4Qj3JBx2v6LC0LUj4S
create directory
aa
as 'D:\aa';
grant read,write on directory aa to king2;
expdp
king2/king2@test02
schemas=king2
directory=aa
dumpfile=expuser.dmp
create directory
aa
as 'D:\aa';
grant read,write on directory aa to king2;
expdp
king2/king2@test02
schemas=king2
directory=aa
dumpfile=expuser.dmp
还原参考:
impdp hjxdsas/123456 directory=DATA_PUMP_DIR dumpfile=HJXD_$BAKUPTIME.dmp logfile=fullexp.log remap_schema=HJXD:hjxdsas table_exists_action=replace
impdp zk/zk directory=bak_dir dumpfile=17.DMP logfile=export.log remap_schema=zk:远程服务器的用户名 table_exists_action=replace
remap_schema=要改成的用户名:旧的用户名
参考:http://blog.itpub.net/28602568/viewspace-759524/
没有权限的话需要授权,授权是指给远程的服务器上的那个用户授权
grant exp_full_database to 远程用户;
其他的 参考:http://www.cnblogs.com/zzjq/p/5492446.html
oracle备份(exp、expdp)
--按用户导出表
expdp bdcdj/bdcdj@pana schemas=bdcdj directory=a dumpfile=bdcdj.dmp
--按表名导出表
expdp scott/tiger@orcl TABLES=emp,dept dumpfile=expdp.dmp DIRECTORY=dpdata1;
--按查询条件导出表
expdp scott/tiger@orcl directory=dpdata1 dumpfile=expdp.dmp Tables=emp query='WHERE deptno=20';
--按表空间导出表
expdp system/manager DIRECTORY=dpdata1 DUMPFILE=tablespace.dmp TABLESPACES=temp,example;
--导整个数据库
expdp system/manager DIRECTORY=dpdata1 DUMPFILE=full.dmp FULL=y;
--正常备份
exp bdcdj/bdcdj@pana file=e:\bdcdj.dmp owner=bdcdj
--正常备份单张表
exp system/manager@TEST file=d:\daochu.dmp tables=(table1,table2)
----------------------------------------------------------------------------------------------------------------------
oracle还原(imp、impdp)
--导入表
impdp sde/sde@nbdcj schemas=bdcdj directory=a dumpfile=bdcdj.dmp
--导入表空间
impdp system/manager DIRECTORY=dpdata1 DUMPFILE=tablespace.dmp TABLESPACES=example;
--导入数据库
impdp system/manager DIRECTORY=dump_dir DUMPFILE=full.dmp FULL=y;
--追加数据
impdp system/manager DIRECTORY=dpdata1 DUMPFILE=expdp.dmp SCHEMAS=system TABLE_EXISTS_ACTION
--改变表的owner
impdp system/manager DIRECTORY=dpdata1 DUMPFILE=expdp.dmp TABLES=scott.dept REMAP_SCHEMA=scott:system;
--还原单表
imp sde/sde@pana file=e:\xx.dmp tables=表名
imp sde/sde@nbbdc file=e:\sde_T_xtsz.dmp tables=T_xtsz
--正常还原
imp sde/sde@nbbdc file=E:\nb\sde.dmp fromuser=sde touser=sde buffer=99999999 log='E:\nb\sde.log'
-- 2 将d:\daochu.dmp中的表table1 导入
imp system/manager@TEST file=d:\daochu.dmp tables=(table1)
create directory
aa
as 'D:\aa';
grant read,write on directory aa to king2;
expdp
king2/king2@test02
schemas=king2
directory=aa
dumpfile=expuser.dmp