Oracle 10g 中通过数据库链接的传输是否经过压缩?是否可以?
我正在通过数据库链接将数据从一个基地传输到另一个基地(使用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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
有一些重复数据删除,但没有严重的压缩。
有一个 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.
正如 @Gary 所说,不是原生的,但可以使用 SSH 隧道进行压缩,假设您无论如何都有命令行访问权限。 SSH 手册页指出,压缩可能会降低快速网络上的速度,但如果您的带宽严重受限,那么这种权衡可能是值得的;并且您可能需要在
ssh_config
中尝试使用CompressionLevel
以获得适合您情况的最佳结果。例如,如果您现有的链接定义为连接到
remote_server
端口1521
:您可以使用空闲的本地端口创建 SSH 隧道,如下所示:
然后您可以有一个指向隧道本地端的数据库链接:
因此您只需更改主机和端口即可。如果您现有的链接使用
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
inssh_config
to get the best results for your situation.For example, if your existing link is defined to connect to
remote_server
port1521
:You can create an SSH tunnel using a free local port, with something like:
And then you can have a DB link that points to the local side of the tunnel:
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 tolocalhost:1522
instead ofremote_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.