17.08.11

死锁:

session1:

SQL> select * from t1;

 

         X

----------

         1

         2

SQL> update t1 set x=11 where x=1;

session2:

SQL> update t1 set x=22 where x=2;

session1:

SQL> update t1 set x=222 where x=2;             阻塞(排队)

session2:

SQL> update t1 set x=111 where x=1;             死锁(死循环)

ERROR at line 1:

ORA-00060: deadlock detected while waiting for resource

$ vi /u01/app/oracle/diag/rdbms/orcl/orcl/trace/alert_orcl.log

 

锁和外键

select … for update

撤销管理

什么是撤销数据:

 

 

         1.交易的回退:没有提交的交易可以rollback

         2.交易的恢复:数据库崩溃时,将磁盘的不正确数据恢复到交易前

         3.读一致性  :被查询的记录有事务占用,转向回滚段找改前镜像

         4.闪回数据  :从回滚段中构造历史数据

事务与撤销数据:

 

 

redo和undo:

 

 

AUM:

3个参数,两个表空间属性

 

undo_management=AUTO 回滚表空间段的段管理模式,管理员只需要备足够的表空间容量,oracle会自动管理扩展回滚段的数量。只能使用一个UNDO表空间。

undo_tablespace:只有在自动管理模式下才可以使用。指明使用哪个UNDO表空间

undo_retention=900 :

         提交之后旧的镜像保持在回滚段中的时间。

         非强制的回退保持时间.(回滚空间不足老的镜像就会被覆盖)

 

autoextend:表空间自动扩展

强制保持:但是对空间要求较大,要慎用。(10g开始支持)

alter tablespace UNDOTABS1 RETENTION GUARANTEE;

select  tablespace_name,RETENTION from dba_tablespaces;

 

UNDO_RETENTION specifies (in seconds) how long already committed undo information is to be retained. The only time you must set this parameter is when:

•The undo tablespace has the AUTOEXTEND option enabled

•You want to set undo retention for LOBs

•You want to guarantee retention

 

undo advisor:

posted on 2017-08-19 09:08  zhang_x  阅读(163)  评论(0编辑  收藏  举报

导航