ORA-01727 view賦權with grant option

來源:互聯網
上載者:User

ORA-01727 view賦權with grant option

ORA-01720: grant option does not exist for 'SCOTT.LOCK1'
該問題出現在將view賦權給另外的使用者時,而該view中引用了第三個使用者下的表。

例如:
我有三個使用者:scott,roy,test
在roy下建立一個view引用到scott的表
然後將roy下的view的存取權限給test
如果按普通的賦權模式,此時就會報出ORA-01720錯誤。

解決方案是:
在將表scott下的表存取權限賦權給roy使用者時,加上with grant option。
這樣當view賦權給test時就會自動把scott表的許可權給test,這樣就不會出錯了。

實驗測試:
環境本地linux RedHat 5, Oracle 11gR2

1.用dba使用者登入,先試著建立視圖roy.new_view,報錯
SQL> connect dbmgr/dbmgr;
Connected.

SQL> create view roy.new_view(id,comm) as select id,comm from scott.lock1;
create view roy.new_view(id,comm) as select id,comm from scott.lock1
                                                              *
ERROR at line 1:
ORA-00942: table or view does not exist

2.給roy賦普通許可權後,建立視圖成功
SQL> grant select on scott.lock1 to roy;

Grant succeeded.

SQL> create view roy.new_view(id,comm) as select id,comm from scott.lock1;

View created.

3.將視圖賦權給test使用者,報錯ORA-01720
SQL> grant select on roy.new_view to test;
grant select on roy.new_view to test
                    *
ERROR at line 1:
ORA-01720: grant option does not exist for 'SCOTT.LOCK1'

4.給roy賦權時加上with grant option 選項再將視圖賦權給test使用者,成功
SQL> grant select on scott.lock1 to roy with grant option;

Grant succeeded.

SQL> grant select on roy.new_view to test;

Grant succeeded.

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.