OracleAWR如何實現(xiàn)數(shù)據(jù)導(dǎo)入/導(dǎo)出

這篇文章主要介紹Oracle AWR如何實現(xiàn)數(shù)據(jù)導(dǎo)入/導(dǎo)出,文中介紹的非常詳細,具有一定的參考價值,感興趣的小伙伴們一定要看完!

我們提供的服務(wù)有:成都網(wǎng)站設(shè)計、成都網(wǎng)站建設(shè)、外貿(mào)網(wǎng)站建設(shè)、微信公眾號開發(fā)、網(wǎng)站優(yōu)化、網(wǎng)站認證、昌黎ssl等。為成百上千家企事業(yè)單位解決了網(wǎng)站和推廣的問題。提供周到的售前咨詢和貼心的售后服務(wù),是有科學(xué)管理、有技術(shù)的昌黎網(wǎng)站制作公司

LINUX狀態(tài)下,連接oracle用戶:su - oracle 

1.上傳采集快照.dmp文件至服務(wù)器  (dbid:4292035712)  919219826

2.在服務(wù)器端創(chuàng)建目錄 (即文件夾awrtest)

$> mkdir /home/oracle/awrtest

3.把第一步中上傳的.dmp文件,移動到第二步中創(chuàng)建的文件夾中:

$> cp /var/ftp/AWR_10107.dmp(如果原文件后綴名是.DMP一定要改成小寫.dmp) /home/oracle/awrtest

4.切換至sqlplus狀態(tài),并且啟動數(shù)據(jù)庫:

$> sqlplus / as sysdba 
SQL>startup;

5. 創(chuàng)建數(shù)據(jù)庫目錄便于數(shù)據(jù)庫查找

SQL> create directory AWRTEST as '/home/oracle/awrtest';

6.加載數(shù)據(jù)文件:

SQL> @?/rdbms/admin/awrload.sql
SQL>Enter value for directory_name: AWRTEST ////注意:輸入directory name 時,字母需要大寫 
Enter value for file_name: AWR_10107 ///注意:此處不要加文件后綴名
Enter value for schema_name: AWR_STAGE //(一般默認就行)
Enter value for default_tablespace: USERS 
Enter value for temporary_tablespace: //(回車默認)

  出現(xiàn)一下文字,就說明導(dǎo)入成功了!

... Creating AWR_STAGE user | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | Loading the AWR data from the following | directory/file: | /home/oracle/awr | AWRDAT_9239_9394.dmp | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | | *** AWR Load Started ... | | This operation will take a few moments. The | progress of the AWR load operation can be | monitored in the following directory/file: | /home/oracle/awr | AWRDAT_9239_9394.log | ... Dropping AWR_STAGE user End of AWR Load ----------------------------------------------------------------------------------

報錯癥狀:(注意文件夾復(fù)權(quán)的問題?。?/p>

[root@localhost ~]# cd /home/oracle/ [root@localhost oracle]# ls -lt
total 660 drwxr-xr-x 2 root   root 4096 Aug 6 02:07 awr
drwxr-xr-x 2 root   root 4096 Aug 6 02:04 awrtest2 -rw-r--r-- 1 oracle oinstall 326088 Jul  8 22:13 zhongxing.html -rw-r--r-- 1 oracle oinstall 311525 Jul  1 12:48 HUAYOUSHIJI.html drwxr-xr-x 3 oracle oinstall 4096 Jul 1 11:32 awrtest1
drwxr-xr-x 2 oracle oinstall 4096 Jul 1 01:10 awrtest
drwxr-xr-x 2 oracle oinstall 4096 Jun 30 12:47 jishubu
drwxr-xr-x 3 oracle oinstall 4096 Jun 22 14:58 Desktop [root@localhost oracle]# chmod -R 777 awr [root@localhost oracle]# ls -lt
total 660 drwxrwxrwx 2 root   root 4096 Aug 6 02:07 awr
drwxr-xr-x 2 root   root 4096 Aug 6 02:04 awrtest2 -rw-r--r-- 1 oracle oinstall 326088 Jul  8 22:13 zhongxing.html -rw-r--r-- 1 oracle oinstall 311525 Jul  1 12:48 HUAYOUSHIJI.html drwxr-xr-x 3 oracle oinstall 4096 Jul 1 11:32 awrtest1
drwxr-xr-x 2 oracle oinstall 4096 Jul 1 01:10 awrtest
drwxr-xr-x 2 oracle oinstall 4096 Jun 30 12:47 jishubu
drwxr-xr-x 3 oracle oinstall 4096 Jun 22 14:58 Desktop [root@localhost oracle]#

其他報錯問題 解決參考地址:

http://space.itpub.net/12129601/viewspace-735524 http://www.xifenfei.com/3966.html   惜分飛  http://blog.163.com/jet_it_life/blog/static/205097083201262431444951/directory  創(chuàng)建不正確導(dǎo)致的ORA-39070 http://www.douban.com/note/37656300/oracle impdp/expdp 的權(quán)限問題
http://space.itpub.net/519536/viewspace-664406 侯圣文老師

AWR數(shù)據(jù)遷移參考地址:

春風(fēng):  http://www.dbdream.org/?p=223
eygle: AWR 與 Statspack 數(shù)據(jù)的導(dǎo)出與遷移  http://www.eygle.com/archives/2010/08/awr_statspack_extract.html

7.執(zhí)行相關(guān)腳本:(如邏輯讀腳本、db-time腳本等)

   查看dbid:

SQL> select dbid from v$database; 223805804 SQL> setpagesize 500 # su - oracle 
$  cd awrtest/ #根據(jù)自己的安裝目錄確認
$  ls (查看當(dāng)前目錄下文件,確認相關(guān)文件名)

生成邏輯讀-語句: 

SELECT case when to_number(to_char(c.end_interval_time, 'mi'))<15 or to_number(to_char(c.end_interval_time, 'mi'))>=45             
                then to_char(round(c.end_interval_time, 'hh34'),'yyyy-mm-dd hh34:mi')                                              
else to_char(c.end_interval_time, 'yyyy-mm-dd hh34')||':30'                                                                        
      end end_time,                                                                                                                
      case when max(decode(a.instance_number, 1, a.value - b.value, null))<0 then null                                             
           else max(decode(a.instance_number, 1, a.value - b.value, null))                                                         
      end INST1,                                                                                                                   
      case when max(decode(a.instance_number, 2, a.value - b.value, null))<0 then null                                             
           else max(decode(a.instance_number, 2, a.value - b.value, null))                                                         
      end INST2,                                                                                                                   
      case when max(decode(a.instance_number, 3, a.value - b.value, null))<0 then null                                             
           else max(decode(a.instance_number, 3, a.value - b.value, null))                                                         
      end INST3,                                                                                                                   
      case when max(decode(a.instance_number, 4, a.value - b.value, null))<0 then null                                             
           else max(decode(a.instance_number, 4, a.value - b.value, null))                                                         
      end INST4                                                                                                                    
FROM sys.wrh$_sysstat a, sys.wrh$_sysstat b, sys.wrm$_snapshot c                                                                   
WHERE a.stat_id =3143187968                                                                                                        
  AND b.stat_id = a.stat_id                                                                                                        
  AND a.snap_id = b.snap_id + 1                                                                                                    
  AND a.snap_id = c.snap_id                                                                                                        
  and a.dbid =&dbid                                                                                                                
  and b.dbid = a.dbid                                                                                                              
  and c.dbid = a.dbid                                                                                                              
  and a.instance_number = b.instance_number                                                                                        
  and a.instance_number = c.instance_number                                                                                        
group by a.snap_id, case when to_number(to_char(c.end_interval_time, 'mi'))<15 or to_number(to_char(c.end_interval_time, 'mi'))>=45
                then to_char(round(c.end_interval_time, 'hh34'),'yyyy-mm-dd hh34:mi')                                              
else to_char(c.end_interval_time, 'yyyy-mm-dd hh34')||':30'                                                                        
      end                                                                                                                          
ORDER BY a.snap_id; 

注意:結(jié)尾的分號不能少。

生成db-time數(shù)據(jù)語句: 

SELECT TO_CHAR(b.end_interval_time, 'yyyy-mm-dd hh34:mi:ss') snap_time,
  --'DB Time(s)',
  CASE
    WHEN (ROUND((a.VALUE - lag(a.VALUE, 1) OVER(ORDER BY a.snap_id)) / 1000000))<0
    THEN 0
    ELSE ROUND((a.VALUE - lag(a.VALUE, 1) OVER(ORDER BY a.snap_id)) / 1000000)
  END AS "db time(s)"
FROM
  (SELECT snap_id,
    VALUE
  FROM dba_hist_sys_time_model
  WHERE stat_name     = 'DB time'
  and dbid=&db_id
  AND INSTANCE_NUMBER = &instance_id) a,
  dba_hist_snapshot b
WHERE b.dbid=&db_id
AND a.snap_id       = b.snap_id
AND b.INSTANCE_NUMBER = &instance_id
--AND b.end_interval_time > sysdate-30
ORDER BY 1;
 
Enter value for db_id: 4292035712
Enter value for instance_id: 1  ///(單實例輸入1,RAC 的根據(jù)實際情況輸入相應(yīng)的值)
Enter value for db_id: 4292035712
Enter value for instance_id: 1     

8.導(dǎo)入excel表 ,生成趨勢圖

   excel里邊選擇數(shù)據(jù) -導(dǎo)入-自文本

   選擇導(dǎo)入的數(shù)據(jù)-生成曲線圖-雙擊橫坐標(biāo)選擇文本格式

9. 觀察趨勢圖高峰值,導(dǎo)出AWR報告,Oracle用戶下執(zhí)行如下命令:

@?/rdbms/admin/awrrpti

導(dǎo)出的AWR報告有兩種類型格式: .txt 和 .html

系統(tǒng)默認導(dǎo)出是.html      一般輸入時間間隔天數(shù):7 

按照步驟,連續(xù)操作就行。

Enter value for dbid: 4292035712 Using 4292035712 for database Id
Enter value for inst_num: 1(輸入實例個數(shù))
Using 1 for instance number

例如:導(dǎo)出時間點為:7月1日 11點 12點 負載高峰時段的AWR數(shù)據(jù)。

注意:在導(dǎo)出報告時,文件起名時要手動添加后綴名.html

    Oracle AWR如何實現(xiàn)數(shù)據(jù)導(dǎo)入/導(dǎo)出

以上是“Oracle AWR如何實現(xiàn)數(shù)據(jù)導(dǎo)入/導(dǎo)出”這篇文章的所有內(nèi)容,感謝各位的閱讀!希望分享的內(nèi)容對大家有幫助,更多相關(guān)知識,歡迎關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道!

本文標(biāo)題:OracleAWR如何實現(xiàn)數(shù)據(jù)導(dǎo)入/導(dǎo)出
URL鏈接:http://bm7419.com/article6/igcoog.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供網(wǎng)站維護、網(wǎng)站制作品牌網(wǎng)站設(shè)計搜索引擎優(yōu)化、ChatGPT服務(wù)器托管

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)

綿陽服務(wù)器托管