imp query子句在unix和windows平台的差异
exp出数据时,偶尔要求仅导入大表中的部分数据。这时就需要使用到query子句
在query子句中可能涉及到数字类型,字符串类型或者日期类型,为此做简单的测试
建表和数据:
www.zhishiwu.com
create table test_qu (
col_num number(10),
col_var varchar2(10),
col_dat date
);
insert into test_qu
select rownum,to_char(rownum*5),round(sysdate+rownum) from dual connect by rownum < 20;
commit;
select * from test_qu;
UNIX:
1
2
3
exp report/oracle@ora10 file=1.dmp TABLES=/(test_qu/) QUERY=/"WHERE col_num />= 5/"
exp report/oracle@ora10 file=1.dmp TABLES=/(test_qu/) QUERY=/"WHERE col_var />= /'5/'/"
exp report/oracle@ora10 file=1.dmp TABLES=/(test_qu/) QUERY=/"WHERE col_dat />= to_date/(/'20130129/',/'yyyymmdd/'/)/"
WINDOWS: www.zhishiwu.com
exp report/oracle@ora10 file=1.dmp TABLES=(test_qu) QUERY="'WHERE col_num >= 5'"
exp report/oracle@ora10 file=1.dmp TABLES=(test_qu) QUERY='"WHERE col_num >= 5"'
exp report/oracle@ora10 file=1.dmp TABLES=(test_qu) QUERY="'WHERE col_var >= ''5'''"
exp report/oracle@ora10 file=1.dmp TABLES=(test_qu) QUERY='"WHERE col_var >= ''5''"'
exp report/oracle@ora10 file=1.dmp TABLES=(test_qu) QUERY="'WHERE col_dat >= to_date(''20130206'',''yyyymmdd'')'"
exp report/oracle@ora10 file=1.dmp TABLES=(test_qu) QUERY='"WHERE col_dat >= to_date(''20130206'',''yyyymmdd'')"'
上例是对常用的三种类型数据的简单范例。 www.zhishiwu.com
需要注意的是,如果server使用9.2的版本,而客户端使用10g的版本,则会报错
EXP-00056: ORACLE error 6550 encountered
ORA-06550: line 1, column 41:
PLS-00302: component 'SET_NO_OUTLINES' must be declared
ORA-06550: line 1, column 15:
PL/SQL: Statement ignored
EXP-00000: Export terminated unsuccessfully