Oracle:跨模式创建视图?
我正在尝试创建一个视图,并将问题归结为无法创建引用不同架构中的表的视图。
例如,我可以这样做:
select count(*) from otherschema.othertable;
我可以这样做:
create view foo as select count(*) as bar from oneofmytables;
但如果我尝试:
create view foo as select count(*) as bar from otherschema.othertable;
我会收到“权限不足”错误。我还需要什么额外的特权?
I'm trying to create a view, and have distilled the problem down to the inability to create a view that references tables from a different schema.
For example, I can do:
select count(*) from otherschema.othertable;
and I can do:
create view foo as select count(*) as bar from oneofmytables;
But if I try:
create view foo as select count(*) as bar from otherschema.othertable;
I get an "insufficient privileges" error. What additional privileges do I need?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您是否直接授予其他用户的表?或者是通过角色?您需要直接授予权限才能创建引用其他表的对象(视图、过程等)。作为快速测试,在 SQL*Plus 中
如果失败,则问题在于您已通过角色被授予了对该表的权限。
Do you have the grant to the other user's table directly? Or is it via a role? You will need the privilege to be granted directly in order to create an object (view, procedure, etc.) that references the other table. As a quick test, in SQL*Plus
If that fails, then the problem is that you have been granted privileges on the table via a role.
我想您已经通过
角色
而不是直接授予
在otherschema.othertable
上获得了选择权。如果是这种情况,您应该以
otheruser
身份连接,然后对 othertable 执行grant select to
。I guess you have been given select right on
otherschema.othertable
via arole
not via a directgrant
.If this is the case, you should connect as
otheruser
and then do agrant select on othertable to <your-schema>
.我相信您的 DBA 需要授予您
权限。根据您站点的安全限制,他们可能允许也可能不允许这样做。我通常不
I believe that your DBA will need to grant you
privilege. Depending on the security restrictions at your site they may or not allow this. I typically do not