关于drop操作对role的影响

作者: admin 分类: Oracle,公众号存档            2 次浏览 发布时间: 2012-10-14 11:00
在测试环境做数据处理时,发现表的连接有问题,以下是简单的模拟了一下。
–drop表后,role中赋予的权限会自动回收
SQL> create user hrc identified by hrc;
User created.
SQL> grant connect,resource to hrc;
Grant succeeded.
SQL> conn hr/hr
SQL> create role hr_all;
Role created.
SQL> grant select,insert,update,delete on tt to hr_all;
Grant succeeded.
SQL> grant hr_all to hrc;
Grant succeeded.
SQL> /
select count(*) from hr.tt
                        *
ERROR at line 1:
ORA-00942: table or view does not exist   –需要建同义词之类的
SQL> select count(*) from hr.tt;
  COUNT(*)
———-
      4162
SQL> conn hr/hr
SQL> drop table tt;
Table dropped.
–使用hrc来查询,会报错
SQL> select count(*) from hr.tt;
select count(*) from hr.tt
                        *
ERROR at line 1:
ORA-00942: table or view does not exist
–hr 重建表tt
SQL> create table tt as select * from all_objects where rownum<200;
Table created.
–使用hrc来查询,还是会报错
SQL> select count(*) from hr.tt;
select count(*) from hr.tt
                        *
ERROR at line 1:
ORA-00942: table or view does not exist
 
 
drop后需要重新赋权限。
 
 

📌 本文来自作者的 ITPUB 技术博客存档(2012 年),原文链接:https://blog.itpub.net/23718752/viewspace-746372/

admin

杨建荣,《Oracle DBA工作笔记》《MySQL DBA工作笔记》作者,dbaplus社群发起人之一,腾讯云TVP,现任竞技世界系统部经理,拥有十多年数据库开发和运维经验,目前专注于开源技术、运维自动化和性能调优

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注