【Oracle导入导出】exp与imp(一)

来源:互联网 发布:有粤语听书软件 编辑:程序博客网 时间:2024/05/17 19:57

   渐渐地发现学习也就那么回事,并没有什么多大的困难,贵在坚持罢了。慢慢的写博客也就成了我的习惯,这是梳理所学知识的一个很好的方式,在工作中遇到的一些问题,在网上查询过的一些知识点,都是比较零散的,如果没有系统地去学习、整理很快就会忘记了,或者变得模糊不清。相信很多人感觉自己以前遇到的问题现在居然想不起来了,好记性不如烂笔头,此话不假。写博客并不一定要写出很专业的东西,不过是平时的积累。或许某个知识点看起来很简单,或许并没有什么新鲜的,半年,一年下来会惊讶的发现自己学习了不少,在这些小知识点的基础上也可以看到自己在各个时间段的学习状态,是积极的还是消极的。

   工作半年,另外一个助我学习的工具是有道云笔记(=.=非广告),可以说我是看着它成长起来的(怎么感觉像保姆)最初只是简陋的界面和简单的功能,现在它已经是很优秀的一款云笔记了。因为学习时间总是零碎的,大多时候在工作中或者在一些其他场合中学习的知识无法完整地记录下来,所以就记录到这电子笔记中,每周整理一次,或者下班回来做个梳理不失为一种很好的方式。+_+废话不多说了,还是先进入正题吧,不过工作半年,也该做个小结,并完善下自己之前所做的计划了。。。。正题:


1.表模式导出数据:在提取数据导入导出中这个用的是比较多的,我们可以将执行参数写到文件中,以供下次调用(关于各个参数的使用,查看Oracle® Database Utilities chapter 19 Original Export and Import中的Export Parameters,这里有详细的说明):

FILE=E:\oracle\export\expdat.dmpTABLES=(T_TEST)GRANTS=yINDEXES=y

执行导出命令:

exp lubinsu/lubinsu@orcl_mine parfile=E:\oracle\dat\exp.dat

这样就将整个表导出了:


接下来将数据导入另外一个数据库:

C:\Users\snoopy>imp scott/lubinsu@orcl file=E:\oracle\export\expdat.dmp tables=(t)       Import: Release 10.2.0.4.0 - Production on Fri Jan 4 22:25:24 2013       Copyright (c) 1982, 2007, Oracle.  All rights reserved.              Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bitProductionWith the Partitioning, OLAP, Data Mining and Real Application Testing options       Export file created by EXPORT:V10.02.01 via conventional pathIMP-00013: only a DBA can import a file exported by another DBAIMP-00000: Import terminated unsuccessfully
可见只有DBA才可以导入DBA导出的对象:
C:\Users\snoopy>imp system/lubinsu@orcl file=E:\oracle\export\expdat.dmp tables=(T_TEST)     Import: Release 10.2.0.4.0 - Production on Fri Jan 4 22:26:59 2013     Copyright (c) 1982, 2007, Oracle.  All rights reserved.          Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bitProductionWith the Partitioning, OLAP, Data Mining and Real Application Testing options     Export file created by EXPORT:V10.02.01 via conventional path     Warning: the objects were exported by LUBINSU, not by you     import done in US7ASCII character set and AL16UTF16 NCHAR character setimport server uses AL32UTF8 character set (possible charset conversion). importing LUBINSU's objects into SYSTEM. importing LUBINSU's objects into SYSTEM. . importing table                       "T_TEST"    3150336 rows importedImport terminated successfully without warnings.

查询下:


原创粉丝点击