2012-08-30 17 views
8

Tengo dos esquemas, llamémoslos BOB y FRED. Necesito llamar a una tabla en el esquema FRED desde el esquema BOB para usar la clave primaria en esa tabla como una clave externa. He configurado las concesiones apropiadas para el esquema FRED para permitir el acceso de BOB a él, pero cada vez que ejecuto el script, se queja de que no tengo los permisos correctos. ¿Hay alguna configuración que deba cambiar en alguna parte? ¿Puede esto siquiera estar terminado?Claves foráneas en esquemas alternativos con Oracle?

creación

Mi FK es la siguiente:

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

Y yo estoy haciendo la subvención:

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

me sale este mensaje de error:

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. 

Respuesta

15

Es necesario:

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

Ver this "AskTom"

4

Para crear una clave externa que hace referencia a una tabla en otro esquema, necesita el privilegio "REFERENCES":

GRANT REFERENCES ON FRED.ITEMS TO BOB; 
Cuestiones relacionadas