ITPub博客

首页 > Linux操作系统 > Linux操作系统 > Oracle Sleep Time

Oracle Sleep Time

原创 Linux操作系统 作者:licheng79 时间:2012-02-09 18:01:35 0 删除 编辑

Oracle Sleep Time

drop  user  usera  cascade;
drop user userb cascade;
create user usera default tablespace users identified by abc123;
grant create session to usera;
grant resource to usera;
grant execute on dbms_lock to usera;

create user userb default tablespace users identified by abc123;
grant create session to userb;
grant resource to useb

connect usera/abc123;

create or replace function usera.f_sleep( in_time number ) return number is
begin
 dbms_lock.sleep(in_time);
 
return 1;
end;
/

grant execute on usera.f_sleep to userb;

connect userb/abc123;

/* About to sleep as userb */
select usera.f_sleep(5) from dual;
/* Finished sleeping as userb */

/* Attempt to access dbms_lock as userb.. Should fail */

begin
  dbms_lock.sleep(
5);
end;
/

 

 

  • Reference:

http://stackoverflow.com/questions/2561671/sleep-function-in-oracle

 

 

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/26136400/viewspace-715978/,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2011-09-07

  • 博文量
    54
  • 访问量
    66926