Oracle匯出表(即DMP檔案)的兩種方法

2021-07-25 12:22:24 字數 1447 閱讀 4723

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

選單欄---->

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檔案)的兩種方法

方法一 利用pl sql developer工具匯出 1 g oracle product 10.1.0 client 1 network admin目錄下有個tnsname.ora檔案,內容如下 cmstar description address list address protocol tc...

oracle 匯出表資料 dmp檔案

應用場景 從a資料庫把錶資料匯出來,匯入到b資料庫 一 資料匯入匯出方式 通過dmp檔案進行匯入匯出。效率最快。不需要考慮表結構,匯入匯出資料時已經包含表結構。二 需要注意的地方 1 匯入前刪除b資料庫裡面的所有表結構 2 必須保證b資料庫的使用者表空間和a資料庫的使用者表空間 名稱一致。否則,當涉...