ITPub博客

首页 > Linux操作系统 > Linux操作系统 > exp用query参数备份表的部分数据

exp用query参数备份表的部分数据

原创 Linux操作系统 作者:bjiokn 时间:2009-12-30 10:35:34 0 删除 编辑
Oracle的exp工具有一个query参数可以指定一个where条件来有条件地导出记录, 对于不经常用这个选项的人来说, 经常会遇到这样的错误:
LRM-00112: multiple values not allowed for parameter 'query'

EXP-00019: failed to process parameters, type 'EXP HELP=Y' for help
EXP-00000: Export terminated unsuccessfully

这是因为在where条件中一般都会有空格, 而命令行下就会被释成几个命令行参数, 需要用单引号或双引号将整个where条件括起来, 就可以了. 在Windows下, 如何指定query参数:

D:\orcl>exp scott/tiger file='aaa.dmp' tables=(emp)  query=\"where deptno=10\"

D:\orcl>exp scott/tiger file='aaa.dmp' tables(emp)
D:\orcl>exp scott/tiger file=at.dmp tables=emp query=\"where deptno=10\"
D:\orcl>exp scott/tiger file='at.dmp' tables=(emp) query=\"where deptno=10\"

exp ... query='where deptno=10'
exp ... query='where deptno=''10'''
exp ... query='where deptno"<"10'

在Solaris(C shell)下, 如何指定query参数:

exp ..... query=\"where col1 \< 1000\"
exp ..... query=\"where col1 \< '1000'\"

其他Unix平台的应当和Solaris下的一样, 我自已也经常搞错. 在上面的例子中已经说明了如何在query值中使用单引号, 因此在看完这篇后, 就应当可以写出正确的where条件了. 最好是写在一个参数文件里, 这样的话就不用注意这些了.

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/21021875/viewspace-623933/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2009-05-31

  • 博文量
    94
  • 访问量
    113661