There are two approaches to this.
1. DB link
You want to
TRUNCATE db2.tbl;
INSERT INTO db2.tbl SELECT * FROM db1.tbl;
You don't need a pair of cursors,
a pair of open DB connections, to do that.
A single connection to db2 suffices.
What you do need is a DB link,
so that db2 queries enjoy access to db1 tables.
The syntax is:
CREATE DATABASE LINK dblink_name
CONNECT TO remote_user_name IDENTIFIED BY password
USING 'remote_database_name/connection_string';
So if you called it link_db1
,
you would transfer data with
INSERT INTO tbl SELECT * FROM link_db1.tbl;
After your client sends the command to db2, the client is out of the picture.
There could be a million result rows, and they all flow directly
from the db1 server to the db2 server.
The client doesn't touch a single row.
If client suffers from low network bandwidth,
that won't impact the throughput of copying lots of row data.
https://docs.oracle.com/cd/E18283_01/server.112/e17120/ds_concepts002.htm
How to create a DB link between two oracle instances
2. in-memory copy
You can create a pair of connections if you want, one to each database.
Download the rows from one, and insert them via the other connection.
You can do it in a single batch if the client has sufficient memory,
or you might prefer to do batches of a few thousand rows at a time.
(Don't do a single row at a time, as it will be latency dominated -- the
throughput will be disappointingly low.)
Network bandwidth available to the client will play a big role
in how quickly the rows can be copied.
The read_sql / to_sql functions offer one way to accomplish the copying.
This is the less attractive option.
Prefer using a DB link, if feasible.