oracle 在视图上授予选择不起作用
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/13636332/
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
grant select on a view does not work
提问by Jap Evans
My oracle database has a user (Lets say SWEET). Inside SWEET schema, i have a table called AUTO_PARTS.
我的 oracle 数据库有一个用户(可以说是 SWEET)。在 SWEET 模式中,我有一个名为 AUTO_PARTS 的表。
Now, i created a new user (SWEET_CV) and created a view on SWEET's AUTO_PARTS table.
现在,我创建了一个新用户 (SWEET_CV) 并在 SWEET 的 AUTO_PARTS 表上创建了一个视图。
CREATE SCHEMA AUTHORIZATION SWEET_CV
CREATE VIEW SWEET_CV.new_autoparts_view
AS SELECT * FROM SWIFT.AUTO_PARTS WHERE PRODUCTNAME = 'ABC'
GRANT select ON SWEET_CV.new_autoparts_view TO SWEET;
The last Grant statement gave error ORA-01720: grant option does not exist for 'SWEET.AUTO_PARTS'. So i did the below.
最后的 Grant 语句给出了错误 ORA-01720:“SWEET.AUTO_PARTS”的授予选项不存在。所以我做了下面的事情。
From SWEET account:
GRANT SELECT ON AUTO_PARTS TO SWEET_CV *WITH GRANT OPTION*
And then From SWEET_CV account:
GRANT SELECT ON SWEET_CV.new_autoparts_view TO SWEET;
Both the grants succeeded and i committed.
赠款都成功了,我承诺了。
Now, when i login to SWEET and query 'select * from SWEET_CV.new_autoparts_view', rows are returned. But when i query 'select * from new_autoparts_view' it says table or view does not exist. Can you please explain why it says not exist even after i did GRANT.
现在,当我登录 SWEET 并查询“select * from SWEET_CV.new_autoparts_view”时,将返回行。但是当我查询“select * from new_autoparts_view”时,它说表或视图不存在。你能解释一下为什么即使在我做了 GRANT 之后它也说不存在。
I want to access the new schema's view in my SWEET without having to refer it as newschema(dot)viewname
我想在我的 SWEET 中访问新模式的视图,而不必将其称为 newschema(dot)viewname
Thanks in advance
提前致谢
回答by a_horse_with_no_name
I want to access the new schema's view in my SWEET without having to refer it as
我想在我的 SWEET 中访问新模式的视图,而不必将其称为
You need to create a synonym in the SWEET
schema that references the view:
您需要在SWEET
引用视图的架构中创建同义词:
create synonym sweet.new_autoparts_view for sweet_cv.new_autoparts_view;