ORA-08176 错误的一个案例
生活随笔
收集整理的這篇文章主要介紹了
ORA-08176 错误的一个案例
小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
在演示事務(wù)的read only mode 的時(shí)候,因?yàn)橐粋€(gè)錯(cuò)誤有了這個(gè)意外的收獲。場景是這樣的: 在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) 嗯,這是因?yàn)橐郧拔野堰@個(gè)索引的狀態(tài)alter 成unusable了,好吧,我們r(jià)ebulid。 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. 現(xiàn)在貌似一切很正常,返回到session 1 中執(zhí)行如下的語句。 SQL> select count(*) from employees; select count(*) from employees * ERROR at line 1: ORA-08176: 一致讀取失敗; 回退數(shù)據(jù)不可用 正常情況下,不應(yīng)該啊,查看下undo 的保留時(shí)間,900s 足夠了。也不可能 是undo tablespace 的空間不夠,因?yàn)槲业膶?shí)驗(yàn)系統(tǒng)中每秒的事務(wù)量幾乎為零。 就算空間不夠也應(yīng)該報(bào)“snapshot too old”的錯(cuò)。 SQL> show parameter undo NAME ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? TYPE ? ? ? ? ? ? ? ? ? VALUE ------------------------------------ ---------------------- --------- undo_management ? ? ? ? ? ? ? ? ? ? ?string ? ? ? ? ? ? ? ? AUTO undo_retention ? ? ? ? ? ? ? ? ? ? ? integer ? ? ? ? ? ? ? ?900 undo_tablespace ? ? ? ? ? ? ? ? ? ? ?string ? ? ? ? ? ? ? ? UNDOTBS1 不由的讓人想到上面的alter index 的語句。我們試著重現(xiàn)錯(cuò)誤。 在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: 一致讀取失敗; 回退數(shù)據(jù)不可用 --至此錯(cuò)誤重現(xiàn)了。 通過重現(xiàn)錯(cuò)誤,我們已經(jīng)知道癥結(jié)所在的,所以以后我們需要避免這種情況的發(fā)生。對這個(gè)ORA-08176 錯(cuò)誤也有了更多的認(rèn)識。最后我們來看看這個(gè)錯(cuò)誤代碼的信息: 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. 導(dǎo)致這個(gè)問題的根本原因是上面加黑的那句話。
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. 導(dǎo)致這個(gè)問題的根本原因是上面加黑的那句話。
轉(zhuǎn)載于:https://www.cnblogs.com/zhjh256/p/10772261.html
總結(jié)
以上是生活随笔為你收集整理的ORA-08176 错误的一个案例的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: MySQL Execution Plan
- 下一篇: 面试中常问的List去重问题,你都答对了