Oracle匯出 DMP 方法

2022-05-08 15:33:12 字數 1439 閱讀 5967

方法一:利用pl/sql developer工具匯出:

選單欄---->tools

1:g:\oracle\product\10.1.0\client_1\network\admin目錄下有個tnsname.ora檔案,內容如下:

cmstar =

(description =

(address_list =

(address = (protocol = tcp)(host = 172.18.13.200)(port = 1521))

)(connect_data =

(service_name = cmstar)))

其中:cmstar為資料庫名,host為ip位址,所以可以仿效上面的例子手動新增資料錄連線。

2:用cmd進入命令列

輸入:tnsping cmstar

就是測試172.18.13.200是否連線成功

3:匯入與匯出,如下:

資料匯出:

1 將資料庫test完全匯出,使用者名稱system 密碼manager 匯出到d:\daochu.dmp中

exp system/manager@test file=d:\daochu.dmp full=y

2 將資料庫中system使用者與sys使用者的表匯出

exp system/manager@test file=d:\daochu.dmp owner=(system,sys)

3 將資料庫中的表table1 、table2匯出

exp system/manager@test file=d:\daochu.dmp tables=(table1,table2) 

4 將資料庫中的表table1中的字段filed1以"00"打頭的資料匯出

exp system/manager@test file=d:\daochu.dmp tables=(table1) query=\" where filed1 like '00%'\"

上面是常用的匯出,對於壓縮我不太在意,用winzip把dmp檔案可以很好的壓縮。

不過在上面命令後面 加上 compress=y  就可以了 

資料的匯入

1 將d:\daochu.dmp 中的資料匯入 test資料庫中。

imp system/manager@test  file=d:\daochu.dmp

上面可能有點問題,因為有的表已經存在,然後它就報錯,對該錶就不進行匯入。

在後面加上 ignore=y 就可以了。

2 將d:\daochu.dmp中的表table1 匯入

imp system/manager@test  file=d:\daochu.dmp  tables=(table1) 

注意事項:匯出dmp資料時需要有匯出表的許可權的使用者,否則不能匯出。

Oracle匯出表dmp檔案

經常我們在匯出資料庫進行備份的時候,會發現有些空表沒有匯出,如何匯出包含空表的完整資料庫呢?那麼請按照下面的方法進行即可。1.使用plsql工具,連線oracle資料庫 2.開啟乙個sql視窗,用以下這句查詢空表並生成執行命令 select alter table table name alloca...

oracle匯出dmp檔案的2種方法

使用exp和expdp匯出資料 1.exp匯出資料命令 2.expdp匯出資料 1 cmd視窗連線資料庫,進入sqlplus頁面 2 建立目錄物件 使用管理員賬號登入建立 sql create or replace directory dump dir as d fzb 建立好後,退出sqlplus...

oracle匯出dmp檔案的2種方法

使用exp和expdp匯出資料 1.exp匯出資料命令 exp gd base 11 192.168.xx.xx oanet file d export xx.dmp log d export gd base.log full y2.expdp匯出資料 1 cmd視窗連線資料庫,進入sqlplus頁...