Read consistency of undo series Learning (ORA-01555 error mechanism analysis)

Source: Internet
Author: User

During Oracle reading, data is static and there is no dirty read, that is, uncommitted data will never be read. We can understand that at the beginning of Oracle's reading, we took a "photo" for his future content and fixed all the content at a time point, as the basis for subsequent reading. Oracle uses scn to implement this theory. when starting the query, a select scn will be determined, which ensures that all the scn in the transaction slot is smaller than the select scn. Well, for example, It's, so all the words I typed earlier are done before.

We already know that the undo segment is used cyclically, and Oracle only overwrites inactive transactions. If a long query needs to read the covered block, a ora-01555 error is reported. The ssolderrcnt field in v $ undostat is used to query whether error 01555 has occurred in Oracle every 10 minutes.

The following figure shows the error 01555:

The error 01555 is generated for many reasons. Here are three columns:

1) undo_retention is not large enough

2) Great undo space pressure

3) Poor SQL Performance

Next we will simulate the 01555 error. Note: avoid confusion with error 30036.

Session 1:

  1. Hr @ ORCL> var I refcursor
  2. Hr @ ORCL>Exec Open: IFor Select*FromT;
  3. PL/SQLProcedureSuccessfully completed.
  4. Hr @ ORCL> print I;
  5. IDNAME
  6. --------------------
  7. 1
  8. 2 B
  9. Hr @ ORCL>Exec Open: IFor Select*FromT;
  10. PL/SQLProcedureSuccessfully completed.

Session 2:

  1. Sys @ ORCL>Delete FromHr. t;
  2. 3RowsDeleted.
  3. Sys @ ORCL>Commit;
  4. CommitComplete.

Session 1:

  1. Hr @ ORCL> print I;
  2. IDNAME
  3. --------------------
  4. 1
  5. 2 B

If there is data, it indicates that the query is before modification; if there is no data, it indicates that the query is after modification. However, if there is no data in the undo, an error is returned. From the query output, we can see that the query is before modification.

  • 1
  • 2
  • Next Page

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.