动态网站制作指南 [  QQ表情  ]
[ 投票调查 ]
[ 企业邮箱 ]
[ 网站空间 ]
网络编程 | 站长之家 | 网页制作 | 图形图象 | 操作系统 | 冲浪宝典 | 软件教学 | 网络办公 | 邮件系统 | 网络安全 | 认证考试 | 系统进程
ASP源码 | .Net源码 | PHP源码 | JSP源码 | JAVA源码 | CGI源码 | VB源码 | C++源码 | Delphi源码 | PB源码 | VF源码 | 汇编 | 服务器
Firefox | IE | Maxthon | 迅雷 | 电驴 | BitComet | FlashGet | QQ | QQ空间 | Vista | 输入法 | Ghost | Word | Excel | wps | Powerpoint
asp | .net | php | jsp | Sql | c# | Ajax | xml | Dreamweaver | FrontPages | Javascript | css | photoshop | fireworks | Flash | Cad | Discuz!
当前位置 > 网站建设学院 > 网络编程 > 数据库 > Oracle教程
Tag:注入,存储过程,分页,安全,优化,xmlhttp,fso,jmail,application,session,防盗链,stream,无组件,组件,md5,乱码,缓存,加密,验证码,算法,cookies,ubb,正则表达式,水印,索引,日志,压缩,base64,url重写,上传,控件,Web.config,JDBC,函数,内存,PDF,迁移,结构,破解,编译,配置,进程,分词,IIS,Apache,Tomcat,phpmyadmin,Gzip,触发器,socket
数据库:数据库教程,数据库技巧,Oracle教程,MySQL教程,Sybase教程,Access教程,DB2教程,数据库安全,数据库文摘
文章搜索服务
邮件订阅
输入你的邮件地址,
你将不会错过任何关于:
[ Oracle教程 ]的信息

本月文章推荐
.Oracle数据库空间使用和管理若干.
.数据库查询结果的动态排序.
.基于成本的优化器 — 一般错误概.
.开机流程与关机、档案系统.
.RedhatLinux on my LAPTOP.
.红旗4.0b版最新使用方法.
.ORACLE在HP-UX下的系列问题处理(.
.2Gb or Not 2Gb.
.配置Windows与Linux平台的DATA G.
.超大型ORACLE数据库应用系统的设.
.JDBC连接各种数据库方法.
.怎样修改查看Oracle字符集及怎样.
.ORACLE在HP-UX下的系列问题处理(.
.研究人员称Oracle仍有问题.
.Oracle9i 資料庫管理實務講座(一).
.揭开Oracle 10G手工创建数据库的.
.核心( Kernel )编译与模组管理.
.优化Oracle网络设置.
.在linux8.0下,oracle9i的配置说.
.oracle 数据分页查询.

“Snapshot too old” Detailed Explanation

发表日期:2008-2-9 |



  Overview
  This article will discuss the circumstances under which a query can return the Oracle error ORA-01555 "snapshot too old (rollback segment too small)". The article will then proceed to discuss actions that can be taken to avoid the error and finally will provide some simple PL/SQL scripts that illustrate the issues discussed.
  
  Terminology
  It is assumed that the reader is familiar with standard Oracle terminology sUCh as 'rollback segment' and 'SCN'. If not, the reader should first read the Oracle Server Concepts manual and related Oracle documentation.
  
  In addition to this, two key concepts are briefly covered below which help in the understanding of ORA-01555:
  
  1. READ CONSISTENCY:
  ====================
  
  This is documented in the Oracle Server Concepts manual and so will not be discussed further. However, for the purposes of this article this should be read and understood if not understood already.
  
  Oracle Server has the ability to have multi-version read consistency which is invaluable to you because it guarantees that you are seeing a consistent view of the data (no 'dirty reads').
  
  2. DELAYED BLOCK CLEANOUT:
  ==========================
  This is best illustrated with an example: Consider a transaction that updates a million row table. This obviously visits a large number of database blocks to make the change to the data. When the user commits the transaction Oracle does NOT go back and revisit these blocks to make the change permanent. It is left for the next transaction that visits any block affected by the update to 'tidy up' the block (hence the term 'delayed block cleanout').
  
  Whenever Oracle changes a database block (index, table, cluster) it stores a pointer in the header of the data block which identifies the rollback segment used to hold the rollback information for the changes made by the transaction. (This is required if the user later elects to not commit the changes and wishes to 'undo' the changes made.)
  
  Upon commit, the database simply marks the relevant rollback segment header entry as committed. Now, when one of the changed blocks is revisited Oracle examines the header of the data block which indicates that it has been changed at some point. The database needs to confirm whether the change has been committed or whether it is currently uncommitted. To do this, Oracle determines the rollback segment used for the previous transaction (from the block's header) and then determines whether the rollback header indicates whether it has been committed or not.
  
  If it is found that the block is committed then the header of the data block is updated so that subsequent Accesses to the block do not incur this processing.
  
  This behaviour is illustrated in a very simplified way below. Here we walk through the stages involved in updating a data block.
  
  STAGE 1 - No changes made
  
  Description: This is the starting point. At the top of the data block we have an area used to link active transactions to a rollback segment (the 'tx' part),
and the rollback segment header has a table that stores information upon all the latest transactions that have used that rollback segment.
  
  In our example, we have two active transaction slots (01 and 02)and the next free slot is slot 03. (Since we are free to overwrite committed transactions.)
  
  Data Block 500       Rollback Segment Header 5
  +----+--------------+   +----------------------+---------+
   tx None         transaction entry 01 ACTIVE 
  +----+--------------+    transaction entry 02 ACTIVE 
   row 1           transaction entry 03 COMMITTED
   row 2           transaction entry 04 COMMITTED
   ... ..            ...   ...  ..  ...  
   row n           transaction entry nn COMMITTED
  +-------------------+    +--------------------------------+
  
  STAGE 2 - Row 2 is updated
  
  Description: We have now updated row 2 of block 500. Note that the data block header is updated to point to the rollback segment 5, transaction slot 3 (5.3) and that it is marked uncommitted (Active).
  
  Data Block 500       Rollback Segment Header 5
  +----+--------------+   +----------------------+---------+
   tx 5.3uncommitted-+  transaction entry 01 ACTIVE 
  +----+--------------+   transaction entry 02 ACTIVE 
   row 1       +--> transaction entry 03 ACTIVE 
   row 2 *changed*     transaction entry 04 COMMITTED
   ... ..            ...   ...  ..  ...  
   row n          transaction entry nn COMMITTED
  +------------------+   +--------------------------------+
  
  STAGE 3 - The user issues a commit
  
  Description: Next the user hits commit. Note that all that this does is it updates the rollback segment header's corresponding transaction slot as committed. It does *nothing* to the data block.
  
  Data Block 500          Rollback Segment Header 5
  +----+--------------+    +----------------------+---------+
   tx 5.3uncommitted--+   transaction entry 01 ACTIVE 
  +----+--------------+    transaction entry 02 ACTIVE 
   row 1        +---> transaction entry 03 COMMITTED
   row 2 *changed*      transaction entry 04 COMMITTED
   ... ..             ...   ...  ..  ...  
   row n           transaction entry nn COMMITTED
  +------------------+    +--------------------------------+
  
  STAGE 4 - Another user selects data block 500
  
  Description: Some time later another user (or the same user) revisits data block 500. We can see that there is an uncommitted change in the data block according to the data block's header.
  
  Oracle then uses the data block header to look up the corresponding rollback segment transaction table slot, sees that it has been committed, and changes data block 500 to reflect the true state of the datablock. (i.e. it performs delayed cleanout).
  
  Data Block 500          Rollback Segment Header 5
  +----+--------------+   +----------------------+---------+
   tx None         transaction entry 01 ACTIVE 
  +----+--------------+    transaction entry 02 ACTIVE 
   row 1           transaction entry 03 COMMITTED
   row 2           transaction entry 04 COMMITTED
   ... ..            ...   ...  ..  ... 
   row n           transaction entry nn COMMITTED
  +------------------+    +--------------------------------+
  
  ORA-01555 EXPlanation
  There are two fundamental causes of the error ORA-01555 that are a result of Oracle trying to attain a 'read consistent' image. These are :
  
  o The rollback information itself is overwritten so that Oracle is unable to rollback the (committed) transaction entries to attain a sufficiently old enough version of the block.
  
  o The transaction slot in the rollback segment's transaction table (stored in the rollback segment's header) is overwritten,
and Oracle cannot rollback the transaction header sufficiently to derive the original rollback segment transaction slot.
  
  Both of these situations are discussed below with the series of steps that cause the ORA-01555. In the steps, reference is made to 'QENV'. 'QENV' is short for 'Query Environment', which can be thought of as the environment that existed when a query is first star
上一篇:Oracle8i和9i中PLSQL程序的不同运行结果 人气:476
下一篇:动态SQL和PL/SQL的EXECUTE IMMEDIATE选项 人气:994
浏览全部Oracle教程的内容 Dreamweaver插件下载 常用网页广告代码全集
  最新网站源码 最新软件下载
2008-10-13 爬爬思特新闻管理系统 v2.0 Beta1
2008-10-13 Pligg v9.9.5 Beta
2008-10-13 广优邮件发送系统 v2.1
2008-10-13 缤纷互动视频交友 v3.1 RC
2008-10-13 MyShop网络商城 build 081005
2008-10-13 Chyrp 超轻量级开源博客引擎 v2.
2008-10-13 162100静态(论坛/文章)系统 v2.4
2008-10-13 金博人才招聘求职网黄金版 v4.2
2008-10-13 愚人笔记 v4.0
2008-10-11 联系人分组工具 v1.1 中文破解版
2008-10-11 FaceMelter变脸 v2.0 汉化破解版
2008-10-11 PathTracker道路跟踪仪 v1.2 破解
2008-10-11 Rooms手机聊天室 v0.6.7 破解版
2008-10-11 RemoteDesktop远程桌面 v1.0 破解
2008-10-11 ProRemote远程调音台 v1.0.1 破解
2008-10-11 PicShare照片共享 v1.0.0 破解版
2008-10-11 Photogene照片编辑器 v1.5 汉化破
2008-10-11 WriteRoom共享文档 v1.0 破解版
  发表评论
姓 名: 验证码:
内 容:
站长工具:网站收录查询 | Google PR查询 | ALEXA排名查询 | CSS在线编辑器 | 广告代码 | js/vbs加密 | md5加密 | 进制转换 | UTF-8 转换工具 | Html转换js | Html转换asp | Html转换php | Html转换perl
实用工具:汉字翻译拼音 | 拼音字典 | 符号对照表 | 个税计算 | 实时汇率查询换算 | 经典小工具 | 汉字简繁转换 | 普通单位换算 | 公制单位换算 | 生辰老黄历 | 国内电话区号 | 国家代码与域名缩写 | 文字加密解密 | 健康查询 | 万年历 | 汉字横竖排版 | 手机号码查询 | 计算器 | ip搜索
业务联系 | 广告刊登 | 频道合作 | 投稿荐稿 | 联系方式 | 加入收藏 | RSS订阅
Copyright © 2000-2008 www.knowsky.com All rights reserved | 网络实名:动态网站制作指南 | 沪ICP备05001343号
ホームページ制作 不動産検索システム 求人情報
防水工事·改修工事 フットサル大会 探偵
SEO対策 中国語教室 ホームページ作成