RELY约束

在使用logical standby的时候,如果在主库表上没有创建主键或者唯一键,建议使用RELY主键来替代,RELY并不生效,只是作为在SQL Apply的时候一个判断数据是否唯一的规则。
SQL> create table test_rely(id int,name varchar2(20));

Table created.

SQL> alter table test_rely add constraint rely_pk primary key (id) rely disable;

Table altered.

SQL> insert into test_rely values(1,'a');

1 row created.

SQL> insert into test_rely values(1,'a');

1 row created.

SQL> commit;

Commit complete.

SQL> select * from test_rely;

        ID NAME
---------- --------------------
         1 a
         1 a

SQL> select constraint_name,constraint_type,table_name,status from user_constraints where table_name='TEST_RELY';

CONSTRAINT_NAME                C TABLE_NAME                     STATUS
------------------------------ - ------------------------------ --------
RELY_PK                        P TEST_RELY                      DISABLED
-EOF-

你可能感兴趣的:(RELY约束)