Oracle資料庫匯入匯出

2021-07-30 04:13:36 字數 1683 閱讀 9456

oracle資料庫匯入匯出方法: 

大多情況都可以用oracle資料匯入匯出完成資料的備份和還原(不會造成資料的丟失)。

oracle有個好處,雖然你的電腦不是伺服器,但是你裝了oracle客戶端,並建立了連線(通過net configuration assistant新增正確的服務命名,其實你可以想成是客戶端與伺服器端 修了條路,然後資料就可以被拉過來了)

這樣你可以把資料匯出到本地,雖然可能伺服器離你很遠。

你同樣可以把dmp檔案從本地匯入到遠處的資料庫伺服器中。

利用這個功能你可以構建倆個相同的資料庫,乙個用來測試,乙個用來正式使用。

1.使用命令列: 

cmd進入命令列 

d:\>cd d:\oracle\product\10.2.0\db_1\bin

該目錄下有exp.exe與imp.exe檔案被用來執行匯入匯出

資料匯出:  

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.將資料庫中的表inner_notify、notify_staff_relat匯出  

exp aichannel/aichannel@testdb2 file= d:datanewsmgnt.dmp tables=(inner_notify,notify_staff_relat) 

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 

imp aichannel/aichannel@hust full=y file=file= d:datanewsmgnt.dmp ignore=y 

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

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

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

2.plsql:  

資料匯出:  

tools-export user objects(使用者物件)  

tools-export tables(表) 

資料的匯入:  

tools-import tables  

oracle import(表) sql inserts(使用者物件)  

也可以將使用者物件的語句拷貝出來,貼上到command window這樣的好處是可以看到執行的過程

Oracle 資料庫 匯入匯出

匯入匯出時要,通過 執行 進行到oracle的安裝目錄的 bin 目錄下導 例如 d oracle product 10.1.0 db 1 bin 匯出分三種 匯出 表 方案 資料庫 1.1.1 匯出自己的表 說明 使用者 密碼 資料庫例項 表名 可多個 檔案路徑 exp userid scott ...

oracle資料庫匯入匯出

用工具匯入 匯出 資料 工具 t 匯出表 x 工具 t 匯出表 x 所選執行檔案位置 e oracle product 10.2.0 db 1 bin imp.exe exp.exe 命令匯入匯出 oracle匯入dmp檔案命令 1 dmp檔案中的資料匯入資料庫 1.首先進入cmd命令視窗 2.執行...

Oracle資料庫匯入匯出

我們經常會在資料備份或環境移至的時候用到oracle的匯入匯出 下面我們來詳細看一下匯入匯出的步驟 1.命令列下匯出dmp檔案 資料匯出,可以帶版本 expdp bp oracle bp oracle orcl directory dump dir dumpfile bp oracle.dmp ve...