ORA-00942: table or view does not exist


今天执行一个 procedure 突然报错:这个procedure 不合法.这个都执行好几年了的procedure 怎么突然报错,难道什么对象被删除了.如是编辑它,发现报错的语句是这句:
 
select count(1) into cout from dba_tables where table_name = 'XXSXX';
 
这个 dba_tables  不是系统自带的视图嘛,怎么会报找不到了.如是向高手们请教,大家给我支招如下

方法一 创建 同义词 并授权:
create synonym test.dba_tables for sys.dba_tables;
grant select on test.dba_tables to test;
 
方法二 直接授权
grant select on sys.dba_tables to  test;
或者
grant select any dictionary to test;

下面这句是把数据字典的查询权限都赋予指定用户,而上面的授权,需要一个个视图授权了.

相关内容