數據泵 expdp導出oracle
nohup expdp system/******** dumpfile=lysb_20121113_%U.dmp directory=dmp_dir schemas=scott logfile=expdp_20121113.log job_name=lysbexpdp &ide
index導入時會佔用大量時間,導入時先導入處index外的其餘對象包括數據spa
nohup impdp system/******** dumpfile=lysb_20121113_%U.dmp directory=dmp_dir schemas=scott logfile=impdp_20121113.log job_name=lysbexpdp TABLE_EXISTS_ACTION=REPLACE EXCLUDE=INDEX &對象
index能夠再重建或者單獨導入索引
nohup impdp system/******** dumpfile=lysb_20121113_%U.dmp directory=dmp_dir schemas=scott logfile=impdp_201211132.log job_name=lysbexpdp include=INDEX &it
附:用數據泵導出時不會導出回收站內的數據。io
在源庫上expdp
create directory dir_dp as 'd:\';
Grant read,write on directory dir_dp to user;
expdp user/password DIRECTORY=dir_dp DUMPFILE=exp_%U.dmp LOGFILE=exp_eb.log SCHEMAS=user exclude=STATISTICS parallel=4
注意必須排除統計值,否則impdp會報錯。
注意不須要排除索引,排除索引手工建索引很麻煩,還不如不用,impdp 只要並行度足夠,建索引會很是快。
在目標庫上impdp
drop user user cascade; 清空數據
CREATE TABLESPACE YKSPACE DATAFILE
'F:\oradata\hr\hr01.dbf' SIZE 5000M AUTOEXTEND ON NEXT 50M MAXSIZE 10000M
LOGGING
ONLINE
PERMANENT
EXTENT MANAGEMENT LOCAL AUTOALLOCATE
BLOCKSIZE 8K
SEGMENT SPACE MANAGEMENT AUTO
FLASHBACK ON;
CREATE USER user
IDENTIFIED BY password
DEFAULT TABLESPACE YKSPACE
TEMPORARY TABLESPACE TEMP
PROFILE DEFAULT
ACCOUNT UNLOCK;
GRANT DBA TO user;
GRANT CONNECT TO user;
ALTER USER user DEFAULT ROLE ALL;
GRANT UNLIMITED TABLESPACE TO user;
create directory DUMP_DIR3 as 'f:\';
Grant read,write on directory DUMP_DIR3 to user;
拷貝源庫上導出的文件到目標系統的F盤上
impdp user/password DIRECTORY=DUMP_DIR3 DUMPFILE=EXP_%U.DMPLOGFILE=imp_eb.log SCHEMAS=user parallel=40
注意EXP_%U.DMP以前是小寫的,可是會自動變成大寫的。
注意導入導出的並行度能夠不同
最後收集統計信息
exec dbms_stats.gather_schema_stats(ownname => 'USER',options => 'GATHER AUTO');
若是在導入大表的時候報錯,能夠單獨導入導出這張表
expdp system/密碼 DIRECTORY=dir_dp tables=SRM.PROPODETAILPLAN DUMPFILE=d:\PROPODETAILPLAN_%U.dmp parallel=10
impdp system/密碼 DIRECTORY=DUMP_DIR3 tables=SRM.PROPODETAILPLAN file=/oracle/PROPODETAILPLAN_%U.dmp parallel=40 CONTENT=DATA_ONLY 若是表已經存在了能夠加上CONTENT=DATA_ONLY 只導入數據。
注意若是已經導入了部分數據在沒有導入索引的狀況下會插入重複數據,因此必須先truncate table SRM.PROPODETAILPLANtable
若是是11g導出而後導入到10g,須要加上version參數,否則導入會報錯 ora-39142
expdp 用戶名/密碼 DIRECTORY=dir_dp DUMPFILE=EXP_%U.dmp LOGFILE=EXPDP.log SCHEMAS=模式名exclude=STATISTICS parallel=20 version=10.2.0.1.0
impdp 用戶名/密碼 DIRECTORY=DUMP_DIR3 DUMPFILE=EXP_%U.dmp LOGFILE=impdp.log SCHEMAS=模式名 parallel=4version=10.2.0.1.0class