Oracle Resumable Space Allocation
1.About Oracle Resumable Space Allocation
从Oracle9i版本开始,Oracle提供了一种避免因为space Error而导致事务异常的机制: resumable space allocation. 在Oracle 10g的OCP考试中有考resumable session的这个知识点。
官网对Resumable的解释如下:
当我们执行一个事务操作,如果使用了resumable space allocation,那么如果遇到space空间不够的情况,事务不会中断,而是生成一条alert log 发送给DBA,当DBA 解决这个问题之后,事务自动恢复运行。
在Oracle 10g中对resumable session功能做了增强,这些新特性在MOS的文档上有说明:
10g NEW FEATURE on RESUMABLE TIMEOUT [ID 240991.1].10g中增强的内容有:
1)增加了一个resumable_timeout的参数
该参数在system和session level级均可以修改。对RAC DB而言,每个instance可以单独设置。而9i中只能在session一级中设置。
Once the operation is suspended, an alert message is sent to the DBA. Once the cause that caused the failure is fixed, the suspended statement automatically resume sits execution. Every "resumable" operation has a time-out period associated. The default value of the time-out period is 2 hours (unless the user issues an alter session enable resumable). A suspended operation is automatically aborted if the error condition is not fixed within the "time-out".
设置resumable_timeout之后,在指定的timeout 时间内会自动恢复,如果超过这个时间没有解决问题,事务操作还是会被中断。
2)对分布式事务的支持
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.
3)增加了一个监控的视图
在10g中,我们也可以通过DBA_OUTSTANDING_ALERTS来监控resumable session。
2. Official Notification Managing Resumable
Oracle 11g R2官方针对Managing Resumable Space Allocation 的说明如下:
2.1 Resumable Space Allocation Overview
This sectionprovides an overview of resumable space allocation. It describes how resumable space allocation works, and specifically defines qualifying statements and error conditions.
2.1.1 How Resumable Space Allocation Works
The following is an overview of how resumable space allocation works. Details are contained inlater sections.
1. A statementexecutes in a resumable mode only if its session has been enabled for resumablespace allocation by one of the following actions:
--启动session 的resumable space allocation,相关的2个actions:
1)The RESUMABLE_TIMEOUT initialization parameter is set to a non zero value.
2)The ALTER SESSION ENABLE RESUMABLE statement is issued.
2. A resumable statement is suspended when one of the following conditions occur (these conditions result in corresponding errors being signalled for non-resumablestatements):
--在启动resumable session之后,当发生以下情况,resumable的语句就会被suspend挂起。
1)Out of space condition
2)Maximum extents reached condition
3)Space quota exceeded condition.
3.When the execution of a resumable statement is suspended, there are mechanisms to perform user supplied operations, log errors, and to query the status of the statementexecution. When a resumable statement is suspended the following actions aretaken:
--当resumable的statement 被suspend,那么相关的机制会被执行,如生成log信息。具体的log 有如下3类:
1)The error is reported in the alert.log.
2)The system issues the Resumable Session Suspended alert.
3)If the user registered a trigger on the AFTER SUSPEND system event, the user trigger is executed. A user supplied PL/SQL procedure can access the error message data using the DBMS_RESUMABLE package and the DBA_ or USER_RESUMABLE view.
4.Suspending astatement automatically results in suspending the transaction. Thus all transactionalresources are held through a statement suspend and resume.
--suspend的事物自动转到suspend事务中,并且事务所有相关的资源都会通过suspend 和 resume 被hold。
5.When the errorcondition is resolved (for example, as a result of user intervention or perhapssort space released by other queries), the suspended statement automaticallyresumes execution and the Resumable Session Suspended alert is cleared.
--当error 被解决之后,被suspend的statement会自动的执行,resumable session的suspended alert 也会自动清除 。
6.A suspended statement can be forced to throw the exception using the DBMS_RESUMABLE.ABORT() procedure.This procedure can be called by a DBA, or by the user who issued the statement.
--suspend 的statement 也可以使用DBMS_RESUMABLE.ABORT()过程来强制中断。
7.A suspensiontime out interval is associated with resumable statements. A resumablestatement that is suspended for the timeout interval (the default is two hours)wakes up and returns the exception to the user.
--suspension time的设置与resumable的时间相关,该参数的默认值是2个小时,即如果在2个小时以后错误尚未解决,resumable 的session wakeup,那么就会中断并反馈异常给终端用户。
8.A resumablestatement can be suspended and resumed multiple times during execution.
--resumable statement 在执行时可以被多次suspend 和 resume。
2.1.2 What Operations are Resumable?
The following operations are resumable:
1. Queries
2. DML
3. Import/Export
4. DDL
The following statements are candidates for resumable execution:
(2)CREATE INDEX
(3)ALTER INDEX ... REBUILD
(4)ALTER TABLE ... MOVE PARTITION
(5)ALTER TABLE ... SPLIT PARTITION
(6)ALTER INDEX ... REBUILD PARTITION
(7)ALTER INDEX ... SPLIT PARTITION
(8)CREATE MATERIALIZED VIEW
(9)CREATE MATERIALIZED VIEW LOG
2.1.3 What Errors are Correctable?
There are three classes of correctable errors:
1. Out of space condition
The operation can not acquire any more extents for a table/index/temporary segment /undo segment/cluster/LOB/table partition/index partition in a tablespace. For example, the following errors fall in this category:
ORA-01653 unable to extend table ... in tablespace ...
ORA-01654 unable to extend index ... in tablespace ...
2. Maximum extents reached condition
The number of extents in a table/index/temporary segment/undo segment /cluster /LOB /table partition /index partition equals the maximum extents defined on the object. For example, the following errors fall in this category:
ORA-01631 max #extents ... reached in table ...
ORA-01632 max #extents ... reached in index ...
3. Space quota exceeded condition
The user has exceeded his assigned space quota in the tablespace. Specifically, this is noted by the following error:
ORA-01536 space quota exceeded for tablespace string
2.1.4 Resumable Space Allocation and Distributed Operations
In a distributed environment, if a user enables or disables resumable space allocation, or if you, as a DBA, alter the RESUMABLE_TIMEOUT initialization parameter,only the local instance is affected. In a distributed transaction, sessions or remote instances are suspended only if RESUMABLE has been enabled in the remote instance.
--在distributed environment中,resumable的配置只对本地的实例有效,如果要在远程实例上生效就需要在远程实例上配置。
2.1.5 Parallel Execution and Resumable Space Allocation
--对于并行执行,如果其中的一个parallel execution 进程遇到了correctable error,那么其对应的server process 就会被suspend,其它的parallel 进程继续执行,直到它们遇到error 或者被suspend进程block。当correctable error 被解决后,suspend 进程会被重新执行。如果suspend操作被中断,那么对应的并行操作也会被中断,然后抛出错误给用户。
不同的并行进程可能遇到一个或者多个correctable errors,这些错误可能导致触发AFTER SUSPEND 的触发器多次。当如果某个并行的进程遇到一个non-correctable error,而其它的并行进程是suspend,那么suspend 的事务就会被立即中断。
对于并行执行中的每个服务器进程,可以查看DBA_RESUMABLE 和 USER_RESUMABLE视图来获取相关的RESUMABLE信息。
2.2 Enabling and Disabling Resumable Space Allocation
Oracle Documents 写道
可以在系统级别或者session级别设置resumable space allocation。
Note:
Because suspended statements can hold up some system resources, users must be granted the RESUMABLE system privilege before they are allowed to enable resumable space allocation and execute resumable statements.
因为suspend 需要hold 一些系统资源,所有执行该操作的用户必须要先获取RESUMABLE的权限。
2.2.1 Setting the RESUMABLE_TIMEOUT Initialization Parameter
--系统级别设置
You can enable resumable space allocation system wide and specify a timeout interval by setting the RESUMABLE_TIMEOUT initialization parameter.
--在系统级别设置需要在初始化参数里添加RESUMABLE_TIMEOUT参数。
For example, the following setting of the RESUMABLE_TIMEOUT parameter in the initialization parameter file causes all sessions to initially be enabled for resumable space allocation and sets the timeout period to 1 hour:
RESUMABLE_TIMEOUT = 3600
--这里设置timeout为1小时。
If this parameter is set to 0, then resumable space allocation is disabled initially for all sessions. This is the default.
--如果参数设置为0,则禁用resumable。默认情况就是0,即默认是禁用该功能的。
You can use the ALTER SYSTEM SET statement to change the value of this parameter at the system level.
--也可以使用alter system set 语句来进行设置。
ALTER SYSTEM SET RESUMABLE_TIMEOUT=0;
Within a session, a user can issue the ALTER SESSION SET statement to set the RESUMABLE_TIMEOUT initialization parameter and enable resumable space allocation, change a timeout value, or to disable resumable mode.
2.2.2 Using ALTER SESSION to Enable and Disable Resumable Space Allocation
ALTER SESSION ENABLE RESUMABLE;
To disable resumable mode, a user issues the following statement:
ALTER SESSION DISABLE RESUMABLE;
The default for a new session is resumable mode disabled, unless the RESUMABLE_TIMEOUT initialization parameter is set to a nonzero value.
The user can also specify a timeout interval, and can provide a name used to identify a resumable statement. These are discussed separately in following sections.
(1)Specifying a Timeout Interval
ALTER SESSION ENABLE RESUMABLE TIMEOUT 3600;
The value of TIMEOUT remains in effect until it is changed by another ALTER SESSION ENABLE RESUMABLE statement,it is changed by another means, or the session ends. The default timeout interval when using the ENABLE RESUMABLE TIMEOUT clause to enable resumable mode is 7200 seconds.
(2)Naming Resumable Statements
ALTER SESSION ENABLE RESUMABLE TIMEOUT 3600 NAME 'insert into table';
The NAME value remains in effect until it is changed by another ALTER SESSION ENABLE RESUMABLE statement, or the session ends. The default value for NAME is 'User username(userid), Session sessionid,Instance instanceid'.
The name of the statement is used to identify the resumable statement in the DBA_RESUMABLE and USER_RESUMABLE views.
2.2.3 Using a LOGON Trigger to Set Default Resumable Mode
Note:
If there aremultiple triggers registered that change default mode and timeout for resumablestatements, the result will be unspecified because Oracle Database does notguarantee the order of trigger invocation.
2.3 Detecting Suspended Statements
When a resumablestatement is suspended, the error is not raised to the client. In order forcorrective action to be taken, Oracle Database provides alternative methods fornotifying users of the error and for providing information about thecircumstances.
--当一个resumable 语句被suspend,这个error不会自动返回给用户,Oracle 提供一些方法来将这些error 信息通知用户。
2.3.1 Notifying Users: The AFTER SUSPEND System Event and Trigger
When a resumablestatement encounter a correctable error, the system internally generates the AFTER SUSPEND system event. Users can registertriggers for this event at both the database and schema level. If a userregisters a trigger to handle this system event, the trigger is executed aftera SQL statement has been suspended.
--当遇到correctable error 时,系统内部使用AFTER SUSPEND 触发器。 用户可以在DB 或者schema 级别注册这个触发器。 如果用户注册触发器来处理这个事件,那么触发器会在SQL 语句suspend 后执行。
SQL statementsexecuted within a AFTER SUSPEND trigger arealways non-resumable and are always autonomous(有自主权的adj.). Transactions started within thetrigger use the SYSTEM rollback segment. These conditions are imposedto overcome deadlocks and reduce the chance of the trigger experiencing thesame error condition as the statement.
Users can usethe USER_RESUMABLE or DBA_RESUMABLE views, or the DBMS_RESUMABLE.SPACE_ERROR_INFO function, within triggers to getinformation about the resumable statements.
--在这个触发器中可以使用 USER_RESUMABLE , DBA_RESUMABLE 视图或者DBMS_RESUMABLE.SPACE_ERROR_INFO函数来获取更多的resumable 语句信息。
Triggers canalso call the DBMS_RESUMABLE package to terminate suspended statements and modify resumable timeout values. In the following example, the default system timeout is changed by creating asystem wide AFTER SUSPEND trigger that calls DBMS_RESUMABLE toset the timeout to 3 hours:
--在触发器中也可以调用 DBMS_RESUMABLE 包来中断suspended语句和修改resumable timeout 时间。
CREATE OR REPLACE TRIGGER resumable_default_timeout AFTER SUSPEND ON DATABASE BEGIN DBMS_RESUMABLE.SET_TIMEOUT(10800); END; /
2.3.2 Using Views to Obtain Information About Suspended Statements
The following views can be queried to obtain information about the status of resumablestatements:
2.3.3 Using the DBMS_RESUMABLE Package
The DBMS_RESUMABLE packagehelps control resumable space allocation. The following procedures can beinvoked:
2.4 Operation-Suspended Alert
When a resumable session is suspended, an operation-suspended alert is issued on the object that needs allocation of resource for the operation to complete. Once the resource is allocated and the operation completes, the operation-suspended alert iscleared. See "Managing Tablespace Alerts" for more information on system-generatedalerts.
相关推荐
在压缩包"resumable.js-master"中,我们可以找到Resumable.js库的源代码和其他相关资源。通常,这个master分支包含了项目的主要代码、示例、测试用例以及文档,方便开发者学习和调试。在实际应用中,你需要根据项目...
Resumable.js是一个JavaScript库,专门用于实现分片上传,它支持断点续传,兼容多种浏览器,为前端提供了友好且灵活的API。 在后端,我们使用PHP作为服务器端语言来处理分片上传。PHP需要实现的功能包括: 1. 接收...
在Python中,`resumable-urlretrieve`是一个非常实用的库,主要用于处理大文件的下载,特别是网络传输过程中可能出现中断的情况。这个库的名字暗示了它的核心功能——可恢复的URL获取,即当下载中断后,可以从上次...
此角色包含了备份数据库所需的大部分权限,如`EXECUTE_CATALOG_ROLE`、`SELECT_CATALOG_ROLE`、`BACKUP ANY TABLE`以及`RESUMABLE`等系统权限。这些权限使得拥有该角色的用户可以完全备份数据库,并且能够在备份过程...
Oracle Database 12c是Oracle公司推出的一个重要版本,它带来了许多创新特性和改进,旨在提升数据库性能、可扩展性和管理效率。以下是其中32个关键新特性的概述,结合实际案例进行分析: 1. **多租户架构...
Oracle 全库迁移使用 IMP/EXP 命令 在 Oracle 数据库中,进行全库迁移是一项复杂的任务,需要使用 IMP 和 EXP 命令来实现。下面将详细介绍如何使用 IMP 和 EXP 命令进行全库迁移,并注意 full 参数的使用。 一、...
- `resumable`:启用或禁用可恢复加载。 #### 实例演示 假设我们要将一个名为`data.csv`的数据文件加载到名为`sales`的表中,我们可以创建一个控制文件`sales.ctl`,并在其中定义数据文件的格式和目标表的结构。...
- `resumable` 参数允许在中断后恢复导出操作。 - `consistent` 与 `object_consistent` 参数的选择应基于恢复需求和数据一致性要求。 了解并熟练掌握Oracle EXP工具的使用,对数据库的管理和维护至关重要。正确...
《PyPI官网下载:深入解析s3resumable-0.0.3.tar.gz》 在Python的世界里,PyPI(Python Package Index)是开发者们不可或缺的资源库,它为Python程序提供了丰富的第三方库和模块。今天我们将聚焦于一个特定的资源...
- **格式**:RESUMABLE=suspend_when_a_space_related_error_is_encountered - **默认值**:N(不暂停) ##### RESUMABLE_NAME - **描述**:用于标识可恢复语句的文本字符串。 - **格式**:RESUMABLE_NAME=text_...
**PyPI 官网下载 | django-resumable-0.1.1.tar.gz** `django-resumable` 是一个基于Python的Django框架的库,主要用于处理大文件上传时的断点续传功能。在开发Web应用时,尤其是涉及到用户上传大文件(如视频、...
8. **高可用性**:介绍Oracle的高可用性特性,如Oracle集群件(RAC)、Standby数据库和Database Resumable,以确保业务连续性和数据保护。 9. **数据迁移与升级**:指导如何将现有数据库迁移到新版本的Oracle8i,...
**PyPI 官网下载 | google-resumable-media-0.2.3.tar.gz** PyPI(Python Package Index)是Python社区广泛使用的软件包仓库,它提供了大量的Python库供开发者下载和使用。在这个场景中,我们关注的是一个名为`...
使用 resumable.js 上传文件的 Flask 应用程序。 这是一个例子。 它可能不应该按原样使用。 贡献 分叉吧 创建您的功能分支( git checkout -b my-new-feature ) 提交您的更改( git commit -am 'Added some ...
如果您想从一个域加载 resumable.js 库并将您的 Node.js 驻留在另一个域上,您必须允许来自 '*' 的 'Access-Control-Allow-Origin'。 请记住,启用此功能存在一些潜在的安全风险。 如果你还想实现跨域上传,打开 app...
### Oracle中用exp/imp命令参数详解 #### 一、使用`exp`命令进行数据导出 `exp`(Export)命令是Oracle提供的一种用于备份和迁移数据的强大工具。通过`exp`命令,用户可以将数据库中的数据以及相关元数据(如表...
什么是Resumable.js Resumable.js是一个JavaScript库,可通过提供多个同时,稳定和可恢复的上载。 该库旨在将容错功能引入通过HTTP上传大文件的过程。 这是通过将每个文件分成小块来完成的。 然后,每当块的上载...
Oracle OCP043认证是Oracle公司为数据库管理员(DBA)提供的专业认证之一,它涵盖了Oracle数据库的管理和维护等多个方面。以下是对题目中涉及的知识点的详细解释: 1. 对于检查EMP_EAST分区物理损坏和验证行是否...
1. **Resumable Operations**:自Oracle 9i起引入,通过`DBMS_RESUMABLE`程序包支持暂停和恢复长时间运行的SQL或PL/SQL操作。 2. **Flashback Technologies**:自Oracle 10g开始,利用`DBMS_FLASHBACK`等程序包支持...