六狼论坛

 找回密码
 立即注册

QQ登录

只需一步,快速开始

新浪微博账号登陆

只需一步,快速开始

搜索
查看: 46|回复: 0

exp+parfile导出符合条件的记录

[复制链接]

升级  84%

10

主题

10

主题

10

主题

童生

Rank: 1

积分
42
 楼主| 发表于 2013-1-15 02:56:02 | 显示全部楼层 |阅读模式
exp parfile=d:\test.par file=d:\back.dmp filesize=2000M log=d:\**.log

filesize的作用是为了防止有的os不支持2G以上容量的文件,而且大文件的I/O性能不好。
 

exp parfile=d:\test.par 
>>>test.par的内容
a)scott用户连接导出自己的所有对象
userid=scott/tiger------连接的用户scott
file=d:\back.dmp------导出的文件的名字
 
b)用system用户连接来导出scott下的所有对象
userid=system/manager
file=d:\back.dmp
owner=(scott) -------导出scott用户的所有对象

c)用system用户连接导出scott和test下的所有对象
userid=system/manager
file=d:\back.dmp
owner=(scott,test)
 
d)用system用户连接导出scott下的emp,dept表、test用户下的student表
userid=system/manager
file=d:\back.dmp
tables=(scott.emp,scott.dept,test.student)
 
e)导出整个数据库(备份整个数据库)--------必须用超级用户 system ,sys
userid=system/manager
file=d:\back.dmp
full=y
以下是比较全的一个导出整个数据库的参数文件
userid=system/manager
file=d:\back.dmp
buffer=1024000 ---------缓冲
rows=y ----------是否导出记录
compress=y ---------extent是否压缩
grants=y ----------grant语句是否导出
indexes=y ----------导出索引
full=y ----------全库导出
feedback=3 ----------显示导出进度每3行
 
f)导出表scott.dept中部门编号是40的记录
userid=system/manager
file=d:\back.dmp
tables=(scott.emp)
query="where deptno=10"
 
g)导出表scott.emp中的记录
userid=system/manager
file=d:\back.dmp
tables=(scott.emp)
feedback=3 ---------每3行记录显示一个点进度
 
如何把导出的数据导入到数据库中进行恢复
imp import缩写形式
dos命令
imp help=y 查看帮助
<1>把scott下的表emp导出 ,
然后删除表中的内容(truncate table emp),
利用导出的文件来恢复
a)导出
exp parfile=d:\test.par
>>> test.par
userid=system/manager
file=d:\back.dmp
tables=(scott.emp)
b)删除
truncate table emp; ---------删数据
或者
drop table emp; ----------删除结构
( delete from emp; -----------删数据可以恢复)
c)恢复
imp parfile=d:\test.par;
>>>test.par
userid=system/manager
file=d:\back.dmp
fromuser=scott -----------从哪个用户来恢复
show=y -----------显示导入文件中的SQL语句
 
<2>scott下的对象全部复制到test用户下
(克隆用户scott)
a)导出scott用户
exp parfile=d:\test.par
>>>test.par
userid=system/manager
file=d:\back.dmp
owner=(scott)
b)导入d:\back.dmp文件中的内容到test用户下
imp parfile=d:\test.par
>>>test.par
userid=system/manager
file=d:\back.dmp
fromuser=scott
touser=test
 
<3>如何进行全库导入
imp system/manager
file=d:\back.dmp full=y ignore=y
full ----------全库
ignore ----------忽略导入过程中的错误

本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/ttonegrames/archive/2008/11/03/3208283.aspx
您需要登录后才可以回帖 登录 | 立即注册 新浪微博账号登陆

本版积分规则

快速回复 返回顶部 返回列表