標籤:
oracle備份(exp、expdp)
--按使用者匯出表
expdp bdcdj/[email protected] schemas=bdcdj directory=a dumpfile=bdcdj.dmp
--按表名匯出表
expdp scott/[email protected] TABLES=emp,dept dumpfile=expdp.dmp DIRECTORY=dpdata1;
--按查詢條件匯出表
expdp scott/[email protected] 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/[email protected] file=e:\bdcdj.dmp owner=bdcdj
--正常備份單張表
exp system/[email protected] file=d:\daochu.dmp tables=(table1,table2)
----------------------------------------------------------------------------------------------------------------------
oracle還原(imp、impdp)
--匯入表
impdp sde/[email protected] 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/[email protected] file=e:\xx.dmp tables=表名
imp sde/[email protected] file=e:\sde_T_xtsz.dmp tables=T_xtsz
--正常還原
imp sde/[email protected] file=E:\nb\sde.dmp fromuser=sde touser=sde buffer=99999999 log=‘E:\nb\sde.log‘
-- 2 將d:\daochu.dmp中的表table1 匯入
imp system/[email protected] file=d:\daochu.dmp tables=(table1)
注意:這是我在工作中所用到的。一般就是這些常用的備份還原。希望對大家有個參考。注意加buffer=99999999是因為所匯入的資料庫檔案大的情況下的。為了防止資料的丟失。如果在還原時發現少表的情況下。本人建議是將空的模板庫在重新還原一下。這樣就會全部還原進去。
oracle備份(expdp、exp)及還原(imp、impdp)的方法