資料幫浦匯入匯出表

2021-07-25 17:34:52 字數 2174 閱讀 4043

將 hhn庫下 scott 使用者的 emp 表和 dept 表匯入到 hhn庫下 tuser 使用者下。

1、 將 scott 使用者的 emp 表和 dept 表匯出:

在 scott 使用者下建立匯出的目錄:

create or replace directory exp_file_dest as 『e:\user_dest』;

2、在cmd下執行:

expdp scott/oracle@hhn tables=emp,dept directory=exp_file_dest dumpfile=scott_emp_dept_20161230.dmp

(dumpfile 引數是指定匯出的檔名。)

3、建立tusr使用者

create user tuser identified by tuser;

tuser 使用者要匯入檔案到資料庫,因此 tuser 必須要有以下許可權:

①、 connect 許可權

②、 resource 許可權

③、 對目錄的讀寫許可權。

④、建立目錄的許可權,在tuser下也必須要有exp_file_dest這個目錄

如果要匯入的是其他資料庫,那麼其他資料庫中並沒有目錄物件: exp_file_dest。假設我要從 hmn 庫匯入

到 hmn 庫,那麼我必須在 hmn 庫建立乙個 directory,把要匯入的檔案放到該目錄下。

授權命令:

grant connect to tuser;

grant resource to tuser;

grant create any directory to tuser;

grant read,write on directory exp_file_dest to tuser;

4、在cmd下執行匯入命令:

impdp tuser/tuser@hhn directory=exp_file_dest dumpfile=scott_emp_dept_20161230.dmp

這個時候報了錯誤

ora-31655: 尚未為作業選擇資料或元資料物件

解決的方法:

impdp system directory=exp_file_dest dumpfile=scott_emp_dept_20161230.dmp remap_schema=scott:tuser tables=scott.emp,scott.dept

檢視結果:

c:\users\administrator>impdp system directory=exp_file_dest dumpfile=scott_emp_dept_20161230.dmp remap_schema=scott:tuser tables=scott.emp,scott.dept

import: release 11.2.0.1.0 - production on 星期五 12月 30 16:24:10 2016

directory=exp_file_dest dumpfile=scott_emp_dept_20161230.dmp remap_schema=scott:tuser tables=scott.emp,sc

ott.dept

處理物件型別 table_export/table/table

處理物件型別 table_export/table/table_data

. . 匯入了 「tuser」.」dept」 5.890 kb 4 行

. . 匯入了 「tuser」.」emp」 8.335 kb 14 行

處理物件型別 table_export/table/index/index

處理物件型別 table_export/table/constraint/constraint

處理物件型別 table_export/table/index/statistics/index_statistics

處理物件型別 table_export/table/comment

處理物件型別 table_export/table/constraint/ref_constraint

作業 「system」.」sys_import_table_01」 已於 16:24:28 成功完成

登入到tuser使用者

資料幫浦匯入匯出

使用資料幫浦需要先建directory create directory dump scott as home oracle dump scott 檢視建立的目錄 select from dba directories 賦權grant read,write on directory dump sco...

資料幫浦匯入匯出

一 新建邏輯目錄 最好以system等管理員建立邏輯目錄,oracle不會自動建立實際的物理目錄 d oracledata 務必手動建立此目錄 僅僅是進行定義邏輯路徑dump dir sql conn system 123456a?orcl as sysdba sql create director...

oracle 資料幫浦匯入與資料幫浦匯出

資料幫浦匯入 指令 impdp 一 資料庫所有物件的匯入 impdp system tiger dumpfile pump dir mydatabase dat filesize 100m nologfile y job name zhang full y estimate only 二 使用者資料...