这个实验得到的结论是:用imp导入数据使用ignore=y参数的话,如果表存在,那么会追加数据到表中。
如果不限制ignore参数的话,系统默认是ignore=n,当遇到已经存在的表导入数据时会提示对象已存在的错误。我们要根据实际的需求来决定是否使用这个参数,有些人为了让导入的过程不出现错误而使用这个参数,我认为没有必要,这个参数要谨慎使用,否则数据库中多了很多重复数据都不知道什么原因。
下面是实验的过程:
[oracle@S01 ~]$ sqlplus xzh/oracle
SQL*Plus: Release 11.2.0.1.0 Production on Fri Aug 17 01:52:05 2012
Copyright (c) 1982, 2009, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> select * from t_char1;
C
-
a
b
c
SQL> ! exp xzh/oracle file=/home/oracle/tempdata/t_char1.dmp tables=t_char1
Export: Release 11.2.0.1.0 - Production on Fri Aug 17 01:54:17 2012
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
Export done in US7ASCII character set and AL16UTF16 NCHAR character set
server uses ZHS16GBK character set (possible charset conversion)
About to export specified tables via Conventional Path ...
. . exporting table T_CHAR1 3 rows exported
EXP-00091: Exporting questionable statistics.
Export terminated successfully with warnings.
SQL> ! ls /home/oracle/tempdata/t_char1.dmp
/home/oracle/tempdata/t_char1.dmp
SQL> ! imp xzh/oracle file=/home/oracle/tempdata/t_char1.dmp ignore=y
Import: Release 11.2.0.1.0 - Production on Fri Aug 17 01:55:42 2012
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
Export file created by EXPORT:V11.02.00 via conventional path
import done in US7ASCII character set and AL16UTF16 NCHAR character set
import server uses ZHS16GBK character set (possible charset conversion)
. importing XZH's objects into XZH
. importing XZH's objects into XZH
. . importing table "T_CHAR1" 3 rows imported
Import terminated successfully without warnings.
SQL> select * from t_char1;
C
-
a
b
c
a
b
c
6 rows selected.