分类: Oracle
2013-08-01 10:04:45
DBMS_RESUMABLE.GET_SESSION_TIMSQL> create index inx_res_test on res_test(owner,object_id,object_name)tablespace test;
------------------------------
1800
SQL> create index inx_res_test on res_test(owner,object_id,object_name)tablespace test;
create index inx_res_test on res_test(owner,object_id,object_name)tablespace test
*
第 1 行出现错误:
ORA-01013: 用户请求取消当前的操作
In 9i, users are not allowed to start a distributed transaction in a resumable
enabled session. And if a session has a distributed transaction, usersare not allowed to enable resumable.
These restrictions are removed in 10g. However, in a distributed transaction,if users enable/disable resumable or change resumable_timeout, only the local
instances are affected. In a distributed transaction, sessions on remote
instances are suspended if resumable has been enabled in the remote instance.
在10g中,我们也可以通过DBA_OUTSTANDING_ALERTS 来监控resumable session.比如:
SQL> create index inx_res_test on res_test(owner,object_id,object_name)tablespace test;
create index inx_res_test on res_test(owner,object_id,object_name)tablespace test
*
第 1 行出现错误:
ORA-30032: 挂起的 (可恢复) 语句已超时
ORA-01652: 无法通过 8 (在表空间 TEST 中) 扩展 temp 段
SQL> select object_name,object_type,reason,message_type,message_level
2 from dba_outstanding_alerts
3 where message_group='Space';
OBJECT_NAME OBJECT_TYPE REASON
------------ ------------ -----------------------------------------------
TEST TABLESPACE 对可恢复会话 User STUDY(61),Session 49,Instance 1
(会话 ID 为 49) 的操作被挂起
MESSAGE_TYPE MESSAGE_LEVEL
------------ -------------
Warning 5
SQL>
在exp/imp,sql*loader工具,同样也支持resumable操作,本文不再多加介绍,大家可以参考Oracle online doc获取更多的信息。
最 后,这个特性还是很有用的。我们可以在临近下班的时候,开始一个很大的createindex的操作,设置2小时的timeout,然后就可以回家吃饭 了,如果中间因为space不足而挂起,我们也可以及时的收到短信告警[别的朋友可能有其他的监控],调整后,让事务继续。