简体   繁体   中英

Copying more than one tables from one database to another

I have 160 tables in one database. Requirement is to copy them into different database.

Database : Oracle using TOAD tool.

Ex:

Database A: 160 tables

Database B: want to copy all 160 tables from Database A into B.

I know I can write DB link for one table coping but I want to copy all 160 tables from different database. is that possible?

I would suggest the standard DATA PUMP feature. You need to export all the 160 tables from source using EXPDP and then import them into the destination database using IMPDP .

See the documentation to read more about DATA PUMP .

I believe most of the GUI based tools like TOAD , SQL Developer etc. has the export and import features.

Given that you only need the tables/data and you are not concerned about indexes and constraints, and given that you can use a DBLINK, you could use a simple script to copy all tables from the remote server to your local server:

BEGIN
    FOR C IN (SELECT * FROM USER_TABLES@REMOTEDB) LOOP
        EXECUTE IMMEDIATE 'CREATE TABLE ' || C.TABLE_NAME || ' AS (SELECT * FROM ' || C.TABLE_NAME || '@REMOTEDB)';
    END LOOP;
END;
/

If this is not an option, DATA PUMP should indeed be used, as @LalitKumarB already said.

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