使用 Oracle 的备用模式中的外键?

Foreign keys in alternate schemas with Oracle?(使用 Oracle 的备用模式中的外键?)
本文介绍了使用 Oracle 的备用模式中的外键?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个模式,我们称它们为 BOB 和 FRED.我需要从架构 BOB 调用架构 FRED 中的一个表,以将该表中的主键用作外键.我已经为模式 FRED 设置了适当的授权以允许 BOB 访问它,但是每当我运行脚本时,它都会抱怨我没有正确的权限.我需要在某处更改其他设置吗?这也能做到吗?

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?

我的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.

推荐答案

你需要:

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

参见这个 问汤姆"

这篇关于使用 Oracle 的备用模式中的外键?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

SQL to Generate Periodic Snapshots from Transactions Table(用于从事务表生成定期快照的SQL)
MyBatis support for multiple databases(MyBatis支持多个数据库)
Oracle 12c SQL: Missing column Headers in result(Oracle 12c SQL:结果中缺少列标题)
SQL query to find the number of customers who shopped for 3 consecutive days in month of January 2020(查询2020年1月连续购物3天的客户数量)
How to get top 10 data weekly (This week, Previous week, Last month, 2 months ago, 3 month ago)(如何每周获取前十大数据(本周、前一周、上个月、2个月前、3个月前))
Select the latest record for an Id per day - Oracle pl sql(选择每天ID的最新记录-Oracle pl SQL)