>進(jìn)入 1.1.1 expdp使用 使用EXPDP工具時(shí),其轉(zhuǎn)儲(chǔ)文件只能被存放在DIRECTORY對(duì)象對(duì)應(yīng)的OS目錄中,而不能直接指定轉(zhuǎn)儲(chǔ)文件所在的OS目錄.因此使用EXPDP工具時(shí),必須首先建立DIRECTORY對(duì)象.并且需要為" />
歡迎進(jìn)入Oracle社區(qū)論壇,與200萬(wàn)技術(shù)人員互動(dòng)交流 >>進(jìn)入 1.1.1 expdp使用 使用EXPDP工具時(shí),其轉(zhuǎn)儲(chǔ)文件只能被存放在DIRECTORY對(duì)象對(duì)應(yīng)的OS目錄中,而不能直接指定轉(zhuǎn)儲(chǔ)文件所在的OS目錄.因此使用EXPDP工具時(shí),必須首先建立DIRECTORY對(duì)象.并且需要為數(shù)據(jù)庫(kù)用戶
歡迎進(jìn)入Oracle社區(qū)論壇,與200萬(wàn)技術(shù)人員互動(dòng)交流 >>進(jìn)入
1.1.1 expdp使用
使用EXPDP工具時(shí),其轉(zhuǎn)儲(chǔ)文件只能被存放在DIRECTORY對(duì)象對(duì)應(yīng)的OS目錄中,而不能直接指定轉(zhuǎn)儲(chǔ)文件所在的OS目錄.因此使用EXPDP工具時(shí),必須首先建立DIRECTORY對(duì)象.并且需要為數(shù)據(jù)庫(kù)用戶授予使用DIRECTORY對(duì)象權(quán)限.
首先得建DIRECTORY:
SQL> conn /as sysdba
SQL> CREATE OR REPLACE DIRECTORY dir_dump AS '/u01/backup/';
SQL> GRANT read,write ON DIRECTORY dir_dump TO public;
1) 導(dǎo)出scott整個(gè)schema
--默認(rèn)導(dǎo)出登陸賬號(hào)的schema
$ expdp scott/tiger@db_esuite parfile=/orahome/expdp.par
expdp.par內(nèi)容:
DIRECTORY=dir_dump
DUMPFILE=scott_full.dmp
LOGFILE=scott_full.log
--其他賬號(hào)登陸, 在參數(shù)中指定schemas
$ expdp system/oracle@db_esuite parfile=/orahome/expdp.par
expdp.par內(nèi)容:
DIRECTORY=dir_dump
DUMPFILE=scott_full.dmp
LOGFILE=scott_full.log
SCHEMAS=SCOTT
2) 導(dǎo)出scott下的dept,emp表
$ expdp scott/tiger@db_esuite parfile=/orahome/expdp.par
expdp.par內(nèi)容:
DIRECTORY=dir_dump
DUMPFILE=scott.dmp
LOGFILE=scott.log
TABLES=DEPT,EMP
3) 導(dǎo)出scott下除emp之外的表
$ expdp scott/tiger@db_esuite parfile=/orahome/expdp.par
expdp.par內(nèi)容:
DIRECTORY=dir_dump
DUMPFILE=scott.dmp
LOGFILE=scott.log
EXCLUDE=TABLE:"='EMP'"
4) 導(dǎo)出scott下的存儲(chǔ)過程
$ expdp scott/tiger@db_esuite parfile=/orahome/expdp.par
expdp.par內(nèi)容:
DIRECTORY=dir_dump
DUMPFILE=scott.dmp
LOGFILE=scott.log
INCLUDE=PROCEDURE
5) 導(dǎo)出scott下以'E'開頭的表
$ expdp scott/tiger@db_esuite parfile=/orahome/expdp.par
expdp.par內(nèi)容:
DIRECTORY=dir_dump
DUMPFILE=scott.dmp
LOGFILE=scott.log
INCLUDE=TABLE:"LIKE 'E%'" //可以改成NOT LIKE,就導(dǎo)出不以E開頭的表
6) 帶QUERY導(dǎo)出
$ expdp scott/tiger@db_esuite parfile=/orahome/expdp.par
expdp.par內(nèi)容:
DIRECTORY=dir_dump
DUMPFILE=scott.dmp
LOGFILE=scott.log
TABLES=EMP,DEPT
QUERY=EMP:"where empno>=8000"
QUERY=DEPT:"where deptno>=10 and deptno<=40"
注: 處理這樣帶查詢的多表導(dǎo)出, 如果多表之間有外健關(guān)聯(lián), 可能需要注意查詢條件所篩選的數(shù)據(jù)是否符合這樣的外健約束, 比如 EMP中有一欄位是 deptno, 是關(guān)聯(lián)dept中的主鍵, 如果"where empno>=8000"中得出的deptno=50的話, 那么, 你的dept的條件"where deptno>=10 and deptno<=40"就不包含deptno=50的數(shù)據(jù), 那么在導(dǎo)入的時(shí)候就會(huì)出現(xiàn)錯(cuò)誤.
[1] [2] [3] [4]
聲明:本網(wǎng)頁(yè)內(nèi)容旨在傳播知識(shí),若有侵權(quán)等問題請(qǐng)及時(shí)與本網(wǎng)聯(lián)系,我們將在第一時(shí)間刪除處理。TEL:177 7030 7066 E-MAIL:11247931@qq.com