它有三种模式: a. 用户模式: 导出用户所有对象以及对象中的数据; b. 表模式: 导出用户所有表或者指定的表; c. 整个数据库: 导出数据库中所有对象。2. 导出工具exp交互式命令行方式的使用的例子$exp test/test123@appdb Enter array fetch buffer size: 4096 > 回车 Export file: expdat.dmp > m.dmp 生成导出的文件名 (1)E(ntire database), (2)U(sers), or (3)T(ables): (2)U > 3 Export table data (yes/no): yes > 回车 Compress extents (yes/no): yes > 回车 Export done in ZHS16GBK character set and ZHS16GBK NCHAR character set About to export specified tables via Conventional Path ... Table(T) or Partition(T:P) to be exported: (RETURN to quit) > cmamenu 要导出的表名 . . exporting table CMAMENU 4336 rows exported Table(T) or Partition(T:P) to be exported: (RETURN to quit) >要导出的表名n Table(T) or Partition(T:P) to be exported: (RETURN to quit) > 回车 Export terminated successfully without warnings. 3. 导出工具exp非交互式命令行方式的例子$exp scott/tiger tables=(emp,dept) file=/directory/scott.dmp grants=y 说明:把scott用户里两个表emp,dept导出到文件/directory/scott.dmp$exp scott/tiger tables=emp query=\"where job=\'salesman\' and sal\<1600\" file=/directory/scott2.dmp 说明:在exp里面加上导出emp的查询条件job='salesman' and sal<1600
2004-02 余枫
http://fengyu.china.com/exp_imp.htm
一. 导出工具 exp1. 它是操作系统下一个可执行的文件 存放目录/ORACLE_HOME/bin exp导出工具将数据库中数据备份压缩成一个二进制系统文件.可以在不同OS间迁移
它有三种模式:
a. 用户模式: 导出用户所有对象以及对象中的数据;
b. 表模式: 导出用户所有表或者指定的表;
c. 整个数据库: 导出数据库中所有对象。2. 导出工具exp交互式命令行方式的使用的例子$exp test/test123@appdb
Enter array fetch buffer size: 4096 > 回车
Export file: expdat.dmp > m.dmp 生成导出的文件名
(1)E(ntire database), (2)U(sers), or (3)T(ables): (2)U > 3
Export table data (yes/no): yes > 回车
Compress extents (yes/no): yes > 回车
Export done in ZHS16GBK character set and ZHS16GBK NCHAR character set
About to export specified tables via Conventional Path ...
Table(T) or Partition(T:P) to be exported: (RETURN to quit) > cmamenu 要导出的表名
. . exporting table CMAMENU 4336 rows exported
Table(T) or Partition(T:P) to be exported: (RETURN to quit) >要导出的表名n
Table(T) or Partition(T:P) to be exported: (RETURN to quit) > 回车
Export terminated successfully without warnings. 3. 导出工具exp非交互式命令行方式的例子$exp scott/tiger tables=(emp,dept) file=/directory/scott.dmp grants=y 说明:把scott用户里两个表emp,dept导出到文件/directory/scott.dmp$exp scott/tiger tables=emp query=\"where job=\'salesman\' and sal\<1600\" file=/directory/scott2.dmp 说明:在exp里面加上导出emp的查询条件job='salesman' and sal<1600
(但我个人很少这样用,还是把满足条件的记录生成临时表后,再exp会方便一些)$exp parfile=username.par file=/directory1/username_1.dmp,/directory1/username_2.dmp filesize=2000M log=/directory2/username_exp.log参数文件username.par内容
userid=username/userpassword
buffer=8192000
compress=n
grants=y
(可用来解决某些OS下2G物理文件的限制及加快压缩速度和方便刻历史数据光盘等)二.导入工具 imp1. 它是操作系统下一个可执行的文件 存放目录/ORACLE_HOME/bin imp导入工具将EXP形成的二进制系统文件导入到数据库中.
它有三种模式:
a. 用户模式: 导出用户所有对象以及对象中的数据;
b. 表模式: 导出用户所有表或者指定的表;
c. 整个数据库: 导出数据库中所有对象。
只有拥有IMP_FULL_DATABASE和DBA权限的用户才能做整个数据库导入
imp步骤:
(1) create table (2) insert data (3) create index (4) create triggers,constraints2.导入工具imp交互式命令行方式的例子
$ imp
Import: Release 8.1.6.0.0 - Production on 星期五 12月 7 17:01:08 2001
(c) Copyright 1999 Oracle Corporation. All rights reserved.
用户名: test
口令:****
连接到: Oracle8i Enterprise Edition Release 8.1.6.0.0 - 64bit Production
With the Partitioning option
JServer Release 8.1.6.0.0 - Production
导入文件: expdat.dmp> /tmp/m.dmp
输入插入缓冲区大小(最小为 8192 ) 30720>
经由常规路径导出由EXPORT:V08.01.06创建的文件
警告: 此对象由 TEST 导出, 而不是当前用户
已经完成ZHS16GBK字符集和ZHS16GBK NCHAR 字符集中的导入
只列出导入文件的内容(yes/no):no>
由于对象已存在, 忽略创建错误(yes/no):no> yes
导入权限(yes/no):yes>
导入表数据(yes/no):yes>
导入整个导出文件(yes/no):no> yes
. 正在将TEST的对象导入到 SCOTT
. . 正在导入表 "CMAMENU" 4336行被导入
成功终止导入,但出现警告。
3.导入工具imp非交互式命令行方式的例子$ imp system/manager fromuser=jones tables=(accts)
$ imp system/manager fromuser=scott tables=(emp,dept)
$ imp system/manager fromuser=scott touser=joe tables=emp
$ imp scott/tiger file = expdat.dmp full=y
$ imp scott/tiger file = /mnt1/t1.dmp show=n buffer=2048000 ignore=n commit=y grants=y full=y log=/oracle_backup/log/imp_scott.log
$ imp system/manager parfile=params.dat
params.dat 内容
file=dba.dmp show=n ignore=n grants=y fromuser=scott tables=(dept,emp)
c:\exp help=Y;
toad里面,选中某个表,在点击右键-》export data即可!