Importing table data from one schema to another schema

Hi All,
I exported tablerows only of Schema A, and same I am trying to imported in Schema B.
While importing I am getting oracle error "row rejected, Integrity constraint violated
parent key not found".
What I did is I disabled all the constraints through script in Schema B, and imported data. Data imported successfully, but while executing the enabling the constraints script in Schema B constraints are not enabled due to parent and chile relationship problems, even I executed this script many times.
Note:- Schema A and Schema B are same structure, Schema A contains data but
Schema B does not
Can any body have any idea on this?
Thanks,

Hi,
But I want data to be completely imported without losing.
I am trying to disable the constraints using the following queries for enabling and
disabling
select 'ALTER TABLE '||A.TABLE_NAME||' DISABLE CONSTRAINT '||B.CONSTRAINT_NAME||';'
FROM user_constraints A, USER_CONSTRAINTS B
WHERE A.TABLE_NAME = B.TABLE_NAME
AND A.CONSTRAINT_TYPE = 'P'
Foreign constraints  -
select 'ALTER TABLE '||A.TABLE_NAME||' DISABLE CONSTRAINT '||B.CONSTRAINT_NAME||';'
FROM user_constraints A, USER_CONSTRAINTS B
WHERE A.TABLE_NAME = B.TABLE_NAME
AND A.CONSTRAINT_TYPE = 'R'
-- Check constraints ---
select 'ALTER TABLE '||A.TABLE_NAME||' DISABLE CONSTRAINT '||B.CONSTRAINT_NAME||';'
FROM user_constraints A, USER_CONSTRAINTS B
WHERE A.TABLE_NAME = B.TABLE_NAME
AND A.CONSTRAINT_TYPE = 'C'

Similar Messages

  • How to transfer table data from one client to another client?

    How to transfer table data from one client to another client?

    Hi,
    Look at the Blog
    /people/community.user/blog/2007/01/07/transport-table-entries
    Regards
    Sudheer

  • EXPORT/IMPORT TABLE DATA FROM ONE SCHEMA TO ANOTHER ONE (S.O.S)

    Hi,
    I urgently need your help:(, I have two different instances, in each of them there are two schemas, A and B; which tables are the same, but I need to transfer JUST the table data from A's tables to B's tables, how can I do so??
    Thanks in advance,
    Isabel

    The total number of tables is 989:(And how many do you want ? If 988, and if you're on a 10g db, you can use exclude parameter from expdp/impdp?
    Nicolas.

  • Import some data from one oracle to another...

    Hi Guys,
    we have 2 oracle database servers on 2 different machines with schema.
    I want to import some data from a specific table from one oracle into another oracle.
    what is the way to do that.
    Please help in details
    Imran Baig

    Hi,
    Thanks for the reply.
    Tables are already created in both of the oralce databases only the data varies. I just have to import only few records from one oracle to another with the same user name and table already existing.
    I have tried using database link. I can view records from the other oracle database but as soon as i write an insert command oracle gets held. I cant do anything.
    Is there any other way?
    Imran

  • Move tables data from One DB to another using DB-Link ?

    Dear friends ,
    I want to move a table data (for a particular schema) from one database to another database's table (for a particular schema) . Can I do it using DB_Link ?
    If yes , then plz tell me the way , how can I do it ?

    >
    I want to move a table data (for a particular schema) from one database to another database's table (for a particular schema) . Can I do it using DB_Link ?>
    Yes you can use db link.Refer to the example in the link:-
    [http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/statements_5005.htm#sthref6315]
    Anand

  • Table Data From One DataBase to another

    Dear Fellows,
    There are two DataBases running in my NT Server. I want to pull data of a table from other database. Does any body know how can I do it if I dont want to export and then import.
    Thanks in advance
    Danish

    Please find the help for SQL*PLUS command COPY.
    It will be useful when you want to copy datas from one database from another database without using import & export.

  • Transfering Table data from one page to another page in OAF

    Hi All,
    Could you please help me with the following requirement. I am trying to transfer the first page selected records to second page, but running into issue.
    I have 2 custom OAF pages:
    1st Page is Invoice Search page and upon searching for an invoice, user can select 'multi records' (its table region with multi-select) and click on upload button.
    The button internally calls setForwardUrl method and calls 2nd page, where second page contains Advacned Table region to show the selected records from 1st page.
    Since user can select more than 1 record in Search region on first page, I would like to hold all rows in an array of Hashmap with Integer index and transfer it to 2nd page. Following is the hashmap syntax I am using:
    java.util.HashMap<Integer,InvoiceRow> map=new <Integer,InvoiceRow>(); // Here InvoiceRow is a custom CLASS structure with InvoiceNumber and Customer Number as variables inside.
    But if I pass the above HashMap to setForwardURL method, the JDeveloper throwing an exception saying that "setForwardURL cannot invoke" message.
    Could you please help me how can I transfer the first page multiselected records to second page?
    Appreciate your time.
    -- Venkat

    Venket, the approach i told you can try in below way:
    public String getSelectedData()
            String whereclause = "(";
           // String whereclause1 = "(";
         XXCONTAINLINESVOImpl vo = this.getXXCONTAINLINESVO1();
          //OAViewObject vo=(OAViewObject)getXXDPECONTAINLINESVO1();
          // System.out.println("debTEST"+punload);
           Row[] sumVoRow =vo.getFilteredRows("Select1", "Y");
            System.out.println("deb multi select test"+sumVoRow.length);
        if (sumVoRow != null && sumVoRow.length > 0)
         for (int i = 0; i < sumVoRow.length; i++) {
                  String wipEntityId =
                  sumVoRow[i].getAttribute("LineId").toString();             
                  whereclause = whereclause+sumVoRow[i].getAttribute("LineId").toString()+",";
                System.out.println("deb multi select test"+whereclause);
            if (whereclause.length() > 0 && whereclause.charAt(whereclause.length()-1)==',')
                 StringBuilder b = new StringBuilder(whereclause);
                 b.replace(whereclause.lastIndexOf(","), whereclause.lastIndexOf(",") + 1, ")" );
                 whereclause = b.toString();
               //  return whereclause;          
            System.out.println("deb where clause test"+whereclause);
        return whereclause;
    so this method will return the value as like : whereclause=(111,222,333) then put this in one session varibale and pass to the below method from CO
        public void processPOData (String wherclause)
            String query = getXXDPECONTAINDATAVO1().getQuery();//Old queryStringBuffer stringbuffer = new StringBuffer();
                      String newwhereclause ="LINE.LINE_ID IN "+wherclause;
                        System.out.println("DEB NEW where clause:"+newwhereclause);
                         StringBuffer stringbuffer = new StringBuffer();  
                       // stringbuffer.append("SELECT rownum LINE_NUM,A.* FROM (");
                        stringbuffer.append(query);
                        stringbuffer.append("  where ");
                       stringbuffer.append(newwhereclause);
                        ViewDefImpl viewdefimpl = getXXDPECONTAINDATAVO1().getViewDefinition();
                        viewdefimpl.setQuery(stringbuffer.toString());
                        System.out.println("DEB NEW QUERY TEST:"+stringbuffer.toString());
                        getXXDPECONTAINDATAVO1().executeQuery();
    Let me know if stil r u facing isssue
    Thnaks
    Deb

  • How to copy table data from onde DB to another DB using clipboard

    HI,
    i copied table data from one DB to another DB, but it displays an error as "policy with check option violation" when inserting the table data.. so how to resolve the proble.. thanks in advance.

    DECLARE
    log_utl_dir VARCHAR2(100) :=('/apps/home/cmsftp/log/gaa');
    CURSOR tb_compy_cur is
    select tb.compy_acronym
    -- QC 158113 - added below
    ,tb.ivr_plan_num
    from tb_fc_compy tb,tb_xop_entitlements te
    where tb.grant_award_accept_flag = 'Y'
    and tb.ivr_plan_num = te.ivr_plan_num
    and te.entitle_name = 'GAA_RECONCILED'
    union all
    select compy_acronym
    -- QC 158113 - added below
    ,tb.ivr_plan_num
    from tb_fc_compy tb
    where tb.res_stock_flag = 'Y'
    --and   (tb.res_auto_lapse_flag = 2 OR
    --tb.res_auto_lapse_flag = 3)
    and exists (select entitle_name from tb_xop_entitlements te
    where tb.ivr_plan_num = te.ivr_plan_num
    and te.entitle_name = 'GAA_RES_FLAG'
    and te.optionee = 'Y'
    and te.psrep = 'Y'
    and te.sponsor = 'Y'
    and te.advisor = 'Y');
    v_xopgrantz_insertcount NUMBER := 0;
    -- QC 158113 - added below
    v_xopgrantz_accpt_count NUMBER := 0;
    v_user_id VARCHAR2(30);
    insert_file_id UTL_FILE.FILE_TYPE;
    insert_log_file varchar2(45) := 'xop_grantz_insertstats.log';
    BEGIN
    DBMS_OUTPUT.PUT_LINE('success1');
    insert_file_id := UTL_FILE.fopen(log_utl_dir,insert_log_file,'w');
    UTL_FILE.put_line(insert_file_id,'Starting the Process at '|| CURRENT_TIMESTAMP);
    UTL_FILE.put_line(insert_file_id,'INSERTING ROWS FOR Companies turned on for GAA_RECONCILE and GAA/RESSTOCK');
    for compy_rec in tb_compy_cur loop
    v_user_id := 'CMS'||compy_rec.compy_acronym||'_USER';
    ctx_set_session.set_user_session(v_user_id);
    dbms_output.put_line ('success2'||''|| v_user_id);
    INSERT into xop_grantz(grant_num,
    user_id,
    last_user_id,
    restrict_grant,
    child_symbol,
    parent_grant_flag,
    bulking_overide_flag,
    exerrestrict_code,
    rounding_method,
    exercisiable_dt,
    def_res_units_flag,
    opt_gain_def_elig_flag,
    opt_gain_deferred_flag,
    opt_gain_deferred_dt,
    opts_accepted,
    lst_updtby_usercd,
    accepted_type,
    GAA_eligible,
    GAA_LST_UPDTBY)
    select g.grant_num,
    v_user_id,
    'GRNTACCPT',
    'N',
    'N',
    (sel ect code
    from tb_xop_exerrestrict_codes
    where cash_allowed = 'Y'
    and cashlesshold_allowed = 'Y'
    and cashlesssell_allowed = 'Y'
    and stockswap_allowed = 'Y'
    and restricted_allowed = 'Y'
    and sar_allowed = 'Y'
    and cashmargin_allowed = 'Y'
    and cashpartial_allowed = 'Y'
    and sarsale_allowed = 'Y'),
    NULL,
    'N',
    'N',
    'N',
    NULL,
    NULL,
    NULL,
    'N',
    NULL,
    NULL
    from grantz g
    where not exists(select 1
    from xop_grantz xg
    where xg.grant_num = g.grant_num);
    v_xopgrantz_insertcount := SQL%ROWCOUNT;
    dbms_output.put_line ('1');
    -- QC158113 - Optimisation fix--starts
    DELETE FROM gt_xop_grant_accpt_type;
    INSERT INTO gt_xop_grant_accpt_type
    SELECT g.grant_num,e.ivr_plan_num,
    pk_xop_grntaccpt.fn_get_accpt_type (v_user_id,
    g.plan_num,
    g.grant_dt,
    g.opt_num,
    g.grant_cd,
    g.plan_type,
    'Y'
    FROM grantz g,tb_xop_entitlements e
    WHERE plan_type IN (2, 4, 5, 7, 8)
    and g.user_id = v_user_id
    and e.ivr_plan_num = compy_rec.ivr_plan_num
    and entitle_name = 'GAA_RES_FLAG' ;
    dbms_output.put_line ('success3');
    v_xopgrantz_accpt_count := SQL%ROWCOUNT;
    UTL_FILE.put_line(insert_file_id,'Inserted count in gt_xop_grant_acceptance '|| v_user_id||v_xopgrantz_accpt_count);
    -- QC158113 - Optimisation fix--ends
    COMMIT;
    UTL_FILE.put_line(insert_file_id,'Inserted count in XOP_GRANTZ for USER_ID '|| v_user_id||v_xopgrantz_insertcount);
    ctx_set_session.set_user_session('');
    dbms_output.put_line ('process completed');
    end loop;
    UTL_FILE.fclose(insert_file_id);
    EXCEPTION
    when others then
    rollback;
    dbms_output.put_line ('Code '||SQLCODE||':'||SQLERRM||' at '||v_user_id||' .pr_xopgrantz_insert');
    pr_xop_log_errors('Code '||SQLCODE||':'||SQLERRM||' at '||v_user_id||' .pr_xopgrantz_insert');
    pr_xop_log_errors('Code '||SQLCODE||':'||SQLERRM||'INSERTING into xop_grantz for ALL grants');
    END;
    i received this error when running the procedure also, so the table gt_xop_grant_accpt_type is not populated
    {Code -28115:ORA-28115: policy with check option violation at CMSFB_USER .pr_xopgrantz_insert}

  • How can I Move data from one column to another in my access table?

    I have two columns, one that stores current month’s data and one that stores last month’s data. Every month data from column 2 (this month’s data) needs to be moved to column 1 that holds last month’s data. I then null out column 2 so I can accumulates this month’s data.
    I understand how to drop a column or add a column, how do I transfer data from one column to another.
    Here is my trial code:
    <cfquery name="qQueryChangeColumnName" datasource="#dsn#">
      ALTER TABLE leaderboard
      UPDATE leaderboard SET  points2 = points3
    </cfquery>
    Unfortunately, I get the following error:
    Error Executing Database Query.
    [Macromedia][SequeLink JDBC Driver][ODBC Socket][Microsoft][ODBC Microsoft Access Driver] Syntax error in ALTER TABLE statement.
    How can I transfer my data with the alter table method?

    I looked up the Access SQL reference (which is probably a
    good place to start when having issues with Access SQL), and
    it suggests you probably need a WHERE clause in there.
    I agree the documentation is a good place to start. But you should not need a WHERE clause here.
    Too few parameters. Expected 1.
    If you run the SQL directly in Access, what are the results? At the very least, it should provide a more informative error message..

  • Transfer data from one database to another without identities but keep the relation b/w PK and Foreign key

    Hi,
    I need to transfer data from one database to another database (both are identical databases). 
    1. Not transferring identity columns (primary keys). the destination table might have the same key.
    2. keep the PK's and FK's relation b/w parent and child table
    3. I have 4 levels 
    Example: tableA (col1 int identity(1,1) , col2, col3)
    tableB (col1 int identity(1,1) ,
    col2 , col3) -- col2 has the foreign key relation with tableA.col1
    tableC (col1 int identity(1,1) ,
    col2, col3) -- col2  has the foreign key relation with tableB.col1
    tableD (col1 int identity(1,1) , col2, col3) -- col2  has the foreign key relation with tableC.col1
    please advise me.
    Thanks in advance

    Try the below:
    /********************************SAMPLE TARGET***************************************************************/
    Use MSDNSamples
    create table TableA(LevelValueId int identity(1,1) primary key, name varchar(100))
    Insert into TableA(name) Select 'R1'
    Insert into TableA(name) Select 'R2'
    create Table TableB(ChildId int identity(100,1),name varchar(100), LevelValueID int references TableA(LevelValueId))
    Insert into TableB(name,LevelValueID) Select 'Childname1',1
    /********************************SAMPLE TARGET***************************************************************/
    /********************************SAMPLE SOURCE***************************************************************/
    Use Sample
    create table TableA(LevelValueId int identity(1,1) primary key, name varchar(100))
    Insert into TableA(name) Select 'C1'
    Insert into TableA(name) Select 'C2'
    create Table TableB(ChildId int identity(100,1),name varchar(100), LevelValueID int references TableA(LevelValueId))
    Insert into TableB(name,LevelValueID) Select 'Kidname1',1
    /********************************SAMPLE SOURCE***************************************************************/
    USe MSDNSamples
    /********************************MIGRATION INTERMEDIATE TABLE***************************************************************/
    --Migration table
    Create table Mg_TableA(LevelValueId int, NewValueId int)
    /********************************MIGRATION INTERMEDIATE TABLE***************************************************************/
    /********************************ACTUAL MIGRATION FOR MASTER TABLE***************************************************************/
    MERGE INTO TableA
    USING sample.dbo.TableA AS tv
    ON 1 = 0
    WHEN NOT MATCHED THEN
    INSERT(name) Values(tv.name)
    Output tv.levelValueId ,inserted.LevelValueid INTO
    Mg_TableA;
    /********************************ACTUAL MIGRATION FOR MASTER TABLE***************************************************************/
    /********************************ACTUAL MIGRATION FOR CHILD TABLE***************************************************************/
    Insert into TableB (name,LevelValueID)
    Select A.name,B.NewValueId From sample.dbo.TableB A
    Inner join Mg_TableA B on A.LevelValueID = B.LevelValueId
    /********************************ACTUAL MIGRATION FOR CHILD TABLE***************************************************************/
    /********************************TEST THE VALUES***************************************************************/
    Select * From TableA
    Select * From Mg_TableA
    Select * From TableB
    /********************************TEST THE VALUES***************************************************************/
    Drop table TableB,Tablea,Mg_TableA
    Use Sample
    Drop Table TableB,Tablea

  • How can I transport data from one client to another client?

    How can I transport data from one client to another client? 
    Regards,
    Subho

    hmmm, CTS = cutomizing transport?
    If you have a customizing table, there are still two possibilities.
    1. customize in DEV system and transport
    2. customize right there where you need it.
    this depends on how the maintainance view is built. If it is a simple customizing table and you get not asked for a TR when customizing a new record or changing an existing one, you hit possibility 2.

  • How to move only subset of data from one database to another?

    Both source & destination are Oracle11g databases.
    The requirement details are as below,
    1) The database contains static as well as transactional data for telecom domain.
    2) We have to move region-wise data from one database to another.
    3) There are around 10 regions.
    4) The region wise data extraction from source db is based on around 40 to 50 tables. Rest of the tables contains
    static data & it will not change.
    5) The volume is around 1 million subscribers per region.
    6) The migration is required because
    a) The client is upgrading its base product which uses this database
    b) There is a change in structure of static tables
    c) Hardware upgrade
    d) The client want to start with single region on new database & rest of the regions will be operated from old
    database.
    7) Keep execution time to very minimum.
    I am thinking to have solution as below,
    1) Create destination database with upgraded db structure (as mentioned in 6b)
    2) Create database links to access source db in destination db.
    3) Write SQL queries to fetch data from all the respective tables for a specific region
    4) Write separate PL/SQL blocks for each table to fetch data from source db & insert into respective table in
    destination db
    a) Use FOR ALL & bulk collect to improve the performance
    b) Divide table data into multiple chunks & execute parallel batches (around 10) to insert the data
    5) Validate pre & post counts to verify the success of migration
    Is there any other better way?
    Regards,
    Sandeep

    How to move only subset of data from a partiular table by using transportable tablespace?
    E.g. SUB table using SMP_SUB tablespace contains subscriber data in source database.
    The indexes defined on SUB table are under SMP_IDX_SUB tablespace
    The subscribers data can be categorized by different regions, say region_id column. Then how to move data & indexes of SUB table from source db to destination db?
    any specific example would be helpful.

  • Move data from one fs to another from a particular position.

    Hi all,
    i have a requirement where i want to move data from one field symbol to another from a particular
    position.
    I have a work area which contains string values. i have converted this string to hexadecimal value .
    in this hex string m lukin for a position where '0A' occurs. Now i have to pick the string till dis '0A' value and move it to some other field symbol. Can anybody tell me how to do that.
    The code i have written is as follows:
      FIELD-SYMBOLS: <fs> TYPE x.
                 data: temp1 type string,
                       p_word type string,
                       temp2 TYPE string,
                       w_len TYPE i.
                       temp1 = wa_value-value. "this wa containd the value
                       w_len = strlen( temp1 ).
             if temp1 cp '"*'.
               ASSIGN wa_value-value TO <fs> CASTING TYPE x.  " converting wa to hex value
                  DATA: VAR TYPE i,
                        COUNTER TYPE i,
                        line_feed_count type i,
                        temp_count type i.
             VAR = strlen( wa_value-value ).
             CLEAR: COUNTER, temp_count, line_feed_count.
               WHILE COUNTER LE VAR.
                IF <fs>+counter(1) = '0A'.
                line_feed_count = line_feed_count + 1.
                COUNTer = COUNTer + 1.
                ENDIF.
                COUNTER = COUNTER + 1.
               ENDWHILE.
            endif.
    Now , i want to pick data from starting till the position it gets '0A' and then again till it finds another '0A'.
    Thanks in advance.

    Hi,
    As everyone has rightly pointed out, there is no direct way of transferring the data from one appset to another. However, there are definitely few ways of doing it:
    1. Run export package. Export the data in flat file. Import the data using import DM package.
    2. Export the data from the cube of your application in excel file. Then run the import DM package to load the data.
    3. Run UJBR transaction in SAP. Take the backup of the transactional data. You will get few flat files. Run the import DM package.
    All the above steps will work only if the structure of the applications in both the appsets is the same. Otherwise, you will have to modify the flat file before uploading the file.
    Hope this helps.

  • Different ways to Transfer data from one database to another database

    Hi all,
    What are the ways to transfer data from one database to another database. With the following options, i Can transfer data as far as i know. Please
    correct me if i am wrong or tell me if there is any other options are available.
    1) Create database link/connection string and using this string and COPY command, we can transfer data.
    2) By using Export and Import utilities.
    I told first one to my interviewer, he told, its strange, by using, COPY command also can we transfer data ? As far as i know, we can transfer data. Am i right ?
    Thanks in advance,
    Pal

    transfer data from one database to another database.You mean store the data of one to another?
    1) Create database link/connection string and using this string and COPY command, we can transfer data.every SELECT on a DB-link is transfering data. And you can have all kind of transfers and store on the e.g CTAS of materialized views or.... the SQL*PLUS COPY :
    The COPY command is not being enhanced to handle datatypes or features introduced with, or after Oracle8i. The COPY command is likely to be made obsolete in a future release.
    But there are many others. Check for ORACLE Streams, and the "COPY" your interviewer was mentioning is about the operating file system COPY right? That's transportable tablespaces.
    http://download.oracle.com/docs/cd/E11882_01/server.112/e17120/tspaces013.htm#ADMIN11403
    -- andy

  • Best Way to port the data from one DB to another DB using Biztalk

    Hi,
    please suggest best way to move the data from one db to another DB using biztalk.
    Currently I am doing like that, for each transaction(getting from different source tables) through receive port, and do some mapping (some custom logic for data mapping), then insert to target normalized tables(multiple tables) and back to update the status
    of transaction in source table in sourceDB. It is processing one by one.
    How/best we we can do it using  bulk transfer and update the status. Since it has more than 10000 transaction per call.
    Thanks,
    Vinoth

    Hi Vinoth,
    For SQL Bulk inserts you can always use SQL Bulk Load
    adapter.
    http://www.biztalkgurus.com/biztalk_server/biztalk_blogs/b/biztalksyn/archive/2005/10/23/processing-a-large-flat-file-message-with-biztalk-and-the-sqlbulkinsert-adapter.aspx
    However, even though a SQL Bulk Load adapter can efficiently insert a large amount of data into SQL you are still stuck with the issues of transmitting the
    MessageBox database and the memory issues of dealing with really large messages.
    I would personally suggest you to use SSIS, as you have mentioned that records have to be processed in specific time of day as opposed to when the
    records are available.
    Please refer to this link to get more information about SSIS: http://msdn.microsoft.com/en-us/library/ms141026.aspx
    If you have any more questions related to SSIS, please ask it in
    SSIS 
    forum and you will get specific support.
    Rachit

Maybe you are looking for