EXP 数据库数据 QUERY 选项使用问题 |
exp ddd/ddd file=/dbf/u11/customer.dmp
tables=AASC.AST_CUSTOMER_KEEP
query='where CUA_TRANS_DTS <
add_months(sysdate, -6)'
table_export[2]: CUA_TRANS_DTS: not found. (没有找到)
答:操作系统不同,用来指定 QUERY= 参数的方法也不同。 WHERE 语句里面往往有很多特殊的字符,如 =.>.< 和空格等等。而 UNIX 和 Windows 操作系统中的外壳命令提示是不欢迎这些字符的,这些字符将被忽略。你应该根据不同的操作系统采用不用的方法。我一般使用带有 QUERY 选项的参数文件( PARFILE ),利用 PARFILE ,可以不考虑操作系统平台而使用完全相同的方法。
下面给出一个例子。我用 select * from all_objects 建立了一个表 T ,我希望输出所有 object_id 小于 5000 的行。在 Windows 中,必须这样做:
C:exp>exp userid=tkyte/tkyte tables=t
query="""where object_id < 5000"""
注意:在 windows 中,需要在 WHERE 语句的两端使用三个双引号。在 UNIX 中,必须这样做:
$ exp userid=/ tables=t query="where
object_id < 5000"
exp userid=/ tables=t parfile=exp.par
如果使用包含 query="where object_id < 5000" 的 PARFILE 文件,我可以在两个系统中使用相同的一个命令:
exp userid=/ tables=t parfile=exp.par
在两种操作系统中,完全相同。这相对于在不同的平台中使用不同的 QUERY 字符串容易多了。
__________________
qwerqwe本文地址: 原文出处:http://www.itpub.net/221227.html
============================================
For example, if user scott wants to export only those employees whose job title is salesman and whose salary is less than 1600, he could do the following (this example is UNIX-based):
exp scott/tiger TABLES=emp QUERY="WHERE job='SALESMAN' and sal<1600"
Note: Because the value of the QUERY parameter contains blanks, most operating systems require that the entire strings WHERE job='salesman' and sal<1600 be placed in double quotation marks or marked as a literal by some method. Operating system reserved characters also need to be preceded by an escape character. See your operating system-specific documentation for information about special and reserved characters on your system. |
When executing this query, Export builds a SQL SELECT statement similar to the following:
SELECT * FROM emp WHERE job='salesman' and sal <1600;
例子(WINNT上执行通过):
exp system/system QUERY="WHERE b_id>=1 and b_id<1000" buffer=8192 tables=usr1.buget_t feedback=50 consistent=n compress=n filesize=2G log=buget_log file=(buget_1, buget_2)
Default: none
This parameter allows you to select a subset of rows from a set of tables when doing a table mode export. The value of the query parameter is a string that contains a WHERE clause for a SQL SELECT statement that will be applied to all tables (or table partitions) listed in the TABLE parameter.
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/35489/viewspace-84372/,如需转载,请注明出处,否则将追究法律责任。