我有两个模式,我们称之为BOB和FRED。我需要从模式BOB调用模式FRED中的表,以使用该表中的主键作为外键。我为模式FRED设置了适当的授权以允许BOB访问它,但每当我运行脚本时,它都会抱怨我没有正确的权限。还有其他设置我需要在某处更改吗?甚至可以这样做吗?
我的FK创作如下:
ALTER TABLE "BOB"."ITEMGROUP" WITH CHECK ADD CONSTRAINT FK_ITEMS_ITEM FOREIGN KEY (ItemID)
REFERENCES "FRED"."ITEMS"(ItemID)
我正在做以下的补助金:
GRANT ALTER ON "FRED"."ITEMS" TO "BOB"
我收到此错误消息:
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.
答案 0 :(得分:19)
答案 1 :(得分:6)
要创建引用另一个模式中的表的外键,您需要“REFERENCES”权限:
GRANT REFERENCES ON FRED.ITEMS TO BOB;