Oracle 10g 中通过数据库链接的传输是否经过压缩?是否可以?

发布于 2024-11-09 09:10:32 字数 143 浏览 0 评论 0原文

我正在通过数据库链接将数据从一个基地传输到另一个基地(使用INSERT INTO SELECT ...)。

我想知道通过链接传输的数据是否经过压缩或者可以压缩以避免过多的网络使用。我的带宽很少,我认为如果还没有完成的话会有所帮助。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

中性美 2024-11-16 09:10:32

有一些重复数据删除,但没有严重的压缩。

有一个 UTL_COMPRESS 函数,但要让它在目的地解压缩会很棘手(可能是触发器,或者代替视图 - 但它很笨重)。

EXPDP 可以使用数据库链接 (NETWORK_LINK) 并且,在 11g 中,压缩 但这确实需要 要获得高级压缩选项许可

最后还有传统的提取、压缩、传输、解压缩、加载。

在 11gR2 中,您可以将外部表与 预处理器来解压缩,这样您就可以半自动化最终选项。

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.

顾铮苏瑾 2024-11-16 09:10:32

正如 @Gary 所说,不是原生的,但可以使用 SSH 隧道进行压缩,假设您无论如何都有命令行访问权限。 SSH 手册页指出,压缩可能会降低快速网络上的速度,但如果您的带宽严重受限,那么这种权衡可能是值得的;并且您可能需要在 ssh_config 中尝试使用 CompressionLevel 以获得适合您情况的最佳结果。

例如,如果您现有的链接定义为连接到 remote_server 端口 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)))'

您可以使用空闲的本地端口创建 SSH 隧道,如下所示:

ssh -C -N -L1522:localhost:1521 remote_server

然后您可以有一个指向隧道本地端的数据库链接:

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)))'

因此您只需更改主机和端口即可。如果您现有的链接使用 tnsnames 条目,那么您只需修改它即可指向 localhost:1522 而不是 remote_server:1521

当然,每当您使用 DB 链接时,您都必须确保 SSH 链接已启动。如果它发生故障,您将收到 ORA-12541: TNS:no Listener 错误,因为没有任何内容会在您的本地端口 1522 上进行侦听。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文