ITPub博客

check约束在IMP时会产生冗余

原创 Linux操作系统 作者:yxyup 时间:2007-12-18 00:00:00 0 删除 编辑

check约束在IMP时会产生冗余



SQL> create table t(id number ,name char(4));

Table created.

SQL> insert into t values(1,'yxy');

1 row created.

SQL> commit;

Commit complete.


SQL> alter table t add check (id=0 or id=1) enable;

Table altered.

SQL> select owner,constraint_name,constraint_type,last_change,SEARCH_CONDITION from dba_constraints where table_name='T';

OWNER CONSTRAINT_NAME C LAST_CHANGE SEARCH_CONDITION
---------- ------------------------------ - -------------- --------------------------------------------------
YXYUP SYS_C0013294 C 20071217184452 id=0 or id=1

oracle@test:/home/oracle #exp yxyup/abc123 tables=t file=t.dmp log=t.log

Export: Release 10.2.0.3.0 - Production on Mon Dec 17 18:45:17 2007

Copyright (c) 1982, 2005, Oracle. All rights reserved.


Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - 64bit Production
With the Partitioning and Data Mining options
Export done in ZHS16GBK character set and AL16UTF16 NCHAR character set

About to export specified tables via Conventional Path ...
. . exporting table T 1 rows exported
Export terminated successfully without warnings.

oracle@test:/home/oracle #imp yxyup/abc123 tables=t file=t.dmp log=t.log rows=N ignore=Y

Import: Release 10.2.0.3.0 - Production on Mon Dec 17 18:45:23 2007

Copyright (c) 1982, 2005, Oracle. All rights reserved.


Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - 64bit Production
With the Partitioning and Data Mining options

Export file created by EXPORT:V10.02.01 via conventional path
import done in ZHS16GBK character set and AL16UTF16 NCHAR character set
. importing YXYUP's objects into YXYUP
. importing YXYUP's objects into YXYUP
Import terminated successfully without warnings.


SQL> r
1* select owner,constraint_name,constraint_type,last_change,SEARCH_CONDITION from dba_constraints where table_name='T'

OWNER CONSTRAINT_NAME C LAST_CHANGE SEARCH_CONDITION
---------- ------------------------------ - -------------- --------------------------------------------------
YXYUP SYS_C0013295 C 20071217184523 id=0 or id=1
YXYUP SYS_C0013294 C 20071217184452 id=0 or id=1

---我晕


SQL>drop table t cascade constraints purge;

Table dropped.

SQL> create table t(id number constraint id_c check (id=0 or id=1) , name char(4));

Table created.

SQL> insert into t values(1,'yxy');

1 row created.

SQL> commit;

Commit complete.

SQL> select owner,constraint_name,constraint_type,last_change,SEARCH_CONDITION from dba_constraints where table_name='T';

OWNER CONSTRAINT_NAME C LAST_CHANGE SEARCH_CONDITION
---------- ------------------------------ - -------------- --------------------------------------------------
YXYUP ID_C C 20071217183919 id=0 or id=1

oracle@test:/home/oracle #exp yxyup/abc123 tables=t file=t.dmp log=t.log

Export: Release 10.2.0.3.0 - Production on Mon Dec 17 18:45:17 2007

Copyright (c) 1982, 2005, Oracle. All rights reserved.


Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - 64bit Production
With the Partitioning and Data Mining options
Export done in ZHS16GBK character set and AL16UTF16 NCHAR character set

About to export specified tables via Conventional Path ...
. . exporting table T 1 rows exported
Export terminated successfully without warnings.

oracle@test:/home/oracle #imp yxyup/abc123 tables=t file=t.dmp log=t.log rows=N ignore=Y

Import: Release 10.2.0.3.0 - Production on Mon Dec 17 18:45:23 2007

Copyright (c) 1982, 2005, Oracle. All rights reserved.


Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - 64bit Production
With the Partitioning and Data Mining options

Export file created by EXPORT:V10.02.01 via conventional path
import done in ZHS16GBK character set and AL16UTF16 NCHAR character set
. importing YXYUP's objects into YXYUP
. importing YXYUP's objects into YXYUP
Import terminated successfully without warnings.

SQL> r
1* select owner,constraint_name,constraint_type,last_change,SEARCH_CONDITION from dba_constraints where table_name='T'

OWNER CONSTRAINT_NAME C LAST_CHANGE SEARCH_CONDITION
---------- ------------------------------ - -------------- --------------------------------------------------
YXYUP ID_C C 20071217183919 id=0 or id=1

SQL> r
1* select owner,constraint_name,constraint_type,last_change,SEARCH_CONDITION from dba_constraints where table_name='T'

OWNER CONSTRAINT_NAME C LAST_CHANGE SEARCH_CONDITION
---------- ------------------------------ - -------------- --------------------------------------------------
YXYUP ID_C C 20071217183919 id=0 or id=1

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

上一篇: 很NX的一段话
请登录后发表评论 登录
全部评论
暂无介绍

注册时间:2007-12-06

  • 博文量
    164
  • 访问量
    1314350