Reg: drop unique indexes.

Hi friends,
How do I remove the Unique index of the table.when I fire below set out its me gives error...

ALTER Table employees
Drop the IX_employeename_01 constraints

ORA-02443: cannot delete constraint - constraint does not exist

Please suggest.

Regards,
Aude
drop index IX_employeename_01

The integrity of the data is maintained by a unique index not by constraint.

Ravi Kumar

Tags: Database

Similar Questions

  • abstract unique index

    Hi guru.

    The idea

    Let's say there's a transformation g: X = > Y

    for the normal unique index this transformation is the mapping on his own game.

    Let's now if I have another transformation that I defined. g' which maps to another set.

    Will I be able to define a unique index as such.

    For example.

    I have a sample of 1 to 1000000 of id

    and I have this g'(id) function of probability which gives the value of 0 to 1

    For example, g'(1) = 0.67 and g'(10) = 0.67

    so in this case if I id = 1 in my table I wouldn't have id = 10

    How can I do this in Oracle?

    create or replace function dettest (p number) deterministic return as number

    Start

    dbms_output.put_line ('in dettest');

    Return floor (p);

    end;

    /

    drop table xx;

    Select * from xx

    create table xx select level double x connect by level<=>

    Drop index xx_fbi

    create index xx_fbi on xx (dettest (x));

    create an index only xx_fbi_uni on xx (dettest (x));

    analyze table xx statistical calculation;

    exec dbms_output.put_line (' select 1 St: ');

    Select x, dettest (x) in xx;

    exec dbms_output.put_line (' 2nd select: "");

    Select x, dettest (x) in xx;

    Insert into xx select 1.2 double;

    Drop index xx_fbi_uni

    Insert into xx select 1.2 double;

  • Accompanied by primary key to a non-unique index?

    Met a weird situation today. A utility, we set up which allows analysts to restore the data in their paintings, started failed when it attempted to drop an index. The index supported a primary key. Makes sense. But our script was supposed to be only an attempt to drop/recreate the nonunique indexes. It turns out that supported on the primary key index was not unique and to the best of my knowledge has emerged as follows:
    SQL> create table junk (f number(1));
    
    Table created.
    
    SQL> create index junk_ix on junk(f);
    
    Index created.
    
    SQL> select UNIQUENESS from DBA_INDEXES where index_name = 'JUNK_IX';
    
    UNIQUENES
    ---------
    NONUNIQUE
    
    SQL> alter table forbesc.junk add constraint junk_pk primary key (f) using index junk_ix;
    
    Table altered.
    
    SQL> select UNIQUENESS from DBA_INDEXES where index_name = 'JUNK_IX';
    
    UNIQUENES
    ---------
    NONUNIQUE
    
    SQL> insert into junk values (1);
    
    1 row created.
    
    SQL> insert into junk values (1);
    insert into junk values (1)
    *
    ERROR at line 1:
    ORA-00001: unique constraint (FORBESC.JUNK_PK) violated
    
    
    SQL> select index_name from dba_constraints where constraint_name = 'JUNK_PK';
    
    INDEX_NAME
    ------------------------------
    JUNK_IX
    What I can't understand, is how an index is not unique is to apply oneness. I thought it was the key to this process. I thought that perhaps an index with the 'SYS_123456' has be created, perhaps, but I couldn't find a:
    SQL> select object_name, object_type from dba_objects order by created desc;
    
    
    OBJECT_NAME   OBJECT_TYPE
    -------------------------------------------     
    JUNK_IX     INDEX
    JUNK     TABLE
    ...
    How the uniqueness is get applied in this case? It comes in Oracle 11.1.0.7

    Thank you
    -= Chuck

    It has always been like that. Oracle can and will use a non-unique index to apply a constraint to PK, the existing index just needs to have the columns PK as the leader or the columns in the index:

    SQL> create table t (id number, id1 number, descr varchar2(10));
    
    Table created.
    
    SQL> create index t_ids on t(id, id1);
    
    Index created.
    
    SQL> select index_name from user_indexes
      2  where table_name = 'T';
    
    INDEX_NAME
    ------------------------------
    T_IDS
    
    SQL> alter table t add constraint t_pk
      2  primary key (id);
    
    Table altered.
    
    SQL> select index_name from user_indexes
      2  where table_name = 'T';
    
    INDEX_NAME
    ------------------------------
    T_IDS
    
    SQL> insert into t values (1, 1, 'One');
    
    1 row created.
    
    SQL> insert into t values (1, 2, 'Two');
    insert into t values (1, 2, 'Two')
    *
    ERROR at line 1:
    ORA-00001: unique constraint (OPS$ORACLE.T_PK) violated
    

    John

  • ORA-01502 error in the case of a unique index unusable and dml in bulk

    Hi all.

    The BP is 11.2.0.3 on a linux machine.

    I did a unique index unusable and issued a dml on the table.
    Howerver, oracle gave me the error ORA-01502.

    In order to avoid the ORA-01502 error, should I drop the unique index and bulk make dml and rebuild the index?

    Or is there another solution without recreating the unique index?
    create table hoho.abcde as
    select level col1 from dual connect by level <=1000 
    
    10:09:55 HOHO@PD1MGD>create unique index hoho.abcde_dx1 on hoho.abcde (col1);
    
    Index created.
    
    10:10:23 HOHO@PD1MGD>alter index hoho.abcde_dx1 unusable;
    
    Index altered.
    
    Elapsed: 00:00:00.03
    10:11:27 HOHO@PD1MGD>delete from hoho.abcde where rownum < 11;
    delete from hoho.abcde where rownum < 11
    *
    ERROR at line 1:
    ORA-01502: index 'HOHO.ABCDE_DX1' or partition of such index is in unusable state
    Thanks in advance.
    Best regards.
    Do I have to accept the unique index maintenance workload(undo generation/redo for undo generation)
    when doing bulk dml?
    

    I think so.

    The amount of data you load compared to existing data in the table?

    If say for example, you add 20%, and then to compare the retention of 20% adds data during the major part collect to create all of the index after insertion so
    you choose the drop/recreate the unique index

    Best regards

    Mohamed Houri
    www.hourim.WordPress.com

  • Unique index with TRIM

    I want to create a unique constraint with TRIM, I get the error message. Is there a way...
    ALTER TABLE core_business.cb_pensioner ADD CONSTRAINT unique_claim_no UNIQUE(TRIM (claim_no))   deferrable initially deferred NOVALIDATE;
    
    ORA-00904: : invalid identifier

    Pre 11g - unique index; 11g go - virtual columns.

    SQL> create table t1
      2  (col1 varchar2(10));
    
    Table created.
    
    SQL> alter table t1 add constraint uk_t1 unique (trim(col1));
    alter table t1 add constraint uk_t1 unique (trim(col1))
                                                *
    ERROR at line 1:
    ORA-00904: : invalid identifier
    
    SQL> create unique index i1 on t1 (trim(col1));
    
    Index created.
    
    ... virtual column method ...
    
    SQL> drop index i1;
    
    Index dropped.
    
    SQL> alter table t1 add col2 as (trim(col1));
    
    Table altered.
    
    SQL> alter table t1 add constraint uk_t1 unique (col2);
    
    Table altered.
    
    SQL> insert into t1 (col1) values ('1');
    
    1 row created.
    
    SQL>  insert into t1 (col1) values ('1  ');
     insert into t1 (col1) values ('1  ')
    *
    ERROR at line 1:
    ORA-00001: unique constraint (RIMS.UK_T1) violated
    
    SQL> select * from t1;
    
    COL1       COL2
    ---------- ----------
    1          1
    
    SQL> 
    
  • unique index on two columns

    Hi all
    I want a unique index on two columns, but when I try this it will show me
      1  CREATE UNIQUE INDEX sale_order_no
      2*   ON sale_order (sale_order_no, season_year)
    SQL> /
      ON sale_order (sale_order_no, season_year)
         *
    ERROR at line 2:
    ORA-01452: cannot CREATE UNIQUE INDEX; duplicate keys found
    I want to do not overlap with the combination of these two

    Plaese Guide
    Thanks and greetings
    Vikas

    You would this behavior if SALE_ORDER_NO has NULL values. If it contains NULL values, a unique single-column index will succeed but an index unique multi-column will fail when it finds duplicates in SEASON_YEAR.

    See:

    SQL> create table dummy_objects (object_id  number, object_owner varchar2(30), object_name varchar2(30));
    
    Table created.
    
    SQL> insert into dummy_objects values (0,'HEMANT','TABLE_A');
    
    1 row created.
    
    SQL> insert into dummy_objects values (1,'HEMANT','TABLE_B');
    
    1 row created.
    
    SQL> insert into dummy_objects values (NULL,'HEMANT','NULL_1');
    
    1 row created.
    
    SQL> insert into dummy_objects values (NULL,'HEMANT','NULL_2');
    
    1 row created.
    
    SQL> create unique index dummy_objects_u1 on dummy_objects(object_id);
    
    Index created.
    
    SQL> drop index dummy_objects_u1;
    
    Index dropped.
    
    SQL> create unique index dummy_objects_u2 on dummy_objects(object_id, object_owner);
    create unique index dummy_objects_u2 on dummy_objects(object_id, object_owner)
                                            *
    ERROR at line 1:
    ORA-01452: cannot CREATE UNIQUE INDEX; duplicate keys found
    
    SQL>
    

    Hemant K Collette
    http://hemantoracledba.blogspot.com

  • How to add a column to an existing unique index?

    Hello

    I have a unique index defined on 5 columns in a table. I want to add a column more to the unique index. Is there one solution other than to drop and create the index?

    Also please let me know which is the ideal way to do it. The table has about 80 million documents.


    Thanks in advance,
    Noble.

    None...

    but creating the new index before your previous fall, the previous will be helping to create the new index faster.

    Abhishek Gera

  • Why is a unique index created implicitly on a CLOB column?

    Hello.

    On a 9.2.0.7 db I modified a table to change a column in a CLOB, I saw that a unique index was implicitly created for the new column.
    This is the normal of the alter behavior when you change a Long on the CLOB type? Why?

    It's strange to me because later I inserted 3 folders on the table with the same text in the CLOB column (I guess the backs of oneness does not refer to the ascii content). What is unique?
    SQL> select index_name, index_type, uniqueness from user_indexes where table_name = 'R2_CONFIG' and index_type = 'LOB';
    
    INDEX_NAME                     INDEX_TYPE                  UNIQUENES
    ------------------------------ --------------------------- ---------
    SYS_IL0000012898C00006$$       LOB                         UNIQUE
    Thanks in advance.

    fsanchezherrero wrote:

    I also noticed that I can not rebuild the index for the tablespace where the other indexes. Is this normal?

    As I said, Oracle maintains LOBINDEX internal. You can not just move to a different tablespace. And unless you're on 8.0, you can't even set/alter tablespace using ALTER TABLE, although Oracle allows you to specify CREATE TABLE:

    SQL> create table t(id number,c clob)
      2  lob(c) store as c_clob(index(tablespace example))
      3  /
    
    Table created.
    
    SQL> select index_name, index_type,tablespace_name from user_indexes where table_name = 'T';
    
    INDEX_NAME                     INDEX_TYPE                  TABLESPACE_NAME
    ------------------------------ --------------------------- ------------------------------
    SYS_IL0000109090C00002$$       LOB                         USERS
    
    SQL> drop table t
      2  /
    
    Table dropped.
    
    SQL> create table t(id number,c clob)
      2  lob(c) store as c_clob(tablespace example index(tablespace users))
      3  /
    
    Table created.
    
    SQL> select index_name, index_type,tablespace_name from user_indexes where table_name = 'T';
    
    INDEX_NAME                     INDEX_TYPE                  TABLESPACE_NAME
    ------------------------------ --------------------------- ------------------------------
    SYS_IL0000109093C00002$$       LOB                         EXAMPLE
    

    At least they fixed ALTER TABLE:

    SQL> alter table t modify lob(c) (index(tablespace userts))
      2  /
    alter table t modify lob(c) (index(tablespace userts))
                                       *
    ERROR at line 1:
    ORA-22853: invalid LOB storage option specification
    

    SY.

  • Creation of a PK via Create Unique Index key more OR through PK restrict only

    What is "significance" of the following difference: -.

    Some PK indexes in the database that I deal with are scripted by creating a Unique index first, then adding the PK constraint with syntax "using the index.

    Others simply create the PK using the addition of the primary key constraint syntax.

    We're much better than the other or where in the documentation would review it? I can't find that he discusses more probably looking in the wrong book.

    Thanks in advance. Bill

    Hi Bill,

    If you create a unique index first then add PK constraint or create a PK constraint directly, one and the same.

    Say, there is a unique index on the column 'a' and now you want to apply PK constraint on the same column, instead of dropping the index and re-create the same, you can use the existing one. It's ok if the amount of data is less, but for a huge amount of data, it is a killer.

    Here's a little comparison of the two cases:

    SQL> drop table t purge;
    
    Table dropped.
    
    SQL> create table t ( a number);
    
    Table created.
    
    SQL> create unique index t_idx on t(a);
    
    Index created.
    
    SQL> alter table t add constraint t_pk primary key (a) using index t_idx;
    
    Table altered.
    
    SQL> select uniqueness from user_indexes where index_name = 'T_IDX';
    
    UNIQUENES
    ---------
    UNIQUE
    
    SQL> select constraint_name, constraint_type, index_name from user_constraints where table_name = 'T';
    
    CONSTRAINT_NAME                C INDEX_NAME
    ------------------------------ - ------------------------------
    T_PK                           P T_IDX
    
    SQL>
    SQL>
    SQL>
    SQL>
    SQL>
    SQL>
    SQL>
    SQL>
    SQL>
    SQL>
    SQL> drop table t purge;
    
    Table dropped.
    
    SQL> create table t ( a number);
    
    Table created.
    
    SQL> alter table t add constraint t_pk primary key (a);
    
    Table altered.
    
    SQL> select uniqueness from user_indexes where index_name = 'T_PK';
    
    UNIQUENES
    ---------
    UNIQUE
    
    SQL> select constraint_name, constraint_type, index_name from user_constraints where table_name = 'T';
    
    CONSTRAINT_NAME                C INDEX_NAME
    ------------------------------ - ------------------------------
    T_PK                           P T_PK
    
    SQL>
    

    I hope that the answer was clear.

    Concerning

    Asif Momen
    http://momendba.blogspot.com

  • Why choose wrong explain plan when there is a unique index

    SQL > create table test in select * from dba_objects;

    Table created.

    SQL > create table test1 in select * from user_objects;

    Table created.

    SQL > create index unique i_test_1 on test (object_id);

    The index is created.

    SQL > exec dbms_stats.gather_table_stats (user, 'TEST');

    PL/SQL procedure successfully completed.

    SQL > exec dbms_stats.gather_table_stats (user, 'TEST1');

    PL/SQL procedure successfully completed.

    SQL > set autot trace
    SQL > select test1.* from test, test1 where test.object_id = test1.object_id;

    23037 selected lines.


    Execution plan
    ----------------------------------------------------------
    Hash value of plan: 3995284093

    -------------------------------------------------------------------------------
    | ID | Operation | Name | Lines | Bytes | Cost (% CPU). Time |
    -------------------------------------------------------------------------------
    | 0 | SELECT STATEMENT | 23038 | 2114K | 77 (12) | 00:00:01 |
    | 1. NESTED LOOPS | 23038 | 2114K | 77 (12) | 00:00:01 |
    | 2. TABLE ACCESS FULL | TEST1 | 23038 | 2002K | 70 (3) | 00:00:01 |
    |* 3 | INDEX UNIQUE SCAN | I_TEST_1 | 1. 5. 0 (0) | 00:00:01 |
    -------------------------------------------------------------------------------

    Information of predicates (identified by the operation identity card):
    ---------------------------------------------------

    3 - access("TEST".") OBJECT_ID '= 'TEST1'.' OBJECT_ID')


    Statistics
    ----------------------------------------------------------
    494 recursive calls
    0 db block Gets
    26457 consistent gets
    0 physical reads
    0 redo size
    1090589 bytes sent via SQL * Net to client
    17270 bytes received via SQL * Net from client
    1537 SQL * Net back and forth to and from the client
    5 kinds (memory)
    0 sorts (disk)
    23037 rows processed


    SQL > drop index i_test_1;

    The index is deleted.

    SQL > create index i_test_1 on test (object_id);

    The index is created.

    SQL > set autot trace
    SQL > select test1.* from test, test1 where test.object_id = test1.object_id;

    23037 selected lines.


    Execution plan
    ----------------------------------------------------------
    Hash value of plan: 845425162

    --------------------------------------------------------------------------------
    --

    | ID | Operation | Name | Lines | Bytes | Cost (% CPU). Time
    |

    --------------------------------------------------------------------------------
    --

    | 0 | SELECT STATEMENT | 23038 | 2114K | 99 (6) | 00:00:02
    |

    |* 1 | HASH JOIN | 23038 | 2114K | 99 (6) | 00:00:02
    |

    | 2. FULL RESTRICTED INDEX SCAN FAST | I_TEST_1 | 49887 | 243K | 27 (4) | 00:00:01
    |

    | 3. TABLE ACCESS FULL | TEST1 | 23038 | 2002K | 70 (3) | 00:00:01
    |

    --------------------------------------------------------------------------------
    --


    Information of predicates (identified by the operation identity card):
    ---------------------------------------------------

    1 - access("TEST".") OBJECT_ID '= 'TEST1'.' OBJECT_ID')


    Statistics
    ----------------------------------------------------------
    1 recursive calls
    0 db block Gets
    1936 complies
    411 physical reads
    0 redo size
    1090589 bytes sent via SQL * Net to client
    17270 bytes received via SQL * Net from client
    1537 SQL * Net back and forth to and from the client
    0 sorts (memory)
    0 sorts (disk)
    23037 rows processed

    I think the hash join is the real plan, why choose nest loop where there is a unique index.

    Jinyu wrote:
    I think that thought cbo cost single scan index is 0, so loop nest is less expensive than the hash join, but I do not know why here costs 0

    Jinyu,

    You are right - in a nested loop, the CBO gives unique access by unique index value slightly cheaper than the same access by a non-unique index--essentially subtracting 1 of the normal cost.

    It is one of the reasons why you only need to create a no unique index to support a unique constraint, if you have a very good reason - if you modify a unique index that is not unique, change of costs and execution of some paths may change.

    Concerning
    Jonathan Lewis

  • What is the difference between primary key and unique indexes with forced not null?

    Primary key is = unique index + not null?

    The short answer is Yes.

    However, even if the primary key, applying both uniquness and not null, there is a notion of "special".

    You can only have one primary key in tables, but you can have multiple unique indexes and constraints not null.

    See: https://asktom.oracle.com/pls/asktom/f?p=100:11:0:P11_QUESTION_ID:8743855576462

  • How to find duplicate keys found when error ORA-01452: cannot CREATE a UNIQUE INDEX.

    Hi gurus,

    I fall for this stupid error

    "cannot CREATE a UNIQUE INDEX; duplicate keys found.


    It is that the Unique Index key is composed of multiple columns

    CREATE A UNIQUE KEY001AUTORISATIONS_APPORT ON TFT_AUTORISATIONS_APPORT INDEX

    (AUT_APPORTEUR, AUT_AGENCE, AUT_PRODUIT, AUT_OPTION, AUT_TARIF, AUT_DATE_AUTORISATION)

    TABLESPACE KEYS_TFT NOPARALLEL NOLOGGING

    Now,.

    My question is, how to find duplicates keys blocking Index creation?

    Thanks if you can help

    Run this query to display the list of the duplicates already existing.

    Select AUT_APPORTEUR, AUT_AGENCE, AUT_PRODUIT, AUT_OPTION, AUT_TARIF, AUT_DATE_AUTORISATION, count (1) as cnt

    of TFT_AUTORISATIONS_APPORT

    Group

    AUT_APPORTEUR, AUT_AGENCE, AUT_PRODUIT, AUT_OPTION, AUT_TARIF, AUT_DATE_AUTORISATION

    view count (1) > 1

    Concerning

    NJ

  • When I change a column is a primary key the associated non-unique index to become unique?

    So basically I already tried this and it shows me that the associated index is not unique.

    create table employees2 in select * from employees;

    create index emp_idx on employees2 (employee_id);

    ALTER employees2 table add primary key (employe_id) using index emp_idx;

    Select * from user_indexes where index-name = "EMP_IDX";

    I was wondering if I right assuming that when you change a column to a primary key or unique while using a given index that does not have the respective index become unique.

    The textbooks I use are sometimes a little hard to understand because of the wording, also, I want to just ask someone with a little more experience than me.

    Thank you.

    your test did give the correct answer: the index is not unique if it serves to bear a unique or primary key constraint. Indeed, it is one of the benefits of the use of no unique indexes in support of UK/PK constraints (since it allows to set the unusable index before to make bulk loads; and, of course, they have also some disadvantages - for example, they need an additional logical reading to reach a line). Richard Foote explains the details in https://richardfoote.wordpress.com/2008/06/04/primary-keys-and-non-unique-indexes-whats-really-happening/ (and other items).

  • How to find the unique index to break the record?

    Hello

    When I do an UPDATE on a table how can I accumulate documents violates a unique index on the table? Is there something like "EXCEPTIONS IN" when using ALTER TABLE MODIFY CONSTRAINT... ENABLE VALIDATE EXCEPTIONS IN...?

    Oracle DB 10g

    Look in the logging of DML errors

    ORACLE-BASE - DML Oracle 10 g Release 2 of the database connection error

  • Duplicate display of unique indexes on diagram - how to remove?

    Hey people,

    A little new for the Modeler and I have a problem with a table I did where a unique index appears twice on my diagram.  I can't understand how to remove it.

    Any ideas?

    Thanks for the help!

    Eric

    In fact you need to look at the bitty little next to each icon and you will see that they are different. What you have is a unique index and a unique key constraint. Different objects in the database named but identical by the Data Modeler (which is automatically generated index when you declared the constraint). If you go to the properties of the table and click on the index node you will see. Now, click on the single key node and you will see the same name. Right-click on the table in the diagram and choose the DOF preview. After the create table code, you should see a create index command and create a unique alter constraint table.

    Why do you need both - constraint and different index information give the optimizer. You can do without one or the other - maybe. Tom Kyte wrote a note on this subject a while back on AskTom. If you're really curious, go here (I don't remember the details).

Maybe you are looking for

  • iOS 10 music playback problems

    Is anyone else having issues with playing music after that 10 updated ios? For example, when listening to music a song will suddenly stop and start a new song. Or the next song will not begin at the beginning that it will start a few seconds or in th

  • Last update of MS causing poor performance and broken aps

    We have recently updated our computer with the last update of security of Ms. Since then, none of our computer games (hearts, purple place, etc.) will not charge, and more often than not, when we opened pages on the internet they will not actually be

  • How to download music content of the smartphone BlackBerry 8530 for Windows Media Player?

    Connect the Blackberry Curve 8530 to USB connection default to the Windows Vista system to Windows Media Player-device Set Up to Blackberry8530.  Choose to synchronize give 2 options in manage files on existing device.  Leave or delete existing files

  • Cisco 1941 hit crypto speed limit

    I have read the documentation about the 85Meg / 170 Meg limit on the SRI G2s As far as I know - this does NOT apply to the 1941. I have a 1941 with sec - k9 license, you can not buy a license of h - s for this device. " The SSEC-K9 license removes th

  • Settles is not up to date pictures thumbnails

    I just had to rebuild my macbook pro and installed a new version of Lightroom CC previously I would incorporate new images, then move them into LR and new records. In doing so, the file and the thumbnail moved to the new folder. Now when I drag the t