Search code examples
oracle-databaseplsqloracle10gdata-migration

Does anyone have a sample data migration script (Oracle 10g to Oracle 10g, but different schemas)?


I am trying to write a data migration pl/sql script to transfer some of the data in one schema to a different schema on another server. The second database started as a subset of the original database, but we have modified the schema. So I can't just use the following for each table:

Insert into DB2.table_name select * from DB1.table_name2; 

I have tried doing a search for sample scripts that show how to do this, but couldn't find anything.


Solution

  • You can create a database link.

    Then, if you're trying to migrate from db1 to db2:

    Insert into table_name (f1, f2, etc) select (f1, f2, etc) from table_name2@DB2;
    

    The select can be as complex or simple as needed.