当涉及到多模式设置时,我在理解 Oracle 中什么是可能的和什么是不可能的时遇到了一些麻烦。假设我有两个模式A
和B
:
-- with user SYS connect as SYSDBA
-- note: ALL PRIVILEGES are granted for simplicity in the scope of this question.
-- real life databases would have more fine-grained grants...
create user A identified by A;
grant all privileges to A;
create user B identified by B;
grant all privileges to B;
-- with user A
create table A.REFERENCED_TABLE (
ID number(7) not null,
constraint REFERENCED_TABLE_PK primary key (ID)
);
-- with user A or B
create table B.REFERENCING_TABLE (
A_ID number(7) not null,
constraint REFERENCING_TABLE_FK
foreign key (A_ID)
references A.REFERENCED_TABLE(ID)
on delete cascade
);
但上述说法导致
ORA-01031: insufficient privileges
如何使一个模式中的表引用另一个模式中的表?是否还有一些GRANT
遗漏?这甚至可能吗?