使用EXPDP/IMPDP匯入匯出表中資料/中繼資料測試

來源:互聯網
上載者:User
首先建立匯出目錄:  --更詳細命令及參數,見:http://blog.csdn.net/haibusuanyun/article/details/12584727
BYS@ bys3>create directory dir_dp as '/home/oracle/';
Directory created.
BYS@ bys3>grant read,write on directory dir_dp to public;
Grant succeeded.
col privilege for a15
col directory_name for a15
col directory_path for a30
SELECT privilege, directory_name, DIRECTORY_PATH FROM user_tab_privs t, all_directories d  WHERE t.table_name(+) = d.directory_name ORDER BY 2, 1;    --可以使用此語句驗證配置。
#######################################################
匯出使用者某個表測試: 只BYS使用者下表定義不匯出資料:
expdp bys/bys tables=bys.test1 directory=dir_dp dumpfile=bys1.dmp logfile=bys1.log content=metadata_only
只BYS使用者下資料不匯出表定義:
expdp bys/bys tables=bys.test1  directory=dir_dp dumpfile=bys2.dmp logfile=bys2.log content=data_only
匯出BYS使用者下所有對象--content不寫,預設是ALL.
expdp bys/bys tables=bys.test1  directory=dir_dp file=bys3.dmp logfile=bys3.log
####################################################
匯出整個使用者下對象測試: 匯出整個使用者下對象的中繼資料:
expdp bys/bys schemas=bys  directory=dir_dp file=bys4.dmp logfile=bys4.log content=metadata_only
匯出整個使用者下的對象
expdp bys/bys schemas=bys  directory=dir_dp file=bys5.dmp logfile=bys5.log
####################################################
匯入使用者某個表測試: 1.刪除整個表,
drop table test1 purge;
匯入整個表含資料:
impdp bys/bys tables=test1 directory=dir_dp dumpfile=bys3.dmp logfile=impdp3.log
匯入表定義
impdp bys/bys tables=test1 directory=dir_dp dumpfile=bys3.dmp logfile=impdp2.log content=metadata_only
匯入表中資料:
impdp bys/bys tables=test1 directory=dir_dp dumpfile=bys3.dmp logfile=impdp1.log content=data_only
匯入使用者下所有對象測試: 刪除BYS使用者下所有表--不刪除使用者
BYS@ bys3>select * from cat;
no rows selected
##
只匯入使用者下對象的中繼資料
impdp bys/bys schemas=bys  directory=dir_dp file=bys5.dmp logfile=bys6.log content=metadata_only
只匯入使用者下對象的資料
impdp bys/bys schemas=bys  directory=dir_dp file=bys5.dmp logfile=bys7.log content=data_only
匯入使用者下所有對象及資料:  --不寫content=,預設就是ALL
impdp bys/bys schemas=bys  directory=dir_dp file=bys5.dmp logfile=bys8.log

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.