高级搜索 返回首页  
名人名言
哲理小故事
技术文章
    - LINUX文章
山阴客技术文章Oracle 表权限授权
Oracle 表权限授权
2023-04-27 11:52:30
by 山阴客  
Rating: not rated yet
1 2 3 4 5 6 7 8 9 10

Oracle 表权限授权

Oracle 表权限授权


--用system用户登录,创建用户并授权

1.使用sqlplus, 以system用户连接数据:sqlplus sys/密码 as sysdba
  例如:sqlplus sys/system as sysdba

    1.2. 或者conn连接, system用户连接数据库: conn system/密码as sysdba
      例如: conn system/system as sysdba

2.创建用户: create user 用户名 identified by 密码
  例如: create user sunway identified by sunway
  PS : 不指定表空间和默认表空间, 则均使用默认

3.授权连接权限给用户,grant connect to 用户名
  例如: grant connect to sunway

4.授权其他用户下的表的查询权限,给刚才创建的用户
  grant select on 其他用户.其他用户的表 to 用户名
  例如: grant select on mdm.mdm_wlzsj_query to sunway


grant select on tablename to zhangsan;//授予zhangsan用户查看指定表的权限
grant drop on tablename to zhangsan;//授予删除表的权限
grant insert on tablename to zhangsan;//授予插入的权限
grant update on tablename to zhangsan;//授予修改表的权限
grant insert(id) on tablename to zhangsan;
grant update(id) on tablename to zhangsan;//授予对指定表特定字段的插入和修改权限,注意,只能是insert和update
grant alert all table to zhangsan;//授予zhangsan用户alert任意表的权限
示例如下:

--例如: 
SQL> conn system/system as sysdba;
已连接。 

SQL> create user test identified by test; 
用户已创建。 

SQL> grant connect to test; 
授权成功。 

SQL> grant select on scott.emp to test; 
授权成功。 

SQL> conn test/test; 
已连接。 

SQL> select * from scott.emp;
 

推荐给好友 打包下载这篇文章 打印这篇文章

Copyright © 2002 myarticle.com.cn
All rights reserved.

备案号:浙ICP备17002154号-3 Powered by: MyArticle Version 1.0dev
Processed Time: 0.0026 s Querys: 5 [ Gzip Level 0 ]