什么是SQL语句来找出哪个Schema拥有Oracle表?
答案 0 :(得分:1)
SELECT OWNER FROM DBA_TABLES WHERE TABLE_NAME = '<your table>'
如果您没有权限DBA_TABLES
使用ALL_TABLES
。
答案 1 :(得分:1)
要查看有关数据库中任何对象的信息,请在USER_TABLES中使用:
select * from all_objects where object_name = 'USER_TABLES';
OWNER OBJECT_NAME OBJECT_ID OBJECT_TYPE CREATED LAST_DDL_TIME
SYS USER_TABLES 3922 VIEW 24-MAY-13 24-MAY-13
USER_TABLES是一个字典视图。所有字典视图都归SYS所有。
答案 2 :(得分:0)
以下是查询:
SELECT TABLE_NAME FROM USER_TABLES WHERE TABLE_NAME='<TABLE_NAME>'; -- There is no owner column in this view
SELECT OWNER, TABLE_NAME FROM ALL_TABLES WHERE OWNER='<OWNER_NAME>' AND TABLE_NAME='<TABLE_NAME>';
SELECT OWNER, TABLE_NAME FROM DBA_TABLES WHERE OWNER='<OWNER_NAME>' AND TABLE_NAME='<TABLE_NAME>';
您还可以使用OBJECT_TYPE='TABLE' and OWNER= '<OWNER_NAME>' and OBJECT_NAME='<TABLE_NAME>'
有3个视图,可以提供该信息: