如何在 Oracle 中检查数据库链接是否有效?

2021-11-17 00:00:00 oracle architecture dblink

我有一个只有总部设置数据的主数据库和不同分支机构的几个数据库.我为每个分支机构服务器创建了一个数据库链接.

I have a main database with only setup data at the headquarter and several databases at different branches.I created a database link for each branch server.

在某些情况下,我想查询所有有效链接(因为某些链接可能由于连接问题或其他原因而无效),所以我的问题是如何在不出现连接超时问题的情况下检查数据库链接是否有效.是否有 SQL 语句让 oracle 主服务器执行该检查并仅返回有效的数据库链接?

In some case I would like to query all the valid links (as some links could be invalid due to connection problems or anything else),so my question is How to check if the database link is valid without getting in Connection timeout problems. Is there a SQL statement to let the oracle main server do that check and return only the valid database links?

推荐答案

我不确定您是否可以创建查询来检查实时数据库链接.您可以做的一件事是创建一个由后台进程更新的表,其中包含数据库链接列表,并为每个链接创建一个最后一次看到活着的时间"时间戳

I'm not sure you can create a query to check live db links. One thing you could do is create a table updated by a background process with the list of db links and for each of them a 'last time seen alive' timestamp

相关文章