oracle备份(exp、expdp)
--按用户导出表 expdp name/pwd@orcl schemas=space1 directory=a dumpfile=expdp.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 id=1'; --按表空间导出表 expdp system/manager DIRECTORY=dpdata1 DUMPFILE=tablespace.dmp TABLESPACES=temp,example; --导整个数据库 expdp system/manager DIRECTORY=dpdata1 DUMPFILE=full.dmp FULL=y;
--正常备份 exp name/pwd@orcl 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)
注意加buffer=99999999是因为所导入的数据库文件大的情况下的。为了防止数据的丢失。如果在还原时发现少表的情况下。建议将空的模板库在重新还原一下。这样就会全部还原进去。
