赛迪网 > IT技术 数据库 > 精彩更新
  IT资讯搜索
 
IT产品搜索
[程序开发][网管世界][网络安全][数据库技术]
[操作系统][嘉宾聊天·在线访谈][活动集锦]
[精彩专题][Symantec专区][订阅IT技术周刊]
[开发论坛][网管论坛][安全论坛][数据库论坛]
[操作系统论坛][Sybase专区][IBM dW技术专区]
[病毒求助][病毒与漏洞播报][文档·源码下载]

动态DDL执行与Schema Objects显示授权问题

发布时间:2008.07.25 08:51     来源:赛迪网    作者:柯蒂斯

【赛迪网-IT技术报道】这是一个大家常见的问题,也是很容易忽略的问题,尤其是在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.

(责任编辑:卢兆林)


[ 发表评论 ] 字体[  ] [ 打印 ] [ 进入博客 ] [ 进入论坛 ]  [ 推荐给朋友 ]
  相关文章
· Oracle 9i轻松取得建表和索引DDL语句 (12-18) · Oracle中提取和存储数据库对象的DDL (12-13)
  客户需求反馈表
* 姓  名:
更多资料  了解方案  认识厂商
* 单位名称:
* 联系电话:
* 电子邮件:
  赛迪推荐  
  手机·资费 ·新品·导购·评测·手机资费·宽带
手机搜索  诺基亚 N73 MOTO Z6
  IT产品 ·笔记本·台式机·服务器·打印·投影
IT产品搜索 
  IT技术 ·开发·网管·安全·数据库·操作系统
  信息化 ·热点·专题·访谈·周刊·方案案例
· 移动信息化市场方兴未艾 企业呼唤标准出台
· 如何把握企业价值差异 避免CRM与SCM脱节
· 齐看四大厂商的SaaS动态 ERP案例分析
· 通方期货CRM解决方案 方正电子公文系统
  IT博客 ·曾剑秋·项立刚·Java学习·网管
  IT技术论坛 ·开发·网管·安全·数据库·系统