DBAsupport.com Forums - Powered by vBulletin
Results 1 to 3 of 3

Thread: deferr constraint on the remote DB!!

  1. #1
    Join Date
    Aug 2000
    Posts
    194
    Hi:

    I have the following situation.

    I want to copy data between two remote databases with the constraints deferred.


    1, Alter session set constraints=deferred ;

    2, insert into tab1@remt1 select * from tab1@remt2 ;

    insert into tab2@remt1 select * from tab2@remt2 ;

    3, Alter session set constraints=default ;

    when I tried this I get the "Parent Key Violation", etc errors.
    If I do the insert on the local site where the constraint is deferred, there is no errors.
    (ie,
    Alter session set constraints=deferred ;

    insert into tab1 select * from tab1@remt2 ;

    Alter session set constraints=default ;
    )

    I am wondering, is there any way to set the constaints deferred on the remote site.

    Thanks ..

  2. #2
    Join Date
    Feb 2001
    Posts
    203
    I think the problem is coming because of the old data in tab1.
    Before you are loading the data into the table first truncate or delete the rows from that table. If all ready data is there in that table and the inserted data is match with the old data then you will get problem(In Parent Key). Normally when i copy the data from one table to another table(Remote) I will go like this.

    DISABLE THE FK
    TRUNCATE TABLE
    COPY DATA FROM TABLE(One to another) with the copy command.
    enable FK.

    Good Luck
    sree

  3. #3
    Join Date
    Aug 2000
    Posts
    194
    Disabling the constraint "DISABLE" it for all sessions. I just want to deferr it for my session.

    The problem was, becaz I do not copy the data in any order. The parent table could be copied at any point after or before the child table is copied. (Thats why I want to find whether Deferr constraint work with DBLINKS)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Click Here to Expand Forum to Full Width