Oracle(exp imp)匯入匯出

2022-07-30 06:03:11 字數 1934 閱讀 6171

直接進入系統命令行執行即可。

exp命令:

1 exp username/psw@test

file=d:test.dmp full=y

2 exp username/psw@test

file=d:test.dmp owner=(ly)

3 exp username/psw@test

file= d:test.dmp tables=(grid1,grid2)

1其中一是將test(與某一資料庫對應的oracle服務名)資料庫進行整體匯出

2將屬於使用者ly的所有表匯出

3將表grid1,與grid2匯出

d:test.dmp是匯出的檔案位址

imp命令:

1 imp system/psw@test

file=d:test.dmp

2 imp system/psw@test

full=y file=d:test.dmp ignore=y

3 imp system/psw@test

file=d:test.dmp tables=(grid1)ignore=y表示如果被匯入的資料庫中某個表已經存在就忽略不匯入那個表

3表示只匯入grid1這個表

在匯入匯出前要先測試下對應的資料庫是否是通的:tnsping test來測試,同樣test是服務名

所有命令可在cmd下執行

對oracle資料庫進行遠端操作,假設資料庫在192.168.1.110上,具體方法如下:

一、在客戶端建立和服務端對應的服務名

方法1:

修改tnsnames.ora檔案

加入遠端伺服器的命名:

sql**

test_orcl =  

(description =  

(address_list =  

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

)  

(connect_data =  

(service_name = orcl)  

)  

) 方法2:

在oracle客戶端,開啟net manager。

建立乙個服務命名test_orcl,主機ip為:192.168.1.110,服務名orcl,埠1521

二、測試遠端伺服器是否暢通

進入到cmd後,執行命令:tnsping test_orcl。

三、遠端運算元據庫

匯出:sql**

1:exp username/password@test_orcl

file=bak_filepath

2:exp username/password@test_orcl

full=y file=bak_filepath

username 使用者名稱,password 密碼,test_orcl 客服端服務名,bak_filepath 備份檔案存放的路徑

匯入:sql**

1:imp username/password@test_orcl

file=bak_filepath full=y

2:imp username/password@test_orcl/database_name

file=bak_filepath full=y

3:imp username/password@test_orcl

file=bak_filepath fromuser=fromadmin touser=toadmin

username 使用者名稱,password 密碼,test_orcl 客服端服務名,bak_filepath 備份檔案存放的路徑

fromadmin 備份資料的使用者名稱,toadmin 還原資料庫的使用者名稱。database_name 還原到那個資料庫上

full=y 將資料庫整體匯出,包括表結構等。

oracle exp imp實現匯出匯入

一.說明 oracle 的exp imp命令用於實現對資料庫的匯出 匯入操作 exp命令用於把資料從遠端資料庫伺服器匯出至本地,生成dmp檔案 imp命令用於把本地的資料庫dmp檔案從本地匯入到遠端的oracle資料庫中。二.下面介紹的是匯入匯出的例項。資料匯出 sql view plain cop...

Oracle exp imp 資料匯入匯出

rem 按表名匯出資料 exp 使用者名稱 密碼 ip 資料庫名稱 tables 表名 file 表名.dmp log 表名.log compress n rem 按表名 查詢條件匯出資料 exp 使用者名稱 密碼 ip 資料庫名稱 tables 表名 file 表名.dmp log 表名.log ...

Oracle exp imp 匯入匯出命令

1 表方式,將指定表的資料匯出 匯入。匯出 匯出一張或幾張表 exp user pwd file dir dmp log log tables table1,table2如果是分割槽表 exp user pwd file dir dmp log log tables table1 tablespac...