Oracle邏輯導(dǎo)入數(shù)據(jù)(IMP/IMPDP)
瀏覽量: 次 發(fā)布日期:2023-10-14 12:07:40
Oracle邏輯導(dǎo)入數(shù)據(jù)(IMP/IMPDP)
Oracle邏輯導(dǎo)人數(shù)據(jù)是邏輯導(dǎo)出數(shù)據(jù)的逆過程,導(dǎo)人數(shù)據(jù)可以使用與EXP對應(yīng)的IMP工具,也可以使用與EMPDP對應(yīng)的IMPDP工具。本文將分別講述如何使用IMP和IMPDP工具完成數(shù)據(jù)的導(dǎo)入工作,Oracle邏輯導(dǎo)入數(shù)據(jù)經(jīng)常用來進(jìn)行備份的恢復(fù)和用來做數(shù)據(jù)遷移,把要遷移的數(shù)據(jù)進(jìn)行EXP/EXPDP導(dǎo)出后,再導(dǎo)入到另外一個(gè)數(shù)據(jù)庫上。
IMP導(dǎo)人數(shù)據(jù)是將數(shù)據(jù)庫中之前使用EXP導(dǎo)出的數(shù)據(jù)導(dǎo)入到數(shù)據(jù)庫當(dāng)中。IMP導(dǎo)入的方式也是在DOS命令窗口下完成的,根據(jù)不同的DMP文件可以進(jìn)行不同方式的導(dǎo)入,具體如下:
導(dǎo)入表語法:
imp student/123456@orcl file=d:/student.dmp log=student.log
fromuser=student touser=teacher TABLES=(stuinfo) buffer=819200
語法解析:
1、使用 imp 導(dǎo)入之前導(dǎo)出student.dmp文件中的學(xué)生信息表(stuinfo)。
2、tables指定要導(dǎo)入的表結(jié)構(gòu),在導(dǎo)入之前要確定dmp文件當(dāng)中是否含有該表數(shù)據(jù)。
3、fromuser指定dmp文件中是從student用戶導(dǎo)入到目標(biāo)數(shù)據(jù)庫的teacher用戶。在imp導(dǎo)入之前要確定teacher用戶下是否已經(jīng)存在該表,不然會報(bào)錯(cuò)。
4、我們選擇導(dǎo)入表數(shù)據(jù)時(shí),會把表相關(guān)的索引和觸發(fā)器一起導(dǎo)入進(jìn)來。
結(jié)果如下:
導(dǎo)入用戶語法:
imp student/123456@orcl file=d:/student.dmp log=student.log
fromuser=student touser=teacher buffer=819200
語法解析:
1、只需要通過fromuser指定要導(dǎo)出的用戶,通過touser指定要導(dǎo)入的用戶,就會把該用戶中所有的數(shù)據(jù)對象和數(shù)據(jù)全部導(dǎo)入。
導(dǎo)入一個(gè)完整數(shù)據(jù)庫:
imp student/123456@orcl file=d:/student.dmp log=student.log
full=y ignore=y buffer=819200
語法解析:
1、通過full=Y指定了要導(dǎo)出的是完整數(shù)據(jù)庫,但是前提DMP數(shù)據(jù)文件中是導(dǎo)出的全庫數(shù)據(jù)。全庫導(dǎo)入一般是用來做數(shù)據(jù)備份以備恢復(fù)使用,或者用來搭建測試環(huán)境時(shí)使用。
使用IMPDP導(dǎo)入數(shù)據(jù)的前提是數(shù)據(jù)是使用EMPDP導(dǎo)出的,同樣也是在DOS窗口下直接輸入IMPDP和登錄數(shù)據(jù)庫的用戶名,即可導(dǎo)人數(shù)據(jù)。
impdp導(dǎo)到指定用戶下:
impdp student/123456@orcl DIRECTORY=dir DUMPFILE=student.dmp logfile=student_imp.log SCHEMAS=student
語法解析:
1、directory指定的是目錄對象,這里的目錄對象就是在使用expdp導(dǎo)出時(shí)創(chuàng)建的目錄對象。
2、dumpfile指定的是要導(dǎo)入的dmp文件,
3、SCHEMAS指定要導(dǎo)入的數(shù)據(jù)是導(dǎo)入到哪個(gè)用戶下。
impdp導(dǎo)入表空間:
impdp student/123456@orcl DIRECTORY=dir DUMPFILE=student_tablespace.dmp logfile=student_imp.log TABLESPACES=student
浦東數(shù)據(jù)恢復(fù)語法解析:
1、tablespaces指定要導(dǎo)入的是表空間下的所有對象和數(shù)據(jù),這里導(dǎo)入的表空間為student表空間。
impdp導(dǎo)入數(shù)據(jù)庫:
impdp student/123456@orcl DIRECTORY=dir DUMPFILE=student_full.dmp logfile=student_imp.log full=y
語法解析:
1、full=Y指定要導(dǎo)入的是數(shù)據(jù)文件中全庫數(shù)據(jù),包括各種數(shù)據(jù)庫對象。這里前提是dmp文件是全庫導(dǎo)出的數(shù)據(jù)文件。
impdp導(dǎo)入追加數(shù)據(jù):
impdp student/123456@orcl DIRECTORY=dir DUMPFILE=student.dmp SCHEMAS=student TABLE_EXISTS_ACTION=append
語法解析:
. oracle證書,開啟數(shù)據(jù)庫專業(yè)之旅的鑰匙
. oracle歸檔日志設(shè)置,Oracle數(shù)據(jù)庫歸檔日志設(shè)置詳解
. oracle drop表數(shù)據(jù)恢復(fù),Oracle數(shù)據(jù)庫中drop表數(shù)據(jù)恢復(fù)方法詳解
. oracle 刪除數(shù)據(jù)文件,Oracle 數(shù)據(jù)文件刪除指南
. win11家庭版裝Oracle,oracle官方網(wǎng)站
. oracle價(jià)格,全面了解Oracle軟件的授權(quán)與成本
. oracle數(shù)據(jù)庫怎么修復(fù),全面指南
. oracle財(cái)務(wù)軟件,企業(yè)財(cái)務(wù)管理的新時(shí)代利器
. 什么是oracle數(shù)據(jù)庫,什么是Oracle數(shù)據(jù)庫?
. 如何查看oracle錯(cuò)誤日志,Oracle數(shù)據(jù)庫錯(cuò)誤日志查看指南
. oracle數(shù)據(jù)庫執(zhí)行計(jì)劃怎么看,查看與分析技巧
. oracle刪除的數(shù)據(jù)怎么恢復(fù),Oracle數(shù)據(jù)庫中刪除數(shù)據(jù)恢復(fù)指南
. oracle一個(gè)實(shí)例多個(gè)數(shù)據(jù)庫,Oracle數(shù)據(jù)庫實(shí)例與多個(gè)數(shù)據(jù)庫的配置與管理
. ora-01578:oracle 數(shù)據(jù)塊損壞,oracle數(shù)據(jù)塊損壞
. oracle恢復(fù)歸檔日志文件,Oracle數(shù)據(jù)庫恢復(fù)歸檔日志文件的方法與技巧
. Oracle database 完全恢復(fù),全面解析與操作指南
. oracle下載官網(wǎng),輕松獲取數(shù)據(jù)庫軟件