1. 程式人生 > >oracle資料庫表結構及資料的匯出

oracle資料庫表結構及資料的匯出

參考:

只匯出表結構:

1、雙擊桌面圖示,開啟PL/SQL Developer,輸入使用者名稱密碼,登陸oracle資料庫;

2、工具(tools)->export user objects是匯出表結構

3、在彈出的對話方塊中設定使用者、匯出物件、匯出路徑等引數;

4、單擊匯出(Export),開始匯出;

匯出表結構和資料:

1.匯出表結構和資料
方式1.tools->export user objects是匯出表結構

tools ->export user object 選擇選項,匯出.sql檔案 說明:匯出的是建表語句(包括儲存結構)

方式2.tools->export tables 是匯出表結構還有資料

用pl/sql developer匯出表的資料時有三種方式:Oracle Export,Sql Insert,pl/sql developer
用中間的sql inserts頁面,選中create tables選項,where clause 裡寫入 where rownum<1。
如果表包含有CLOB型別欄位的話,sql是無法匯出的。這時候可以改用PL/SQL的pde格式進行匯出。

區別:

第一種(Oracle Export)是匯出為.dmp的檔案格式,.dmp檔案是二進位制的,可以跨平臺,還能包含許可權,效率也很不錯,用得最為廣泛 。

第二種(Sql Insert)是匯出為.sql檔案的,可用文字編輯器檢視,通用性比較好,但效率不如第一種,適合小資料量匯入匯出。

尤其注意的是表中不能有大欄位(blob,clob,long),如果有,會提示不能匯出

(提示如下: table contains one or more LONG columns cannot export in sql format,user Pl/sql developer format instead)。  

第三種(pl/sql developer)是匯出為.pde格式的,.pde為Pl/sql developer自有的檔案格式,只能用Pl/sql developer自己匯入匯出,不能用編輯器檢視。

2.匯入步驟:a.tools->import tables->SQL Inserts 匯入.sql檔案。b. tools->import talbes->Oracle Import然後再匯入dmp檔案。 說明:和匯出類似,另外,匯入之前最好把以前的表刪除,當然匯入另外資料庫除外。

其他---匯出資料到excel檔案

選中資料表--query data --選中要匯出的資料--右鍵copy to excel

excel資料匯入到資料庫