ORACLE AWR報告生成過程出現多個實例記錄分析

来源:http://www.cnblogs.com/kerrycode/archive/2016/07/18/5681816.html
-Advertisement-
Play Games

在一次生成AWR報告中,發現在“Instances in this Workload Repository schema”部分,出現了多個實例記錄信息(host敏感信息被用host1,host2,host3替換)。具體信息如下截圖所示: SQL> @?/rdbms/admin/awrrpt Curr... ...


在一次生成AWR報告中,發現在“Instances in this Workload Repository schema”部分,出現了多個實例記錄信息(host敏感信息被用host1,host2,host3替換)。具體信息如下截圖所示:

SQL> @?/rdbms/admin/awrrpt
 
Current Instance
~~~~~~~~~~~~~~~~
 
   DB Id    DB Name      Inst Num Instance
----------- ------------ -------- ------------
 3990839260 SCM2                1 SCM2
 
 
Specify the Report Type
~~~~~~~~~~~~~~~~~~~~~~~
Would you like an HTML report, or a plain text report?
Enter 'html' for an HTML report, or 'text' for plain text
Defaults to 'html'
Enter value for report_type: html
 
Type Specified:  html
 
 
Instances in this Workload Repository schema
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
   DB Id     Inst Num DB Name      Instance     Host
------------ -------- ------------ ------------ ------------
  3990839260        1 SCM2         SCM2         host1
* 3990839260        1 SCM2         SCM2         host2
  3990839260        1 SCM2         SCM2         host3
 
Using 3990839260 for database Id
Using          1 for instance number
 
 
Specify the number of days of snapshots to choose from
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Entering the number of days (n) will result in the most recent
(n) days of snapshots being listed.  Pressing <return> without
specifying a number lists all completed snapshots.

clip_image001

 

其實這幾個Host對於我來說,非常熟悉,一個是資料庫遷移前的hostname,一個是hostname修改前的名稱,一個是hostname修改後的名稱。那麼為什麼出現這個情況呢?我們先從$ORACLE_HOME/rdbms/admin/awrrpt.sql腳本開始,看看這些記錄是怎麼獲取的。

[oracle@MyOracle admin]$ more awrrpt.sql 
 
Rem $Header: awrrpt.sql 24-oct-2003.12:04:53 pbelknap Exp $
Rem
Rem awrrpt.sql
Rem
Rem Copyright (c) 1999, 2003, Oracle Corporation.  All rights reserved.  
Rem
Rem    NAME
Rem      awrrpt.sql
Rem
Rem    DESCRIPTION
Rem      This script defaults the dbid and instance number to that of the
Rem      current instance connected-to, then calls awrrpti.sql to produce
Rem      the Workload Repository report.
Rem
Rem    NOTES
Rem      Run as select_catalog privileges
Rem      This report is based on the Statspack report.
Rem
Rem      If you want to use this script in an non-interactive fashion,
Rem      see the 'customer-customizable report settings' section in
Rem      awrrpti.sql
Rem
Rem    MODIFIED   (MM/DD/YY)
Rem    pbelknap    10/24/03 - swrfrpt to awrrpt 
Rem    pbelknap    10/14/03 - moving params to rpti 
Rem    pbelknap    10/02/03 - adding non-interactive mode cmnts 
Rem    mlfeng      09/10/03 - heading on 
Rem    aime        04/25/03 - aime_going_to_main
Rem    mlfeng      01/27/03 - mlfeng_swrf_reporting
Rem    mlfeng      01/13/03 - Update comments
Rem    mlfeng      07/08/02 - swrf flushing
Rem    mlfeng      06/12/02 - Created
Rem
 
--
-- Get the current database/instance information - this will be used 
-- later in the report along with bid, eid to lookup snapshots
 
set echo off heading on underline on;
column inst_num  heading "Inst Num"  new_value inst_num  format 99999;
column inst_name heading "Instance"  new_value inst_name format a12;
column db_name   heading "DB Name"   new_value db_name   format a12;
column dbid      heading "DB Id"     new_value dbid      format 9999999999 just c;
 
prompt
prompt Current Instance
prompt ~~~~~~~~~~~~~~~~
 
select d.dbid            dbid
     , d.name            db_name
     , i.instance_number inst_num
     , i.instance_name   inst_name
  from v$database d,
       v$instance i;
 
@@awrrpti
 
undefine num_days;
undefine report_type;
undefine report_name;
undefine begin_snap;
undefine end_snap;
--
-- End of file

clip_image002

 

如上所示,其實awrrpt.sql裡面沒有多少料,主要功能還是在awrrpti.sql中實現的。在awrrpti.sql裡面,看到通過下麵部分信息,定位到AWR裡面的信息來源於awrinput.sql

clip_image003

 

檢查awrinput.sql腳本,發現AWR那段數據來自於下麵SQL語句

--
-- Request the DB Id and Instance Number, if they are not specified
 
column instt_num  heading "Inst Num"  format 99999;
column instt_name heading "Instance"  format a12;
column dbb_name   heading "DB Name"   format a12;
column dbbid      heading "DB Id"     format a12 just c;
column host       heading "Host"      format a12;
 
prompt
prompt
prompt Instances in this Workload Repository schema
prompt ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
select distinct
       (case when cd.dbid = wr.dbid and 
                  cd.name = wr.db_name and
                  ci.instance_number = wr.instance_number and
                  ci.instance_name   = wr.instance_name   and
	   

您的分享是我們最大的動力!

-Advertisement-
Play Games
更多相關文章
  • 1、UIApplication(應用程式實例) 獲取方式:[UIApplication sharedApplication] 詳細:http://www.cnblogs.com/hissia/p/5678518.html 2、NSNotificationCenter(消息中心) 獲取方式:[NSNo ...
  • user_tab_columns來源於user_tab_cols,user_tab_cols where hidden_column='NO',引自:http://blog.csdn.net/gumengkai/article/details/50823140 user_all_tables 是 u ...
  • 我執行下邊的sql語句 得到下麵結果 誰能告訴我那一步沒有去重嗎? ...
  • 工作中的問題總結: 問題一:scala 之向下轉型 引言:假如在複雜的業務邏輯中,變數的類型不能確認,只能給個介面類型,這樣數據類型推導不會錯誤,但是後面要使用實現類的類型時,你卻發現轉不過來了? 對於這樣的一個問題,scala可以這樣解決: 首先建造一個介面,People: 這樣定義了一個介面,接 ...
  • sql語言進階 典型操作 order by - select * from play_list order by createtime; - select * from play_list order by bookedcount desc,createtime asc; order by 語句用於 ...
  • 目標與目的 學習目標: 掌握日常資料庫建表操作 瞭解表設計的規範 何為表結構設計: 表結構設計需要在正式進行開發之前完成 根據產品需求將複雜的業務模型抽象出來 項目分析 實踐課程模型: 類似電商類的網站 用戶: 核心業務 非核心業務 核心業務: 交易相關 訂單詳情,訂單 商品相關 商品類別,商品 非 ...
  • memcatch 做單純的日活數據,或者靜態數據緩存 redis 做日活數據? mongodb 不建索引,用以插入數據? mongodb 建立索引,用以緩存用於讀取的歷史不活躍數據? mysql 數據持久化存儲 應該建立一個資料庫CRUD框架,然後對外是封裝好的? 總覺得已經有搭配好的框架了。 ...
  • 原因: 之前已經寫過一篇關於列存儲索引的簡介http://www.cnblogs.com/wenBlog/p/4970493.html,很粗糙但是基本闡明瞭列存儲索引的好處。為了更好的理解列存儲索引,接下來我們一起通過列存儲索引與傳統的行存儲索引地對比2014中的列存儲索引帶來了哪些改善。由於已經很 ...
一周排行
    -Advertisement-
    Play Games
  • 1. 說明 /* Performs operations on System.String instances that contain file or directory path information. These operations are performed in a cross-pla ...
  • 視頻地址:【WebApi+Vue3從0到1搭建《許可權管理系統》系列視頻:搭建JWT系統鑒權-嗶哩嗶哩】 https://b23.tv/R6cOcDO qq群:801913255 一、在appsettings.json中設置鑒權屬性 /*jwt鑒權*/ "JwtSetting": { "Issuer" ...
  • 引言 集成測試可在包含應用支持基礎結構(如資料庫、文件系統和網路)的級別上確保應用組件功能正常。 ASP.NET Core 通過將單元測試框架與測試 Web 主機和記憶體中測試伺服器結合使用來支持集成測試。 簡介 集成測試與單元測試相比,能夠在更廣泛的級別上評估應用的組件,確認多個組件一起工作以生成預 ...
  • 在.NET Emit編程中,我們探討了運算操作指令的重要性和應用。這些指令包括各種數學運算、位操作和比較操作,能夠在動態生成的代碼中實現對數據的處理和操作。通過這些指令,開發人員可以靈活地進行算術運算、邏輯運算和比較操作,從而實現各種複雜的演算法和邏輯......本篇之後,將進入第七部分:實戰項目 ...
  • 前言 多表頭表格是一個常見的業務需求,然而WPF中卻沒有預設實現這個功能,得益於WPF強大的控制項模板設計,我們可以通過修改控制項模板的方式自己實現它。 一、需求分析 下圖為一個典型的統計表格,統計1-12月的數據。 此時我們有一個需求,需要將月份按季度劃分,以便能夠直觀地看到季度統計數據,以下為該需求 ...
  • 如何將 ASP.NET Core MVC 項目的視圖分離到另一個項目 在當下這個年代 SPA 已是主流,人們早已忘記了 MVC 以及 Razor 的故事。但是在某些場景下 SSR 還是有意想不到效果。比如某些靜態頁面,比如追求首屏載入速度的時候。最近在項目中回歸傳統效果還是不錯。 有的時候我們希望將 ...
  • System.AggregateException: 發生一個或多個錯誤。 > Microsoft.WebTools.Shared.Exceptions.WebToolsException: 生成失敗。檢查輸出視窗瞭解更多詳細信息。 內部異常堆棧跟蹤的結尾 > (內部異常 #0) Microsoft ...
  • 引言 在上一章節我們實戰了在Asp.Net Core中的項目實戰,這一章節講解一下如何測試Asp.Net Core的中間件。 TestServer 還記得我們在集成測試中提供的TestServer嗎? TestServer 是由 Microsoft.AspNetCore.TestHost 包提供的。 ...
  • 在發現結果為真的WHEN子句時,CASE表達式的真假值判斷會終止,剩餘的WHEN子句會被忽略: CASE WHEN col_1 IN ('a', 'b') THEN '第一' WHEN col_1 IN ('a') THEN '第二' ELSE '其他' END 註意: 統一各分支返回的數據類型. ...
  • 在C#編程世界中,語法的精妙之處往往體現在那些看似微小卻極具影響力的符號與結構之中。其中,“_ =” 這一組合突然出現還真不知道什麼意思。本文將深入剖析“_ =” 的含義、工作原理及其在實際編程中的廣泛應用,揭示其作為C#語法奇兵的重要角色。 一、下劃線 _:神秘的棄元符號 下劃線 _ 在C#中並非 ...