`

【转】Oracle数据库中给接口厂商提供某几张表的只读权限

 
阅读更多

有时候在做接口的时候,需要给调用者提供Oracle数据库用户,此用户可能只能访问我方生产库中的某几张表,而且只能查询不能增删改,这就需要我们从Oracle数据库中给接口厂商设置相应的权限,具体如下:

假设我方生产用户为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表中的所有数据,并且不会给我们的数据库造成任何影响。

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics