Oracle匯出程式Exp的使用具體過程

2021-04-12 18:36:26 字數 2752 閱讀 1372

oracle的匯出實用程式(export utility)允許從資料庫提取資料,並且將資料寫入作業系統檔案。exp使用的基本格式:exp[username[/password[@service]]],以下例舉exp常用用法。 

1. 獲取幫助 

exp help=y

2. 匯出乙個完整資料庫

exp system/manager file=bible_db log=dible_db full=y

3. 匯出資料庫定義而不匯出資料

exp system/manager file=bible_db log=dible_db full=y rows=n

4. 匯出乙個或一組指定使用者所屬的全部表、索引和其他物件

exp system/manager file=seapark log=seapark owner=seapark

exp system/manager file=seapark log=seapark owner=(seapark,amy,amyc,harold)

注意:在匯出使用者時,儘管已經得到了這個使用者的所有物件,但是還是不能得到這些物件引用的任何同義詞。解決方法是用以下的sql*plus命令建立乙個指令碼檔案,執行這個指令碼檔案可以獲得乙個重建seapark所屬物件的全部公共同義詞的可執行指令碼,然後在目標資料庫上執行該指令碼就可重建同義詞了。

set linesize 132

set pagesize 0

set trimspool on

spool c:/seapark.syn

select 'create public synonym '||synonym_name

||' for '||table_owner||'.'||table_name||';'

from dba_synonyms

where table_owner = 'seapark' and owner = 'public';

spool off

5. 匯出乙個或多個指定表

exp seapark/seapark file=tank log=tank tables=tank

exp system/manager file=tank log=tank tables=seapark.tank

exp system/manager file=tank log=tank tables=(seapark.tank,amy.artist)

6. 估計匯出檔案的大小

全部表總位元組數:

select sum(bytes) 

from dba_segments 

where segment_type = 'table';

seapark使用者所屬表的總位元組數:

select sum(bytes)

from dba_segments

where owner = 'seapark'

and segment_type = 'table';

seapark使用者下的aquatic_animal表的位元組數:

select sum(bytes)

from dba_segments

where owner = 'seapark'

and segment_type = 'table'

and segment_name = 'aquatic_animal';

7. 匯出表資料的子集(oracle8i以上)

nt系統:

exp system/manager query='where salad_type='fruit'' tables=amy.salad_type 

file=fruit log=fruit

unix系統:

exp system/manager query=/"where salad_type=/'fruit/'/" tables=amy.salad_type 

file=fruit log=fruit

8. 用多個檔案分割乙個匯出檔案

exp system/manager 

file=(paycheck_1,paycheck_2,paycheck_3,paycheck_4)

log=paycheck, filesize=1g tables=hr.paycheck

9. 使用引數檔案

exp system/manager parfile=bible_tables.par

bible_tables.par引數檔案:

#export the sample tables used for the oracle8i database administrator's bible.

file=bible_tables

log=bible_tables

tables=(

amy.artist

amy.books

seapark.checkup

seapark.items

)10. 增量匯出

「完全」增量匯出(complete),即備份整個資料庫 

exp system/manager inctype=complete file=990702.dmp

「增量型」增量匯出(incremental),即備份上一次備份後改變的資料 

exp system/manager inctype=incremental file=990702.dmp

「累計型」增量匯出(cumulative),即備份上一次「完全」匯出之後改變的資料 

exp system/manager inctype=cumulative file=990702.dmp

oracle 11g 匯出空表 exp 匯出

oracle 11g 匯出空表 exp 匯出 在沒有dba許可權的條件下,用exp 匯出是乙個不錯的選擇,但是在遇到空表的情況下 11g預設不匯出空表,則可以進行如下操作 對已存在的表 執行如下 要經過統計分析後 num rows 0 才準確 分析表例子 analyze table test1 co...

oracle 資料備份匯入imp匯出exp

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

Oracle資料庫匯出 exp 匯入 imp

exp damp 檔案,方便資料遷移。但這個過程不能太長,以免回滾段和聯機日誌消耗完 imp 將exp dmp檔案上載到資料庫內。buffer 上載資料緩衝區,以位元組為單位,預設依賴作業系統 commit 上載資料緩衝區中的記錄上載後是否執行提交 feeback 顯示處理記錄條數,預設為0,即不顯...