Home  >  Article  >  Database  >  oracle 将视图权限授予普通用户

oracle 将视图权限授予普通用户

WBOY
WBOYOriginal
2016-06-07 15:27:271926browse

在非sys,system用户的存储过程中,查询v$开头的视图,如v$mystat,v$statname等。这些视图查询是需要在sys下显示授权后才能在存储过程中使用。 但是,如果我们使用grant on v$view to username,则会收到ORA-02030错误。 如下所示: SQL grant select on v$my

在非sys,system用户的存储过程中,查询v$开头的视图,如v$mystat,v$statname等。这些视图查询是需要在sys下显示授权后才能在存储过程中使用。

但是,如果我们使用grant on v$view to username,则会收到ORA-02030错误。

如下所示:

SQL> grant select on v$mystat to scott;
 
grant select on v$mystat to scott
 
ORA-02030: 只能从固定的表/视图查询

这是因为v$mystat不是一个视图,其实它是一个同义词。

 

因此,需要将同义词对应的视图进行授权。

 


SQL> grant select on v_$mystat to scott;
 
Grant succeeded

 

小技巧,你也可以试试看。

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn