14

2つのスキーマがあります。それらを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.
4

2 に答える 2

25

必要がある:

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

この「AskTom」を参照してください

于 2012-08-30T14:57:55.990 に答える
8

別のスキーマのテーブルを参照する外部キーを作成するには、「REFERENCES」権限が必要です。

GRANT REFERENCES ON FRED.ITEMS TO BOB;
于 2012-08-30T14:57:51.340 に答える