共計 3023 個字符,預計需要花費 8 分鐘才能閱讀完成。
本篇內容介紹了“數據庫中 exp 導出方法是什么”的有關知識,在實際案例的操作過程中,不少人都會遇到這樣的困境,接下來就讓丸趣 TV 小編帶領大家學習一下如何處理這些情況吧!希望大家仔細閱讀,能夠學有所成!
1. 功能簡介
Export 和 import 是 oracle 很常用的數據遷移工具(導出 / 導入)。這種遷移方式采用的是邏輯遷移。實際進行操作時,export/import 對應的命令是 emp/imp(注意小寫)。
2. 遷移條件:
exp imp 支持跨版本、跨平臺的遷移,還支持夸字符集的數據遷移。最重要的是,在遷移之前不需要做任何的準備工作,只需要執行 exp/imp 命令,指定相關參數即可完成導出 / 導入任務
3. 查看幫助
可以通過 help= y 命令來調出幫助信息
[oracle@localhost u01]$ exp help=y
Export: Release 11.2.0.4.0 – Production on Tue Oct 23 02:43:45 2018
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
USERID must be the first parameter on the command line.
Keyword Description (Default) Keyword Description (Default)
————————————————————————–
USERID username/password FULL export entire file (N)
BUFFER size of data buffer OWNER list of owner usernames
FILE output files (EXPDAT.DMP) TABLES list of table names
COMPRESS import into one extent (Y) RECORDLENGTH length of IO record
GRANTS export grants (Y) INCTYPE incremental export type
INDEXES export indexes (Y) RECORD track incr. export (Y)
DIRECT direct path (N) TRIGGERS export triggers (Y)
LOG log file of screen output STATISTICS analyze objects (ESTIMATE)
ROWS export data rows (Y) PARFILE parameter filename
CONSISTENT cross-table consistency(N) CONSTRAINTS export constraints (Y)
OBJECT_CONSISTENT transaction set to read only during object export (N)
FEEDBACK display progress every x rows (0)
FILESIZE maximum size of each dump file
FLASHBACK_SCN SCN used to set session snapshot back to
FLASHBACK_TIME time used to get the SCN closest to the specified time
QUERY select clause used to export a subset of a table
RESUMABLE suspend when a space related error is encountered(N)
RESUMABLE_NAME text string used to identify resumable statement
RESUMABLE_TIMEOUT wait time for RESUMABLE
TTS_FULL_CHECK perform full or partial dependency check for TTS
VOLSIZE number of bytes to write to each tape volume
TABLESPACES list of tablespaces to export
TRANSPORT_TABLESPACE export transportable tablespace metadata (N)
TEMPLATE template name which invokes iAS mode export
Export terminated successfully without warnings.
注:執行 imp 時支持的參數與上述類似,不完全相同,可以可以通過命令 imp help= y 進行查看
4.Exp/imp 的處理模式
Exp/imp 工具在使用的時候支持 4 中操作模式:
(1)
整庫模式:導出導入整個數據庫,對應 FULL 參數;
(2)
表空間模式:導出導入指定表空間中的對象數據,對應 tablespace 參數;
(3)
用戶模式:導出導入用戶自有對象,對應 owner 參數;
(4)
表模式:導出導入指定的表或分區表,對應 tables 參數。
5.Exp 調用方式
(1)
命令行方式調用
直接執行命令
例如:$ exp scott/tiger tables=emp file=scott_emp.dmp log=scott_emp.log
(2)
參數文件方式調用
第一步,編輯一個文件
$ vi scott_emp.dat
Tables=emp
Buffer=20480
log=scott_emp.log
第二步,然后在執行命令時調用這個文件
$ exp scott/tiger parfile=scott_emp.dat
6.Exp 導出例子說明
(1)
導出 scott 用戶的 emp 表
$ exp scott/tiger tables=emp file=scott_emp.dmp log=scott_emp.log
(2)
導出 scott 用戶 emp 表中 empno 100 的數據
$ exp scott/tiger tables=emp
query= where empno 100 file=scott_emp100.dmp log=scott_emp100.log
(3)
導出 scott 用戶所有的表
$ exp scott/tiger owner=scott file=scott_tables.dmp log=scott_tables.log
(4)
全庫導出
$ exp system/oracle full=y file=fulldb.dmp log=fulldb.log
7. 重要參數說明
TABLES:
指定要導出那些表
QUERY:
對要導出的數據進行篩選
SCHEMA:
指定 schema(寫成用戶名)
LOG:
指定產生日志文件名
FULL: FULL= y 時,代表全庫導出
FILESIZE:
指定導出單一文件的大小
索引、約束、授權
GRANTS:指定對象的授權信息(訪問、操作權限),默認為 Y
INDEXES:指定是否導出表的索引,默認為 Y
CONSTRAINTS:指定是否導出表的約束,默認為 Y
TRIGGERS:指定是否導出與表相關的觸發器,默認為 Y
“數據庫中 exp 導出方法是什么”的內容就介紹到這里了,感謝大家的閱讀。如果想了解更多行業相關的知識可以關注丸趣 TV 網站,丸趣 TV 小編將為大家輸出更多高質量的實用文章!