database 如何找出 Oracle RDBMS 查询中使用了哪些数据库链接?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/2467343/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-08 07:38:46  来源:igfitidea点击:

How do you find out which database links are used in queries for the Oracle RDBMS?

databaseoracle

提问by JavaRocky

I would like to find out if any and which database links are being used, for a schema, and in which tables. Is it possible via the data dictionary somehow?

我想知道是否有任何数据库链接以及正在使用哪些数据库链接、模式以及在哪些表中。是否可以通过数据字典以某种方式?

Is this possible with the Oracle RDBMS?

这可以通过 Oracle RDBMS 实现吗?

采纳答案by Doug Porter

This will show you any database links set up on the database:

这将显示在数据库上设置的任何数据库链接:

select * from dba_db_links;

You would then have to search for any queries or objects using the db link by doing a text search of them for the link syntax <tablename>@<dblink name>

然后,您必须通过对链接语法进行文本搜索来使用 db 链接搜索任何查询或对象 <tablename>@<dblink name>

回答by KLeonine

I know the answer by Dougman is accepted and accurate. But here is some more information.

我知道 Dougman 的回答是被接受且准确的。但这里有更多信息。

If the user is not a DBA user, it will not have access to DBA_DB_LINKS. Also, USER_DB_LINKS will display the db links created by the current user, so that won't list all the DB links that the user has access to.

如果用户不是 DBA 用户,它将无权访问 DBA_DB_LINKS。此外,USER_DB_LINKS 将显示当前用户创建的数据库链接,因此不会列出用户有权访问的所有数据库链接。

You can use ALL_DB_LINKS to get the links that the user has access to.

您可以使用 ALL_DB_LINKS 来获取用户有权访问的链接。

select * from all_db_links;

回答by jykoe

You can first edit all sql code of a schema: ex:

您可以首先编辑架构的所有 sql 代码:例如:

SELECT DBMS_METADATA.GET_DDL(object_type, object_name, owner)
  FROM all_OBJECTS
  WHERE (OWNER = 'your schema name');

and then search in the result the pattern of the db_link, which looks like @dblink_name.

然后在结果中搜索 db_link 的模式,它看起来像@dblink_name.