I'm transferring data from one base to another via database links (using INSERT INTO SELECT ...
).
I want to know if data transferred through the link is compressed or can be compressed to avoid too much network use. I have very little bandwidth, and I think that would help if it's not already done.
There's some de-duplication but no serious compression.
There is a UTL_COMPRESS function but it would be tricky to get that to decompress on the destination (maybe a trigger, or instead of view - but it is clunky).
EXPDP can use a database link (NETWORK_LINK) and, in 11g, compression but that does require the Advanced Compression option to be licensed.
Lastly there's conventional extract, zip, transfer, unzip, load
In 11gR2 you can use external tables with a preprocessor to unzip, so you could semi-automate that final option.
As @Gary says, not natively, but it's possible to get compression using an SSH tunnel, assuming you have command-line access anyway. The SSH man page notes that compression can slow things down on a fast network, but that trade-off may be worth it if you're severely bandwidth-constrained; and you may need to experiment with CompressionLevel
in ssh_config
to get the best results for your situation.
For example, if your existing link is defined to connect to remote_server
port 1521
:
create database link direct connect to usr identified by pwd
using 'DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=remote_server)(PORT=1521))
(CONNECT_DATA=(SERVICE_NAME=remote_service)))'
You can create an SSH tunnel using a free local port, with something like:
ssh -C -N -L1522:localhost:1521 remote_server
And then you can have a DB link that points to the local side of the tunnel:
create database link direct connect to usr identified by pwd
using 'DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=localhost)(PORT=1522))
(CONNECT_DATA=(SERVICE_NAME=remote_service)))'
So you just change the host and port. If your existing link is using a tnsnames
entry then you can just modify that instead, to point to localhost:1522
instead of remote_server:1521
.
Of course you have to make sure the SSH link is up whenever you use the DB link. If it's down you'll get an ORA-12541: TNS:no listener
error, since nothing will be listening on your local port 1522.
来源:https://stackoverflow.com/questions/6081696/is-transfer-via-database-link-in-oracle-10g-compressed-is-it-possible