hc2342uhxx3vw36x96hq
asked on
Conditional data-transfer of a large table from one machine to another using Oracle
A large table with over two million records has to be conditionally transferred from one Oracle user to another Oracle user in different machines. We have to filter only the records created after a specified date, with another field beginning with a particular string, and with another field greater than a particular number. The specified date, string and number are parameters, so can vary, and are not yet known. It's a one-shot transfer, so this technique will be applied only one time.
Please describe your solution in two cases:
a) You can create a DBLink;
b) You aren't allowed to create a DBLink.
Please describe your solution in two cases:
a) You can create a DBLink;
b) You aren't allowed to create a DBLink.
assuming the table doesn't have a LOB, fastest way to move the data is to just insert it over a link.
what is the SIZE of the table?
select bytes from dba_segments where owner = 'xxx' and segment_name = 'yyyyy';
now.. some are going to tell you to use export/import or data pump or pl/sql procedure with cursor or "oracle copy"
all of those will work fine.. but, for 2 million rows one time.. just insert the rows over the link.
what is the SIZE of the table?
select bytes from dba_segments where owner = 'xxx' and segment_name = 'yyyyy';
now.. some are going to tell you to use export/import or data pump or pl/sql procedure with cursor or "oracle copy"
all of those will work fine.. but, for 2 million rows one time.. just insert the rows over the link.
with db_link
connect to target database
CREATE DATABASE LINK source_link CONNECT TO source_user IDENTIFIED BY 'pass' USING 'SOURCE';
insert into target_table select * from source_table@source_link where......
;
commit;
without db_link
assume username/password are same on target/source
connect to target database
insert into owner.target_table select * from owner.source_table@source where......
;
commit;
ASKER
The size is the following: 190000000
(I've approximated the value, of course).
The table contains about 2 million records: with the where condition, they will become 1,75 million records.
With a simple insert statement you cannot do it. With a cursor is it possible?
declare cursor cxxx is select * from source_table@source_link where date_field >= to_date (.....)
Is theren't a fastest way to copy?
(I've approximated the value, of course).
The table contains about 2 million records: with the where condition, they will become 1,75 million records.
With a simple insert statement you cannot do it. With a cursor is it possible?
declare cursor cxxx is select * from source_table@source_link where date_field >= to_date (.....)
Is theren't a fastest way to copy?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
OK, thanks!
ASKER