ORA-01555 和游标

简介:   This is the situation when a query opens a cursor, then loops through fetching, changing, and committing the records on the same table.
 
This is the situation when a query opens a cursor, then loops through fetching, changing, and committing the records on the same table. In this scenerio, very often an ORA-01555 can result. Let's take the  following example to explain this:

A cursor was opened at SCN=10. The execution SCN of the query is  then marked as SCN=10. Every fetch by that cursor now needs to get the read-consistent data from SCN=10. The user program is now  fetching x numbers of records, changing them, and committing them. Let's say they were committed with SCN=20. If a later fetch happens to retrieve a record which is in one of the previously committed  blocks, then the fetch will see that the SCN there as 20. Since the fetch has to get the snapshot from SCN=10 it will try to find it in the rollback segments. If it could rollback sufficiently backwards  as previously explained, then it could reconstruct the snapshot  from SCN=10. If not, then it will result in an ORA-01555 error.

相关文章
|
5月前
|
SQL Oracle 关系型数据库
Oracle游标的定义与使用
Oracle游标的定义与使用
|
6月前
|
SQL Oracle 关系型数据库
Oracle游标的定义与使用技巧
Oracle游标的定义与使用技巧
|
SQL 存储 Oracle
Oracle 游标&子程序&触发器
游标的作用:处理多行数据,类似与java中的集合
86 0
|
存储 Oracle 关系型数据库
oracle 存储过程~游标
oracle 存储过程~游标
|
SQL 存储 数据库
Oracle-cursor游标
游标的使用
1446 0
|
SQL
Oracle-cursor动态游标
动态游标的语法和使用
2760 0
|
SQL Oracle 关系型数据库
|
SQL Oracle 关系型数据库
|
Oracle 关系型数据库