檢視幫助
expdp -help
parallel 是並行數,expdp和impdp都可以使用這個引數
--expdp匯出:
1.建立資料幫浦路徑:
sql> create or replace directory imostdb as '/opt/oracle/imost';
---directory created. //需確保/home/目錄空間足夠大(提前進行備份驗證)
2.賦予匯出使用者「匯入匯出」的許可權
grant connect to imostdb_cs;
grant dba to imostdb_cs;
grant exp_full_database to imostdb_cs;
grant imp_full_database to imostdb_cs;
grant resource to imostdb_cs;
3.匯出資料:(dmp檔案在資料幫浦路徑下)
expdp userid=imostdb_cs/'%tgb6yhn' directory=imostdb dumpfile=expdp_imost_20150318.dmp logfile=expdp_imost_20150318.log schemas=promotion content=metadata_only;
--需要注意的地方有:
1.userid用到的使用者和密碼是否正確並具有匯出匯入許可權
2.directory用到的路徑是否存在並保證空間充裕且userid用到的使用者對該路徑擁有讀寫許可權
3.使用者模式匯出使用schemas,除此之外還有表模式,表空間模式,全庫模式等(網上可以找到很多模板的)
4.content引數值,因為本次僅匯出資料結構所以我們使用的是metadata_only,該引數的預設值就是all
--impdp匯入
第一步到第三步請使用具有dba許可權的使用者執行
第一步:建立使用者所在的profile
-- create profile
create profile sdpuser limit
sessions_per_user unlimited
cpu_per_session unlimited
cpu_per_call unlimited
connect_time unlimited
idle_time unlimited
logical_reads_per_session unlimited
logical_reads_per_call unlimited
composite_limit unlimited
private_sga unlimited
failed_login_attempts unlimited
password_life_time unlimited
password_reuse_time unlimited
password_reuse_max unlimited
password_lock_time unlimited
password_grace_time unlimited
password_verify_function null;
第二步:建立使用者並賦權
-- create the user
create user promotion identified by "chpromo123"
default tablespace promotion
temporary tablespace temp
profile sdpuser;
-- grant/revoke role privileges
grant connect to promotion;
grant dba to promotion;
grant exp_full_database to promotion;
grant imp_full_database to promotion;
grant resource to promotion;
-- grant/revoke system privileges
grant alter any trigger to promotion;
grant alter any type to promotion;
grant create any directory to promotion;
grant create any table to promotion;
grant create any trigger to promotion;
grant create any type to promotion;
grant create any view to promotion;
grant create job to promotion;
grant create procedure to promotion;
grant create sequence to promotion;
grant create session to promotion;
grant drop any table to promotion;
grant drop any trigger to promotion;
grant drop any type to promotion;
grant drop any view to promotion;
grant insert any table to promotion;
grant unlimited tablespace to promotion;
第三步:建立匯入匯出路徑並賦權
create or replace directory local_transfer as '/opt/oracle/backup';
grant read,write on directory local_transfer to promotion;
第四步:在後台使用oracle使用者執行如下匯入語句
(請注意確認使用者,表空間以及dmp檔案資訊)
impdp userid=promotion/'userpasswd' directory=local_transfer dumpfile=expdp_promotion_20150317.dmp logfile=impdp_promotion_20150317.log remap_tablespace=ts_pmt_data:promotion,ts_sdp_temp:temp,ts_pmt_idx:promotion_index schemas=promotion
--注:需要注意的地方
1.匯入的使用者最還與原來保持一致,使用者許可權要賦足
2.以上都需執行,且dmp檔案要放在建立的資料幫浦路徑下
3.如果上面impdp匯入出問題,執行「impdp userid=promotion/'userpasswd' directory=local_transfer dumpfile=expdp_promotion_20150317.dmp」
Oracle使用expdp和exp匯入匯出資料
一 資料幫浦方式 1 新建par檔案 1.1新建impdp.par檔案 要匯入的資料庫使用者名稱 密碼 userid lee 123 dmp檔案所在路徑的變數,可以在資料庫中配置 directory data pump dir dmp檔名稱,如果想匯入多個,寫成test u.dmp即可 dumpfi...
Oracle使用expdp遷移dblink(教程)
建立dblink必須使用dblink的所有者登入資料庫建立,才能建立到當前的模式下。且不知道資料庫使用者密碼的情況下,將無法直接建立dblink。那麼使用expdp方式遷移dbkink將是一種非常方便簡單的方法。可以使用如下方法將整個資料庫的dblink儲存到乙個轉儲檔案中 expdp dumpfi...
oracle的expdp和impdp命令研究
建立遠端資料連線 create database link db mzdb11 connect to ytmztwo identified by ytmztwo909 using mzdb11 建立本地目錄 create directory db mz as c 授權使用者讀寫 grant read...