Resumable space allocation

Normal 0 7.8 pt 0 2 false false false EN-US ZH-CN X-NONE 实验目的:理解 Resumable space allocation 原理及使用方法。

实验结果:在session 1 中插入大量数据到一个表中,使得该表出现 out of space error,此时触发一触发器,在该触发器中设置enable resumable; 然后在session 2 extent space,此时发现session 1可以正常执行。

实验参考:Chapter 14 of “Administrator’s Guide”

范例:

Session 1:

         1) create small size(3m) of tablespace

         SQL> create tablespace tb_resumable

         2  datafile '/oracle/db11g/oradata/mydb/resumable.dbf' size 3m;

Tablespace created.

         2) grant privilege to user jay

         SQL> grant resumable to jay;

Grant succeeded.

         SQL> grant execute on dbms_resumable to jay;

Grant succeeded.

SQL> conn jay/jay

Connected.

         3) create a trigger

         SQL> create or replace trigger trig_resumable

         2     after suspend on database

         3             begin

         4                     dbms_resumable.set_timeout(60);

         5             end;

         6     /

Trigger created.

4) Enable resumable

SQL> ALTER SESSION ENABLE RESUMABLE;

Session altered.

         5) create a table and insert a large number of rows to this table.

         SQL> create table t_resumable tablespace tb_resumable  as select * from dba_objects;

         此时Session 1停止,等待60s

Session 2:

         60s内扩大tablespace tb_resumable空间

         SQL>  alter database datafile '/oracle/db11g/oradata/mydb/resumable.dbf'

       2  autoextend on;

Database altered.

         此时Session 1出现Table created.

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

转载于:http://blog.itpub.net/24068527/viewspace-666796/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
resumable.js 是一个 JavaScript 库,用于在网络连接中断或暂停时,使文件上传能够恢复。以下是 resumable.js 的官方教程: 1. 安装 resumable.js 你可以通过 npm 安装 resumable.js: ``` npm install resumablejs ``` 或者,你可以将 resumable.js 下载到本地,并将其包含在你的 HTML 文件中: ``` <script src="path/to/resumable.js"></script> ``` 2. 准备 HTML 代码 在你的 HTML 文件中添加以下代码: ``` <input type="file" id="fileInput"> <button id="uploadButton">Upload</button> ``` 这将创建一个文件上传控件和一个上传按钮。 3. 初始化 resumable.js 在你的 JavaScript 文件中添加以下代码: ``` var r = new Resumable({ target: '/upload', chunkSize: 1 * 1024 * 1024, simultaneousUploads: 4, testChunks: false }); r.assignBrowse(document.getElementById('fileInput')); r.assignDrop(document.body); document.getElementById('uploadButton').addEventListener('click', function() { r.upload(); }); ``` 这将创建一个 Resumable 对象,并将其绑定到文件上传控件和上传按钮。`target` 属性指定文件上传的目标 URL,`chunkSize` 属性指定上传的块大小,`simultaneousUploads` 属性指定同时上传的块数,`testChunks` 属性指定是否测试上传的块。 4. 处理事件 你可以通过监听 Resumable 对象的事件来处理上传过程中的不同阶段。以下是一些常用的事件: - `fileAdded`:当文件添加到上传队列时触发。 - `fileSuccess`:当文件上传成功时触发。 - `fileError`:当文件上传失败时触发。 - `progress`:当上传进度发生变化时触发。 你可以使用以下代码来监听事件: ``` r.on('fileAdded', function(file) { console.log('File added:', file); }); r.on('fileSuccess', function(file) { console.log('File uploaded:', file); }); r.on('fileError', function(file, message) { console.log('File upload error:', file, message); }); r.on('progress', function() { console.log('Progress:', r.progress()); }); ``` 5. 完整示例 下面是一个完整的示例,演示如何使用 resumable.js 进行文件上传: ``` <!DOCTYPE html> <html> <head> <title>Resumable.js Example</title> <script src="path/to/resumable.js"></script> </head> <body> <input type="file" id="fileInput"> <button id="uploadButton">Upload</button> <script> var r = new Resumable({ target: '/upload', chunkSize: 1 * 1024 * 1024, simultaneousUploads: 4, testChunks: false }); r.assignBrowse(document.getElementById('fileInput')); r.assignDrop(document.body); r.on('fileAdded', function(file) { console.log('File added:', file); }); r.on('fileSuccess', function(file) { console.log('File uploaded:', file); }); r.on('fileError', function(file, message) { console.log('File upload error:', file, message); }); r.on('progress', function() { console.log('Progress:', r.progress()); }); document.getElementById('uploadButton').addEventListener('click', function() { r.upload(); }); </script> </body> </html> ``` 这个示例将上传文件块大小设置为 1MB,同时最多上传 4 个块。在文件添加、上传成功、上传失败和上传进度发生变化时,会在控制台中输出相应的信息。当点击上传按钮时,将触发上传操作。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值