I think we've resolved that now
SQL> CREATE TABLE redef_tab (
2 id NUMBER,
3 description VARCHAR2(50),
4 nn_col int not null,
5 nn2_col int,
6 CONSTRAINT redef_tab_pk PRIMARY KEY (id),
7 constraint redef_tab_ck check ( nn2_col is not null )
8 );
Table created.
SQL>
SQL> desc redef_tab
Name Null? Type
----------------------------------------------------------------------- -------- ------------------------------------------------
ID NOT NULL NUMBER
DESCRIPTION VARCHAR2(50)
NN_COL NOT NULL NUMBER(38)
NN2_COL NUMBER(38)
SQL> select * from user_constraints
2 where table_name = 'REDEF_TAB'
3 @pr
==============================
OWNER : MCDONAC
CONSTRAINT_NAME : SYS_C0061374
CONSTRAINT_TYPE : C
TABLE_NAME : REDEF_TAB
SEARCH_CONDITION : "NN_COL" IS NOT NULL
SEARCH_CONDITION_VC : "NN_COL" IS NOT NULL
R_OWNER :
R_CONSTRAINT_NAME :
DELETE_RULE :
STATUS : ENABLED
DEFERRABLE : NOT DEFERRABLE
DEFERRED : IMMEDIATE
VALIDATED : VALIDATED
GENERATED : GENERATED NAME
BAD :
RELY :
LAST_CHANGE : 03-MAR-18
INDEX_OWNER :
INDEX_NAME :
INVALID :
VIEW_RELATED :
ORIGIN_CON_ID : 0
==============================
OWNER : MCDONAC
CONSTRAINT_NAME : REDEF_TAB_CK
CONSTRAINT_TYPE : C
TABLE_NAME : REDEF_TAB
SEARCH_CONDITION : nn2_col is not null
SEARCH_CONDITION_VC : nn2_col is not null
R_OWNER :
R_CONSTRAINT_NAME :
DELETE_RULE :
STATUS : ENABLED
DEFERRABLE : NOT DEFERRABLE
DEFERRED : IMMEDIATE
VALIDATED : VALIDATED
GENERATED : USER NAME
BAD :
RELY :
LAST_CHANGE : 03-MAR-18
INDEX_OWNER :
INDEX_NAME :
INVALID :
VIEW_RELATED :
ORIGIN_CON_ID : 0
==============================
OWNER : MCDONAC
CONSTRAINT_NAME : REDEF_TAB_PK
CONSTRAINT_TYPE : P
TABLE_NAME : REDEF_TAB
SEARCH_CONDITION :
SEARCH_CONDITION_VC :
R_OWNER :
R_CONSTRAINT_NAME :
DELETE_RULE :
STATUS : ENABLED
DEFERRABLE : NOT DEFERRABLE
DEFERRED : IMMEDIATE
VALIDATED : VALIDATED
GENERATED : USER NAME
BAD :
RELY :
LAST_CHANGE : 03-MAR-18
INDEX_OWNER : MCDONAC
INDEX_NAME : REDEF_TAB_PK
INVALID :
VIEW_RELATED :
ORIGIN_CON_ID : 0
PL/SQL procedure successfully completed.
SQL>
SQL>
SQL> insert into redef_tab values (1,'x',11,21);
1 row created.
SQL> insert into redef_tab values (2,'x',12,22);
1 row created.
SQL> insert into redef_tab values (3,'x',13,23);
1 row created.
SQL>
SQL> EXEC DBMS_REDEFINITION.can_redef_table(user, 'REDEF_TAB');
PL/SQL procedure successfully completed.
SQL>
SQL> CREATE TABLE redef_tab2 (
2 id NUMBER,
3 description VARCHAR2(50),
4 nn_col int,
5 nn2_col int
6 );
Table created.
SQL>
SQL> EXEC DBMS_REDEFINITION.start_redef_table(user, 'REDEF_TAB', 'REDEF_TAB2');
PL/SQL procedure successfully completed.
SQL>
SQL> SET SERVEROUTPUT ON
SQL> DECLARE
2 error_count pls_integer := 0;
3 BEGIN
4 DBMS_REDEFINITION.COPY_TABLE_DEPENDENTS(user,
5 'REDEF_TAB',
6 'REDEF_TAB2',
7 dbms_redefinition.cons_orig_params ,
8 TRUE,
9 TRUE,
10 TRUE,
11 FALSE,
12 error_count);
13 DBMS_OUTPUT.PUT_LINE('errors := ' || TO_CHAR(error_count));
14 END;
15 /
errors := 0
PL/SQL procedure successfully completed.
SQL>
SQL> EXEC DBMS_REDEFINITION.finish_redef_table(user, 'REDEF_TAB', 'REDEF_TAB2');
PL/SQL procedure successfully completed.
SQL>
SQL> desc redef_tab
Name Null? Type
----------------------------------------------------------------------- -------- ------------------------------------------------
ID NOT NULL NUMBER
DESCRIPTION VARCHAR2(50)
NN_COL NOT NULL NUMBER(38)
NN2_COL NUMBER(38)
SQL> select * from user_constraints
2 where table_name = 'REDEF_TAB'
3 @pr
==============================
OWNER : MCDONAC
CONSTRAINT_NAME : REDEF_TAB_CK
CONSTRAINT_TYPE : C
TABLE_NAME : REDEF_TAB
SEARCH_CONDITION : nn2_col is not null
SEARCH_CONDITION_VC : nn2_col is not null
R_OWNER :
R_CONSTRAINT_NAME :
DELETE_RULE :
STATUS : ENABLED
DEFERRABLE : NOT DEFERRABLE
DEFERRED : IMMEDIATE
VALIDATED : VALIDATED
GENERATED : USER NAME
BAD :
RELY :
LAST_CHANGE : 03-MAR-18
INDEX_OWNER :
INDEX_NAME :
INVALID :
VIEW_RELATED :
ORIGIN_CON_ID : 0
==============================
OWNER : MCDONAC
CONSTRAINT_NAME : SYS_C0061374
CONSTRAINT_TYPE : C
TABLE_NAME : REDEF_TAB
SEARCH_CONDITION : "NN_COL" IS NOT NULL
SEARCH_CONDITION_VC : "NN_COL" IS NOT NULL
R_OWNER :
R_CONSTRAINT_NAME :
DELETE_RULE :
STATUS : ENABLED
DEFERRABLE : NOT DEFERRABLE
DEFERRED : IMMEDIATE
VALIDATED : VALIDATED
GENERATED : GENERATED NAME
BAD :
RELY :
LAST_CHANGE : 03-MAR-18
INDEX_OWNER :
INDEX_NAME :
INVALID :
VIEW_RELATED :
ORIGIN_CON_ID : 0
==============================
OWNER : MCDONAC
CONSTRAINT_NAME : REDEF_TAB_PK
CONSTRAINT_TYPE : P
TABLE_NAME : REDEF_TAB
SEARCH_CONDITION :
SEARCH_CONDITION_VC :
R_OWNER :
R_CONSTRAINT_NAME :
DELETE_RULE :
STATUS : ENABLED
DEFERRABLE : NOT DEFERRABLE
DEFERRED : IMMEDIATE
VALIDATED : VALIDATED
GENERATED : USER NAME
BAD :
RELY :
LAST_CHANGE : 03-MAR-18
INDEX_OWNER : MCDONAC
INDEX_NAME : REDEF_TAB_PK
INVALID :
VIEW_RELATED :
ORIGIN_CON_ID : 0
PL/SQL procedure successfully completed.
SQL>
SQL>
SQL>