添加 FK 约束时权限不足 (Oracle)
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/1262801/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Insufficient privileges when adding FK constraint (Oracle)
提问by Steven
ALTER TABLE LAB_ADMIN_USER.TEST_TEMPLATE_ABBR ADD (
CONSTRAINT TEST_TEMPLATE_ABBR_R01
FOREIGN KEY (test_template_id)
REFERENCES LAB_ADMIN.TEST_TEMPLATE (test_template_id)
ON DELETE CASCADE)
What is the most likely cause of 'ORA=01031: insufficient privileges' when executing the command above? In other words, what permission does LAB_ADMIN_USER most likely not have?
执行上述命令时“ORA=01031:权限不足”的最可能原因是什么?换句话说,LAB_ADMIN_USER 最有可能没有什么权限?
I already created the table successfully and attempted to add the FK constraint as LAB_ADMIN_USER.
我已经成功创建了表并尝试将 FK 约束添加为 LAB_ADMIN_USER。
回答by APC
The table with the primary key is owned by a different schema - LAB_ADMIN. That user must grant REFERENCES on TEST_TEMPLATE to LAB_ADMIN_USER.
带有主键的表由不同的模式 - LAB_ADMIN 所有。该用户必须将 TEST_TEMPLATE 上的 REFERENCES 授予 LAB_ADMIN_USER。
回答by diptiman
From the owning schema execute GRANT REFERENCES ON OWNINGSCHEMA.TABLE TO OTHERSCHEMA;
从拥有架构执行 GRANT REFERENCES ON OWNINGSCHEMA.TABLE TO OTHERSCHEMA;