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.