简体   繁体   中英

How replicate data(all dml statement) from one table to another table in different schema oracle

I want to replicate table A data to B as we have some different columns in table B. So It is possible to replicate data.

Schema names are different also

example:

table A

(custome_name, customer_desc,create_date,create_user,update_date,update_user)

table B

(customer_id,custome_name, customer_desc,create_date,create_user,update_date,update_user)

User B has to grant privileges to user A so that A could insert data into their table:

grant insert on table_b to a;

Then, user A would write an INSERT statement, specifying which columns in user B 's table_b will be populated with which column values from table_a

INSERT INTO b.table_b (custome_name,
                       customer_desc,
                       create_date,
                       create_user,
                       update_date,
                       update_user)
   SELECT custome_name,
          customer_desc,
          create_date,
          create_user,
          update_date,
          update_user
     FROM table_a;

That's it.


If users reside in different databases, you'd use a database link .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM