ORACLE故障排除--注意事項

來源:互聯網
上載者:User
oracle 1.       在系統良好運作時, 進行一次Statspack! 並將結果檔案儲存作為以後的判斷標準.2.       ORACLE中建立一張存放有執行計畫的表指令碼如下: --建立一張計劃表create table plan_hashes( sql_text           varchar2(1000), hash_value         number, plan_hash_value    number, constraint plan_hashes_pk primary key(hash_value,sql_text,plan_hash_value))organization index; --將shared_pool中的語句插入計劃表insert into plan_hashes( sql_text, hash_value, plan_hash_value )select distinct sql_text,       hash_value,       plan_hash_value from v$sql where command_type in ( /* DELETE */ 7,    /* INSERT */ 2, /* MERGE */ 189, /* SELECT */ 3, /* UPDATE */ 6 )   and parsing_user_id <> 0   and parsing_schema_id <> 0; --查看當前shared pool中的執行計畫與計劃表的差異select distinct sql_text,       hash_value,       plan_hash_value,       decode( (select 1                  from plan_hashes                 where plan_hashes.hash_value = v$sql.hash_value                   and plan_hashes.sql_text = v$sql.sql_text                   and rownum = 1), 1, 'Changed', 'New' ) status from v$sql where (sql_text, hash_value, plan_hash_value)not in (select sql_text, hash_value, plan_hash_value           from plan_hashes)   and command_type in ( /* DELETE */ 7,    /* INSERT */ 2, /* MERGE */ 189, /* SELECT */ 3, /* UPDATE */ 6 )   and parsing_user_id <> 0   and parsing_schema_id <> 0/ --shared_pool中新的執行計畫存入計劃表insert into plan_hashes( sql_text, hash_value, plan_hash_value )select distinct sql_text,       hash_value,       plan_hash_value from v$sql where (sql_text, hash_value, plan_hash_value)not in (select sql_text, hash_value, plan_hash_value           from plan_hashes)   and command_type in ( /* DELETE */ 7,    /* INSERT */ 2, /* MERGE */ 189, /* SELECT */ 3, /* UPDATE */ 6 )   and parsing_user_id <> 0   and parsing_schema_id <> 0/ 3.       找出差異收集了之前的曆史資料,我們就能通過比對找出兩者之間的差別 4.       每次只更改一個問題不要多個人同時更改多個問題,也不要一個人更改多個問題,這樣就無法確定到底是哪個變動解決了問題所在 5.       確認是否需要修改這個問題改動一個問題之前要先確定目標,並且經過驗證(小規模的基準測試是必要的)之後才能動手 6.       做好備份任何改動之前都需要進行備份,使系統能夠回退到改動前的狀態時必須的 7.       建立小型的測試案例由於系統可能會很龐大,運行起來相當複雜耗時,所以需要儘可能多的剝離不需要的代碼,使用簡單,明了的測試案例重現錯誤! 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.