国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 開發 > 綜合 > 正文

動態DDL執行與Schema Objects顯示授權問題

2024-07-21 02:44:16
字體:
來源:轉載
供稿:網友

這是一個大家常見的問題,也是很容易忽略的問題,尤其是在PRocedure里面動態執行DDL語句的時候發生. 我們必須使用顯示授權方式來保證DDL的執行權限, 而不能通過role的傳遞方式,下面是一個簡單的測試過程來驗證這一點.


參考說明:


If the referenced item is indeed declared and you believe that you have privileges to refer to that item, check the privileges; if the privileges were granted only via a role, then this is expected and documented behavior. Stored objects (packages, procedures, functions, triggers, views) run in the security domain of the object owner with no roles enabled except PUBLIC. Again, you will be notified only that the item was not declared

 


Test steps:


SQL> create user chris identified by pass;

 


User created.

 


SQL> grant dba to chris;

 


Grant succeeded.

 


SQL> connect chris/pass;


Connected.


SQL> create table test1 (name varchar2(10));


Table created.

 


--Success here.


SQL> drop table test1;

 


Table dropped.

 


SQL> create or replace procedure chris_cr_tbl


2 IS


3 begin


4 execute immediate 'create table test1 (name varchar2(10))';


5 end;


6 /

 


Procedure created.

 


SQL> exec chris_cr_tbl;


BEGIN chris_cr_tbl; END;

 


*


ERROR at line 1:


ORA-01031: insufficient privileges


ORA-06512: at "CHRIS.CHRIS_CR_TBL", line 4


ORA-06512: at line 1

 


--Failed Here


SQL> connect test/Oracle


Connected.


SQL> grant create table to chris;

 


Grant succeeded.


--Explicit Grant


SQL> connect chris/pass


Connected.


SQL> exec chris_cr_tbl;

 


PL/SQL procedure successfully completed.

 


SQL> select table_name from all_tables where owner='CHRIS';

 


TABLE_NAME


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


TEST1

 


SQL> drop table test1;

 


Table dropped.


發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 新化县| 东乌珠穆沁旗| 河津市| 景德镇市| 万载县| 乌鲁木齐市| 靖西县| 尚志市| 上犹县| 陕西省| 天津市| 珠海市| 阳山县| 古丈县| 青浦区| 安西县| 芦山县| 崇阳县| 合肥市| 海晏县| 彭泽县| 红河县| 五莲县| 蓝田县| 南木林县| 咸宁市| 昌邑市| 桂东县| 澄江县| 隆子县| 驻马店市| 普陀区| 无极县| 镇巴县| 永修县| 堆龙德庆县| 临江市| 含山县| 瑞金市| 丹东市| 旌德县|