Tuesday, August 7, 2012

Oracle impdp via database link


Oracle impdp via database link

Example:

create user XXX
identified by "YYY"
default tablespace ZZZ_TBS
temporary tablespace TEMP
profile DEFAULT;

grant execute on DBMS_FLASHBACK to XXX
grant read, write on directory DATA_PUMP_DIR to XXX, system;
grant connect to XXX;
grant resource to XXX;
grant create any materialized view to XXX;
grant create any view to XXX;
grant create materialized view to XXX;
grant unlimited tablespace to XXX;
grant create any table to XXX;
grant create any sequence to XXX;
grant create any trigger to XXX;
grant create any type to XXX;

create public database link old_data_source connect to old_xxx identified by old_yyy using '(DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = A.B.C.D)(PORT = 1521))) (CONNECT_DATA = (SERVICE_NAME = my_service)))';

select * from old_xxx.some_table@old_data_source

impdp xxx/yyy DIRECTORY=data_pump_dir NETWORK_LINK=old_data_source remap_schema=old_xxx:xxx

No comments: