updating DB from one computer to another

fung
2004-09-16
2013-05-02
  • fung

    fung - 2004-09-16

    Hi All,

    We have two databases DB1 and DB2. DB1 is in computer C1 and DB2 is in another computer C2. First we export DB1 in C1 by running RUN_DBExport.bat and import it into DB2 in C2 by running RUN_DBRestore.bat. Then users of C2 input data in some tables (say A and B). At the same time, in DB1, we edit the table (say E and F) by creating more columns, as the result we also edit the AD_Column, AD_Field.

    Question is: How could we import those update from DB1 into DB2? As the users have input data, we cant just import the whole database, which will make all the input data lost.

    Any greate idea?

    Thanks a lot!!!

     
    • petershen

      petershen - 2004-09-25

      1, export the db1
      2, import the db1 into the db2 as another schema,let's say reference
      3, run merge sql
      (merge is a sql command in oracle)

      for example:

      Merge into compiere.AD_Element c1
        using reference.AD_Element c2
        on(c1.AD_Element_ID=c2.AD_Element_ID)
      when Matched then
         update Set AD_CLIENT_ID = c2.AD_CLIENT_ID  ,                                  
                  AD_ORG_ID    = c2.AD_ORG_ID     ,                                         
                  ISACTIVE     = c2.ISACTIVE      ,                                       
                  CREATED      = c2.CREATED      ,                                  
                  UPDATED         = c2.UPDATED      ,                  
                  CREATEDBY    = c2.CREATEDBY    ,                                      
                  UPDATEDBY      = c2.UPDATEDBY   ,                                                   
                  NAME           = c2.NAME       ,                                        
                  DESCRIPTION    = c2.DESCRIPTION   ,                                              
                  HELP           = c2.HELP       ,  
                  ENTITYTYPE     = c2.ENTITYTYPE    ,                           
                  COLUMNNAME     = c2.COLUMNNAME   ,                                 
                  PRINTNAME     = c2.PRINTNAME    ,            
                  PO_NAME  = c2.PO_NAME,                                         
                  PO_PRINTNAME    = c2.PO_PRINTNAME          ,
                  PO_DESCRIPTION    = c2.PO_DESCRIPTION  ,               
                  PO_HELP       = c2.PO_HELP 
          when not Matched then
        insert (c1.AD_Element_ID,c1.AD_CLIENT_ID,c1.AD_ORG_ID,c1.ISACTIVE,c1.CREATED,c1.UPDATED,c1.CREATEDBY,c1.UPDATEDBY,c1.NAME,c1.DESCRIPTION,c1.HELP,c1.ENTITYTYPE,c1.COLUMNNAME,c1.PRINTNAME,c1.PO_NAME,c1.PO_PRINTNAME,c1.PO_DESCRIPTION,c1.PO_HELP)
      values (c2.AD_Element_ID,c2.AD_CLIENT_ID,c2.AD_ORG_ID,c2.ISACTIVE,c2.CREATED,c2.UPDATED,c2.CREATEDBY,c2.UPDATEDBY,c2.NAME,c2.DESCRIPTION,c2.HELP,c2.ENTITYTYPE,c2.COLUMNNAME,c2.PRINTNAME,c2.PO_NAME,c2.PO_PRINTNAME,c2.PO_DESCRIPTION,c2.PO_HELP) ;
      /

      Peter Shen

       
    • fung

      fung - 2004-09-26

      That's great!! Thank you very much!!!

      In addition to the table AD_Field and AD_Column, what other tables should i merge?

       

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks