oerr ora 10618
10618, 00000, "Operation not allowed on this segment"
// *Cause: This DBMS_SPACE operation is not permitted on segments in
// tablespaces with AUTO SEGMENT SPACE MANAGEMENT
// *Action: Recheck the segment name and type and re-issue the statement
执行SHOW_SPACE存储过程时只能在DBA角色下成功,在NORMAL角色用户下报错:
ORA-10618: Operation not allowed on this segment
ORA-06512: at "SYS.DBMS_SPACE", line 167
ORA-06512: at "DMS.SHOW_SPACE", line 65
ORA-06512: at line 2
意思就是说 dbms_space这个包只能在非自动段空间管理的表空间上用.
查查 dba_tablespaces.
Not quite correct. That particular operation, or procedure/function, is only permitted on non-ASSM tablespace. But some other procedures, such as spce_usage, is used on ASSM.
虽然当前用户执行语句是有权限的,但是放到存储过程中就必须要显式的赋个权限给当前用户。
用户拥有的role权限在存储过程是不可用的
select * from dba_role_privs where grantee='SUK';
GRANTEE GRANTED_ROLE ADMIN_OPTION DEFAULT_ROLE
------------ ------------ ------------ ------------
SUK DBA NO YES
SUK CONNECT NO YES
SUK RESOURCE NO YES
--用户SUK拥有DBA这个role
--再创建一个测试存储过程:
create or replace procedure p_create_table
is
begin
Execute Immediate 'create table create_table(id int)';
end p_create_table;
/
--然后测试
SQL> exec p_create_table;
begin p_create_table; end;
ORA-01031: 权限不足
ORA-06512: 在"SUK.P_CREATE_TABLE", line 3
ORA-06512: 在line 1
--可以看到,即使拥有DBA role,也不能创建表。role在存储过程中不可用。
--遇到这种情况,我们一般需要显式进行系统权限,如 grant create table to suk;
--但这种方法太麻烦,有时候可能需要进行非常多的授权才能执行存储过程
--实际上,oracle给我们提供了在存储过程中使用role权限的方法:
--修改存储过程,加入Authid Current_User时存储过程可以使用role权限。
create or replace procedure p_create_table
Authid Current_User
is
begin
Execute Immediate 'create table create_table(id int)';
end p_create_table;
/
--再尝试执行:
SQL> exec p_create_table;
PL/SQL procedure successfully completed
「喜欢这篇文章,您的关注和赞赏是给作者最好的鼓励」
关注作者
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。




