resumable oracle,ORACLE的RESUMABLE特性

In the PROD database you have granted the RESUMABLE system privilege to the CONNECT role.

Resumable space operation has been enabledforall user sessions.

You want users NOT to be aware of any kind of space-related problemswhileperforming transactions.

Instead, you want the problem to be resolved by a database trigger automatically.

Which combination of triggering time and event would you use to achievethisobjective?

A.AFTER CREATE

B.AFTER SUSPEND

C.BEFORE CREATE

D.AFTER TRUNCATE

E.BEFORE SUSPEND

F. AFTER INSERT OR DELETE OR UPDATE

G.BEFORE INSERT OR DELETE OR UPDATEIn the PROD database you have granted the RESUMABLE system privilege to the CONNECT role. Resumable space operation has been enabled for all user sessions. You want users NOT to be aware of any kind of space-related problems while performing transactions. Instead, you want the problem to be resolved by a database trigger automatically. Which combination of triggering time and event would you use to achieve this objective? A.AFTER CREATE B.AFTER SUSPEND C.BEFORE CREATE D.AFTER TRUNCATE E.BEFORE SUSPEND F. AFTER INSERT OR DELETE OR UPDATE G.BEFORE INSERT OR DELETE OR UPDATE

答案是:B。

参考doc

试验如下:

session1:

SQL> create tablespace users datafile 'E:ORACLEPRODUCT10.2.0ORADATAORCLUSE

RS.DBF' SIZE 3M;

表空间已创建。

SQL> grant resumable to xys;

授权成功。

SQL> create or replace trigger trigg_system

2 after suspend on database

3 begin

4 dbms_resumable.set_timeout(10);

5 end;

6 /

警告: 创建的触发器带有编译错误。

SQL> show error

TRIGGER TRIGG_SYSTEM 出现错误:

LINE/COL ERROR

-------- -----------------------------------------------------------------

2/2 PL/SQL: Statement ignored

2/2 PLS-00201: 必须声明标识符 'DBMS_RESUMABLE'

SQL> create or replace trigger trigg_system

2 after suspend on database

3 begin

4 dbms_resumable.set_timeout(10);

5 end;

6 /

警告: 创建的触发器带有编译错误。

SQL> connect /as sysdba

已连接。

SQL> grant execute on dbms_resumable to xys;

授权成功。

SQL> connect xys/manager

已连接。

SQL> create or replace trigger trigg_system

2 after suspend on database

3 begin

4 dbms_resumable.set_timeout(10);

5 end;

6 /

触发器已创建

session2:

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

表已创建。

SQL> insert into t_resumable select *from t_resumable;

insert into t_resumable select *from t_resumable

*

第 1 行出现错误:

ORA-01653: 表 XYS.T_RESUMABLE 无法通过 128 (在表空间 USERS 中) 扩展

SQL> alter session enable resumable;

会话已更改。

--注意这里insert操作会等待10秒,10秒之后出现了错误

SQL> insert into t_resumable select *from t_resumable;

insert into t_resumable select *from t_resumable

*

第 1 行出现错误:

ORA-30032: 挂起的 (可恢复) 语句已超时

ORA-01653: 表 XYS.T_RESUMABLE 无法通过 128 (在表空间 USERS 中) 扩展

--回到session1修改一下timeout时间(10秒有些短,来不及修改datafile 4的autoextend属性),单位是秒

SQL> create or replace trigger trigg_system

2 after suspend on database

3 begin

4 dbms_resumable.set_timeout(60);

5 end;

6 /

触发器已创建

session2:

--此时下面insert会等待60秒,如果60秒之后发现空间可用,则继续执行

SQL> insert into t_resumable select *from t_resumable;

已创建11413行。

--此期间在session1中修改datafile 4使其能自动扩展

SQL> alter database datafile 4 autoextend on;

数据库已更改。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值