Oracle 資料庫匯入,匯出命令

2021-09-01 08:56:44 字數 1842 閱讀 8988

[size=small]oracle 資料匯入匯出imp/exp就相當於oracle資料還原與備份。exp命令可以把資料從遠端資料庫伺服器匯出到本地的dmp檔案,imp命令可以把 dmp檔案從本地匯入到遠處的資料庫伺服器中。 利用這個功能可以構建兩個相同的資料庫,乙個用來測試,乙個用來正式使用。

執行環境:可以在sqlplus.exe或者dos(命令列)中執行.

oracle 配置檔案 tnsnames.ora

oracle_192.168.28.1 =

(description =

(address_list =

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

)(connect_data =

(service_name = oracle11)))

oracle_192.168.28.2 =

(description =

(address_list =

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

)(connect_data =

(service_name = oracle22)))

1.資料庫匯入,匯出命令

資料匯出:

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

exp test/test@oracle_192.168.28.1 file=d:\daochu.dmp full=y

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

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

資料匯入:

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

imp dev/dev@oracle_192.168.28.2 file=d:\daochu.dmp

imp dev/dev@oracle_192.168.28.2 full=y file=file= d:\data\newsmgnt.dmp ignore=y

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

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

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

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

2.資料庫表中clob,blob 匯入匯出命令

exp 資料庫使用者名稱/密碼@配置名稱 file=輸出檔案路徑 log=日誌檔案路徑 tables=(資料庫表名) query=\"查詢條件\"

imp 資料庫使用者名稱/密碼@配置名稱 file=輸入檔案路徑 log=日誌檔案路徑 tables=(資料庫表名) ignore=y

exp test/test@oracle_192.168.28.1 file=c:\11.dmp log=c:\11.log tables=(table1) query=\"where createdby='sysadmin' and to_char(createtime,'yyyy-mm-dd')='2012-05-17'\"

imp dev/dev@oracle_192.168.28.2 file=c:\11.dmp log=c:\121.log tables=(table1) ignore=y

用cmd.exe 執行就可以,注意的地方就是query 地方 \"

先執行exp 後執行imp

注意:

操作者要有足夠的許可權,許可權不夠它會提示。[/size]

Oracle資料庫匯入匯出命令

匯出表結構 exp name password hostname db name owner username rows n file filename.dmp log exp log.log 匯入表結構 imp name password hostname db name fromuser use...

oracle 資料庫 匯入匯出命令

匯入匯出命令imp emp 1 將資料庫test完全匯出,使用者名稱system 密碼manager 匯出到d daochu.dmp中 exp system manager test file d daochu.dmp full y 2 將資料庫中system使用者與sys使用者的表匯出 exp s...

oracle資料庫匯入匯出命令

oracle資料匯入匯出imp exp 功能 oracle資料匯入匯出imp exp就相當與oracle資料還原與備份。可以在sqlplus.exe或者dos 命令列 中執行 資料匯出 1 將資料庫test完全匯出,使用者名稱system 密碼manager 匯出到d daochu.dmp中 exp...