测试drop procedure + create procedure与create or replace procedure的区别
1、创建2个用户
create user boss identified by boss;
create user clerk identified by clerk;
grant create session to boss,clerk;
2、使用boss用户创建一个存储过程
create or replace procedure p_test
as
begin
dbms_output.put_line('Great Chinese Peple!');
end;
/
3、授权
conn / as sysdba
SQL> grant create procedure to boss;
Grant succeeded.
conn boss/boss
grant execute on p_test to clerk;
conn clerk/clerk
set serveroutput on
exec boss.p_test;
Great Chinese Peple!
PL/SQL procedure successfully completed.
4、查询相应的权限
Select * From Dba_Tab_Privs Where grantee='CLERK'
GRANTEE OWNER TABLE_NAME GRANTOR PRIVILEGE GRANTABLE HIERARCHY
---------------------------------------------------------------------------------
BOSS P_TEST BOSS EXECUTE NO NO
5、boss用户再次执行创建存储过程的脚本
create or replace procedure p_test
as
begin
dbms_output.put_line('Great Peple of republic of china!');
end;
/
执行完后查询权限表:
关于上次对p_test给予clerk的赋权仍然存在,而使用clerk/clerk仍然可以执行。
6、我们先drop p_test然后在创建存储过程
conn boss/boss
drop procedure p_test;
create or replace procedure p_test
as
begin
dbms_output.put_line('Great Peple of republic of china!');
end;
/
再去查询权限表,发现那条记录没有了,clerk用户也无法执行boss的存储过程了。
也就说,当我们删除一个对象的时候,其相关的对象授权都会被级联删除。
阅读(7321) | 评论(0) | 转发(0) |