SQL 如何列出数据库链接 (Oracle) 中存在的所有表?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/29555790/
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-01 03:30:13  来源:igfitidea点击:

How can I list all tables existent in a Database Link (Oracle)?

sqldatabaseoracle

提问by Igor Abreu

Basically I have a Database link (Oracle) called mylink.domain, in this link we can access foundation information like name of them members and other general information.

基本上,我有一个名为mylink.domain的数据库链接(Oracle),在此链接中,我们可以访问基础信息,例如成员名称和其他一般信息。

I would like to list all table's name in this link but i don't know how to do that.

我想在此链接中列出所有表的名称,但我不知道该怎么做。

Thanks in advance

提前致谢

回答by a_horse_with_no_name

You can access the all_tablesview through the dblink:

您可以all_tables通过 dblink访问该视图:

select owner, table_name
from all_tables@dblink
order by owner, table_name;

回答by Andreas Brandstetter

Selecting the content of ALL_TABLES dictionary view will list you all tables your user has access to. Generally, it is not always possible to get a list of tables you dont have permissions for - they just do not show up. If your user has the SELECT ANY DICTIONARY priviledge, you can select the content of DBA_TABLES, which will always list all tables existing in the database.

选择 ALL_TABLES 字典视图的内容将列出您的用户有权访问的所有表。通常,并不总是可以获得您没有权限的表的列表 - 它们只是不显示。如果您的用户具有 SELECT ANY DICTIONARY 特权,您可以选择 DBA_TABLES 的内容,它将始终列出数据库中存在的所有表。

回答by CodeMonkey

select table_name from all_tables@dblinkname;

从 all_tables@dblinkname 中选择 table_name;

This shows all tables your linked user has access to.

这将显示您的链接用户有权访问的所有表。

Where I got the answer from

我从哪里得到答案