简体   繁体   中英

reference to table from another schema in oracle

I have 2 different schemas ( finn, hr ).
I have a table from hr whose name is ( hr_employee_info_tbl ) and another table from finn whose name is FINN_BUDGET_TBL.
I tried to make a reference from FINN_BUDGET_TBL to hr_employee_info_tbl but get ora-01031 insufficient privileges.

which privilige i have to grant my user?

-- Create/Recreate primary, unique and foreign key constraints

alter table FINN_BUDGET_TBL
  add constraint employee_id_fk foreign key (EMPLOYEE_ID)
  references hr.hr_employee_info_tbl (EMPLOYEE_INFO_ID);

与用户hr连接,运行:

grant select on hr.hr_employee_info_tbl to finn;

Make sure you are logging in as the owner of FINN_BUDGET_TBL (in this case FINN) and the current logged in user has read on the hr schema.

grant select on hr.hr_employee_info_tbl to FINN;

"Alter any table" to the current user (FINN) also might work, but is in general, not the right thing to do.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM