ORA-08176 错误的一个案例
生活随笔
收集整理的這篇文章主要介紹了
ORA-08176 错误的一个案例
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
在演示事務的read only mode 的時候,因為一個錯誤有了這個意外的收獲。場景是這樣的: 在session 1 中執(zhí)行了如下的語句。 SQL> set transaction read only; Transaction set. SQL> select count(*) from employees; COUNT(*) ---------- 107 在session 2 中執(zhí)行如下的語句。 SQL> ?insert into employees 2 ?(employee_id, last_name, email, 3 ?hire_date, job_id) values (210, 4 ?'Hintz', 'JHINTZ', SYSDATE, 5 ?'SH_CLERK'); insert into employees * ERROR at line 1: ORA-01502: 索引 'HR.EMP_EMAIL_UK' 或這類索引的分區(qū)處于不可用狀態(tài) 嗯,這是因為以前我把這個索引的狀態(tài)alter 成unusable了,好吧,我們rebulid。 SQL> alter index emp_email_uk rebuild; Index altered. SQL> ?insert into employees 2 ?(employee_id, last_name, email, 3 ?hire_date, job_id) values (210, 4 ?'Hintz', 'JHINTZ', SYSDATE, 5 ?'SH_CLERK'); 1 row created. SQL> commit; Commit complete. 現在貌似一切很正常,返回到session 1 中執(zhí)行如下的語句。 SQL> select count(*) from employees; select count(*) from employees * ERROR at line 1: ORA-08176: 一致讀取失敗; 回退數據不可用 正常情況下,不應該啊,查看下undo 的保留時間,900s 足夠了。也不可能 是undo tablespace 的空間不夠,因為我的實驗系統(tǒng)中每秒的事務量幾乎為零。 就算空間不夠也應該報“snapshot too old”的錯。 SQL> show parameter undo NAME ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? TYPE ? ? ? ? ? ? ? ? ? VALUE ------------------------------------ ---------------------- --------- undo_management ? ? ? ? ? ? ? ? ? ? ?string ? ? ? ? ? ? ? ? AUTO undo_retention ? ? ? ? ? ? ? ? ? ? ? integer ? ? ? ? ? ? ? ?900 undo_tablespace ? ? ? ? ? ? ? ? ? ? ?string ? ? ? ? ? ? ? ? UNDOTBS1 不由的讓人想到上面的alter index 的語句。我們試著重現錯誤。 在session 1 中執(zhí)行如下的語句. SQL> set transaction read only; Transaction set. SQL> select count(*) from employees; COUNT(*) ---------- 107 在session 2 中執(zhí)行如下的語句。 SQL> alter index emp_email_uk unusable; Index altered. SQL> ?INSERT INTO employees 2 ?(employee_id, last_name, email, 3 ?hire_date, job_id) VALUES (210, 4 ?'Hintz', 'JHINTZ', SYSDATE, 5 ?'SH_CLERK'); INSERT INTO employees * ERROR at line 1: ORA-01502: 索引 'HR.EMP_EMAIL_UK' 或這類索引的分區(qū)處于不可用狀態(tài) SQL> alter index emp_email_uk rebuild; Index altered. 返回到session 1 中執(zhí)行如下的語句。 SQL> select count(*) from employees; select count(*) from employees * ERROR at line 1: ORA-08176: 一致讀取失敗; 回退數據不可用 --至此錯誤重現了。 通過重現錯誤,我們已經知道癥結所在的,所以以后我們需要避免這種情況的發(fā)生。對這個ORA-08176 錯誤也有了更多的認識。最后我們來看看這個錯誤代碼的信息: ORA-08176: cannot continue consistent read for the table/index - no undo
records
Cause:?Oracle encountered an operation that does not generate undo records.
For example, the operation might have been an attempt to create an index by
performing a direct load or executing a discrete mode transaction. 導致這個問題的根本原因是上面加黑的那句話。
records
Cause:?Oracle encountered an operation that does not generate undo records.
For example, the operation might have been an attempt to create an index by
performing a direct load or executing a discrete mode transaction. 導致這個問題的根本原因是上面加黑的那句話。
轉載于:https://www.cnblogs.com/zhjh256/p/10772261.html
總結
以上是生活随笔為你收集整理的ORA-08176 错误的一个案例的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: MySQL Execution Plan
- 下一篇: 面试中常问的List去重问题,你都答对了