与Oracle交替模式中的外键? [英] Foreign keys in alternate schemas with Oracle?

查看:137
本文介绍了与Oracle交替模式中的外键?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个模式,我们称之为BOB和FRED。我需要从架构BOB调用模式FRED中的表来使用该表中的主键作为外键。我已经为模式FRED设置了适当的授权,允许BOB访问它,但是每当我运行脚本时,它都会抱怨我没有正确的权限。还有另一个设置,我需要改变的地方?可以这样做吗?



我的FK创建如下:

 <$ c $ (ItemID)
REFERENCESFRED。ITEMS(ItemID)


我正在做这个补助:

  GRANT ALTER在FRED。ITEMS到BOB

我得到这个错误信息:

  SQL错误:ORA-01031:权限不足
01031. 00000 - 权限不足

*原因:尝试更改当前用户名或密码
而没有适当的权限。如果
尝试安装数据库而没有必要的操作
系统特权,也会发生此错误。
当在DBMS MAC中配置了Trusted Oracle时,如果用户被授予了比当前登录名更高的标签
所需的特权,则此错误可能发生


*操作:请数据库管理员执行操作或授予
所需的权限。
对于受信任的Oracle用户,如果获得此错误,虽然在更高的标签上授予了
适当的权限,但要求数据库
管理员以适当的标签重新授予权限。


解决方案

您需要:

 在FRED上授予引用。ITEMS到BOB

请参阅这个AskTom


I have two schemas, let's call them BOB and FRED. I need to call a table in schema FRED from schema BOB to use the primary key in that table as a foreign key. I've set up the appropriate grants for schema FRED to allow BOB access to it, but whenever I run the script, it complains that I do not have the correct permissions. Is there another setting that I need to change somewhere? Can this even be done?

My FK creation is as follows:

ALTER TABLE "BOB"."ITEMGROUP" WITH CHECK ADD CONSTRAINT FK_ITEMS_ITEM FOREIGN KEY (ItemID)
REFERENCES "FRED"."ITEMS"(ItemID)

And I'm doing the grant with:

GRANT ALTER ON "FRED"."ITEMS" TO "BOB"

I get this error message:

SQL Error: ORA-01031: insufficient privileges 
01031. 00000 -  "insufficient privileges"

*Cause:    An attempt was made to change the current username or password
           without the appropriate privilege. This error also occurs if
           attempting to install a database without the necessary operating
           system privileges.
           When Trusted Oracle is configure in DBMS MAC, this error may occur
           if the user was granted the necessary privilege at a higher label
           than the current login.

*Action:   Ask the database administrator to perform the operation or grant
           the required privileges.
           For Trusted Oracle users getting this error although granted the
           the appropriate privilege at a higher label, ask the database
           administrator to regrant the privilege at the appropriate label.

解决方案

You need to:

grant references on "FRED"."ITEMS" TO "BOB"

See this "AskTom"

这篇关于与Oracle交替模式中的外键?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆