读书人

请教如何修改 AWR 中的awrrpt 出数据的

发布时间: 2012-09-23 10:28:11 作者: rapoo

请问怎么修改 AWR 中的awrrpt 出数据的配置:bid 和 eid?
SQL> @d:\app\Administrator\product\11.2.0\dbhome_1\RDBMS\ADMIN\awrrpt.sql

Current Instance
~~~~~~~~~~~~~~~~

DBID DB_NAME INST_ INST_NAME
---------- ------------ ----- ------------
1320905818 ORCL 1 orcl
rpt_options
---------
0

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'
Type Specified: html
Cannot SET TRIMSPOOL
Cannot SET UNDERLINE


Instances in this Workload Repository schema
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

DBBID INSTT DBB_NAME INSTT_NAME HOST
------------ ----- ------------ ------------ ------------
* 1320905818 1 ORCL orcl WIN-MNLTY03Y
8L7


Using 1320905818 for database Id
Using 1 for instance number
dbid
---------
1320905818
inst_num
---------
1
inst_num
---------
1
dbid
---------
1320905818
max_snap_time
---------
18/09/2012


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.


Listing the last 2 days of Completed Snapshots

INST_NAME DB_NAME SNAP_ID SNAPDAT LV
------------ ------------ -------- ------------------ --
orcl ORCL 295 17 9月 2012 00:00 1
orcl ORCL 296 17 9月 2012 01:00 1
orcl ORCL 297 17 9月 2012 02:00 1
orcl ORCL 298 17 9月 2012 03:00 1
orcl ORCL 299 17 9月 2012 04:00 1
orcl ORCL 300 17 9月 2012 05:00 1
orcl ORCL 301 17 9月 2012 06:00 1
orcl ORCL 302 17 9月 2012 07:00 1
orcl ORCL 303 17 9月 2012 08:00 1
orcl ORCL 304 17 9月 2012 09:00 1
orcl ORCL 305 17 9月 2012 10:00 1
orcl ORCL 306 17 9月 2012 11:00 1
orcl ORCL 307 17 9月 2012 12:00 1
orcl ORCL 308 17 9月 2012 13:00 1
orcl ORCL 309 17 9月 2012 14:01 1
orcl ORCL 310 17 9月 2012 15:00 1
orcl ORCL 311 17 9月 2012 16:00 1
orcl ORCL 312 17 9月 2012 17:00 1
orcl ORCL 313 17 9月 2012 18:00 1
orcl ORCL 314 17 9月 2012 19:00 1

INST_NAME DB_NAME SNAP_ID SNAPDAT LV
------------ ------------ -------- ------------------ --
orcl ORCL 315 17 9月 2012 20:00 1
orcl ORCL 316 17 9月 2012 21:00 1
orcl ORCL 317 17 9月 2012 22:00 1
orcl ORCL 318 17 9月 2012 23:00 1
orcl ORCL 319 18 9月 2012 00:00 1
orcl ORCL 320 18 9月 2012 01:00 1
orcl ORCL 321 18 9月 2012 02:00 1
orcl ORCL 322 18 9月 2012 03:00 1
orcl ORCL 323 18 9月 2012 04:00 1
orcl ORCL 324 18 9月 2012 05:00 1
orcl ORCL 325 18 9月 2012 06:00 1
orcl ORCL 326 18 9月 2012 07:00 1
orcl ORCL 327 18 9月 2012 08:00 1
orcl ORCL 328 18 9月 2012 09:01 1


dbid
---------
1320905818
inst_num
---------
1
max_snap_time
---------
18/09/2012


Specify the Begin and End Snapshot Ids
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Begin Snapshot Id specified: 7331

End Snapshot Id specified: 7355

bid
---------
7331
eid
---------
7355


declare

cursor cspid(vspid dba_hist_snapshot.snap_id%type) is
select end_interval_time
, startup_time
from dba_hist_snapshot
where snap_id = vspid
and instance_number = :inst_num
and dbid = :dbid;

bsnapt dba_hist_snapshot.end_interval_time%type;
bstart dba_hist_snapshot.startup_time%type;
esnapt dba_hist_snapshot.end_interval_time%type;
estart dba_hist_snapshot.startup_time%type;

begin

-- Check Begin Snapshot id is valid, get corresponding instance startup time
open cspid(:bid);
fetch cspid into bsnapt, bstart;
if cspid%notfound then
raise_application_error(-20200,
'Begin Snapshot Id '||:bid||' does not exist for this database/instance');
end if;
close cspid;

-- Check End Snapshot id is valid and get corresponding instance startup time
open cspid(:eid);
fetch cspid into esnapt, estart;
if cspid%notfound then
raise_application_error(-20200,
'End Snapshot Id '||:eid||' does not exist for this database/instance');
end if;
if esnapt <= bsnapt then
raise_application_error(-20200,
'End Snapshot Id '||:eid||' must be greater than Begin Snapshot Id '||:bid);
end if;
close cspid;

-- Check startup time is same for begin and end snapshot ids
if ( bstart != estart) then
raise_application_error(-20200,
'The instance was shutdown between snapshots '||:bid||' and '||:eid);
end if;

end;

ORA-20200: Begin Snapshot Id 7331 does not exist for this database/instance
ORA-06512: 在 line 23
inst_num
---------
1
dbid
---------
1320905818
bid
---------
7331
eid
---------
7355

[解决办法]
你可以从Dba_Hist_Snapshot里取出你想要的bid和eid。bid指awr报告开始统计的时间点的快照ID,eid指结束的快照id
[解决办法]
bid,eid要从Snapshots的id里面选啊,也就是295-328里面选

读书人网 >oracle

热点推荐