?
假设我方用户为scott,我们给第三方用户建立的接口用户为scott_read,我们开放给第三方用户的表为student表。
?
1.使用system用户登录:sqlplus system/password@orcl。
?
2.创建scott_read用户:create user scott_read(用户名) identified by tiger(密码)。
?
3.将connect和resource权限赋给scott_read用户:grant connect,resource to scott_read。
?
注意:此处一定注意不要将dba权限赋给scott_read,否则此用户可以操作我们数据库的任何东西,这是大忌。
?
4.将scott的student表查询权限赋给scott_read用户:grant select on scott.student(表或视图名) to scott_read。
?
5.创建同义词:create or replace synonym scott_read.student for scott.student。
?
至此,scott_read用户可以直接查询student表中的所有数据,并且不会给我们的数据库造成任何影响。