How do I copy or import Oracle schemas between two different databases on different servers?

后端 未结 3 532
耶瑟儿~
耶瑟儿~ 2020-12-30 13:47

What is the best way to copy schema from one user/instance/server:

jdbc:oracle:thin:@deeb02:1535:DH, user pov

to another user/instance/serv

相关标签:
3条回答
  • 2020-12-30 14:39

    Use oracle exp utility to take a dump of the schema from the first database

    exp user1/pass1@db1 owner=user1 file=user1.dmp log=user1.log
    

    Then use imp utility to populate the other schema in the other datbase

    imp user2/pass2@db2 fromuser=user1 touser=user2 file=user1.dmp log=user2.log
    
    0 讨论(0)
  • 2020-12-30 14:46

    you can directly copy schema via network (without moving files from one server to another) using datapump parameter NETWORK LINK as described here:

    http://vishwanath-dbahelp.blogspot.com/2011/09/network-link-in-datapump.html

    for example:

    impdp -userid user/pass@destination_server LOGFILE=log.txt NETWORK_LINK=dblink_from_dest_to_source SCHEMAS=schema1 directory=DATA_PUMP_DIR
    

    check that directory DATA_PUMP_DIR exists in

    select *
    from dba_directories
    

    and points to correct place in destination_server file system.

    0 讨论(0)
  • 2020-12-30 14:47

    Similarly, if you're using Oracle 10g+, you should be able to make this work with Data Pump:

    expdp user1/pass1@db1 directory=dp_out schemas=user1 dumpfile=user1.dmp logfile=user1.log
    

    And to import:

    impdp user2/pass2@db2 directory=dp_out remap_schema=user1:user2 dumpfile=user1.dmp logfile=user2.log
    
    0 讨论(0)
提交回复
热议问题