Oracle导出表(即DMP文件)的两种方法
1:G:\Oracle\product\10.1.0\Client_1\NETWORK\ADMIN目錄下有個(gè)tnsname.ora文件,內(nèi)容如下:
CMSTAR =
? (DESCRIPTION =
??? (ADDRESS_LIST =
????? (ADDRESS = (PROTOCOL = TCP)(HOST = 172.18.13.200)(PORT = 1521))
??? )
??? (CONNECT_DATA =
????? (SERVICE_NAME = cmstar)
??? )
? )
其中:CMSTAR為數(shù)據(jù)庫(kù)名,HOST為IP地址,所以可以仿效上面的例子手動(dòng)添加數(shù)據(jù)錄連接。
2:用cmd進(jìn)入命令行
輸入:tnsping cmstar
就是測(cè)試172.18.13.200是否連接成功
3:導(dǎo)入與導(dǎo)出,如下:
數(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
?2 將數(shù)據(jù)庫(kù)中system用戶與sys用戶的表導(dǎo)出
?? exp?system/manager@TEST?file=d:\daochu.dmp owner=(system,sys)
?3 將數(shù)據(jù)庫(kù)中的表table1 、table2導(dǎo)出
?? exp?system/manager@TEST?file=d:\daochu.dmp tables=(table1,table2)?
?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文件可以很好的壓縮。
??不過(guò)在上面命令后面 加上 compress=y? 就可以了?
數(shù)據(jù)的導(dǎo)入
?1 將D:\daochu.dmp 中的數(shù)據(jù)導(dǎo)入 TEST數(shù)據(jù)庫(kù)中。
?? imp?system/manager@TEST? file=d:\daochu.dmp
?? 上面可能有點(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)?
?
注意事項(xiàng):導(dǎo)出dmp數(shù)據(jù)時(shí)需要有導(dǎo)出表的權(quán)限的用戶,否則不能導(dǎo)出。
轉(zhuǎn)載于:https://www.cnblogs.com/tianciliangen/p/7504776.html
《新程序員》:云原生和全面數(shù)字化實(shí)踐50位技術(shù)專家共同創(chuàng)作,文字、視頻、音頻交互閱讀總結(jié)
以上是生活随笔為你收集整理的Oracle导出表(即DMP文件)的两种方法的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: 随笔 —— 当下不晚
- 下一篇: CSS3小知识