码迷,mamicode.com
首页 > 数据库 > 详细

Oracle创建用户,并赋于只读某几张表的权限

时间:2019-01-18 17:29:59      阅读:278      评论:0      收藏:0      [点我收藏+]

标签:grant   pre   source   写法   sqlplus   job   title   ide   dba   

#进入数据库

su - oracle
sqlplus / as sysdba

#创建只读用户

create user kms identified by "123@456";
grant connect to kms;

#给表赋予权限

grant select on ecology.hrmresource to kms;
grant select on ecology.HrmDepartment to kms;
grant select on ecology.HrmSubCompany to kms;
grant select on ecology.hrmjobtitles to kms;

#创建同义词

grant create synonym to kms;
create or replace synonym kms.hrmresource for ecology.hrmresource;
create or replace synonym kms.HrmDepartment for ecology.HrmDepartment;
create or replace synonym kms.HrmSubCompany for ecology.HrmSubCompany;
create or replace synonym kms.hrmjobtitles for ecology.hrmjobtitles;

注意:如果不创建同义词,那么kms用户查询表时,必须使用ecology.table这类的写法,不能直接用table.

Oracle创建用户,并赋于只读某几张表的权限

标签:grant   pre   source   写法   sqlplus   job   title   ide   dba   

原文地址:http://blog.51cto.com/msiyuetian/2344241

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!