有什么方法可以中断 Windows Server 2008 中 PostgreSQL 8.4 中丢失或空闲的 TCP/IP 连接吗?
我问过:如何通过 keepalive postgreSQL 断开 TCP/IP 连接而不更改寄存器中的任何内容?
现在,我想确认:
我的系统(C#.NET、NHibernate 和 Active Record)正在与数据库一起运行PostgreSQL 8.4 和 Windows 服务器。我需要一种方法来中断空闲或丢失的 TCP/IP 连接并解锁数据。
我无法调整操作系统配置,也无法重新编译 PostgreSQL。如果需要,我的系统可以在 Oracle 10g Express 中运行!我需要知道:我可以在不为 PostgreSQL 实施新补丁的情况下中断空闲连接吗?为此,我是否需要将数据库迁移到 Oracle?
谢谢,
I've asked: How to break connections TCP/IP by keepalive postgreSQL without changing anything in the register?
And now, I want to confirm:
My system (C#.NET, NHibernate and Active Record) is running with a database PostgreSQL 8.4 and a Windows Server. I need a way to break idle or lost TCP/IP connections and unblock data.
I can't tweak OS configs nor recompile the PostgreSQL. My system can run in Oracle 10g Express if needed! I need to know: Can I break idle conections without implement a new patch for PostgreSQL? Do I need to migrate my database to Oracle for that?
Thanks,
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果有办法强制每个新连接在连接时执行查询,您可以编写一个数据库函数,为符合某些条件的任何进程动态调用“pg_terminate_backend(pid)”。在不知道您的设置的情况下,一些可能性是:
我个人而言,我会尝试进行重构,以最大限度地减少任何事务可能打开的时间。在某些地方,您可能会不必要地打开事务,从而导致触发问题的可能性增加:
If there's a way to force each new connection to execute a query at connect time, you could write a database function that dynamically calls "pg_terminate_backend(pid)" for any processes that are in some criteria. Without knowing your setup, some possibilities are:
Personally, I would try and refactor in order to minimize the amount of time any transaction can possibly be open. Some places where you may have a transaction open unnecessarily, resulting in an increased chance of triggering your problem:
您正在寻找 pg_cancel_backend() 或 pg_terminate_backend() ?
检查 http://www.postgresql.org/docs/current/static /functions-admin.html
You're looking for pg_cancel_backend() or pg_terminate_backend() ?
Check http://www.postgresql.org/docs/current/static/functions-admin.html