Oracle數(shù)據(jù)導(dǎo)出實(shí)例解析
下面的文章內(nèi)容主要介紹的是Oracle導(dǎo)出的實(shí)例。如果你對(duì)Oracle數(shù)據(jù)導(dǎo)出的實(shí)際操作或是Oracle數(shù)據(jù)導(dǎo)出的實(shí)際應(yīng)用代碼不是很了解的話,你就可以點(diǎn)擊以下的文章,對(duì)其相關(guān)的知識(shí)有個(gè)更好的里了解。
Oracle數(shù)據(jù)導(dǎo)出:
1 將數(shù)據(jù)庫(kù)TEST完全導(dǎo)出,用戶名system 密碼manager 導(dǎo)出到D:daochu.dmp中
- exp system/manager@TEST file=d:daochu.dmp full=y
full=y 如果TEST有DBA權(quán)限的話,會(huì)把整個(gè)SID下的數(shù)據(jù)庫(kù)導(dǎo)出來(lái),導(dǎo)出TEST整個(gè)用戶的話用full-y
2 將Oracle數(shù)據(jù)庫(kù)中system用戶與sys用戶的表導(dǎo)出
- exp system/manager@TEST file=d:daochu.
dmp owner=(system,sys)
3 將數(shù)據(jù)庫(kù)中的表inner_notify、notify_staff_relat導(dǎo)出
- exp aichannel/aichannel@TESTDB2 file=
d:datanewsmgnt.dmp tables=(inner_notify,notify_staff_relat)
4 將數(shù)據(jù)庫(kù)中的表table1中的字段filed1以"00"打頭的數(shù)據(jù)導(dǎo)出
- exp system/manager@TEST file=d:daochu.dmp tables=
(table1) query=" where filed1 like '00%'"
上面是常用的導(dǎo)出,對(duì)于壓縮,既用winzip把dmp文件可以很好的壓縮。
也可以在上面命令后面 加上 compress=y 來(lái)實(shí)現(xiàn)。
Oracle數(shù)據(jù)的導(dǎo)入
1 將D:daochu.dmp 中的數(shù)據(jù)導(dǎo)入 TEST數(shù)據(jù)庫(kù)中。
- imp system/manager@TEST file=d:daochu.dmp
- imp aichannel/aichannel@HUST full=y file=
d:datanewsmgnt.dmp ignore=y
上面可能有點(diǎn)問(wèn)題,因?yàn)橛械谋硪呀?jīng)存在,然后它就報(bào)錯(cuò),對(duì)該表就不進(jìn)行導(dǎo)入。
在后面加上 ignore=y 就可以了。
2 將d:daochu.dmp中的表table1 導(dǎo)入
- imp system/manager@TEST file=
d:daochu.dmp tables=(table1)
基本上上面的導(dǎo)入導(dǎo)出夠用了。不少情況要先是將表徹底刪除,然后導(dǎo)入。
注意:
操作者要有足夠的權(quán)限,權(quán)限不夠它會(huì)提示。
Oracle數(shù)據(jù)庫(kù)時(shí)可以連上的。可以用tnsping TEST 來(lái)獲得數(shù)據(jù)庫(kù)TEST能否連上。
附錄一:
給用戶增加導(dǎo)入數(shù)據(jù)權(quán)限的操作
***,啟動(dòng)sql*puls
第二,以system/manager登陸
第三,create user 用戶名 IDENTIFIED BY 密碼 (如果已經(jīng)創(chuàng)建過(guò)用戶,這步可以省略)
第四,
- GRANT CREATE USER,DROP USER,ALTER USER ,CREATE ANY VIEW ,
- DROP ANY VIEW,EXP_FULL_DATABASE,IMP_FULL_DATABASE,
- DBA,CONNECT,RESOURCE,CREATE SESSION TO
用戶名字
第五, 運(yùn)行-cmd-進(jìn)入dmp文件所在的目錄,
- imp userid=system/manager full=y file=*.dmp
或者
- imp userid=system/manager full=y file=filename.dmp
執(zhí)行示例:
- F:WorkOracle_Databackup>imp userid=test/test full=
y file=inner_notify.dmp
屏幕顯示
- Import: Release 8.1.7.0.0 - Production on 星期四 2月
16 16:50:05 2006- (c) Copyright 2000 Oracle Corporation. All rights reserved.
連接到:
- Oracle8i Enterprise Edition Release 8.1.7.0.0 - Production
- With the Partitioning option
- JServer Release 8.1.7.0.0 - Production
經(jīng)由常規(guī)路徑導(dǎo)出由EXPORT:V08.01.07創(chuàng)建的文件
已經(jīng)完成ZHS16GBK字符集和ZHS16GBK NCHAR 字符集中的導(dǎo)入
導(dǎo)出服務(wù)器使用UTF8 NCHAR 字符集 (可能的ncharset轉(zhuǎn)換)
. 正在將AICHANNEL的對(duì)象導(dǎo)入到 AICHANNEL
. . 正在導(dǎo)入表 "INNER_NOTIFY" 4行被導(dǎo)入
準(zhǔn)備啟用約束條件...
成功終止導(dǎo)入,但出現(xiàn)警告。
附錄二:
Oracle 不允許直接改變表的擁有者, 利用Export/Import可以達(dá)到這一目的.
先建立import9.par,
然后,使用時(shí)命令如下:imp parfile=/filepath/import9.par
例 import9.par 內(nèi)容如下:
- FROMUSER=TGPMS
- TOUSER=TGPMS2
- ROWS=Y
- INDEXES=Y
- GRANTS=Y
- CONSTRAINTS=Y
- BUFFER=409600
- file==/backup/ctgpc_20030623.dmp
- log==/backup/import_20030623.log
以上的相關(guān)內(nèi)容就是對(duì)Oracle數(shù)據(jù)導(dǎo)出的實(shí)例介紹,望你能有所收獲。
【編輯推薦】