91超碰碰碰碰久久久久久综合_超碰av人澡人澡人澡人澡人掠_国产黄大片在线观看画质优化_txt小说免费全本

溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

ORA-02030: can only select from fixed tables/views

發布時間:2020-08-10 16:27:28 來源:ITPUB博客 閱讀:291 作者:迷倪小魏 欄目:關系型數據庫


今天在測試的過程中遇到了一個小問題,這讓我產生了疑惑:為什么單獨執行的時候就可以,而在創建view的時候就會提示沒有權限?

SEIANG@seiang11g>select value from v$mystat, v$statname 
  2  where v$mystat.statistic# = v$statname.statistic# 
  3  and v$statname.name = 'redo size';
 
     VALUE
----------
     29152

 

SEIANG@seiang11g>create or replace view redo_size1
  2  as
  3  select value from v$mystat, v$statname 
  4  where v$mystat.statistic# = v$statname.statistic# 
  5  and v$statname.name = 'redo size';
select value from v$mystat, v$statname
                            *
ERROR at line 3:
ORA-01031: insufficient privileges

 

起初,還以為是沒有create view的權限,于是就查詢了seiang用戶的去權限視圖:

SEIANG@seiang11g>select * from role_sys_privs where PRIVILEGE = 'CREATE VIEW';

 

ROLE       PRIVILEGE                                ADM

---------- ---------------------------------------- ---

DBA        CREATE VIEW                              YES

 

問題解決:

 

第一次:

SYS@seiang11g>GRANT SELECT ANY DICTIONARY to seiang;

 

Grant succeeded.

 

 

SEIANG@seiang11g>create or replace view redo_size
  2  as
  3  select value from v$mystat, v$statname 
  4  where v$mystat.statistic# = v$statname.statistic# 
  5  and v$statname.name = 'redo size';
 
View created.
 
回收權限,繼續試驗
SYS@seiang11g>revoke SELECT ANY DICTIONARY from  seiang;
 
Revoke succeeded.
 
SEIANG@seiang11g>create or replace view redo_size1
  2  as
  3  select value from v$mystat, v$statname 
  4  where v$mystat.statistic# = v$statname.statistic# 
  5  and v$statname.name = 'redo size';
select value from v$mystat, v$statname
                            *
ERROR at line 3:
ORA-01031: insufficient privileges
 
 
第二次:
 
SYS@seiang11g>grant select on v$statname to seiang;
grant select on v$statname to seiang
                *
ERROR at line 1:
ORA-02030: can only select from fixed tables/views
 
SYS@seiang11g> select * from dba_synonyms t where t.synonym_name = 'V$STATNAME';
 
OWNER      SYNONYM_NAME    TABLE_OWNER    TABLE_NAME                     DB_LINK
---------- --------------- -------------- ------------------------------ --------------------
PUBLIC     V$STATNAME      SYS            V_$STATNAME
 

分析:對以v$開頭的視圖,不能直接grant,v$開頭的視圖是v_$的同義詞

 
 
第三次:
 
SYS@seiang11g>grant select on v_$statname to seiang;
 
Grant succeeded.
 
 
SEIANG@seiang11g>create or replace view redo_size1
  2  as
  3  select value from v$mystat, v$statname 
  4  where v$mystat.statistic# = v$statname.statistic# 
  5  and v$statname.name = 'redo size';
select value from v$mystat, v$statname
                  *
ERROR at line 3:
ORA-01031: insufficient privileges
 
 
SYS@seiang11g>grant select on v_$mystat to  seiang;
 
Grant succeeded.
 
 SEIANG@seiang11g>create or replace view redo_size3
  2  as
  3  select value from v$mystat, v$statname 
  4  where v$mystat.statistic# = v$statname.statistic# 
  5  and v$statname.name = 'redo size';
 
View created.

 

 

 

下面是Oracle 11g官方文檔的解釋說明:

*******************************************************************************

To create a view in your own schema, you must have the CREATE VIEW system privilege. To create a view in another user's schema, you must have the CREATEANY VIEW system privilege.

要在自己的schema中創建視圖,必須具有CREATE VIEW系統去權限。 要在其他用戶的schema中創建視圖,必須具有CREATE ANY VIEW系統權限。

To create a subview, you must have the UNDER ANY VIEW system privilege or the UNDER object privilege on the superview.

要創建一個子視圖,必須具有UNDER ANY VIEW系統權限或者該超級視圖的UNDER對象權限。

The owner of the schema containing the view must have the privileges necessary to either select, insert, update, or delete rows from all the tables or views on which the view is based. The owner must be granted these privileges directly, rather than through a role.

包含視圖schema的所有者必須具有從視圖(基于的所有表或視圖)中選擇,插入,更新或刪除行所必需的權限。 所有者必須直接授予這些權限,而不是通過角色授予。


 ORA-02030: can only select from fixed tables/views


作者:SEian.G(苦練七十二變,笑對八十一難)




向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

瑞昌市| 公安县| 康平县| 石渠县| 宾阳县| 郴州市| 屯留县| 公安县| 聂拉木县| 丽水市| 临西县| 梁河县| 平邑县| 济源市| 合作市| 花莲县| 星座| 白银市| 瑞昌市| 额济纳旗| 浮梁县| 通辽市| 镶黄旗| 临夏县| 丰顺县| 隆安县| 河北省| 独山县| 定远县| 拉萨市| 襄城县| 离岛区| 增城市| 灵武市| 南阳市| 大竹县| 永嘉县| 墨脱县| 湾仔区| 中阳县| 烟台市|