oracle資料匯入匯出

2021-07-13 10:49:28 字數 4593 閱讀 7371

1:把使用者usera的物件導到使用者userb,

用法區別在於fromuser=usera touser=userb ,remap_schema='usera':'usera' 。 例如

imp system/passwd fromuser=usera touser=userb file=/oracle/exp.dmp log=/oracle/exp.log;

impdp system/passwd directory=expdp dumpfile=expdp.dmp remap_schema='usera':'userb' logfile=/oracle/exp.log;

2:更換表空間,用exp/imp的時候,要想更改表所在的表空間,需要手工去處理一下,

如alter table *** move tablespace_new之類的操作。

用impdp只要用remap_tablespace='tabspace_old':'tablespace_new'

3:當指定一些表的時候,使用exp/imp 時,tables的用法是 tables=('table1','table2','table3')。

expdp/impdp的用法是tables='table1','table2','table3'

4:是否要匯出資料行

exp (rows=y 匯出資料行,rows=n 不匯出資料行)

expdp content(all:物件+匯出資料行,data_only:只匯出物件,metadata_only:只匯出資料的記錄) 注:

1、imp只適用於exp匯出檔案,不適用於expdp匯出檔案;

impdp只適用於expdp匯出檔案,而不適用於exp匯出檔案

2、expdp/impdp是資料幫浦,是oracle 10g 以後才有,expdp只能在伺服器執行;匯入匯出速度比較快。

sql>create dexp和empdp的區別irectory dmpdir as 『/u01/dmdir』;

sql>grant read,write on directory to test;

$expdp scott/tiger dumpfile=scott.dmp directory=dmpdir schemas=test

$expdp scott/tiger dumpfile=tmp_dump.dmp directory=dmpdir tables=(tmp_test:p1,tmp_test:p2) job_name=tmp_dump logfile=tmp_dump.log

$expdp scott/tiger dumpfile=full.dmp directory=dmpdir full=y job_name=full

$expdp scott/timer dumpfile=tmp_200703.dmp directory=dmpdir tables=tmp query=\」where to_char\(create_time,\』yyyy-mm-dd\』\)\<\'2007-04\'\"

scott/tiger:使用者/密碼(*)

dumpfile:匯出後的檔名(*)

directory:匯出檔案存放位置(位於伺服器端)(*)

content:匯出檔案中包含的內容(預設為:all,可選data_only/metadata_only)

filesize:指定匯出檔案大小(單位為bytes).

job_name:此次匯出程序使用的名稱,方便跟蹤查詢(可選)

logfile:日誌檔名(預設為:export.log)

include:匯出時包含指定的型別

(例:include=table_data,

include=table:"like 'tab%'"

include=table:」not like 『tab%』」…)

exclude:匯出時排除的資料型別(例:exclude=table:emp)

full:全庫匯出時使用(同exp的full,預設為n)

schema:匯出某乙個schema下的所有資料

tables:按表匯出(這裡的方法和exp一樣)

tablespace:指定乙個表空間匯出.

query:按表匯出時,使用條件語句限定匯出範圍(同exp中的query)

transport_full_check:

transport_tablespaces:

flashback_scn:

flashback_time:

parallel:並行操作

parfile:

network_link:

當 data pump export (dpe) 執行時,按 control-c;它將阻止訊息在螢幕上顯示,但不停止匯出程序本身。相反,它將顯示 dpe 提示符(如下所示)。程序現在被認為處於「互動式」模式:

export>

這種方法允許在這個 dpe 作業上輸入命令查詢及控制當前作業。

impdp命令列選項與expdp有很多相同的,不同的有:

1,remap_datafile

該選項用於將源資料檔名轉變為目標資料檔名,在不同平台之間搬移表空間時可能需要該選項.

remap_datafiel=source_datafie:target_datafile

2,remap_schema

該選項用於將源方案的所有物件裝載到目標方案中.

remap_schema=source_schema:target_schema

3,remap_tablespace

將源表空間的所有物件匯入到目標表空間中

remap_tablespace=source_tablespace:target:tablespace

4.reuse_datafiles

該選項指定建立表空間時是否覆蓋已存在的資料檔案.預設為n

reuse_datafiels=

5.skip_unusable_indexes

指定匯入是是否跳過不可使用的索引,預設為n

6,sqlfile

指定將匯入要指定的索引ddl操作寫入到sql指令碼中

sqlfile=[directory_object:]file_name

impdp scott/tiger directory=dump dumpfile=tab.dmp sqlfile=a.sql

7.streams_configuration

指定是否匯入流元資料(stream matadata),預設值為y.

8,table_exists_action

該選項用於指定當表已經存在時匯入作業要執行的操作,預設為skip

9.transform

該選項用於指定是否修改建立物件的ddl語句

transform=transform_name:value[:object_type]

transform_name用於指定轉換名,其中segment_attributes用於標識段屬性(物理屬性,儲存屬性,表空間,日誌等資訊),storage用於標識段儲存屬性,value用於指定是否包含段屬性或段儲存屬性,object_type用於指定物件型別.

impdp scott/tiger directory=dump dumpfile=tab.dmp

transform=segment_attributes:n:table

10.transport_datafiles

該選項用於指定搬移空間時要被匯入到目標資料庫的資料檔案

transport_datafile=datafile_name

datafile_name用於指定被複製到目標資料庫的資料檔案

impdp system/manager directory=dump dumpfile=tts.dmp

transport_datafiles=』/user01/data/tbs1.f』

您可以通過 parallel 引數為匯出使用乙個以上的執行緒來顯著地加速作業。每個執行緒建立乙個單獨的轉儲檔案,因此引數 dumpfile 應當擁有和並行度一樣多的專案。您可以指定萬用字元作為檔名,而不是顯式地輸入各個檔名,例如:

expdp ananda/abc123 tables=cases directory=dpdata1 dumpfile=expcases_%u.dmp parallel=4 job_name=cases_export

注意:dumpfile 引數擁有乙個萬用字元 %u,它指示檔案將按需要建立,格式將為expcases_nn.dmp,其中nn 從 01 開始,然後按需要向上增加。

在並行模式下,狀態螢幕將顯示四個工作程序。(在預設模式下,只有乙個程序是可見的)所有的工作程序同步取出資料,並在狀態螢幕上顯示它們的進度。

分離訪問資料檔案和轉儲目錄檔案系統的輸入/輸出通道是很重要的。否則,與維護 data pump 作業相關的開銷可能超過並行執行緒的效益,並因此而降低效能。並行方式只有在表的數量多於並行值並且表很大時才是有效的。

create or replace directory 

dmpdir as  '/opt/oradata01/';

expdp daily/***xx tables=s1mme_2016052622,s1mme_2016052623,s1mme_2016052700,s1mme_2016052701,s1mme_2016052702,s1mme_2016052703 directory=dmpdir dumpfile=hz_daily20160612.dmp

oracle資料匯入匯出

語法 imp userid password 資料庫全域性名 file dmp檔案的目錄 其它引數 獲取幫助,敲入 imp help y import常用的引數 1 file 指定匯入檔名 fromuser 允許匯入指定的使用者擁有的表 full full y時,匯入dmp檔案中所有的事物 igno...

Oracle資料匯入匯出

資料庫的維護過程,難免遇到一些表的備份和恢復工作。為了方便起見,我將這些重複的工作整理成了執行在windows上的批處理,和執行在aix伺服器上的kshell指令碼。指令碼的作業內容就是,指定具體的表集合,分檔案逐表備份和恢復。如果是經常性的指定的固定表的話,可以修改以陣列方式的指令碼。如果是經常改...

oracle 資料匯出匯入

資料庫的匯出匯入 匯出表步驟 1 匯出表結構與資料 2 匯出序列 3 匯出觸發器 4 匯出檢視 匯出表工具 plsql developer 設定環境變數 變數名 nls lang 變數值 american america.zhs16gbk 這裡主要是解決資料庫的字符集問題,根據資料庫的字符集設定,保...