Oracle SQL Developer查询作为其他用户连接(Oracle SQL Developer Query Connect as Other User)
我正在通过一个新的sql文件设计一个新的数据库。 我正在使用Oracle SQL Developer并以sysdba身份登录。
我想知道SQL开发人员是否支持或具有相同的命令
connect scott/tiger;
先谢谢你。
编辑
我试图在Schema引用Schema B表的表上创建一个外键。
显示的错误是
[错误] ORA-00942:表或视图不存在
因此,我想以“Schema B”身份登录,授予SYS用户所有权限,再次以sys身份登录并创建关系。
希望我这次更清楚。
I am designing a new database via a new sql file. I am using Oracle SQL Developer and logged in as sysdba.
I would like to know if SQL developer supports or has equivalent command to
connect scott/tiger;
Thank you in advance.
Edit
I am trying to create a foreign key on Schema A table referencing to Schema B table.
The error shown is
[Err] ORA-00942: table or view does not exist
I therefore want to login as "Schema B", grant all permission to SYS user, login as sys again and create the relationship.
Hope I am clearer this time.
原文:https://stackoverflow.com/questions/6291672
2020-03-04 12:17
满意答案
作为用户SYS,您应该能够通过使用架构所有者前缀对象名称来创建所需的关系,如前所述:
ALTR TABLE foo.t1 ADD FOREIGN KEY (col) REFERENCES bar.t2(ID);
也就是说,您还必须为用户foo授予REFERENCES权限才能建立这种关系:
GRANT REFERENCES ON bar.t2 TO foo;
用户SYS应该能够完成所有这些。 这是否是一种好的做法是另一个问题。
As the user SYS you should be able to create the relationship you want by simply prefixing object names with schema owner, as mentioned previously:
ALTR TABLE foo.t1 ADD F