您好,登錄后才能下訂單哦!
最近在看一些Oracle分享的時(shí)候,經(jīng)常提到導(dǎo)出ASH的dump給另外的人來做分析,但我沒有什么相關(guān)的操作,不知道是怎樣的一個(gè)操作流程,于是上網(wǎng)看了各種博文。于是自己動(dòng)手做實(shí)驗(yàn)做一次導(dǎo)出導(dǎo)入。
實(shí)驗(yàn)環(huán)境:Oracle 11.2.0.4+rhel 7.2
執(zhí)行下面的語句對ASH信息做dump操作
sys@ORA11G>alter system set events 'immediate trace name ashdump level 10';
上面的語句中l(wèi)evel的意思是dump出ASH buffer中最近n分鐘的數(shù)據(jù),這里以10分鐘為例。
使用下面的語句打到對應(yīng)的trace文件
sys@ORA11G>SELECT value FROM v$diag_info WHERE name = 'Default Trace File'; VALUE ------------------------------------------------------------------- /u01/app/oracle/diag/rdbms/ora11g/ora11g/trace/ora11g_ora_7556.trc
先簡單查看一下trace文件中的內(nèi)容:
從上面的兩個(gè)圖中可以看到trace文件中包含了三類信息:trace的基本信息、導(dǎo)入dump的方法和ash的實(shí)際數(shù)據(jù),其實(shí)只要按照trace中的文件給出的方法就可以很容易的把dump數(shù)據(jù)導(dǎo)入到數(shù)據(jù)庫中。
1、創(chuàng)建臨時(shí)表
CREATE TABLE ashdump AS SELECT * FROM SYS.WRH$_ACTIVE_SESSION_HISTORY WHERE rownum < 0;
2、生成sqlldr的control file
[oracle@rhel7 ash]$ sed -n '1,/^Step 2:/d;/^Step 3:/,$d;p' ora11g_ora_7556.trc |sed '/^-/d' > ashldr.ctl
3、使用sqlldr工具把trace文件中的數(shù)據(jù)導(dǎo)入到臨時(shí)表中
[oracle@rhel7 ash]$ sqlldr zx/zx control=ashldr.ctl data=ora11g_ora_7556.trc errors=1000000 SQL*Loader: Release 11.2.0.4.0 - Production on Sat Sep 23 17:16:40 2017 Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved. Commit point reached - logical record count 19 Commit point reached - logical record count 37 Commit point reached - logical record count 55 Commit point reached - logical record count 73 Commit point reached - logical record count 91 Commit point reached - logical record count 109 Commit point reached - logical record count 127 Commit point reached - logical record count 145 Commit point reached - logical record count 163 Commit point reached - logical record count 181 Commit point reached - logical record count 199 Commit point reached - logical record count 217 Commit point reached - logical record count 235 Commit point reached - logical record count 253 Commit point reached - logical record count 271 Commit point reached - logical record count 289 Commit point reached - logical record count 307 Commit point reached - logical record count 325 Commit point reached - logical record count 343 Commit point reached - logical record count 361 Commit point reached - logical record count 379 Commit point reached - logical record count 397 Commit point reached - logical record count 415 Commit point reached - logical record count 433 Commit point reached - logical record count 451 Commit point reached - logical record count 469 Commit point reached - logical record count 487 Commit point reached - logical record count 505 Commit point reached - logical record count 523 Commit point reached - logical record count 541 Commit point reached - logical record count 559 Commit point reached - logical record count 577 Commit point reached - logical record count 595 Commit point reached - logical record count 613 Commit point reached - logical record count 631 Commit point reached - logical record count 649 Commit point reached - logical record count 651 zx@ORA11G>select count(*) from ashdump; COUNT(*) ---------- 650
數(shù)據(jù)導(dǎo)入成功后就可以根據(jù)具體的問題現(xiàn)在做近一步的分析。
其實(shí)導(dǎo)出和導(dǎo)入的步驟非常簡單,Oracle直接給出了步驟,難的是拿到數(shù)據(jù)后如何使用這些數(shù)據(jù)進(jìn)行近一步的分析,從而找出問題的根本原因。
如下分析每個(gè)sampletime的會話數(shù)量
參考:http://www.eygle.com/archives/2009/08/howto_dump_ashinfo.html
https://antognini.ch/2017/07/offline-analysis-of-ash-data-with-ashdump/
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。