Disable a constraints

hello,
i want to disable a constraints ,when i tried to disable a constraints iam getting error.the error is
ora-00054:resource busy and acquired with nowait specified.
how to over come this error.
by
ravikumar

This message appears when some other user is updating the rows after doing an exclusive lock.So you get this message saying that the resource is busy.
So you have to wait for that user to commit/rollback his transaction, only then you get go forward with you task

Similar Messages

  • I cannot Disable a constraint in SQL Developer

    Here is my issue:
    I have created a table already named practice1.
    Using SQL Developer PL/SQL try to run a loop as following:
    DECLARE
    COUNTER1  NUMBER(2);
    BEGIN
    COUNTER1 := 30;
    ALTER TABLE practice1
    DISABLE  CONSTRAINT PRK1;
    LOOP
    COUNTER1 := 30;
    INSERT INTO PRACTICE1
    VALUES (COUNTER1, 'test7', 8, 9);
    EXIT WHEN  COUNTER1 >26;
    END LOOP;
    END;
    In other words I Insert the COUNTER1 variable value as Primary Key in the tables field1 column.
    I run the script successfully without the ALTER TABLE DISABLE CONTSRAINT.. command.
    Everytime I run it I had to increase the starting value of Variable COUNTER1 so it will not attempt to insert a duplicate pre-existed value in Primary Key.
    Then I decided to insert the command ALTER TABLE DISABLE CONSTRAINT in order to not have to worry to change the starting value.
    I am able to disable the constraint by using the same command in isolation . If I run it as part of the script as above I get the following error:
    Error report:
    ORA-06550: line 5, column 1:
    PLS-00103: Encountered the symbol "ALTER" when expecting one of the following:
       ( begin case declare end exception exit for goto if loop mod
       null pragma raise return select update while with
       <an identifier> <a double-quoted delimited-identifier>
       <a bind variable> << continue close current delete fetch lock
       insert open rollback savepoint set sql execute commit forall
       merge pipe purge
    06550. 00000 -  "line %s, column %s:\n%s"
    *Cause:    Usually a PL/SQL compilation error.
    *Action:
    I would appreciate any suggestions.
    Thank you.

    Your question has NOTHING to do with sql developer.
    Mark this question ANSWERED and repost it in the SQL and PL/SQL forum.
    https://forums.oracle.com/community/developer/english/oracle_database/sql_and_pl_sql
    The problem is that you CANNOT execute DDL directly in PL/SQL. You need to use dynamic SQL to execute DDL within PL/SQL.
    EXECUTE IMMEDIATE 'ALTER TABLE . . .';
    If you need more help use the correct forum as shown above.

  • Can I disable a constraint in a stored procedure

    Hi,
    I wish to disable a constraint and then enable after I do a certain insert into a database, In my procedure I put the 'ALTER ..DISABLE' command straight after the begin and the the 'ALTER..ENABLE' just before the exit command but I keep getting a compile error. Any suggestions?

    Since ALTER TABLE is DDL, you would have to use dynamic SQL in order to call it from PL/SQL, i.e.
    BEGIN
      EXECUTE IMMEDIATE 'ALTER TABLE ... DISABLE';
      <<do something>>
      EXECUTE IMMEDIATE 'ALTER TABLE ... ENABLE';
    END;Of course, since you're executing DDL, you'll be implicitly committing after both dynamic SQL statements.
    A better approach, though, may be declare the constraint to be deferrable and do
    EXECUTE IMMEDIATE 'ALTER SESSION SET CONSTRAINTS = DEFERRED'since that doesn't implicitly commit. You can also avoid having to hard-code constraint names in strings in your code. Plus, the constraints will be automatically checked when you commit.
    Justin

  • Disable ingegrity constraint, then re-enable w/deletion of violations?

    Suppose table2 has a foreign-key relationship with table1. Is there any way to disable that constraint on table2, delete a huge number of records from table1, then re-enable the constraint on table 2... telling Oracle to simply delete any records it finds in table2 that no longer satisfy the constraint?
    Or, alternatively, is there a way to cascade the deletes, but defer the cascaded deletion until all the records that are going to be deleted from the current table have, in fact, been deleted (or at least marked for deletion)?
    For the record, the real situation is nowhere near this trivial... we have a table with ~2 billion records that's partitioned by range on its primary key (from which we want to drop a partition containing ~300 million records) and has dozens of downstream tables with foreign key relationships leading back to it.
    The good news is that this isn't a database that has to be kept online and available at all times for continual transaction processing. The foreign-key relationships are mainly there for the sake of academic correctness and self-documentation, and the records being purged are ancient and haven't even been part of a table scan for months. So we're not the least bit worried about having a row in table27 spend two hours on "death row" between the time its deletion becomes inevitable (by virtue of deleting an upstream record with a foreign-key chain leading back to it) and the time it gets physically deleted. Metaphorically, we just need a fast way to slice a chunk off from table1 with a chainsaw, then efficiently eliminate the witnesses from the downstream tables with a meat cleaver. :-)

    OK, let's suppose table1 is the big table with billions of records, from which I'm going to drop the first partition and ~250 million records contained within it.
    table2 has a foreign key relationship: table2.foo_id = table1.id
    table3 has a foreign key relationship to table2: table3.bar = table2.bar
    both foreign key relationships are deferrable, initially deferred.
    Now, partition #1 gets dropped, taking ~250 million records with it. I'm going to guess that the implicit commit comes at the end of that drop, and that's the point when Oracle officially notices that table2 has a foreign key relationship with table1 and parses through it to cascade the deletion and remove the newly-orphaned rows in table2.
    The big question is, when does table2's constraint come into effect? If Oracle defers the next implicit commit attempt until it finishes purging orphaned records from table2, then proceeds to cascade the deletion and purge orphaned records from table3 before its next attempted implicit commit, that's great.
    HOWEVER, I can see a conflict. DROP is a DDL statement that implicitly commits, but what about any DELETEs that get cascaded from it as an outcome of the drop? Do they fall under the single umbrella of the original DROP, or does something like this happen:
    Partition #1 of table1 gets dropped. implicit commit attempted, but foreign key relationship between table2 and table1 formally noticed. Oracle deletes the first orphaned row from table2, then tries to autocommit it... and notices that table3 has a FK relationship with table2. So it scans through table3, deletes any rows that the deletion of the first row from table2 will orphan, and autocommits that deletion. It then continues looking through table2 for the next orphaned row, deletes it, attempts to autocommit, notices the FK constraint (again) between table3 and table2, scans through table3 (again) looking for rows that will be orphaned by the deletion of the second row from table2, deletes them, and autocommits. Then repeats, over and over again, scanning all of table3 from top to bottom each time it deletes a row from table2.
    I have to admit I'm a little fuzzy about what exactly Oracle is doing ACID-wise behind the scenes, mainly because nothing I normally do really requires moment-to-moment integrity. All I really use transactions for is to conveniently undo the mess and restore the database to its original state if a program crashes for some reason, and try to sidestep them (and their overhead) entirely when I'm doing something manually with Toad or SQL*Plus that's time-consuming and doesn't need to keep the database in any kind of usable state between the time it starts and ends. But in the case of deferred integrity checks, I can see how encouraging Oracle to autocommit could actually make performance worse, by prematurely firing otherwise-deferrable constraints.

  • How to disable  all constraints on a table

    Hi ,
    I want to disable all constraints on a table
    select 'ALTER TABLE '||substr(c.table_name,1,35)||
    ' DISABLE CONSTRAINT '||constraint_name||' ;'
    from user_constraints c
    where c.table_name = MY_table;
    thanks in advance

    What is wrong with query you have?
    Why do you have substr around the table name?
    If you want to execute the output as well, do this,
    SET SERVEROUT ON
    BEGIN
       FOR i IN (SELECT 'ALTER TABLE ' || c.table_name || ' DISABLE CONSTRAINT ' || constraint_name AS l_sql, table_name, constraint_name
                   FROM user_constraints c
                  WHERE c.table_name = my_table_name)
       LOOP
          EXECUTE IMMEDIATE i.l_sql;
          DBMS_OUTPUT.PUT_LINE ('Disabled constraint ' || i.constraint_name || ' on table ' || i.table_name);
       END LOOP;
    END;
    /

  • DISABLE VALIDATE CONSTRAINT에 관하여(8I NEW)

    제품 : ORACLE SERVER
    작성날짜 : 2002-11-05
    DISABLE VALIDATE CONSTRAINT에 관하여(8I NEW)
    ===========================================
    개 요
    =======
    간단하게 설명하면, enable/disable은 향후 DML작업으로 추가되는 데이터에 대해
    constraint를 설정/해제한다는 의미이고,
    validate/novalidate는 constraint를 설정/해제할 때 기존 데이터의 constraint를
    보장하거나 보장하지 않는다는 것이다.
    아래에서 Version별 Constraint를 정리하였고, 여러 가지 설정에 각각에 대하여
    살펴보기로 한다.
    V7 V8 V8i
    enable enable validate* enable validate*
    enable novalidate enable no validate
    disable disable disable validate
    disable novalidate*
    * default
    1. ENABLE VALIDATE
    과거의 데이터건 향후의 데이터건 모든 데이터에 대해서 constraint를
    보장함을 의미.
    2. ENABLE NOVALIDATE
    향후의 모든 DML은 constraint의 적용을 받으나 기존 데이터에 대한 constraint는
    보장하지 않는다.
    3. DISABLE NOVALIDATE
    오라클은 더이상 모든 데이터에 대한 constraint를 보장하지 않는다.
    4. DISABLE VALIDATE
    설정된 constraint는 해제되고, 사용된 index는 drop된다. 그러나 table에 대한
    모든 DML은 허락되지 않기 때문에 기존 데이터의 constraint는 보장된다.
    즉 table은 freezing 되어 query만 허용된다.
    DISABLE VALIDATE의 용도
    ======================
    이 기능은 data warehousing에서 유용하게 이용될 수 있다. 우선 index 공간을
    절약하면서 uniqueness를 보장받을 수 있다.
    또한 range-partitioned table에 대량 데이터를 exchange partition 기능으로
    적재할 경우, 추가되는 partition의 데이터에 대해 constraint를 validate하기 위한 table scan을 하지 않으므로 성능을 향상시킬 수 있다.
    (물론 partition key와 PK key가 같아야 한다)
    만약 constraint가 DISABLE VALIDATE된 table에 DML작업을 실행하면 에러가 발생.
    ORA-25128: No insert/update/delete on table with
    constraint (x.x) disabled and validated
    DISABLE VALIDATE 예제
    =====================
    CREATE TABLE tbl_emp (
    empno NUMBER CONSTRAINT pk_emp PRIMARY KEY,
    ename VARCHAR2(20)
    SELECT constraint_name,validated,status FROM user_constraints
    WHERE table_name = 'TBL_EMP' ;
    CONSTRAINT_NAME VALIDATED STATUS
    PK_EMP VALIDATED ENABLED
    SELECT index_name , status FROM user_indexes
    WHERE table_name = 'TBL_EMP' ;
    INDEX_NAME STATUS
    PK_EMP VALID
    ALTER TABLE tbl_emp MODIFY CONSTRAINT pk_emp DISABLE VALIDATE ;
    SELECT constraint_name,validated,status FROM user_constraints
    WHERE table_name = 'TBL_EMP' ;
    CONSTRAINT_NAME VALIDATED STATUS
    C1 VALIDATED DISABLED
    SELECT index_name , status FROM user_indexes
    WHERE table_name = 'TBL_EMP' ;
    no rows selected
    delete from tbl_emp
    ERROR at line 1:
    ORA-25128: No insert/update/delete on table with constraint (SCOTT.PK_EMP) disabled and validated

  • How to disable all Constraints for a Table

    Hi There,
    So I have a table that I need to delete a significant amount of records from. Using some advice I found it better to select the records that I wanted to keep into a temporary table and then truncate the original table. After that I insert the contents of the temp table into the original table.
    So now I am thinking I could speed this up even more if I disable all the constraints on the original table.
    Is there an easy way to do this or do I need to disable each constraint individually?
    thanks
    John

    http://forums.oracle.com/forums/search.jspa?threadID=&q=disable+all+constraints+&objID=c84&dateRange=all&userID=&numResults=15

  • Error 90548: Disabling SSL constraint checking

    I'm trying to setup some LDAPAuthenticators (WLS 10.1) to connect securely with SSL. All the servers have valid keystores they use already, so I just switched to port 636, checked the SSLEnabled box, and setup a user and credential to connect as. But when the Admin server starts, it gives the error:
    <090548> The certificate chain received from peer contained a V3 CA certificate which was missing the basic constraints extension.
    Looking at the error codes, it says a work around is "...disable the basic constraints checking to allow the certificate chain to be accepted..." but I cannot find this anywhere in the admin console. Does anyone know what property this is talking about?
    Mike
    Update
    Found out it's a command line switch: -Dweblogic.security.SSL.enforceConstraints=off
    http://edocs.bea.com/wls/docs100/secmanage/ssl.html#wp1194486
    Edited by: prattm on Feb 4, 2009 7:51 PM

    Any one has any idea??/

  • How to Disable check constraint in cronacle

    Hi All,
    We found that one job failed in cronacle with the following error
    *ORA-20800: JCS-02138: problem with parameter "PRINT_BANNERPAGE"
    SAP recommended the soultion saying
    Disable the "Check Constraints" that are being used in the scripts currently in Cronacle or apply some patch.So we want to explore the first option i.e check constraint
    Can any one help me in Regarding the check constraints.
    Thanks in advance
    shylaja

    Hi,
    Scripts can have check constraints and reference contraints, you will find these under the script properties when you edit the script.
    I would set the constraint to optional, meaning that you still have the dropdown available but it no longer complains if it does not like the chosen value.
    Regards,
    Anton.

  • Drop parent table with disabled child constraints?

    I have a table I would like to drop and recreate. I do not want to have to recreate all the foreign key constraints again. Can I disable the foreign key constraints, drop the table and then recreate the table and enable the foreign key constraints?
    Thanks,
    John E.

    No.
    The Triggers,Indexes,Constraints etc, assocated with a table are bound to the table they are defined for.
    They owe their existance to the existance of the table.
    If the table goes, so do the constraints.
    If you have Oracle9i, can use DBMS_METADATA to generate the DDL script of the table before dropping it.

  • Disabling PK constraint

    Hi,
    When we create PK, it creates a unique index internally. Please share with me the internal index architecture and internal tables, like how it relates the index keys and the data.
    When we disable the PK Constraint, what is the outcome like dropping tables, etc., please give me more details, thank you.

    http://tahiti.oracle.com/

  • How to disabled all constraints when importing data (urgent)

    Hi,
    I am running import on my database. It’s dump file size 40GB & I forget to set import parameter constraint=N. due to that import is very slow.
    Could any body help me out.
    Thanks,
    AT

    Hi,
    >>due to that import is very slow
    I'm not sure whether this is the "source" of low performance, because just in the end of the process that integrity constraints are enabled.
    1) New tables are created. (Type definitions, Table definitions)
    2) Data is imported. (Table data)
    3) Indexes are built. (Table indexes)
    4) Triggers are imported. (integrity constraints, views, procedures, and triggers)
    5) Integrity constraints are enabled on the new tables.
    6) Any bitmap, functional, and/or domain indexes are built.
    Cheers
    Legatti

  • Deleting Datas from a table without disabling constraints.

    Hi,
    I am working in Oracle9i and solaris 5.8. In that i want to delete half of the datas in a table . the table contains one lakh rows but i need to delete only 50 thousand rows. But the table is constraints enabled.Please send me some queries how to delete the datas withput disabling the constraints.

    What type of constraint do you have ?
    In case of not null, unique, primary key constraint you can delete the rows without disabling the constraints.
    In case of referential integrity constraint you can also delete the rows without disable the constraints but you have to specify on delete cascade constraints clause. By doing so, Oracle will delete the rows in the child table as well.
    http://www.techonthenet.com/oracle/foreign_keys/foreign_delete.php

  • Constraint: disable validate returns error while trying to load data

    Hi,
    I may be missing something but this is what I'm facing:
    Table ttab has a primary key, let say ttab_pk, that I modified using this command: alter table ttab modify constraint ttab_pk disable validate.
    I thought I would be able to load new data with SQLLoader without any problem (sqlldr userid=myusr/mypwd control=myctl.ctl direct=TRUE), but I keep having this msg:
    SQL*Loader-951: Error calling once/load initialization
    ORA-02373: Error parsing insert statement for table MYSCHEMA.TTAB.
    ORA-25128: No insert/update/delete on table with constraint (MYSCHEMA.TTAB_PK) disabled and validated
    In what config the "disable validate" really work ?
    Thank a lot for any help.

    http://download.oracle.com/docs/cd/B10500_01/server.920/a96524/c22integ.htm
    # DISABLE NOVALIDATE is the same as DISABLE. The constraint is not checked and is not necessarily true.
    # DISABLE VALIDATE disables the constraint, drops the index on the constraint, and disallows any modification of the constrained columns. metalink
    Note <Note:69637.1> has a good discussion of DISABLE VALIDATE

  • Problem in enabling constraint - after disabling and truncation of table .

    Hello Friends,
    I have a table called DRR_TABLES that has list of table names . The requirement is to truncate the tables present in DRR_TABLES except KEY_IDS table and table_name like '%TYPE%' table.
    written a procedure . successfullly truncating the tables from DRR_TABLES but while enabling constraints after truncation , I am getting problem in enabling constraints .
    ERROR at line 1:
    ORA-02270: no matching unique or primary key for this column-list
    ORA-06512: at "schema123.TRUNCATE_DRR_TABLES ", line 49
    ORA-06512: at line 1
    Heres is the code .
    PROCEDURE TRUNCATE_DRR_TABLES is
    x varchar2(200);
    v_tablecount number := 0;
    cursor c is select TABLE_NAME from DRR_TABLES where population_source='PUBLISHING' and TABLE_NAME != 'KEY_IDS' and TABLE_NAME NOT LIKE '%TYPE%';
    BEGIN
    DBMS_OUTPUT.PUT_LINE (' TRUNCATING DRR TABLES ...........');
    OPEN c ;
    LOOP
    FETCH c INTO x ;
    EXIT WHEN c%NOTFOUND;
    for c1 in (select table_name, constraint_name from user_constraints where TABLE_NAME = x and status ='ENABLED' ORDER BY CONSTRAINT_TYPE DESC )
    loop
    begin
    execute immediate ('alter table '||c1.table_name||' disable constraint '||c1.constraint_name|| ' cascade');
    NULL;
    end;
    end loop;
    EXECUTE IMMEDIATE 'TRUNCATE TABLE ' || x ;
    v_tablecount := v_tablecount + 1 ;
    DBMS_OUTPUT.PUT_LINE('TABLE TRUNCATED :'|| x );
    END LOOP ;
    DBMS_OUTPUT.PUT_LINE (' TOTAL TABLES TRUNCATED ' || v_tablecount );
    CLOSE c;
    OPEN c ;
    LOOP
    FETCH c INTO x ;
    EXIT WHEN c%NOTFOUND;
    for c2 in (select table_name, constraint_name from user_constraints where TABLE_NAME = x and status = 'DISABLED' ORDER BY CONSTRAINT_TYPE)
    loop
    begin
    execute immediate ('alter table '||c2.table_name||' enable constraint '||c2.constraint_name);
    NULL;
    end;
    end loop;
    END LOOP ;
    CLOSE c ;
    END TRUNCATE_DRR_TABLES ;
    LINE 49 is the line corresponding to enable constraint statement.
    Edited by: kumar73 on 3 Sep, 2012 11:44 PM

    It is such a pity that a user having 321 posts till date is unaware of basics of Posting a Question.
    1. You need to provide us with your Oracle version
    select * from v$version;2. You need to understand and get accustomed to using tags before and after Code or SQL's for better readability.
    3. You need to provide us with the Table Structure and the Constraints Definition.
    There are many things that looks like Bad Coding practices:
    <font face="Times New Roman" size=2>
    1. Avoid RBAR (Loops).
    2. Implement Bulk Collect.
    3. Why do you need to disable the constraints before truncating? Are you kind of handling the Referential Integrity Constraints?
    4. Duplicate checking of Disabled Constraints.
    5. When the procedure is being executed at Production Environment, are you going to Monitor the DBMS_OUTPUT? Why not Log the Statements into a LOG Table?
    6. Why use a TableCount variable? Would the TableCount Variable be not equal to the Number of Records returned by Cursor C?
    7. What is the need to use a NULL statement after every Execute Immediate?
    8. What is the Need to surround each execute Immediate with Begin .. End block?
    9. Where is your Exception handling Block? Forgot to write?
    </font>
    What has been your effort in finding which Constraint/Table is causing you the trouble?                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

Maybe you are looking for

  • Refresh activities listed in workspace inbox automatically

    Hi, I have a split-n implemented inside a process. The activity is asigned to a group of persons with a specific role. The first person who executes the activity completes the activity and the process continues, but this activity is still shown in ot

  • Pulling hash out of loops (foreach)

    Hi, Hope this is the right group.  I have encountered variants of this off and on for some time, and would like to find a good explanation of what is going on.  In this case, I have a file with what I'll call "userid" on it, one per line: user01 user

  • R.I.P. Airport Express???

    Hi All, If after one year and one week of flawless operation (just outside warranty), my Airport Express stops producing any wireless signal, that probably means it's time for me to replace it! My internet connection started to slow down and an hour

  • Update print-dependent data

    When I make : SPRO -> Material Management-> Purchasing -> Message -> Output Control->Message Types->Define message type for purchase order->Fine-Tuned Control: Purchase Order Somebody could explain me what means the U=>Update print-dependent data If

  • Changing my dreamweaver licence over to a new computer. Microsoft laptop to an IMAC?

    Can anyone tell me how i go about transferring my Dreamweaver monthly licence from a Microsoft Laptop download over to an IMAC? Cheers Ellen