ITPub博客

首页 > Linux操作系统 > Linux操作系统 > resumable mode TIMEOUT

resumable mode TIMEOUT

原创 Linux操作系统 作者:jjslove 时间:2011-12-21 10:28:00 0 删除 编辑
无聊中发现遗漏知识点
 
今天在看043的时候看到一道题:
2. You execute the following command to enable a session in resumable mode:
SQL> ALTER SESSION ENABLE RESUMABLE TIMEOUT 60;
What is the impact of a timeout on the statements being suspended?
A.The statements remain suspended for at least 60 seconds.
B.The statements are suspended for 60 seconds and then they are executed.
C.The suspended statements error out if the problem is not rectified within 60 seconds.
D.The statements are automatically suspended 60 seconds after an error is received, and then attempt to
execute normally again.
Answer: C
 
 resumable mode,我实在想不起来是什么,于是搜了下帖子,看了之后才想起他的功能,下面是转载:
 
 
 
 
 
 
总结: 当在会话里打开这个功能后(运行 alter session enable resumable timeout 秒,
默认7200).当运行某些sql导致空间不足(表空间用完了)、或已抵达该表/段的 maxextents,
或者 该用户使用此表空间的配额已经用完(原话:Out of space condition, Maximum extents
reached condition, Space quota exceeded condition.),此时Oracle将不会报错,而是把
语句挂起,让 dba 在 timeout 所指定的时间范围内解决问题,之后语句又可以继续运行。

这个功能主要是防止因为空间不够的原因导致session failed,

例如你create一个很大index,三天三夜后,完成了99%,这时候表空间用完了导致create失败,那只能吐血了

比如alter session enable resumable timeout 60;

挂起时间60秒到了之后就报错了,可以把挂起时间修改大一些,从9i开始,Oracle提供了一种避免因为space Error而导致事务异常的操作,那就是resumable.通常,DBA在日常工作中,往往忽略了对空间资源上的需求,比如一个大的事务所需要的 temp,undo,data space等等。直到出现了经典的ORA-01652才恍然

有了resumable session后,他会等待一段时间,等你有了空间后继续

使用很简单,首先user要有resumable权限,如果没有,可以grant resumable to user

在session开始时,alter session enable resumable就可以了

对于application可以通过logon trigger:

SQL> create or replace trigger logon_set_resumable                              
2 after logon                                                                
3 on xfan.schema                                                             
4 begin                                                                      
5 execute immediate ‘alter session enable resumable
timeout 1200′;           
6 end;                                                                       
7 /

Trigger created.

这样当你空间不够的时候,session会等你,alert.log中有类似如下的信息

statement in resumable session ‘User CG15_USER(19), Session 1455, Instance 1′ was suspended due to    

ORA-01652: unable to extend temp segment by12800 intablespace CATYINDX01

当你扩展表空间后,该session继续工作,alert.log中也有记录:

session in resumable session ‘User CG15_USER(19), Session 1455, Instance 1′ was resumed

当然在job开始之前预先加好空间还是上上之选,这个功能是为了以防万一

注意, 设定resumable_timeout的user , 必须有resumable 权限.

如:
SQL>altersessionenableresumable;
ERROR:
ORA-01031:insufficient privileges

SQL> grant resumable to user;

SQL> alter session set resumable_time=9000;

详细信息可以参考metalink文档:136941.1(Using RESUMABLE Session to Avoid Transaction Abort Due to Space Errors

metalink参考:https://metalink.oracle.com/metalink/plsql/f?p=130:14:5469944998771384890::::p14_database_id,p14_docid,p14_show_header,p14_show_help,p14_black_frame,p14_font:NOT,240991.1,1,1,1,helvetica

https://metalink.oracle.com/metalink/plsql/f?p=130:14:5469944998771384890::::p14_database_id,p14_docid,p14_show_header,p14_show_help,p14_black_frame,p14_font:NOT,152013.1,1,1,1,helvetica

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

下一篇: impdp的一个case
请登录后发表评论 登录
全部评论

注册时间:2011-02-13

  • 博文量
    16
  • 访问量
    29545